aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-12-20 19:51:19 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-12-20 19:51:41 +1300
commit4fb9b7e1467baf57f54e47ab962c6af1769680c0 (patch)
tree22648b0d6b717072912a1af3aaccab51beb7dc8d
parentfbba97c6ded44f3a433ca2e3bf18b620752aca1a (diff)
downloadtraccar-server-4fb9b7e1467baf57f54e47ab962c6af1769680c0.tar.gz
traccar-server-4fb9b7e1467baf57f54e47ab962c6af1769680c0.tar.bz2
traccar-server-4fb9b7e1467baf57f54e47ab962c6af1769680c0.zip
Decode odometer and RFID for TK228
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java4
-rw-r--r--test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index bc7a0b71a..435e2ab14 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -73,7 +73,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
.expression("(.*)") // driver
.groupEnd("?")
.or()
- .number("|(x{9})") // odometer
+ .number("|(d{1,9})") // odometer
.groupBegin()
.number("|(x{5,})") // rfid
.groupEnd("?")
@@ -262,7 +262,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_ODOMETER, parser.nextHexLong());
position.set(Position.KEY_SATELLITES, parser.nextHexInt());
position.set("driverLicense", parser.next());
- position.set(Position.KEY_ODOMETER, parser.nextHexLong());
+ position.set(Position.KEY_ODOMETER, parser.nextLong());
position.set(Position.KEY_DRIVER_UNIQUE_ID, parser.next());
return position;
diff --git a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
index f5f3b3057..41d02ae31 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(
+ "242400716578902405843299553136323533332e3937382c412c343632332e313137392c4e2c30373932342e323437312c572c303030302c3030302c3139313231372c2c2a31437c31312e357c3139347c303030307c313139322c303030307c3835383030307c30303331343809540d0a"));
+
+ verifyPosition(decoder, binary(
"2424010a142170525979ff9999753137353830322e3030302c412c313330362e303639342c4e2c31303035342e323439302c452c302e30302c3331332c3234313031372c2c2a30457c302e397c377c323530307c303030302c303030302c303130312c303241447c30323038303030353043313330313638353333427c30427c30303032313034357c30417c2520205e59454e53414241494348414924534f4e474b52414e244d522e5e5e3f3b363030373634333130303530303337333835333d3135303531393637303631343d3f2b202020202020202020202020203234202020202020202020202020312020202020202020202020203030303431313120203030313030545c0d0a"));
verifyPositions(decoder, binary(