aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-06-16 16:25:12 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-06-16 16:25:12 +1200
commit4289c06d73eb5d07c58990386ebca9180e0e7527 (patch)
tree58101ebd66146926de5fae5aa24461c8a3dfa897
parent5a26d7f00cdabed1518a184e3086b113a87f2819 (diff)
downloadtrackermap-server-4289c06d73eb5d07c58990386ebca9180e0e7527.tar.gz
trackermap-server-4289c06d73eb5d07c58990386ebca9180e0e7527.tar.bz2
trackermap-server-4289c06d73eb5d07c58990386ebca9180e0e7527.zip
Fix Meiligao odometer decoding issue
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java6
-rw-r--r--test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java7
2 files changed, 8 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index 48ee95c13..cdbf3850a 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2015 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2012 - 2016 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -284,10 +284,10 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
}
if (parser.hasNext()) {
- position.set(Position.KEY_ODOMETER, parser.nextInt(16));
+ position.set(Position.KEY_ODOMETER, parser.nextLong(16));
}
if (parser.hasNext()) {
- position.set(Position.KEY_ODOMETER, parser.nextInt(16));
+ position.set(Position.KEY_ODOMETER, parser.nextLong(16));
}
if (parser.hasNext()) {
diff --git a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
index dd497858b..76f62d0f5 100644
--- a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class MeiligaoProtocolDecoderTest extends ProtocolTest {
MeiligaoProtocolDecoder decoder = new MeiligaoProtocolDecoder(new MeiligaoProtocol());
verifyPosition(decoder, binary(
+ "242400746251103044ffff99553033353033392e3939392c412c323832332e373632312c4e2c31303635322e303730342c572c3030302e302c3030302e302c3136303631362c2c2c412a37357c302e397c323038332e327c303030307c303030302c303030307c31303034333736333265780d0a"));
+
+ verifyPosition(decoder, binary(
"24240072190820157fffff99553039343335342e3030302c412c313930372e303631392c4e2c30373235312e333235312c452c3031302e312c3138382e352c3234303231362c2c2c412a36427c302e387c36352e327c303830307c303030302c303030307c303336343838373532c73f0d0a"));
verifyPosition(decoder, binary(
@@ -78,8 +81,8 @@ public class MeiligaoProtocolDecoderTest extends ProtocolTest {
verifyPosition(decoder, binary(
"242400001007ffffffffff99553136323330392e3035342c562c303933312e393136332c4e2c30363931312e383233332c572c2c2c3235313131332c2c2c4e2a36437c7c3135387c303030309cc60d0a"));
- //verifyPosition(decoder, binary(
- // "242400003563070435652099553035323034322e3030302c412c343435382e333536352c4e2c30343130342e343831332c452c302e30302c302e30302c3139303131342c2c2a39437c302e3730303030307c2d3835393131373337367c303130307c307c7c7c4f2a0d0a"));
+ verifyAttributes(decoder, binary(
+ "242400003563070435652099553035323034322e3030302c412c343435382e333536352c4e2c30343130342e343831332c452c302e30302c302e30302c3139303131342c2c2a39437c302e3730303030307c2d3835393131373337367c303130307c307c7c7c4f2a0d0a"));
verifyPosition(decoder, binary(
"2424005035784251ffffff99553030303033362e3938312c562c303933312e333437312c4e2c30363931312e383431322c572c2c2c3238303131342c2c2c4e2a36357c7c3136387c323030305e420d0a"));