use of org.eclipse.smarthome.binding.hue.internal.discovery.HueLightDiscoveryService in project smarthome by eclipse.
the class HueThingHandlerFactory method removeHandler.
@Override
protected synchronized void removeHandler(ThingHandler thingHandler) {
if (thingHandler instanceof HueBridgeHandler) {
ServiceRegistration<?> serviceReg = this.discoveryServiceRegs.get(thingHandler.getThing().getUID());
if (serviceReg != null) {
// remove discovery service, if bridge handler is removed
HueLightDiscoveryService service = (HueLightDiscoveryService) bundleContext.getService(serviceReg.getReference());
if (service != null) {
service.deactivate();
}
serviceReg.unregister();
discoveryServiceRegs.remove(thingHandler.getThing().getUID());
}
}
}
use of org.eclipse.smarthome.binding.hue.internal.discovery.HueLightDiscoveryService in project smarthome by eclipse.
the class HueThingHandlerFactory method registerLightDiscoveryService.
private synchronized void registerLightDiscoveryService(HueBridgeHandler bridgeHandler) {
HueLightDiscoveryService discoveryService = new HueLightDiscoveryService(bridgeHandler);
discoveryService.activate();
this.discoveryServiceRegs.put(bridgeHandler.getThing().getUID(), bundleContext.registerService(DiscoveryService.class.getName(), discoveryService, new Hashtable<String, Object>()));
}
Aggregations