aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-09-08 04:45:40 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-09-08 04:45:40 +1200
commit3aebd92cc3781b417ded6260d1300434b1418e7e (patch)
treea200a116a519f60c8667ba630fd4b11d0c8ea2d6
parent5e481bfc1596de062093c5bc01cf168ed906aafc (diff)
downloadtraccar-server-3aebd92cc3781b417ded6260d1300434b1418e7e.tar.gz
traccar-server-3aebd92cc3781b417ded6260d1300434b1418e7e.tar.bz2
traccar-server-3aebd92cc3781b417ded6260d1300434b1418e7e.zip
Handle GOOME status message
-rw-r--r--src/org/traccar/protocol/EelinkProtocolDecoder.java4
-rw-r--r--test/org/traccar/protocol/EelinkProtocolDecoderTest.java6
2 files changed, 9 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java
index 11d111e54..2526282b1 100644
--- a/src/org/traccar/protocol/EelinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java
@@ -160,7 +160,9 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
if (statusType == 0x01 || statusType == 0x02 || statusType == 0x03) {
buf.readUnsignedInt(); // device time
- decodeStatus(position, buf.readUnsignedShort());
+ if (buf.readableBytes() >= 2) {
+ decodeStatus(position, buf.readUnsignedShort());
+ }
}
}
diff --git a/test/org/traccar/protocol/EelinkProtocolDecoderTest.java b/test/org/traccar/protocol/EelinkProtocolDecoderTest.java
index 46c85d89a..d62357fe3 100644
--- a/test/org/traccar/protocol/EelinkProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/EelinkProtocolDecoderTest.java
@@ -14,6 +14,12 @@ public class EelinkProtocolDecoderTest extends ProtocolTest {
"676701000c007b03525440717505180104"));
verifyPosition(decoder, binary(
+ "676705002102b459ae7388fcd360d7034332b1000000028f000a4f64002eb101010159ae7388"));
+
+ verifyPosition(decoder, binary(
+ "676702001c02b259ae7387fcd360d6034332b2000000028f000a4f64002eb10101"));
+
+ verifyPosition(decoder, binary(
"6767050022001F59643640000000000000000000000001CC0000249500142000015964A6C0006E"));
verifyAttributes(decoder, binary(