aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-05-15 02:23:14 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-05-15 02:23:14 +1200
commitbb0d6eef1870454673cffbcd9b27d0381aaf21ff (patch)
tree79278278e486cde4845d07db233ce6995f7857ad /src
parent849cfa52a907666241b58d988c9a3b324ac67ba0 (diff)
downloadtrackermap-server-bb0d6eef1870454673cffbcd9b27d0381aaf21ff.tar.gz
trackermap-server-bb0d6eef1870454673cffbcd9b27d0381aaf21ff.tar.bz2
trackermap-server-bb0d6eef1870454673cffbcd9b27d0381aaf21ff.zip
Decode additional GPS103 data
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index f32d22c00..ceb0c5748 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -65,14 +65,14 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
.expression("([EW]),").optional()
.number("(d+)(dd.d+),") // longitude (dddmm.mmmm)
.expression("([EW])?,").optional()
- .number("(d+.?d*)?,?") // speed
- .number("(d+.?d*)?,?") // course
- .number("(d+.?d*)?,?") // altitude
- .expression("([^,;]+)?,?")
- .expression("([^,;]+)?,?")
- .expression("([^,;]+)?,?")
- .expression("([^,;]+)?,?")
- .expression("([^,;]+)?,?")
+ .number("(d+.?d*)?,").optional() // speed
+ .number("(d+.?d*)?,").optional() // course
+ .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
.groupEnd()
.any()
.compile();
@@ -168,7 +168,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
} else if (alarm.startsWith("T:")) {
position.set(Position.PREFIX_TEMP + 1, alarm.substring(2));
} else if (alarm.startsWith("oil ")) {
- position.set("oil", alarm.substring(4));
+ position.set(Position.KEY_FUEL_LEVEL, Double.parseDouble(alarm.substring(4)));
} else if (!position.getAttributes().containsKey(Position.KEY_ALARM) && !alarm.equals("tracker")) {
position.set(Position.KEY_EVENT, alarm);
}
@@ -218,9 +218,15 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(parser.nextDouble(0));
position.setAltitude(parser.nextDouble(0));
- for (int i = 1; i <= 5; i++) {
- position.set(Position.PREFIX_IO + i, parser.next());
+ if (parser.hasNext()) {
+ position.set(Position.KEY_IGNITION, parser.nextInt() == 1);
}
+ if (parser.hasNext()) {
+ position.set(Position.KEY_DOOR, parser.nextInt() == 1);
+ }
+ position.set("fuel1", parser.nextDouble());
+ position.set("fuel2", parser.nextDouble());
+ position.set(Position.PREFIX_TEMP + 1, parser.nextInt());
}