aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-09-18 10:59:56 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-09-18 10:59:56 +1200
commitd4e4948bfce5b088f505ff9c89dd8baad34ed16c (patch)
treeff8de9711b3e887cfede151a2a3fd48e57fab797 /src/org/traccar
parent8baf73493d24c85bc5d13069044fc1150ed62c2e (diff)
downloadtrackermap-server-d4e4948bfce5b088f505ff9c89dd8baad34ed16c.tar.gz
trackermap-server-d4e4948bfce5b088f505ff9c89dd8baad34ed16c.tar.bz2
trackermap-server-d4e4948bfce5b088f505ff9c89dd8baad34ed16c.zip
Improve TK103 decoder pattern
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
index 3885ee2ef..21aa81bda 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -44,10 +44,10 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
"([NS]),?" +
"(\\d{3})(\\d{2}\\.\\d+)" + // Longitude (DDDMM.MMMM)
"([EW]),?" +
- "(\\d+\\.\\d)(?:\\d*,)?" + // Speed
+ "(\\d+\\.\\d{1,2}),?" + // Speed
"(\\d{2})(\\d{2})(\\d{2}),?" + // Time (HHMMSS)
- "(\\d+\\.?\\d+),?" + // Course
- "([0-9a-fA-F]{8})?,?" + // State
+ "(\\d+\\.?\\d{1,2}),?" + // Course
+ "(?:([01]{8})|([0-9a-fA-F]{8}))?,?" + // State
"(?:L([0-9a-fA-F]+))?.*\\)?"); // Odometer
@Override
@@ -137,7 +137,7 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(Double.valueOf(parser.group(index++)));
// State
- String status = parser.group(index++);
+ String status = parser.group(index++); // binary status
if (status != null) {
position.set(Event.KEY_STATUS, status);
@@ -145,6 +145,7 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_CHARGE, !BitUtil.check(value, 0));
position.set(Event.KEY_IGNITION, BitUtil.check(value, 1));
}
+ position.set(Event.KEY_STATUS, parser.group(index++)); // hex status
// Odometer
String odometer = parser.group(index++);