From 48ec866d8e50ce2ef63ca336648db611cc233916 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 18 Jan 2021 21:59:54 -0800 Subject: Decode disassembling alarm --- src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java | 3 +++ src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java index b0cd1ab8c..a3d16cb62 100644 --- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java @@ -115,6 +115,9 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder { if (BitUtil.check(value, 8)) { return Position.ALARM_POWER_OFF; } + if (BitUtil.check(value, 17)) { + return Position.ALARM_TAMPERING; + } if (BitUtil.check(value, 20)) { return Position.ALARM_GEOFENCE; } diff --git a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java index b4a5148d6..552b5bb2d 100644 --- a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java @@ -14,6 +14,10 @@ public class HuabaoProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "7E01000021013345678906000F002C012F373031313142534A2D4D3742203030303030303001D4C1423838383838B47E")); + verifyAttribute(decoder, binary( + "7e02000033421030000018004c000200000004000201556dcb06c4d41d000c00f100fc210118095853010400000000fe0140ff0c01cc000000002694000055d87a7e"), + Position.KEY_ALARM, Position.ALARM_TAMPERING); + verifyAttribute(decoder, binary( "7e02000033202011200010001300020000000400020158b30006c93ee5002000000000201127162937010400000000fe0145ff0c01cc00000000263300000f3e627e"), Position.KEY_BATTERY_LEVEL, 69); -- cgit v1.2.3