DiscoveryService registered but startScan not executed [message #1773637] |
Mon, 02 October 2017 06:16  |
Eclipse User |
|
|
|
Hello,
I've a little problem perhaps it's a comprehsension problem on my part.
I've implemented a HandlerFactory extending BaseThingHandlerFactory. My assumption was that when I start scan by pressing the button in the inbox that I get in popup for "Scan for Things" a new entry for my discovery service.

that's my HandlerFactory extending BaseThingHandlerFactory:
@Override
protected @Nullable ThingHandler createHandler(Thing thing) {
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
if (thingTypeUID.equals(THING_TYPE_STATION)) {
MyBridgeHandler handler = new MyBridgeHandler((Bridge) thing);
registerDeviceDiscoveryService(handler);
return handler;
}
return null;
}
private void registerDeviceDiscoveryService(MyBridgeHandler bridgHandler) {
MyDiscoveryService discoveryService = new MyDiscoveryService (bridgHandler);
this.discoveryServiceRegs.put(bridgHandler.getThing().getUID(), bundleContext.registerService(DiscoveryService.class.getName(), discoveryService,
new Hashtable<String, Object>()));
}
and a MyDiscoveryService extending AbstractDiscoveryService:
public MyDiscoveryServiceMyBridgeHandler bridgeHandler) throws IllegalArgumentException {
super(SEARCH_TIME);
this.bridgeHandler = bridgeHandler;
}
@Override
protected void startScan() {
some code....
}
When I start debugging I see that my code is executed succefully.
But why is my service not listed?
Attachment: paperui.jpg
(Size: 41.35KB, Downloaded 468 times)
|
|
|
|
|
Re: DiscoveryService registered but startScan not executed [message #1773884 is a reply to message #1773882] |
Fri, 06 October 2017 06:05   |
Eclipse User |
|
|
|
hi Kai,
thank you for your support! I have implemented getSupportedThingTypes() in my DiscoveryService and now it works!!!
But after your response I'm not sure if I do it right anymore. So let me explain what I'm doing.
I've a bridgeHandler which connect to a http api with username and password to get a sessionid. After connecting to the http api the bridge requests the api with the sessionid to get a json list with devices: These devices are my new discovered things.
After all the http api is a gateway to communicate with the devices. Therefore I have come to the assumption to implement a bridgehandler for the api.
Is the bridgehandler in that case the right aproach for the implementation?
|
|
|
|
Powered by
FUDForum. Page generated in 0.04592 seconds