aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-12-17 22:37:15 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2018-12-17 22:37:15 -0800
commit85cd0f9e023b7c664373ea19418c2ed5675c5025 (patch)
treee051c3c713cd669728c7408403a0d737b2e0a70a /src/org/traccar/protocol
parent42e836fc36831ad0dae900e1bd9c6fed4ef59912 (diff)
downloadtraccar-server-85cd0f9e023b7c664373ea19418c2ed5675c5025.tar.gz
traccar-server-85cd0f9e023b7c664373ea19418c2ed5675c5025.tar.bz2
traccar-server-85cd0f9e023b7c664373ea19418c2ed5675c5025.zip
Improve GPS103 decoding
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index c0f485349..1fbae15ce 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -73,9 +73,11 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
.number(",(d+.?d*)?").optional() // altitude
.number(",([01])?").optional() // ignition
.number(",([01])?").optional() // door
- .number(",(?:(d+.d+)%)?").optional() // fuel 1
- .number(",(?:(d+.d+)%)?").optional() // fuel 2
- .number("(-?d+)?") // temperature
+ .groupBegin()
+ .number(",(?:(d+.d+)%)?") // fuel 1
+ .number(",(?:(d+.d+)%|d+)?") // fuel 2
+ .groupEnd("?")
+ .number(",([-+]?d+)?") // temperature
.groupEnd()
.any()
.compile();
@@ -193,7 +195,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
} else if (alarm.equals("acc off")) {
position.set(Position.KEY_IGNITION, false);
} else if (alarm.startsWith("T:")) {
- position.set(Position.PREFIX_TEMP + 1, alarm.substring(2));
+ position.set(Position.PREFIX_TEMP + 1, Double.parseDouble(alarm.substring(2)));
} else if (alarm.startsWith("oil ")) {
position.set(Position.KEY_FUEL_LEVEL, Double.parseDouble(alarm.substring(4)));
} else if (!position.getAttributes().containsKey(Position.KEY_ALARM) && !alarm.equals("tracker")) {