Search in sources :

Example 1 with ZonePlayerHandler

use of org.eclipse.smarthome.binding.sonos.internal.handler.ZonePlayerHandler in project smarthome by eclipse.

the class SonosHandlerFactory method createHandler.

@Override
protected ThingHandler createHandler(Thing thing) {
    ThingTypeUID thingTypeUID = thing.getThingTypeUID();
    if (SonosBindingConstants.SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID)) {
        logger.debug("Creating a ZonePlayerHandler for thing '{}' with UDN '{}'", thing.getUID(), thing.getConfiguration().get(UDN));
        ZonePlayerHandler handler = new ZonePlayerHandler(thing, upnpIOService, opmlUrl);
        // register the speaker as an audio sink
        String callbackUrl = createCallbackUrl();
        SonosAudioSink audioSink = new SonosAudioSink(handler, audioHTTPServer, callbackUrl);
        @SuppressWarnings("unchecked") ServiceRegistration<AudioSink> reg = (ServiceRegistration<AudioSink>) getBundleContext().registerService(AudioSink.class.getName(), audioSink, new Hashtable<String, Object>());
        audioSinkRegistrations.put(thing.getUID().toString(), reg);
        return handler;
    }
    return null;
}
Also used : AudioSink(org.eclipse.smarthome.core.audio.AudioSink) ZonePlayerHandler(org.eclipse.smarthome.binding.sonos.internal.handler.ZonePlayerHandler) Hashtable(java.util.Hashtable) ThingTypeUID(org.eclipse.smarthome.core.thing.ThingTypeUID) ServiceRegistration(org.osgi.framework.ServiceRegistration)

Aggregations

Hashtable (java.util.Hashtable)1 ZonePlayerHandler (org.eclipse.smarthome.binding.sonos.internal.handler.ZonePlayerHandler)1 AudioSink (org.eclipse.smarthome.core.audio.AudioSink)1 ThingTypeUID (org.eclipse.smarthome.core.thing.ThingTypeUID)1 ServiceRegistration (org.osgi.framework.ServiceRegistration)1