aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-03-17 10:03:31 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-03-17 10:03:31 +1300
commitc422898f913eaea260170cf2f4c05e7c932a80ff (patch)
tree5f69b1c6fe13157ed0bd54be793da1e28b880d25
parent271263e6feb2b78f7f23a04cb1cbca86eb8c4c64 (diff)
downloadtraccar-server-c422898f913eaea260170cf2f4c05e7c932a80ff.tar.gz
traccar-server-c422898f913eaea260170cf2f4c05e7c932a80ff.tar.bz2
traccar-server-c422898f913eaea260170cf2f4c05e7c932a80ff.zip
Fix GPS103 protocol OBD decoding
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java10
-rw-r--r--test/org/traccar/protocol/Gps103ProtocolDecoderTest.java3
2 files changed, 10 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index e2aed6309..ce5a54141 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -87,11 +87,13 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
.number("(d+),") // odometer
.number("(d+.d+)?,") // fuel instant
.number("(?:d+.d+)?,") // fuel average
+ .number("(d+),") // hours
.number("(d+),") // speed
- .number("d+,") // power load
- .number("(d+.d+%),") // throttle
+ .number("d+.?d*%,") // power load
+ .number("(d+),") // temperature
+ .number("(d+.?d*%),") // throttle
.number("(d+),") // rpm
- .number("(d+.d+%),") // battery
+ .number("(d+.d+),") // battery
.number("[^,]*,") // dtc 1
.number("[^,]*,") // dtc 2
.number("[^,]*,") // dtc 3
@@ -166,7 +168,9 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_ODOMETER, parser.nextInt());
position.set(Event.KEY_FUEL, parser.next());
+ position.set(Event.KEY_HOURS, parser.next());
position.set(Event.KEY_OBD_SPEED, parser.next());
+ position.set(Event.PREFIX_TEMP + 1, parser.next());
position.set(Event.KEY_THROTTLE, parser.next());
position.set(Event.KEY_RPM, parser.next());
position.set(Event.KEY_BATTERY, parser.next());
diff --git a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
index ab59ba331..aecbe2ef1 100644
--- a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
@@ -10,6 +10,9 @@ public class Gps103ProtocolDecoderTest extends ProtocolTest {
Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(new Gps103Protocol());
+ verifyAttributes(decoder, text(
+ "imei:359710049028435,OBD,160316053657,70430,,,0,49,60.00%,46,19.22%,859,0.00,U1108,,,;"));
+
verifyPosition(decoder, text(
"359769031878322imei:359769031878322,tracker,1602160718,2,F,221811.000,A,1655.2193,S,14546.6722,E,0.00,,"));