aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-18 14:25:18 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-07-18 14:25:32 +1200
commit24fa824e20cf68d36f760e4b921edb1fb25525b3 (patch)
treeb3225174b19622202f0aedf780892fecc70944d7
parent43d26a730aff016c1324011e5f4b98c55a8d93ad (diff)
downloadtrackermap-server-24fa824e20cf68d36f760e4b921edb1fb25525b3.tar.gz
trackermap-server-24fa824e20cf68d36f760e4b921edb1fb25525b3.tar.bz2
trackermap-server-24fa824e20cf68d36f760e4b921edb1fb25525b3.zip
Support GT06 external power subtype
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java14
-rw-r--r--test/org/traccar/protocol/Gt06ProtocolDecoderTest.java3
2 files changed, 16 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index ce915fde8..57e2d64b7 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -277,7 +277,19 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
if (type == MSG_INFO) {
int subType = buf.readUnsignedByte();
- if (subType == 0x05) {
+ if (subType == 0x00) {
+
+ Position position = new Position();
+ position.setDeviceId(getDeviceId());
+ position.setProtocol(getProtocolName());
+
+ getLastLocation(position, null);
+
+ position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
+
+ return position;
+
+ } else if (subType == 0x05) {
Position position = new Position();
position.setDeviceId(getDeviceId());
diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index 94d665478..9201caac6 100644
--- a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -13,6 +13,9 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
verifyNothing(decoder, binary(
"787805120099abec0d0a"));
+ verifyAttributes(decoder, binary(
+ "797900089400000002e852d70d0a"));
+
verifyNothing(decoder, binary(
"78780D01086471700328358100093F040D0A"));