use of org.eclipse.smarthome.binding.tradfri.internal.discovery.TradfriDiscoveryService in project smarthome by eclipse.
the class TradfriHandlerFactory method unregisterDiscoveryService.
private void unregisterDiscoveryService(TradfriGatewayHandler bridgeHandler) {
ServiceRegistration<?> serviceReg = this.discoveryServiceRegs.get(bridgeHandler.getThing().getUID());
if (serviceReg != null) {
TradfriDiscoveryService service = (TradfriDiscoveryService) getBundleContext().getService(serviceReg.getReference());
if (service != null) {
service.deactivate();
}
serviceReg.unregister();
discoveryServiceRegs.remove(bridgeHandler.getThing().getUID());
}
}
use of org.eclipse.smarthome.binding.tradfri.internal.discovery.TradfriDiscoveryService in project smarthome by eclipse.
the class TradfriDiscoveryServiceTest method setUp.
@Before
public void setUp() {
initMocks(this);
when(handler.getThing()).thenReturn(BridgeBuilder.create(GATEWAY_TYPE_UID, "1").build());
discovery = new TradfriDiscoveryService(handler);
listener = new DiscoveryListener() {
@Override
public void thingRemoved(DiscoveryService source, ThingUID thingUID) {
}
@Override
public void thingDiscovered(DiscoveryService source, DiscoveryResult result) {
discoveryResult = result;
}
@Override
public Collection<ThingUID> removeOlderResults(DiscoveryService source, long timestamp, Collection<ThingTypeUID> thingTypeUIDs, ThingUID bridgeUID) {
return null;
}
};
discovery.addDiscoveryListener(listener);
}
use of org.eclipse.smarthome.binding.tradfri.internal.discovery.TradfriDiscoveryService in project smarthome by eclipse.
the class TradfriHandlerFactory method registerDiscoveryService.
private void registerDiscoveryService(TradfriGatewayHandler bridgeHandler) {
TradfriDiscoveryService discoveryService = new TradfriDiscoveryService(bridgeHandler);
discoveryService.activate();
this.discoveryServiceRegs.put(bridgeHandler.getThing().getUID(), getBundleContext().registerService(DiscoveryService.class.getName(), discoveryService, new Hashtable<String, Object>()));
}
Aggregations