aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-04-20 20:40:43 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-04-20 20:40:43 -0700
commit63627af3fbc0e1641d7ed4bf1ba817d9af5f6c26 (patch)
tree5f74f5826726b79a895f5b69bf33102e9101f687 /src/main
parent269d458f82d0a4e2fe6a657fa2761c5202452ec5 (diff)
downloadtrackermap-server-63627af3fbc0e1641d7ed4bf1ba817d9af5f6c26.tar.gz
trackermap-server-63627af3fbc0e1641d7ed4bf1ba817d9af5f6c26.tar.bz2
trackermap-server-63627af3fbc0e1641d7ed4bf1ba817d9af5f6c26.zip
Support Wetrack140 format
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/ItsProtocolDecoder.java16
1 files changed, 15 insertions, 1 deletions
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()));