Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC2217 improvements #1337

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ public void initialize() {
* @return a serial port identifier or null
*/
private @Nullable SerialPortIdentifier getSerialPortIdentifier(final String name) {
if (name.startsWith("rfc2217://")) {
return serialPortManager.getIdentifier(name);
}

Optional<SerialPortIdentifier> opt = serialPortManager.getIdentifiers().filter(id -> id.getName().equals(name))
.findFirst();
if (opt.isPresent()) {
Expand Down Expand Up @@ -133,8 +137,16 @@ private void watchSerialPort() {
SerialPort commPort = portIdentifier.open("org.openhab.binding.zwave", 2000);
serialPort = commPort;
commPort.setSerialPortParams(115200, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
commPort.enableReceiveThreshold(1);
commPort.enableReceiveTimeout(SERIAL_RECEIVE_TIMEOUT);
try {
commPort.enableReceiveThreshold(1);
} catch (UnsupportedCommOperationException e) {
logger.debug("Enabling receive threshold is unsupported");
}
try {
commPort.enableReceiveTimeout(SERIAL_RECEIVE_TIMEOUT);
} catch (UnsupportedCommOperationException e) {
logger.debug("Enabling receive timeout is unsupported");
}
inputStream = commPort.getInputStream();
outputStream = commPort.getOutputStream();
logger.debug("Starting receive thread");
Expand Down