Skip to content

Commit

Permalink
added data validation
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Lauterbach <lauterbachthomas@gmail.com>
  • Loading branch information
Thomas Lauterbach committed Jul 8, 2021
1 parent df6d002 commit 9451010
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,21 @@ public State convertToStateImpl(String channelId, String channelTypeId, Function

return UnDefType.UNDEF;
}

@Override
protected boolean validateData(byte[] bytes) {
// Window status
if (bytes[0] == 1) {
return bytes.length == 8;
}
// Alarm
if (bytes[0] == 2) {
return bytes.length == 2;
}
// Calibration (not supported but valid)
if (bytes[0] == 11) {
return bytes.length == 2;
}
return false;
}
}

0 comments on commit 9451010

Please sign in to comment.