Skip to content

Commit

Permalink
[dsmr] Catch exceptions for RFC2217 compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: Wouter Born <[email protected]>
  • Loading branch information
wborn committed Sep 7, 2020
1 parent e338240 commit bf1777f
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 bf1777f

Please sign in to comment.