From 5cfc15ffa2a5ba0ca32a9382a33288ea75fc4da5 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 28 Jul 2015 14:13:40 +1200 Subject: Add H02 power info support --- src/org/traccar/protocol/H02ProtocolDecoder.java | 2 +- test/org/traccar/protocol/H02ProtocolDecoderTest.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java index e3130305b..9b58af854 100644 --- a/src/org/traccar/protocol/H02ProtocolDecoder.java +++ b/src/org/traccar/protocol/H02ProtocolDecoder.java @@ -83,7 +83,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { // Location double latitude = readCoordinate(buf, false); - int x = buf.readByte(); // reserved + position.set(Event.KEY_POWER, buf.readByte()); double longitude = readCoordinate(buf, true); int flags = buf.readUnsignedByte() & 0x0f; position.setValid((flags & 0x02) != 0); diff --git a/test/org/traccar/protocol/H02ProtocolDecoderTest.java b/test/org/traccar/protocol/H02ProtocolDecoderTest.java index 18ae70f99..b7d356ff0 100644 --- a/test/org/traccar/protocol/H02ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/H02ProtocolDecoderTest.java @@ -96,6 +96,9 @@ public class H02ProtocolDecoderTest extends ProtocolDecoderTest { verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( "24270517030820321418041423307879000463213792000056fffff9ffff0000")))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "2441091144271222470112142233983006114026520E000000FFFFFBFFFF0014060000000001CC00262B0F170A")))); + } } -- cgit v1.2.3