Search in sources :

Example 1 with KodiHandler

use of org.openhab.binding.kodi.internal.handler.KodiHandler in project openhab-addons by openhab.

the class KodiHandlerFactory method createHandler.

@Override
@Nullable
protected ThingHandler createHandler(Thing thing) {
    ThingTypeUID thingTypeUID = thing.getThingTypeUID();
    if (thingTypeUID.equals(THING_TYPE_KODI)) {
        String callbackUrl = createCallbackUrl();
        KodiHandler handler = new KodiHandler(thing, commandDescriptionProvider, stateDescriptionProvider, webSocketClient, callbackUrl);
        // register the Kodi as an audio sink
        KodiAudioSink audioSink = new KodiAudioSink(handler, audioHTTPServer, callbackUrl);
        @SuppressWarnings("unchecked") ServiceRegistration<AudioSink> reg = (ServiceRegistration<AudioSink>) bundleContext.registerService(AudioSink.class.getName(), audioSink, new Hashtable<>());
        audioSinkRegistrations.put(thing.getUID().toString(), reg);
        return handler;
    }
    return null;
}
Also used : AudioSink(org.openhab.core.audio.AudioSink) KodiHandler(org.openhab.binding.kodi.internal.handler.KodiHandler) Hashtable(java.util.Hashtable) ThingTypeUID(org.openhab.core.thing.ThingTypeUID) ServiceRegistration(org.osgi.framework.ServiceRegistration) Nullable(org.eclipse.jdt.annotation.Nullable)

Aggregations

Hashtable (java.util.Hashtable)1 Nullable (org.eclipse.jdt.annotation.Nullable)1 KodiHandler (org.openhab.binding.kodi.internal.handler.KodiHandler)1 AudioSink (org.openhab.core.audio.AudioSink)1 ThingTypeUID (org.openhab.core.thing.ThingTypeUID)1 ServiceRegistration (org.osgi.framework.ServiceRegistration)1