I am developing a binding following the developer’s guide. The binding uses a serial port. I am having trouble running the binding in the demo-app in Eclipse.
For development, I am using the
openhab-transport-serial-rfc2217 module to access a remote serial port. So I added
org.eclipse.smarthome.io.transport.serial.rxtx.rfc2217 to the run requirements of the demo app launch config.
However, this doesn’t work. I think the problem has to do with load order of bundles. From the log, I can see that my binding is activated before the
rxtx.rfc2217 bundle, so the rfc2217 serial provider is not registered when the binding tries to initialize the serial port, so it fails.
If I run the same confguration in a debugger and set a breakpoint in my binding init, then the other bundles have time to load, and the it can successfully open the port.
I am trying to fix this by ensuring the right dependencies, so that the rfc2217 provider will be activated before my binding. But I’m struggling with this, and everything I try leads to different resolution failures.
Currently I have this in my binding’s POM:
<properties> <bnd.importpackage>org.eclipse.smarthome.io.transport.serial.rxtx.rfc2217</bnd.importpackage> </properties>
org.eclipse.smarthome.io.transport.serial.rxtx.rfc2217 as an
Import-Package in the binding’s manifest, but resolving the runtime config now fails with:
Resolution failed. Capabilities satisfying the following requirements could not be found: [<<INITIAL>>] ⇒ osgi.identity: (osgi.identity=org.openhab.binding.upb) ⇒ [org.openhab.binding.upb version=220.127.116.11911170242] ⇒ osgi.wiring.package: (&(osgi.wiring.package=org.eclipse.smarthome.io.transport.serial.rxtx.rfc2217))
Does anyone know how this is supposed to work?