aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-02-26 19:17:15 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-02-26 19:17:15 -0800
commita68b4ab19873de65145772b408b4db75da25484a (patch)
tree36ddf14bc830b02a8cf478da006d526ce96dc999
parent728e55fc00a4b7b980d6e59f2ce8664859a5c848 (diff)
downloadtrackermap-server-a68b4ab19873de65145772b408b4db75da25484a.tar.gz
trackermap-server-a68b4ab19873de65145772b408b4db75da25484a.tar.bz2
trackermap-server-a68b4ab19873de65145772b408b4db75da25484a.zip
Update ITS protocol
-rw-r--r--src/org/traccar/protocol/ItsProtocolDecoder.java12
-rw-r--r--test/org/traccar/protocol/ItsProtocolDecoderTest.java3
2 files changed, 9 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/ItsProtocolDecoder.java b/src/org/traccar/protocol/ItsProtocolDecoder.java
index e2b1dc238..a200ff8b7 100644
--- a/src/org/traccar/protocol/ItsProtocolDecoder.java
+++ b/src/org/traccar/protocol/ItsProtocolDecoder.java
@@ -36,22 +36,22 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder {
private static final Pattern PATTERN = new PatternBuilder()
.expression("[^$]*")
- .text("$,")
- .expression("[^,]+,") // event
+ .text("$")
+ .expression(",?[^,]+,") // event
.groupBegin()
.expression("[^,]+,") // vendor
.expression("[^,]+,") // firmware version
- .groupEnd("?")
.expression("[^,]+,") // type
- .groupBegin()
.number("d+,")
.expression("[LH],") // history
- .groupEnd("?")
+ .or()
+ .expression("[^,]+,") // type
+ .groupEnd()
.number("(d{15}),") // imei
.groupBegin()
.expression("(?:NM|SP),") // status
.or()
- .expression("[^,]+,") // vehicle registration
+ .expression("[^,]*,") // vehicle registration
.number("([01]),") // valid
.groupEnd()
.number("(dd),?(dd),?(dddd),") // date (ddmmyyyy)
diff --git a/test/org/traccar/protocol/ItsProtocolDecoderTest.java b/test/org/traccar/protocol/ItsProtocolDecoderTest.java
index 4cadfc996..0281320a9 100644
--- a/test/org/traccar/protocol/ItsProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/ItsProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class ItsProtocolDecoderTest extends ProtocolTest {
ItsProtocolDecoder decoder = new ItsProtocolDecoder(null);
verifyPosition(decoder, text(
+ "$NRM,ROADRPA,1.7AIS,NR,01,L,869867036345389,,1,25022019,051716,25.12891000,N,75.85587833,E,7.6,350.00,14,284.8,1.00,1.00,AIRTEL,1,1,28.0,4.2,0,C,13,404,70,4E3B,3C84,11,4E3B,39B8,08,4E3B,3965,07,4E3B,48B5,07,4E3B,3C85,0000,00,000551,71978C6B"));
+
+ verifyPosition(decoder, text(
"$,1,CHVTS,CHVTS1.0,DT,16,L,861359039868243,861359039868243,1,05022019,071225,19.965062,N,73.736088,E,0,050,03,0632,6.67,6.75,Idea Cel,1,1,23.96,4.0,0,W,28,404,004,4e2b,49e,4e2bea86727ab3d6704e2bea7714e2be9d72,0000,00,001133,232"));
verifyPosition(decoder, text(