Skip to content

Commit

Permalink
[dsmr] Catch exceptions for RFC2217 compatibility (#8420)
Browse files Browse the repository at this point in the history
Signed-off-by: Wouter Born <[email protected]>
  • Loading branch information
wborn authored Sep 7, 2020
1 parent 6aa1793 commit 2fb38d0
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 2fb38d0

Please sign in to comment.