aboutsummaryrefslogtreecommitdiff
path: root/src
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
parent269d458f82d0a4e2fe6a657fa2761c5202452ec5 (diff)
downloadtraccar-server-63627af3fbc0e1641d7ed4bf1ba817d9af5f6c26.tar.gz
traccar-server-63627af3fbc0e1641d7ed4bf1ba817d9af5f6c26.tar.bz2
traccar-server-63627af3fbc0e1641d7ed4bf1ba817d9af5f6c26.zip
Support Wetrack140 format
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/ItsProtocolDecoder.java16
-rw-r--r--src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java3
2 files changed, 18 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()));
diff --git a/src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java
index 8277b8843..dfd86969a 100644
--- a/src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java
@@ -17,6 +17,9 @@ public class ItsProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, text(
"$LGN,,869867037009679,3.2AIH,9.99546000,N,76.35886167,E"));
+ verifyPosition(decoder, text(
+ "$,NRM,MARK,V0.0.1,NR,01,L,358980100040246,000000000,1,10032021,073239,25.932051,N,71.509872,E,0.6,1.40,13,211.2,1.4,0.7,IDEA,0,1,0.1,3.7,0,N,20,404,60,A5F,FD3F,A5F,6F88,29,A5F,5855,18,A5F,6F87,18,A5F,FD41,14,0000,00,0.1,0,000027,0,0,0,4E9C,*"));
+
verifyAttribute(decoder, text(
"$,C,CTPL,4.0.0,NR,01,L,869247045166383,NA00000000,1,12032020,144453,30.452524,N,077.610351,E,1.4,34.8,14,384.19,1.8,0.8,IDEA P,1,1,14.2,4.17,0,C,22,404,82,0FB1,3B26,516B,0FB1,18,3B25,0FB1,15,5169,0FB1,14,3B27,0FB1,13,0000,00,8083,194.9,0B,*,IP=106.67.5.173"),
Position.KEY_ODOMETER, 194900.0);