From 63627af3fbc0e1641d7ed4bf1ba817d9af5f6c26 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 20 Apr 2021 20:40:43 -0700 Subject: Support Wetrack140 format --- .../java/org/traccar/protocol/ItsProtocolDecoder.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java b/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java index a7e9200f1..9eed58347 100644 --- a/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java @@ -79,7 +79,7 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder { .number("(d+.?d*),") // power .number("(d+.?d*),") // battery .number("([01]),") // emergency - .expression("[CO]?,") // tamper + .expression("[COYN]?,") // tamper .expression("(.*),") // cells .number("([012]{4}),") // inputs .number("([01]{2}),") // outputs @@ -100,6 +100,12 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder { .number("d+,") // index .number("(d+.?d*),") // adc1 .number("(d+.?d*),") // adc2 + .or() + .number("(d+.d+),") // adc1 + .number("(d+),") // odometer + .number("(d{6}),") // index + .expression("([^,]+),") // response format + .expression("([^,]+),") // response .groupEnd("?") .groupEnd("?") .or() @@ -270,6 +276,14 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder { position.set(Position.PREFIX_ADC + 2, parser.nextDouble()); } + if (parser.hasNext(5)) { + position.set(Position.PREFIX_ADC + 1, parser.nextDouble()); + position.set(Position.KEY_ODOMETER, parser.nextInt()); + position.set(Position.KEY_INDEX, parser.nextInt()); + position.set("responseFormat", parser.next()); + position.set("response", parser.next()); + } + if (parser.hasNext(2)) { position.setAltitude(parser.nextDouble()); position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble())); -- cgit v1.2.3