Skip to content

Commit

Permalink
added data validation
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Lauterbach <[email protected]>
  • Loading branch information
Thomas Lauterbach committed Sep 8, 2021
1 parent 0a96792 commit 8d7bd95
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,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 8d7bd95

Please sign in to comment.