diff options
author | Anton Tananaev <anton@traccar.org> | 2023-12-29 15:10:10 -0800 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-12-29 15:10:10 -0800 |
commit | e7fa59e3e5c81f45f248ac7c4a1de6ba919b0065 (patch) | |
tree | 48758b4227ba308bf9aa76d82b01e9e7078bbdff /src | |
parent | 30b74bc637b4f1165e040c23324f3504897d2b97 (diff) | |
download | trackermap-server-e7fa59e3e5c81f45f248ac7c4a1de6ba919b0065.tar.gz trackermap-server-e7fa59e3e5c81f45f248ac7c4a1de6ba919b0065.tar.bz2 trackermap-server-e7fa59e3e5c81f45f248ac7c4a1de6ba919b0065.zip |
Support MettaX new alarms
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java index 881209120..a102e9e44 100644 --- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java @@ -131,7 +131,10 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder { if (BitUtil.check(value, 8)) { return Position.ALARM_POWER_OFF; } - if (BitUtil.check(value, 17)) { + if (BitUtil.check(value, 15)) { + return Position.ALARM_VIBRATION; + } + if (BitUtil.check(value, 16) || BitUtil.check(value, 17)) { return Position.ALARM_TAMPERING; } if (BitUtil.check(value, 20)) { @@ -140,7 +143,7 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder { if (BitUtil.check(value, 28)) { return Position.ALARM_MOVEMENT; } - if (BitUtil.check(value, 29)) { + if (BitUtil.check(value, 29) || BitUtil.check(value, 30)) { return Position.ALARM_ACCIDENT; } return null; @@ -488,6 +491,14 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte() * 10); buf.readUnsignedByte(); // reserved break; + case 0x57: + int alarm = buf.readUnsignedShort(); + position.set(Position.KEY_ALARM, BitUtil.check(alarm, 8) ? Position.ALARM_ACCELERATION : null); + position.set(Position.KEY_ALARM, BitUtil.check(alarm, 9) ? Position.ALARM_BRAKING : null); + position.set(Position.KEY_ALARM, BitUtil.check(alarm, 10) ? Position.ALARM_CORNERING : null); + buf.readUnsignedShort(); // external switch state + buf.skipBytes(4); // reserved + break; case 0x60: int event = buf.readUnsignedShort(); position.set(Position.KEY_EVENT, event); |