From 743ed6cd39d661aba7d9b6671feda5c08949be6f Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 31 Aug 2013 18:32:50 +1200 Subject: Fix EasyTrack decoder --- src/org/traccar/protocol/EasyTrackProtocolDecoder.java | 7 ++++--- test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java index 2ad4520a4..d6a14fd08 100644 --- a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java +++ b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java @@ -33,6 +33,7 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder { super(serverManager); } + //ET,358155100003016,HB,A,0d081e,07381e,8038ee09,03d2e9be,004f,0000,40c00000,0f,100,0000,00037c,29 static private Pattern pattern = Pattern.compile( "\\*..," + // Manufacturer "(\\d+)," + // IMEI @@ -51,7 +52,7 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder { "(\\p{XDigit}{4})," + // Speed "(\\p{XDigit}{4})," + // Course "(\\p{XDigit}{8})," + // Status - "(\\d+)," + // Signal + "(\\p{XDigit}+)," + // Signal "(\\d+)," + // Power "(\\p{XDigit}{4})," + // Oil "(\\p{XDigit}+),?" + // Milage @@ -112,8 +113,8 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder { position.setLongitude( hemisphere * Integer.parseInt(parser.group(index++), 16) / 600000.0); - position.setSpeed(Integer.parseInt(parser.group(index++), 16) / 600000.0); - position.setCourse(Integer.parseInt(parser.group(index++), 16) / 600000.0); + position.setSpeed(Integer.parseInt(parser.group(index++), 16) / 100.0); + position.setCourse(Integer.parseInt(parser.group(index++), 16) / 100.0); // Status extendedInfo.set("status", parser.group(index++)); diff --git a/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java b/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java index 75c637f1c..2c20d4f1b 100644 --- a/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java +++ b/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java @@ -22,6 +22,12 @@ public class EasyTrackProtocolDecoderTest { assertNotNull(decoder.decode(null, null, "*ET,135790246811221,DW,A,0A090D,101C0D,00CF27C6,8413FA4E,0000,0000,00000000,20,4,0000,00F123,100")); + + assertNotNull(decoder.decode(null, null, + "*ET,358155100003016,HB,A,0d081e,07381e,8038ee09,03d2e9be,004f,0000,40c00000,0f,100,0000,00037c,29")); + + assertNotNull(decoder.decode(null, null, + "*ET,358155100003016,HB,A,0d081e,073900,8038ee2f,03d2e9fd,0114,0000,40c00000,12,100,0000,00037c,32")); } -- cgit v1.2.3