Io.transport.serial read out existing connected ports?

Hi OpenHAB Community :wink:

How can i read out the existing connected serial ports?

I wrote a discovery service for a serial device and that scann’s the existing ports. But when it tries to connect to a before connected port it throws an exception and the program stops. So the other ports couldn’t be scanned. is there another Way to avoid this?

I’m not entirely certain what you are asking, but if you catch the exception in your loop it will allow the program to continue on an scan the rest of the ports.

If you are asking about how to prevent the exception from occurring, that is beyond my knowledge.

Rich

Thanks for the reply rlkoshak… The catch of the exception is a possibility, but it is possible to read out all the serial ports of the system with the Set availablePorts = NRSerialPort.getAvailableSerialPorts(); command. But there are either the connected ports listed. I just want to see the disconnected ports.