diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-12-11 23:03:31 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-12-11 23:03:38 -0800 |
commit | 757d5c176f84834de6b20000692e8f6bd7d57edc (patch) | |
tree | c124a181e5a09bb5c509d3052c47cba686de64ee /src/org/traccar/protocol | |
parent | a642b73c6cc727f4baa3c5ca7a5cc9b0679fead2 (diff) | |
download | traccar-server-757d5c176f84834de6b20000692e8f6bd7d57edc.tar.gz traccar-server-757d5c176f84834de6b20000692e8f6bd7d57edc.tar.bz2 traccar-server-757d5c176f84834de6b20000692e8f6bd7d57edc.zip |
Decode additional Ericar attributes
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/Gps103ProtocolDecoder.java | 16 |
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; } |