Exemplo n.º 1
0
func ConnectAnyReciva(mgr ssdp.Manager, reactor upnp.Reactor, flags int) (reciva []*Reciva) {
	qry := ssdp.ServiceQueryTerms{
		ssdp.ServiceKey(RECIVA_RADIO): -1,
	}
	res := mgr.QueryServices(qry)
	if dev_list, has := res[RECIVA_RADIO]; has {
		for _, dev := range dev_list {
			if RADIO == dev.Product() {
				if svc_map, err := upnp.Describe(dev.Location()); nil != err {
					panic(err)
				} else {
					reciva = append(reciva, MakeReciva(svc_map, reactor, flags))
				}
				break
			}
		}
	}
	return
}
Exemplo n.º 2
0
func ConnectAny(mgr ssdp.Manager, reactor upnp.Reactor, flags int) (sonos []*Sonos) {
	qry := ssdp.ServiceQueryTerms{
		ssdp.ServiceKey(MUSIC_SERVICES): -1,
	}
	res := mgr.QueryServices(qry)
	if dev_list, has := res[MUSIC_SERVICES]; has {
		for _, dev := range dev_list {
			if SONOS == dev.Product() {
				if svc_map, err := upnp.Describe(dev.Location()); nil != err {
					panic(err)
				} else {
					sonos = append(sonos, MakeSonos(svc_map, reactor, flags))
				}
				break
			}
		}
	}
	return
}