aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-10-05 14:41:35 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2019-10-05 14:41:35 -0700
commitd2c24e28111e351f392ac0e579f4f1d443ebcf1d (patch)
treeff9bd8f5788b0a98d9180a10e52fdb7878deaeee
parent4ecca566c4faba5f526b92d5920f542a5b03cc95 (diff)
downloadtrackermap-server-d2c24e28111e351f392ac0e579f4f1d443ebcf1d.tar.gz
trackermap-server-d2c24e28111e351f392ac0e579f4f1d443ebcf1d.tar.bz2
trackermap-server-d2c24e28111e351f392ac0e579f4f1d443ebcf1d.zip
Decode ADC values
-rw-r--r--src/main/java/org/traccar/protocol/GatorProtocolDecoder.java8
-rw-r--r--src/test/java/org/traccar/protocol/GatorProtocolDecoderTest.java3
2 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/GatorProtocolDecoder.java b/src/main/java/org/traccar/protocol/GatorProtocolDecoder.java
index 31500bae6..043839be9 100644
--- a/src/main/java/org/traccar/protocol/GatorProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/GatorProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2013 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -120,8 +120,10 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_STATUS, buf.readUnsignedByte());
position.set("key", buf.readUnsignedByte());
- position.set("oil", buf.readUnsignedShort() / 10.0);
- position.set(Position.KEY_POWER, buf.readUnsignedByte() + buf.readUnsignedByte() * 0.01);
+
+ position.set(Position.PREFIX_ADC + 1, buf.readUnsignedByte() + buf.readUnsignedByte() * 0.01);
+ position.set(Position.PREFIX_ADC + 2, buf.readUnsignedByte() + buf.readUnsignedByte() * 0.01);
+
position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
return position;
diff --git a/src/test/java/org/traccar/protocol/GatorProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GatorProtocolDecoderTest.java
index e2be99cb9..7e1ccb79d 100644
--- a/src/test/java/org/traccar/protocol/GatorProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/GatorProtocolDecoderTest.java
@@ -20,6 +20,9 @@ public class GatorProtocolDecoderTest extends ProtocolTest {
GatorProtocolDecoder decoder = new GatorProtocolDecoder(null);
verifyAttributes(decoder, binary(
+ "242480002600341cad190917022021812497260280594200000000c047010000135400009bb600ff00b90d"));
+
+ verifyAttributes(decoder, binary(
"2424800026364101b31608041108380273453415301532000000008000010000122800000124000000c40d"));
verifyNull(decoder, binary(