Skip to content

Commit

Permalink
[dsmr] Catch exceptions for RFC2217 compatibility (openhab#8420)
Browse files Browse the repository at this point in the history
Signed-off-by: Wouter Born <[email protected]>
  • Loading branch information
wborn authored and andrewfg committed Oct 8, 2020
1 parent 1dec0d0 commit 0fc13c4
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,16 @@ public void open(DSMRSerialSettings portSettings) {
serialPort.notifyOnOverrunError(true);
serialPort.notifyOnParityError(true);

serialPort.enableReceiveThreshold(SERIAL_TIMEOUT_MILLISECONDS);
serialPort.enableReceiveTimeout(SERIAL_TIMEOUT_MILLISECONDS);
try {
serialPort.enableReceiveThreshold(SERIAL_TIMEOUT_MILLISECONDS);
} catch (UnsupportedCommOperationException e) {
logger.debug("Enable receive threshold is unsupported");
}
try {
serialPort.enableReceiveTimeout(SERIAL_TIMEOUT_MILLISECONDS);
} catch (UnsupportedCommOperationException e) {
logger.debug("Enable receive timeout is unsupported");
}
// The binding is ready, let the meter know we want to receive values
serialPort.setRTS(true);
if (!serialPortReference.compareAndSet(oldSerialPort, serialPort)) {
Expand Down

0 comments on commit 0fc13c4

Please sign in to comment.