diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-03-16 01:43:47 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-03-16 01:43:47 +1300 |
commit | 37a023ca4db10bc48fcc9eca9daddcf8d2701ef9 (patch) | |
tree | 24ace8ac2864b12eb1afeb11e444f7695ac73463 | |
parent | 38c12eb011e47c131a9b1e47e2b29901270057b1 (diff) | |
download | trackermap-server-37a023ca4db10bc48fcc9eca9daddcf8d2701ef9.tar.gz trackermap-server-37a023ca4db10bc48fcc9eca9daddcf8d2701ef9.tar.bz2 trackermap-server-37a023ca4db10bc48fcc9eca9daddcf8d2701ef9.zip |
Implement H02 power cut alarm
-rw-r--r-- | src/org/traccar/protocol/H02ProtocolDecoder.java | 2 | ||||
-rw-r--r-- | test/org/traccar/protocol/H02ProtocolDecoderTest.java | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java index a717ddc4d..6ab997b86 100644 --- a/src/org/traccar/protocol/H02ProtocolDecoder.java +++ b/src/org/traccar/protocol/H02ProtocolDecoder.java @@ -73,6 +73,8 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ALARM, Position.ALARM_SOS); } else if (!BitUtil.check(status, 2)) { position.set(Position.KEY_ALARM, Position.ALARM_OVERSPEED); + } else if (!BitUtil.check(status, 19)) { + position.set(Position.KEY_ALARM, Position.ALARM_POWER_CUT); } position.set(Position.KEY_IGNITION, BitUtil.check(status, 10)); diff --git a/test/org/traccar/protocol/H02ProtocolDecoderTest.java b/test/org/traccar/protocol/H02ProtocolDecoderTest.java index 90a1470c6..27b41f4e8 100644 --- a/test/org/traccar/protocol/H02ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/H02ProtocolDecoderTest.java @@ -11,6 +11,12 @@ public class H02ProtocolDecoderTest extends ProtocolTest { H02ProtocolDecoder decoder = new H02ProtocolDecoder(new H02Protocol()); verifyPosition(decoder, buffer( + "*HQ,4210209006,V1,201812,A,2608.9437,N,08016.2521,W,000.80,000,150317,EFE7F9FF,310,260,0,0,6#")); + + verifyPosition(decoder, buffer( + "*HQ,4210209006,V1,201844,A,2608.9437,N,08016.2521,W,000.80,000,150317,FFFFF9FF,310,260,0,0,6#")); + + verifyPosition(decoder, buffer( "*HQ,4109179024,V19,103732,V,3853.2770,S,06205.8678,W,000.00,000,100217,,5492932630888,8954314165044716555?,FFFFFBFF#")); verifyAttributes(decoder, buffer( |