aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-08-31 18:32:50 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2013-08-31 18:32:50 +1200
commit743ed6cd39d661aba7d9b6671feda5c08949be6f (patch)
tree515b7fdd59ec6300fa11fb7bd7601fb797d40806
parentc244a6c040ef8af247b08cb5ff25dfaac50aa1e5 (diff)
downloadtrackermap-server-743ed6cd39d661aba7d9b6671feda5c08949be6f.tar.gz
trackermap-server-743ed6cd39d661aba7d9b6671feda5c08949be6f.tar.bz2
trackermap-server-743ed6cd39d661aba7d9b6671feda5c08949be6f.zip
Fix EasyTrack decoder
-rw-r--r--src/org/traccar/protocol/EasyTrackProtocolDecoder.java7
-rw-r--r--test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java6
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"));
}