diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-07-14 21:36:30 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-07-14 21:36:30 -0700 |
commit | 9d057f8c87af2df410f65e5f70f26c59b3192fcb (patch) | |
tree | 51c868e04402c4cac126c9576f29777ada37248c /src | |
parent | 3bfeece57b525f18be57856dce277473ca2cff95 (diff) | |
download | trackermap-server-9d057f8c87af2df410f65e5f70f26c59b3192fcb.tar.gz trackermap-server-9d057f8c87af2df410f65e5f70f26c59b3192fcb.tar.bz2 trackermap-server-9d057f8c87af2df410f65e5f70f26c59b3192fcb.zip |
Update ITS decoder
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/ItsProtocolDecoder.java | 4 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java | 15 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java b/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java index 6a107d67d..1e0a4603c 100644 --- a/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java @@ -56,7 +56,7 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder { .expression("[^,]*,") // vehicle registration .number("([01]),").optional() // valid .groupEnd() - .number("(dd),?(dd),?(d{2,4}),") // date (ddmmyyyy) + .number("(dd),?(dd),?(d{2,4}),?") // date (ddmmyyyy) .number("(dd),?(dd),?(dd),") // time (hhmmss) .expression("([01AV]),").optional() // valid .number("(d+.d+),([NS]),") // latitude @@ -203,7 +203,7 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder { int lac = Integer.parseInt(cells[3], 16); int cid = Integer.parseInt(cells[4], 16); Network network = new Network(CellTower.from(mcc, mnc, lac, cid, Integer.parseInt(cells[0]))); - if (!cells[5].startsWith("(")) { + if (cells.length > 5 && !cells[5].startsWith("(")) { for (int i = 0; i < 4; i++) { lac = Integer.parseInt(cells[5 + 3 * i + 1], 16); cid = Integer.parseInt(cells[5 + 3 * i + 2], 16); diff --git a/src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java index 8733e9034..4f5a63188 100644 --- a/src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java @@ -15,6 +15,21 @@ public class ItsProtocolDecoderTest extends ProtocolTest { "$LGN,,869867037009679,3.2AIH,9.99546000,N,76.35886167,E")); verifyPosition(decoder, text( + "$,EPB,SEM,868997031721531,NM,14072020112020,A,28.359959,N,076.927566,E,260.93,0.1,0.0,G,NA00000000,N.A0000000,*")); + + verifyPosition(decoder, text( + "$,EPB,EMR,868997031721531,NM,14072020111520,A,28.359959,N,076.927553,E,261.41,0.1,0.0,G,NA00000000,N.A0000000,*")); + + verifyPosition(decoder, text( + "$RLP,N.A,2.1.3,NR,01,L,861359032310722,N.A,14072020,180150,1,29.949376,N,078.060980,E,0.0,119.3,11,310.6,1.84,0.92,VODAFONE I,0,1,23.9,4.01,0,C,24,404,56,1b1,B6F1,0001,00,31024,1.5,00.0,0.63,-0.28,0.76,15,38,5A,*")); + + verifyPosition(decoder, text( + "$RLP,N.A,2.1.3,NR,01,L,861359032295600,N.A,14072020,180212,1,29.949271,N,078.061241,E,15.0,25.30,9,288.2,1.44,1.10,VODAFONE I,0,1,24.0,3.99,0,C,15,404,56,1b1,B6F1,0001,00,18646,29.2,00.0,-0.46,0.33,-0.81,161,153,4B,*")); + + verifyPosition(decoder, text( + "$RLP,N.A,2.1.1,NR,01,L,869867030158879,N.A,14042020,204826,1,28.593055,N,076.970035,E,0.6,313.4,16,169.0,0.99,0.64,VODAFONE I,0,1,24.8,4.19,0,C,18,404,11,415,A20A,a20b,415,0,d1db,413,0,43f1,413,0,43ef,413,0,0001,00,150689,1076.9,20,*")); + + verifyPosition(decoder, text( "$NRM,ROADRPA,3.5AIS,NR,01,L,869867036940288,,1,04012020,094901,23.18731933,N,77.45079633,E,0.0,0.00,13,545.6,1.10,0.60,Idea Cellular Ltd,0,1,13.2,4.1,0,C,31,404,78,62E1,5799,29,62E1,579B,23,62E1,52EB,22,62E1,52EA,21,62E1,2FF1,0100,00,0,0,001926,8252.226,-,-,-,-,5_5_5_5_0,171B56E1*")); verifyPosition(decoder, text( |