Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse SmartHome » Problem to open a serial com port for binding
Problem to open a serial com port for binding [message #1736700] Fri, 01 July 2016 09:01 Go to next message
Paolo Marini is currently offline Paolo MariniFriend
Messages: 2
Registered: June 2016
Junior Member
Hi all,

i'm implementing a binding in openHab, to implement the connectivity with a domotic system. Now, i created an OSGi project model that search all the available port using the library
- com.fazecast.jSerialComm.SerialPort

The code used for the discovery is the following:

public boolean Open() {
SerialPort comPorts[] = SerialPort.getCommPorts();
for (SerialPort comPort : comPorts) {
logger.debug(comPort.getSystemPortName());
}
return true;
}

Now, if i use this code in my binding, when i call the open method Open(),
the system seem to stay blocked in Open() methond.
I tryed the same code in an easy java project ans everithing seem work fine.

Some Idea?
Re: Problem to open a serial com port for binding [message #1736801 is a reply to message #1736700] Fri, 01 July 2016 20:29 Go to previous message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
> Some Idea?

Not really. Maybe the lib has issues to run on OSGi due to native calls, classloader hacks, etc. Have you tried to ask at jSerialComm for help?

Just for the reference, very similar code works well on OSGi (also ESH) with RXTX (through nrjavaserial), see e.g. https://github.com/openhab/openhab/blob/master/bundles/binding/org.openhab.binding.serial/src/main/java/org/openhab/binding/serial/internal/SerialDevice.java#L177
Previous Topic:Problem with Discovery Service
Next Topic:ItemRegistery(org.eclipse.smarthome.core.items.ItemRegistry) is empty when channel is linked?
Goto Forum:
  


Current Time: Tue Sep 24 18:03:40 GMT 2024

Powered by FUDForum. Page generated in 0.04163 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top