diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-06-16 00:35:48 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-06-16 00:35:48 +1200 |
commit | 27c605fc6fb1e4cf71ae1ab800ef47fd06ca3af7 (patch) | |
tree | 932b39748dee10dcbcb32fc6381acb9c47d2c5df | |
parent | 216e7ede1ba6e7298bd032b113057803b5b8f635 (diff) | |
download | trackermap-server-27c605fc6fb1e4cf71ae1ab800ef47fd06ca3af7.tar.gz trackermap-server-27c605fc6fb1e4cf71ae1ab800ef47fd06ca3af7.tar.bz2 trackermap-server-27c605fc6fb1e4cf71ae1ab800ef47fd06ca3af7.zip |
Add power load for GPS103 OBD
-rw-r--r-- | src/org/traccar/protocol/Gps103ProtocolDecoder.java | 3 | ||||
-rw-r--r-- | test/org/traccar/protocol/Gps103ProtocolDecoderTest.java | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java index 2b546bb26..ec8871865 100644 --- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -92,7 +92,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { .number("(d+.d+)?,") // fuel average .number("(d+)?,") // hours .number("(d+),") // speed - .number("d+.?d*%,") // power load + .number("(d+.?d*%),") // power load .number("(?:([-+]?d+)|[-+]?),") // temperature .number("(d+.?d*%),") // throttle .number("(d+),") // rpm @@ -211,6 +211,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_FUEL_CONSUMPTION, parser.nextDouble(0)); position.set(Position.KEY_HOURS, parser.nextInt()); position.set(Position.KEY_OBD_SPEED, parser.nextInt(0)); + position.set("powerLoad", parser.next()); position.set(Position.PREFIX_TEMP + 1, parser.nextInt()); position.set(Position.KEY_THROTTLE, parser.next()); position.set(Position.KEY_RPM, parser.nextInt(0)); diff --git a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java index ee48ebb27..acafe3982 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:862106025092216,OBD,170605095949,195874,,370.8,808,066,30.0%,+87,13.0%,02444,14.3,,,,;")); + verifyNull(decoder, text( "imei:868683027825532,OBD,170613203014,,,,0,0,0.00%,0,0.00%,0,0.00,,,,;")); |