func handleEvent_TestEventBrief(reactor upnp.Reactor, c chan bool) { for { select { case evt := <-reactor.Channel(): switch evt.Type() { case upnp.AlarmClock_EventType: log.Printf("ALARM_CLOCK") case upnp.AVTransport_EventType: log.Printf("AV_TRANSPORT") case upnp.ConnectionManager_EventType: log.Printf("CONNECTION_MANAGER") case upnp.ContentDirectory_EventType: log.Printf("CONTENT_DIRECTORY") case upnp.DeviceProperties_EventType: log.Printf("DEVICE_PROPERTIES") case upnp.GroupManagement_EventType: log.Printf("GROUP_MANAGEMENT") case upnp.MusicServices_EventType: log.Printf("MUSIC_SERVICES") case upnp.RenderingControl_EventType: log.Printf("RENDERING_CONTROL") case upnp.SystemProperties_EventType: log.Printf("SYSTEM_PROPERTIES") case upnp.ZoneGroupTopology_EventType: log.Printf("ZONE_GROUP_TOPOLOGY") } } } c <- true }
func handleEvent_TestEvent(reactor upnp.Reactor, c chan bool) { for { select { case evt := <-reactor.Channel(): switch evt.Type() { case upnp.AlarmClock_EventType: b := evt.(upnp.AlarmClockEvent) log.Printf("%#v", b) case upnp.AVTransport_EventType: b := evt.(upnp.AVTransportEvent) log.Printf("%#v", b) case upnp.ConnectionManager_EventType: b := evt.(upnp.ConnectionManagerEvent) log.Printf("%#v", b) case upnp.ContentDirectory_EventType: b := evt.(upnp.ContentDirectoryEvent) log.Printf("%#v", b) case upnp.DeviceProperties_EventType: b := evt.(upnp.DevicePropertiesEvent) log.Printf("%#v", b) case upnp.GroupManagement_EventType: b := evt.(upnp.GroupManagementEvent) log.Printf("%#v", b) case upnp.MusicServices_EventType: b := evt.(upnp.MusicServicesEvent) log.Printf("%#v", b) case upnp.RenderingControl_EventType: b := evt.(upnp.RenderingControlEvent) log.Printf("%#v", b) case upnp.SystemProperties_EventType: b := evt.(upnp.SystemPropertiesEvent) log.Printf("%#v", b) case upnp.ZoneGroupTopology_EventType: b := evt.(upnp.ZoneGroupTopologyEvent) log.Printf("%#v", b) } } } c <- true }
func MakeReciva(svc_map upnp.ServiceMap, reactor upnp.Reactor, flags int) (reciva *Reciva) { reciva = &Reciva{} for svc_type, svc_list := range svc_map { switch svc_type { case "AVTransport": for _, svc := range svc_list { reciva.AVTransport.Svc = svc svc.Describe() if nil != reactor { reactor.Subscribe(svc, &reciva.AVTransport) } break } case "ConnectionManager": for _, svc := range svc_list { reciva.ConnectionManager.Svc = svc svc.Describe() if nil != reactor { reactor.Subscribe(svc, &reciva.ConnectionManager) } break } case "Playlist": for _, svc := range svc_list { reciva.Playlist.Svc = svc svc.Describe() if nil != reactor { reactor.Subscribe(svc, &reciva.Playlist) } break } case "RecivaRadio": for _, svc := range svc_list { reciva.RecivaRadio.Svc = svc svc.Describe() if nil != reactor { reactor.Subscribe(svc, &reciva.RecivaRadio) } break } case "RecivaSimpleRemote": for _, svc := range svc_list { reciva.RecivaSimpleRemote.Svc = svc svc.Describe() if nil != reactor { reactor.Subscribe(svc, &reciva.RecivaSimpleRemote) } break } case "RenderingControl": for _, svc := range svc_list { reciva.RenderingControl.Svc = svc svc.Describe() if nil != reactor { reactor.Subscribe(svc, &reciva.RenderingControl) } break } } } return }
func MakeSonos(svc_map upnp.ServiceMap, reactor upnp.Reactor, flags int) (sonos *Sonos) { sonos = &Sonos{} for svc_type, svc_list := range svc_map { if !sonosCheckServiceFlags(svc_type, flags) { continue } switch svc_type { case "AlarmClock": for _, svc := range svc_list { sonos.AlarmClock.Svc = svc svc.Describe() reactor.Subscribe(svc, sonosHandleUpdate) break } case "AVTransport": for _, svc := range svc_list { sonos.AVTransport.Svc = svc svc.Describe() reactor.Subscribe(svc, sonosHandleUpdate) break } case "ConnectionManager": for _, svc := range svc_list { sonos.ConnectionManager.Svc = svc svc.Describe() reactor.Subscribe(svc, sonosHandleUpdate) break } case "ContentDirectory": for _, svc := range svc_list { sonos.ContentDirectory.Svc = svc svc.Describe() reactor.Subscribe(svc, sonosHandleUpdate) break } case "DeviceProperties": for _, svc := range svc_list { sonos.DeviceProperties.Svc = svc svc.Describe() reactor.Subscribe(svc, sonosHandleUpdate) break } case "GroupManagement": for _, svc := range svc_list { sonos.GroupManagement.Svc = svc svc.Describe() reactor.Subscribe(svc, sonosHandleUpdate) break } case "MusicServices": for _, svc := range svc_list { sonos.MusicServices.Svc = svc svc.Describe() reactor.Subscribe(svc, sonosHandleUpdate) break } case "RenderingControl": for _, svc := range svc_list { sonos.RenderingControl.Svc = svc svc.Describe() reactor.Subscribe(svc, sonosHandleUpdate) break } case "SystemProperties": for _, svc := range svc_list { sonos.SystemProperties.Svc = svc svc.Describe() reactor.Subscribe(svc, sonosHandleUpdate) break } case "ZoneGroupTopology": for _, svc := range svc_list { sonos.ZoneGroupTopology.Svc = svc svc.Describe() reactor.Subscribe(svc, sonosHandleUpdate) break } } } return }