aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-08-09 19:09:07 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-08-09 19:09:07 +1200
commitc47057df70a9322dad794d160582d8b84115b5c9 (patch)
treed67eff819594035835202641e35c6b43e5e8afb8
parent7a0d77249d1ae8c4d0e0f478feedee8ffa49b854 (diff)
downloadtrackermap-server-c47057df70a9322dad794d160582d8b84115b5c9.tar.gz
trackermap-server-c47057df70a9322dad794d160582d8b84115b5c9.tar.bz2
trackermap-server-c47057df70a9322dad794d160582d8b84115b5c9.zip
Fix TK103 status parsing
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java3
-rw-r--r--test/org/traccar/protocol/Tk103ProtocolDecoderTest.java6
2 files changed, 7 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
index 5cbde4b7e..f4a62a99e 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -33,6 +33,7 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
+ //088048003342 BR00 150807 A 1352.9871 N 10030.9084 E 000.0 110718 000.0 001010000 L00000000
private static final Pattern pattern = Pattern.compile(
"(\\d+)(,)?" + // Device ID
".{4},?" + // Command
@@ -45,7 +46,7 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
"([EW]),?" +
"(\\d+\\.\\d)(?:\\d*,)?" + // Speed
"(\\d{2})(\\d{2})(\\d{2}),?" + // Time (HHMMSS)
- "(\\d+\\.?\\d+),?" + // Course
+ "(\\d+\\.?\\d),?" + // Course
"([0-9a-fA-F]{8})?,?" + // State
"(?:L([0-9a-fA-F]+))?.*\\)?"); // Odometer
diff --git a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
index ca5c550c7..0cfd790d8 100644
--- a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
@@ -10,8 +10,12 @@ public class Tk103ProtocolDecoderTest extends ProtocolDecoderTest {
public void testDecode() throws Exception {
Tk103ProtocolDecoder decoder = new Tk103ProtocolDecoder(new Tk103Protocol());
+
+ verify(decoder.decode(null, null,
+ "(088048003342BR00150807A1352.9871N10030.9084E000.0110718000.0001010000L00000000)"));
- assertNull(decoder.decode(null, null, "(090411121854BP0000001234567890HSO"));
+ assertNull(decoder.decode(null, null,
+ "(090411121854BP0000001234567890HSO"));
verify(decoder.decode(null, null,
"(01029131573BR00150428A3801.6382N02351.0159E000.0080729278.7800000000LEF9ECB9C)"));