aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-12-29 15:10:10 -0800
committerAnton Tananaev <anton@traccar.org>2023-12-29 15:10:10 -0800
commite7fa59e3e5c81f45f248ac7c4a1de6ba919b0065 (patch)
tree48758b4227ba308bf9aa76d82b01e9e7078bbdff
parent30b74bc637b4f1165e040c23324f3504897d2b97 (diff)
downloadtrackermap-server-e7fa59e3e5c81f45f248ac7c4a1de6ba919b0065.tar.gz
trackermap-server-e7fa59e3e5c81f45f248ac7c4a1de6ba919b0065.tar.bz2
trackermap-server-e7fa59e3e5c81f45f248ac7c4a1de6ba919b0065.zip
Support MettaX new alarms
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java15
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);