forked from szatmary/sonos
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdoc.go
More file actions
42 lines (42 loc) · 943 Bytes
/
doc.go
File metadata and controls
42 lines (42 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Package sonos provides an implementation of the Sonos UPnP API.
//
// This package allows discovery, control, and event subscription for Sonos devices on the local network.
//
// Basic Usage:
//
// package main
//
// import (
// "context"
// "log"
// "time"
//
// "github.com/caglar10ur/sonos"
// )
//
// func main() {
// s, err := sonos.NewSonos()
// if err != nil {
// log.Fatal(err)
// }
// defer s.Close()
//
// ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
// defer cancel()
//
// // Discover devices
// s.Search(ctx, func(s *sonos.Sonos, zp *sonos.ZonePlayer) {
// log.Printf("Found device: %s (%s)", zp.RoomName(), zp.IPAddress())
//
// // Control the device (e.g., GetVolume)
// vol, err := zp.GetVolume()
// if err != nil {
// log.Printf("Error getting volume: %v", err)
// return
// }
// log.Printf("Current volume: %d", vol)
// })
//
// <-ctx.Done()
// }
package sonos