Documentation ¶
Overview ¶
Package sonos provides an imlementation of the Sonos UPnP API.
Index ¶
- func FromEndpoint(endpoint string) (*url.URL, error)
- type AVTransportLastChange
- type Device
- type EventHandlerFunc
- type FoundZonePlayerFunc
- type Icon
- type Lite
- type QueueLastChange
- type RenderingControlLastChange
- type Root
- type Satellite
- type Service
- type Services
- type Sonos
- func (s *Sonos) Close()
- func (s *Sonos) FindRoom(ctx context.Context, room string) (*ZonePlayer, error)
- func (s *Sonos) Register(zp *ZonePlayer) error
- func (s *Sonos) Renew(ctx context.Context, opts *SubscriptionOptions) error
- func (s *Sonos) Search(ctx context.Context, fn FoundZonePlayerFunc) error
- func (s *Sonos) ServeHTTP(response http.ResponseWriter, request *http.Request)
- func (s *Sonos) Subscribe(ctx context.Context, opts *SubscriptionOptions) (string, error)
- func (s *Sonos) Unsubscribe(ctx context.Context, opts *SubscriptionOptions) error
- type SonosService
- type SpecVersion
- type SubscriptionOptions
- type VanishedDevice
- type ZoneGroup
- type ZoneGroupMember
- type ZoneGroupState
- type ZoneGroupTopologyAvailableSoftwareUpdate
- type ZoneGroupTopologyZoneGroupState
- type ZonePlayer
- func (z *ZonePlayer) Client() *http.Client
- func (zp *ZonePlayer) Event(evt interface{}, fn EventHandlerFunc)
- func (z *ZonePlayer) GetVolume() (int, error)
- func (z *ZonePlayer) GetZoneGroupState() (*ZoneGroupState, error)
- func (z *ZonePlayer) HardwareVersion() string
- func (z *ZonePlayer) IsCoordinator() bool
- func (z *ZonePlayer) Location() *url.URL
- func (z *ZonePlayer) ModelName() string
- func (z *ZonePlayer) Play() error
- func (z *ZonePlayer) RoomName() string
- func (z *ZonePlayer) SerialNumber() string
- func (z *ZonePlayer) SetAVTransportURI(url string) error
- func (z *ZonePlayer) SetVolume(desiredVolume int) error
- func (z *ZonePlayer) Stop() error
- type ZonePlayerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AVTransportLastChange ¶
type AVTransportLastChange struct { InstanceID struct { TransportState struct { Value string `xml:"val,attr"` } `xml:"TransportState"` CurrentPlayMode struct { Value string `xml:"val,attr"` } `xml:"CurrentPlayMode"` CurrentCrossfadeMode struct { Value string `xml:"val,attr"` } `xml:"CurrentCrossfadeMode"` NumberOfTracks struct { Value string `xml:"val,attr"` } `xml:"NumberOfTracks"` CurrentTrack struct { Value string `xml:"val,attr"` } `xml:"CurrentTrack"` CurrentSection struct { Value string `xml:"val,attr"` } `xml:"CurrentSection"` CurrentTrackURI struct { Value string `xml:"val,attr"` } `xml:"CurrentTrackURI"` CurrentTrackDuration struct { Value string `xml:"val,attr"` } `xml:"CurrentTrackDuration"` CurrentTrackMetaData struct { Value string `xml:"val,attr"` } `xml:"CurrentTrackMetaData"` NextTrackURI struct { Value string `xml:"val,attr"` } `xml:"NextTrackURI"` NextTrackMetaData struct { Value string `xml:"val,attr"` } `xml:"NextTrackMetaData"` EnqueuedTransportURI struct { Value string `xml:"val,attr"` } `xml:"EnqueuedTransportURI"` EnqueuedTransportURIMetaData struct { Value string `xml:"val,attr"` } `xml:"EnqueuedTransportURIMetaData"` PlaybackStorageMedium struct { Value string `xml:"val,attr"` } `xml:"PlaybackStorageMedium"` AVTransportURI struct { Value string `xml:"val,attr"` } `xml:"AVTransportURI"` AVTransportURIMetaData struct { Value string `xml:"val,attr"` } `xml:"AVTransportURIMetaData"` NextAVTransportURI struct { Value string `xml:"val,attr"` } `xml:"NextAVTransportURI"` NextAVTransportURIMetaData struct { Value string `xml:"val,attr"` } `xml:"NextAVTransportURIMetaData"` CurrentTransportActions struct { Value string `xml:"val,attr"` } `xml:"CurrentTransportActions"` CurrentValidPlayModes struct { Value string `xml:"val,attr"` } `xml:"CurrentValidPlayModes"` DirectControlClientID struct { Value string `xml:"val,attr"` } `xml:"DirectControlClientID"` DirectControlIsSuspended struct { Value string `xml:"val,attr"` } `xml:"DirectControlIsSuspended"` DirectControlAccountID struct { Value string `xml:"val,attr"` } `xml:"DirectControlAccountID"` TransportStatus struct { Value string `xml:"val,attr"` } `xml:"TransportStatus"` SleepTimerGeneration struct { Value string `xml:"val,attr"` } `xml:"SleepTimerGeneration"` AlarmRunning struct { Value string `xml:"val,attr"` } `xml:"AlarmRunning"` SnoozeRunning struct { Value string `xml:"val,attr"` } `xml:"SnoozeRunning"` RestartPending struct { Value string `xml:"val,attr"` } `xml:"RestartPending"` TransportPlaySpeed struct { Value string `xml:"val,attr"` } `xml:"TransportPlaySpeed"` CurrentMediaDuration struct { Value string `xml:"val,attr"` } `xml:"CurrentMediaDuration"` RecordStorageMedium struct { Value string `xml:"val,attr"` } `xml:"RecordStorageMedium"` PossiblePlaybackStorageMedia struct { Value string `xml:"val,attr"` } `xml:"PossiblePlaybackStorageMedia"` PossibleRecordStorageMedia struct { Value string `xml:"val,attr"` } `xml:"PossibleRecordStorageMedia"` RecordMediumWriteStatus struct { Value string `xml:"val,attr"` } `xml:"RecordMediumWriteStatus"` CurrentRecordQualityMode struct { Value string `xml:"val,attr"` } `xml:"CurrentRecordQualityMode"` PossibleRecordQualityModes struct { Value string `xml:"val,attr"` } `xml:"PossibleRecordQualityModes"` } `xml:"InstanceID"` }
http://upnp.org/specs/av/UPnP-av-AVTransport-v1-Service.pdf
func (*AVTransportLastChange) String ¶
func (e *AVTransportLastChange) String() string
type Device ¶
type Device struct { XMLName xml.Name `xml:"device"` DeviceType string `xml:"deviceType"` FriendlyName string `xml:"friendlyName"` Manufacturer string `xml:"manufacturer"` ManufacturerURL string `xml:"manufacturerURL"` ModelNumber string `xml:"modelNumber"` ModelDescription string `xml:"modelDescription"` ModelName string `xml:"modelName"` ModelURL string `xml:"modelURL"` SoftwareVersion string `xml:"softwareVersion"` SwGen string `xml:"swGen"` HardwareVersion string `xml:"hardwareVersion"` SerialNum string `xml:"serialNum"` MACAddress string `xml:"MACAddress"` UDN string `xml:"UDN"` Icons []Icon `xml:"iconList>icon"` MinCompatibleVersion string `xml:"minCompatibleVersion"` LegacyCompatibleVersion string `xml:"legacyCompatibleVersion"` APIVersion string `xml:"apiVersion"` MinAPIVersion string `xml:"minApiVersion"` DisplayVersion string `xml:"displayVersion"` ExtraVersion string `xml:"extraVersion"` RoomName string `xml:"roomName"` DisplayName string `xml:"displayName"` ZoneType int `xml:"zoneType"` Feature1 string `xml:"feature1"` Feature2 string `xml:"feature2"` Feature3 string `xml:"feature3"` Seriesid string `xml:"seriesid"` Variant int `xml:"variant"` InternalSpeakerSize float32 `xml:"internalSpeakerSize"` BassExtension float32 `xml:"bassExtension"` SatGainOffset float32 `xml:"satGainOffset"` Memory int `xml:"memory"` Flash int `xml:"flash"` FlashRepartitioned int `xml:"flashRepartitioned"` AmpOnTime int `xml:"ampOnTime"` RetailMode int `xml:"retailMode"` Services []Service `xml:"serviceList>service"` Devices []Device `xml:"deviceList>device"` }
type EventHandlerFunc ¶
type EventHandlerFunc func(interface{})
type FoundZonePlayerFunc ¶
type FoundZonePlayerFunc func(*Sonos, *ZonePlayer)
type QueueLastChange ¶
type QueueLastChange struct { QueueID []struct { Value string `xml:"val,attr"` UpdateID struct { Value string `xml:"val,attr"` } `xml:"UpdateID"` Curated struct { Value string `xml:"val,attr"` } `xml:"Curated"` QueueOwnerID struct { Value string `xml:"val,attr"` } `xml:"QueueOwnerID"` } `xml:"QueueID"` }
func (*QueueLastChange) String ¶
func (e *QueueLastChange) String() string
type RenderingControlLastChange ¶
type RenderingControlLastChange struct { InstanceID struct { Volume []struct { Channel string `xml:"channel,attr"` Value string `xml:"val,attr"` } `xml:"Volume"` Mute []struct { Channel string `xml:"channel,attr"` Value string `xml:"val,attr"` } `xml:"Mute"` Bass struct { Value string `xml:"val,attr"` } `xml:"Bass"` Treble struct { Value string `xml:"val,attr"` } `xml:"Treble"` Loudness struct { Channel string `xml:"channel,attr"` Value string `xml:"val,attr"` } `xml:"Loudness"` OutputFixed struct { Value string `xml:"val,attr"` } `xml:"OutputFixed"` SpeakerSize struct { Value string `xml:"val,attr"` } `xml:"SpeakerSize"` SubGain struct { Value string `xml:"val,attr"` } `xml:"SubGain"` SubCrossover struct { Value string `xml:"val,attr"` } `xml:"SubCrossover"` SubPolarity struct { Value string `xml:"val,attr"` } `xml:"SubPolarity"` SubEnabled struct { Value string `xml:"val,attr"` } `xml:"SubEnabled"` SonarEnabled struct { Value string `xml:"val,attr"` } `xml:"SonarEnabled"` SonarCalibrationAvailable struct { Value string `xml:"val,attr"` } `xml:"SonarCalibrationAvailable"` PresetNameList struct { Value string `xml:"val,attr"` } `xml:"PresetNameList"` } `xml:"InstanceID"` }
http://upnp.org/specs/av/UPnP-av-RenderingControl-v1-Service.pdf
func (*RenderingControlLastChange) String ¶
func (e *RenderingControlLastChange) String() string
type Root ¶
type Root struct { XMLName xml.Name `xml:"root"` Xmlns string `xml:"xmlns,attr"` SpecVersion SpecVersion `xml:"specVersion"` Device Device `xml:"device"` }
type Satellite ¶
type Satellite struct { XMLName xml.Name `xml:"Satellite"` UUID string `xml:"UUID"` Location string `xml:"Location"` ZoneName string `xml:"ZoneName"` Icon string `xml:"Icon"` Configuration string `xml:"Configuration"` SoftwareVersion string `xml:"SoftwareVersion"` SWGen string `xml:"SWGen"` MinCompatibleVersion string `xml:"MinCompatibleVersion"` LegacyCompatibleVersion string `xml:"LegacyCompatibleVersion"` BootSeq string `xml:"BootSeq"` TVConfigurationError string `xml:"TVConfigurationError"` HdmiCecAvailable string `xml:"HdmiCecAvailable"` WirelessMode string `xml:"WirelessMode"` WirelessLeafOnly string `xml:"WirelessLeafOnly"` HasConfiguredSSID string `xml:"HasConfiguredSSID"` ChannelFreq string `xml:"ChannelFreq"` BehindWifiExtender string `xml:"BehindWifiExtender"` WifiEnabled string `xml:"WifiEnabled"` Orientation string `xml:"Orientation"` RoomCalibrationState string `xml:"RoomCalibrationState"` SecureRegState string `xml:"SecureRegState"` VoiceConfigState string `xml:"VoiceConfigState"` MicEnabled string `xml:"MicEnabled"` AirPlayEnabled string `xml:"AirPlayEnabled"` IdleState string `xml:"IdleState"` MoreInfo string `xml:"MoreInfo"` }
type Services ¶
type Services struct { // services AlarmClock *clk.Service AudioIn *ain.Service AVTransport *avt.Service ConnectionManager *con.Service ContentDirectory *dir.Service DeviceProperties *dev.Service GroupManagement *gmn.Service GroupRenderingControl *rcg.Service MusicServices *mus.Service QPlay *ply.Service Queue *que.Service RenderingControl *ren.Service SystemProperties *sys.Service VirtualLineIn *vli.Service ZoneGroupTopology *zgt.Service }
type Sonos ¶
type Sonos struct {
// contains filtered or unexported fields
}
func (*Sonos) Register ¶
func (s *Sonos) Register(zp *ZonePlayer) error
func (*Sonos) ServeHTTP ¶
func (s *Sonos) ServeHTTP(response http.ResponseWriter, request *http.Request)
func (*Sonos) Unsubscribe ¶
func (s *Sonos) Unsubscribe(ctx context.Context, opts *SubscriptionOptions) error
type SonosService ¶
type SpecVersion ¶
type SubscriptionOptions ¶
type SubscriptionOptions struct { ZonePlayer *ZonePlayer Service SonosService Timeout uint64 EventHandler EventHandlerFunc Sid string }
func (*SubscriptionOptions) SetSid ¶
func (o *SubscriptionOptions) SetSid(sid string)
func (*SubscriptionOptions) Validate ¶
func (o *SubscriptionOptions) Validate() error
type VanishedDevice ¶
type VanishedDevice struct { XMLName xml.Name `xml:"VanishedDevice"` UUID string `xml:"UUID"` Location string `xml:"Location"` ZoneName string `xml:"ZoneName"` Icon string `xml:"Icon"` Configuration string `xml:"Configuration"` SoftwareVersion string `xml:"SoftwareVersion"` SWGen string `xml:"SWGen"` MinCompatibleVersion string `xml:"MinCompatibleVersion"` LegacyCompatibleVersion string `xml:"LegacyCompatibleVersion"` BootSeq string `xml:"BootSeq"` TVConfigurationError string `xml:"TVConfigurationError"` HdmiCecAvailable string `xml:"HdmiCecAvailable"` WirelessMode string `xml:"WirelessMode"` WirelessLeafOnly string `xml:"WirelessLeafOnly"` HasConfiguredSSID string `xml:"HasConfiguredSSID"` ChannelFreq string `xml:"ChannelFreq"` BehindWifiExtender string `xml:"BehindWifiExtender"` WifiEnabled string `xml:"WifiEnabled"` Orientation string `xml:"Orientation"` RoomCalibrationState string `xml:"RoomCalibrationState"` SecureRegState string `xml:"SecureRegState"` VoiceConfigState string `xml:"VoiceConfigState"` MicEnabled string `xml:"MicEnabled"` AirPlayEnabled string `xml:"AirPlayEnabled"` IdleState string `xml:"IdleState"` MoreInfo string `xml:"MoreInfo"` }
type ZoneGroup ¶
type ZoneGroup struct { XMLName xml.Name `xml:"ZoneGroup"` Coordinator string `xml:"Coordinator,attr"` ID string `xml:"ID,attr"` ZoneGroupMember []ZoneGroupMember `xml:"ZoneGroupMember"` }
type ZoneGroupMember ¶
type ZoneGroupMember struct { XMLName xml.Name `xml:"ZoneGroupMember"` UUID string `xml:"UUID"` Location string `xml:"Location"` ZoneName string `xml:"ZoneName"` Icon string `xml:"Icon"` Configuration string `xml:"Configuration"` SoftwareVersion string `xml:"SoftwareVersion"` SWGen string `xml:"SWGen"` MinCompatibleVersion string `xml:"MinCompatibleVersion"` LegacyCompatibleVersion string `xml:"LegacyCompatibleVersion"` BootSeq string `xml:"BootSeq"` TVConfigurationError string `xml:"TVConfigurationError"` HdmiCecAvailable string `xml:"HdmiCecAvailable"` WirelessMode string `xml:"WirelessMode"` WirelessLeafOnly string `xml:"WirelessLeafOnly"` HasConfiguredSSID string `xml:"HasConfiguredSSID"` ChannelFreq string `xml:"ChannelFreq"` BehindWifiExtender string `xml:"BehindWifiExtender"` WifiEnabled string `xml:"WifiEnabled"` Orientation string `xml:"Orientation"` RoomCalibrationState string `xml:"RoomCalibrationState"` SecureRegState string `xml:"SecureRegState"` VoiceConfigState string `xml:"VoiceConfigState"` MicEnabled string `xml:"MicEnabled"` AirPlayEnabled string `xml:"AirPlayEnabled"` IdleState string `xml:"IdleState"` MoreInfo string `xml:"MoreInfo"` Satellite []Satellite `xml:"Satellite>Satellite"` VanishedDevice []VanishedDevice `xml:"VanishedDevices>VanishedDevice"` }
type ZoneGroupState ¶
type ZoneGroupTopologyAvailableSoftwareUpdate ¶
type ZoneGroupTopologyAvailableSoftwareUpdate struct { Type string `xml:"Type,attr"` Version string `xml:"Version,attr"` UpdateURL string `xml:"UpdateURL,attr"` DownloadSize string `xml:"DownloadSize,attr"` ManifestURL string `xml:"ManifestURL,attr"` Swgen string `xml:"Swgen,attr"` LatestSwgen string `xml:"LatestSwgen,attr"` ManifestRevision string `xml:"ManifestRevision,attr"` }
func (*ZoneGroupTopologyAvailableSoftwareUpdate) String ¶
func (e *ZoneGroupTopologyAvailableSoftwareUpdate) String() string
type ZoneGroupTopologyZoneGroupState ¶
type ZoneGroupTopologyZoneGroupState struct { ZoneGroups struct { ZoneGroup []struct { Coordinator string `xml:"Coordinator,attr"` ID string `xml:"ID,attr"` ZoneGroupMember []struct { UUID string `xml:"UUID,attr"` Location string `xml:"Location,attr"` ZoneName string `xml:"ZoneName,attr"` Icon string `xml:"Icon,attr"` Configuration string `xml:"Configuration,attr"` SoftwareVersion string `xml:"SoftwareVersion,attr"` SWGen string `xml:"SWGen,attr"` MinCompatibleVersion string `xml:"MinCompatibleVersion,attr"` LegacyCompatibleVersion string `xml:"LegacyCompatibleVersion,attr"` ChannelMapSet string `xml:"ChannelMapSet,attr"` BootSeq string `xml:"BootSeq,attr"` TVConfigurationError string `xml:"TVConfigurationError,attr"` HdmiCecAvailable string `xml:"HdmiCecAvailable,attr"` WirelessMode string `xml:"WirelessMode,attr"` WirelessLeafOnly string `xml:"WirelessLeafOnly,attr"` ChannelFreq string `xml:"ChannelFreq,attr"` BehindWifiExtender string `xml:"BehindWifiExtender,attr"` WifiEnabled string `xml:"WifiEnabled,attr"` EthLink string `xml:"EthLink,attr"` Orientation string `xml:"Orientation,attr"` RoomCalibrationState string `xml:"RoomCalibrationState,attr"` SecureRegState string `xml:"SecureRegState,attr"` VoiceConfigState string `xml:"VoiceConfigState,attr"` MicEnabled string `xml:"MicEnabled,attr"` AirPlayEnabled string `xml:"AirPlayEnabled,attr"` IdleState string `xml:"IdleState,attr"` MoreInfo string `xml:"MoreInfo,attr"` SSLPort string `xml:"SSLPort,attr"` HHSSLPort string `xml:"HHSSLPort,attr"` Invisible string `xml:"Invisible,attr"` VirtualLineInSource string `xml:"VirtualLineInSource,attr"` } `xml:"ZoneGroupMember"` } `xml:"ZoneGroup"` } `xml:"ZoneGroups"` VanishedDevices string `xml:"VanishedDevices"` }
func (*ZoneGroupTopologyZoneGroupState) String ¶
func (e *ZoneGroupTopologyZoneGroupState) String() string
type ZonePlayer ¶
func NewZonePlayer ¶
func NewZonePlayer(opts ...ZonePlayerOption) (*ZonePlayer, error)
NewZonePlayer returns a new ZonePlayer instance.
func (*ZonePlayer) Client ¶
func (z *ZonePlayer) Client() *http.Client
Client returns the underlying http client.
func (*ZonePlayer) Event ¶
func (zp *ZonePlayer) Event(evt interface{}, fn EventHandlerFunc)
func (*ZonePlayer) GetVolume ¶
func (z *ZonePlayer) GetVolume() (int, error)
func (*ZonePlayer) GetZoneGroupState ¶
func (z *ZonePlayer) GetZoneGroupState() (*ZoneGroupState, error)
func (*ZonePlayer) HardwareVersion ¶
func (z *ZonePlayer) HardwareVersion() string
func (*ZonePlayer) IsCoordinator ¶
func (z *ZonePlayer) IsCoordinator() bool
func (*ZonePlayer) Location ¶
func (z *ZonePlayer) Location() *url.URL
func (*ZonePlayer) ModelName ¶
func (z *ZonePlayer) ModelName() string
func (*ZonePlayer) Play ¶
func (z *ZonePlayer) Play() error
func (*ZonePlayer) RoomName ¶
func (z *ZonePlayer) RoomName() string
func (*ZonePlayer) SerialNumber ¶
func (z *ZonePlayer) SerialNumber() string
func (*ZonePlayer) SetAVTransportURI ¶
func (z *ZonePlayer) SetAVTransportURI(url string) error
func (*ZonePlayer) SetVolume ¶
func (z *ZonePlayer) SetVolume(desiredVolume int) error
func (*ZonePlayer) Stop ¶
func (z *ZonePlayer) Stop() error
type ZonePlayerOption ¶
type ZonePlayerOption func(*ZonePlayer)
func WithClient ¶
func WithClient(c *http.Client) ZonePlayerOption
func WithLocation ¶
func WithLocation(u *url.URL) ZonePlayerOption
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
A minimal implementation of the Digital Item Declaration Language (DIDL).
|
A minimal implementation of the Digital Item Declaration Language (DIDL). |
examples
|
|
services
|
|
AVTransport
Package avtransport is a generated AVTransport package.
|
Package avtransport is a generated AVTransport package. |
AlarmClock
Package alarmclock is a generated AlarmClock package.
|
Package alarmclock is a generated AlarmClock package. |
AudioIn
Package audioin is a generated AudioIn package.
|
Package audioin is a generated AudioIn package. |
ConnectionManager
Package connectionmanager is a generated ConnectionManager package.
|
Package connectionmanager is a generated ConnectionManager package. |
ContentDirectory
Package contentdirectory is a generated ContentDirectory package.
|
Package contentdirectory is a generated ContentDirectory package. |
DeviceProperties
Package deviceproperties is a generated DeviceProperties package.
|
Package deviceproperties is a generated DeviceProperties package. |
GroupManagement
Package groupmanagement is a generated GroupManagement package.
|
Package groupmanagement is a generated GroupManagement package. |
GroupRenderingControl
Package grouprenderingcontrol is a generated GroupRenderingControl package.
|
Package grouprenderingcontrol is a generated GroupRenderingControl package. |
MusicServices
Package musicservices is a generated MusicServices package.
|
Package musicservices is a generated MusicServices package. |
QPlay
Package qplay is a generated QPlay package.
|
Package qplay is a generated QPlay package. |
Queue
Package queue is a generated Queue package.
|
Package queue is a generated Queue package. |
RenderingControl
Package renderingcontrol is a generated RenderingControl package.
|
Package renderingcontrol is a generated RenderingControl package. |
SystemProperties
Package systemproperties is a generated SystemProperties package.
|
Package systemproperties is a generated SystemProperties package. |
VirtualLineIn
Package virtuallinein is a generated VirtualLineIn package.
|
Package virtuallinein is a generated VirtualLineIn package. |
ZoneGroupTopology
Package zonegrouptopology is a generated ZoneGroupTopology package.
|
Package zonegrouptopology is a generated ZoneGroupTopology package. |
Click to show internal directories.
Click to hide internal directories.