aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Gps103ProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/Gps103ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index 72e8430ba..c0f485349 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -104,9 +104,9 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
.text("imei:")
.number("(d+),") // imei
.expression("[^,]+,")
- .expression("...,") // event
- .expression(".{6},") // sensor id
- .expression(".{4},") // sensor voltage
+ .expression("(?:-+|(.+)),") // event
+ .expression("(?:-+|(.+)),") // sensor id
+ .expression("(?:-+|(.+)),") // sensor voltage
.number("(dd)(dd)(dd),") // time (hhmmss)
.number("(dd)(dd)(dd),") // date (ddmmyy)
.number("(d+),") // rssi
@@ -118,6 +118,9 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
.number("(-?d+),") // altitude
.number("(d+.d+),") // hdop
.number("(d+),") // satellites
+ .number("([01]),") // ignition
+ .number("([01]),") // charge
+ .expression("(?:-+|(.+))") // error
.any()
.compile();
@@ -307,6 +310,10 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
+ position.set(Position.KEY_EVENT, parser.next());
+ position.set("sensorId", parser.next());
+ position.set("sensorVoltage", parser.nextDouble());
+
position.setTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY));
position.set(Position.KEY_RSSI, parser.nextInt());
@@ -320,6 +327,9 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_HDOP, parser.nextDouble());
position.set(Position.KEY_SATELLITES, parser.nextInt());
+ position.set(Position.KEY_IGNITION, parser.nextInt() > 0);
+ position.set(Position.KEY_CHARGE, parser.nextInt() > 0);
+ position.set("error", parser.next());
return position;
}