From a7c067243085ad62eefe5e6643b48ddd99793ad0 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 21 Mar 2019 22:35:57 -0700 Subject: Additional ITS attributes --- src/org/traccar/protocol/ItsProtocolDecoder.java | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/org/traccar/protocol') diff --git a/src/org/traccar/protocol/ItsProtocolDecoder.java b/src/org/traccar/protocol/ItsProtocolDecoder.java index a200ff8b7..a12b75961 100644 --- a/src/org/traccar/protocol/ItsProtocolDecoder.java +++ b/src/org/traccar/protocol/ItsProtocolDecoder.java @@ -63,6 +63,22 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder { .number("(d+.?d*),") // speed .number("(d+.?d*),") // course .number("(d+),") // satellites + .groupBegin() + .number("(d+.?d*),") // altitude + .number("d+.?d*,") // pdop + .number("d+.?d*,") // hdop + .expression("[^,]*,") + .number("([01]),") // ignition + .number("([01]),") // charging + .number("(d+.?d*),") // power + .number("(d+.?d*),") // battery + .number("[01],") // emergency + .expression("[CO]?,") // tamper + .number("(?:x+,){5}") // main cell + .number("(?:-?x+,){12}") // other cells + .number("([01]{4}),") // inputs + .number("([01]{2}),") // outputs + .groupEnd("?") .or() .number("(-?d+.d+),") // altitude .number("(d+.d+),") // speed @@ -109,6 +125,16 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_SATELLITES, parser.nextInt()); } + if (parser.hasNext(7)) { + position.setAltitude(parser.nextDouble()); + position.set(Position.KEY_IGNITION, parser.nextInt() > 0); + position.set(Position.KEY_CHARGE, parser.nextInt() > 0); + position.set(Position.KEY_POWER, parser.nextDouble()); + position.set(Position.KEY_BATTERY, parser.nextDouble()); + position.set(Position.KEY_INPUT, parser.nextBinInt()); + position.set(Position.KEY_OUTPUT, parser.nextBinInt()); + } + if (parser.hasNext(2)) { position.setAltitude(parser.nextDouble()); position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble())); -- cgit v1.2.3