From 757d5c176f84834de6b20000692e8f6bd7d57edc Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 11 Dec 2018 23:03:31 -0800 Subject: Decode additional Ericar attributes --- src/org/traccar/protocol/Gps103ProtocolDecoder.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/org') 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; } -- cgit v1.2.3