From 6a294a6f574c610e6577224c0eea0e65ce8993f2 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 1 Apr 2017 16:13:46 +1300 Subject: Add new Aquila protocol format --- .../traccar/protocol/AquilaProtocolDecoder.java | 47 ++++++++++++++++++++-- 1 file changed, 44 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/AquilaProtocolDecoder.java b/src/org/traccar/protocol/AquilaProtocolDecoder.java index 56723e0ef..5f421727f 100644 --- a/src/org/traccar/protocol/AquilaProtocolDecoder.java +++ b/src/org/traccar/protocol/AquilaProtocolDecoder.java @@ -92,6 +92,33 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder { .number("-?d+,") // accelerometer y .number("-?d+,") // accelerometer z .number("d+,") // delta distance + .or() + .number("(d+),") // course + .number("(d+),") // satellites + .number("(d+.d+),") // hdop + .number("(?:d+,){2}") // reserved + .number("(d+),") // adc 1 + .number("([01]),") // di 1 + .number("[01],") // case open + .number("[01],") // over speed start + .number("[01],") // over speed end + .number("(?:[01],){2}") // reserved + .number("[01],") // immobilizer + .number("([01]),") // power status + .number("([01]),") // di 2 + .number("(?:[01],){2}") // reserved + .number("([01]),") // ignition + .number("(?:[01],){6}") // reserved + .number("[01],") // low battery + .number("[01],") // corner packet + .number("(?:[01],){4}") // reserved + .number("[01],") // do 1 + .number("[01],") // reserved + .number("[01],") // hard acceleration + .number("[01],") // hard breaking + .number("(?:[01],){4}") // reserved + .number("(d+),") // external voltage + .number("(d+),") // internal voltage .groupEnd() .text("*") .number("xx") // checksum @@ -133,9 +160,9 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder { if (parser.hasNext(9)) { position.set(Position.KEY_FUEL_LEVEL, parser.next()); - position.set(Position.PREFIX_IO + 1, parser.next()); + position.set(Position.PREFIX_IN + 1, parser.next()); position.set(Position.KEY_CHARGE, parser.next()); - position.set(Position.PREFIX_IO + 2, parser.next()); + position.set(Position.PREFIX_IN + 2, parser.next()); position.set(Position.KEY_IGNITION, parser.nextInt() == 1); @@ -144,7 +171,7 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder { position.setCourse((course - 1) * 45); } - } else { + } else if (parser.hasNext(7)) { position.setCourse(parser.nextInt()); @@ -159,6 +186,20 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder { String dtcs = parser.next(); position.set(Position.KEY_DTCS, dtcs.substring(1, dtcs.length() - 1).replace('|', ' ')); + } else { + + position.setCourse(parser.nextInt()); + + position.set(Position.KEY_SATELLITES, parser.nextInt()); + position.set(Position.KEY_HDOP, parser.nextDouble()); + position.set(Position.PREFIX_ADC + 1, parser.nextInt()); + position.set(Position.PREFIX_IN + 1, parser.nextInt()); + position.set(Position.KEY_CHARGE, parser.next()); + position.set(Position.PREFIX_IN + 2, parser.nextInt()); + position.set(Position.KEY_IGNITION, parser.nextInt() == 1); + position.set(Position.KEY_POWER, parser.nextInt()); + position.set(Position.KEY_BATTERY, parser.nextInt()); + } return position; -- cgit v1.2.3