From ad5c4cb2031ff706c6416c6d24d1f5f421633f73 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 14 Feb 2018 07:23:50 +1300 Subject: Support IVT-100 and TL3000 protocols --- .../traccar/protocol/Ivt401ProtocolDecoderTest.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/org/traccar/protocol/Ivt401ProtocolDecoderTest.java') diff --git a/test/org/traccar/protocol/Ivt401ProtocolDecoderTest.java b/test/org/traccar/protocol/Ivt401ProtocolDecoderTest.java index c0f076014..032d252b4 100644 --- a/test/org/traccar/protocol/Ivt401ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Ivt401ProtocolDecoderTest.java @@ -10,6 +10,27 @@ public class Ivt401ProtocolDecoderTest extends ProtocolTest { Ivt401ProtocolDecoder decoder = new Ivt401ProtocolDecoder(new Ivt401Protocol()); + verifyPosition(decoder, text( + "(TLN,865933030026336,250118,063827,+18.598098,+73.806518,0,79,0,1,1,5,1200,0,0.0,11.50,4.00,36,0,0,1.00,0,0,12702,202,0)")); + + verifyPosition(decoder, text( + "(TLA,865933030026336,250118,063838,+18.598110,+73.806518,0,334,0,1,1,5,1200,0,0.0,12.20,4.10,36,0,0,1.00,0,0,12704,0,0,0,0,0,0,0,0,0,0,0,0,1,0,3,203,0)")); + + verifyNull(decoder, text( + "(TLB,356917050440515,0,0,+0.0,+0.0,0,0,0,0,0,0,000,00,0.00,12.21,7.95,26.57,0.0,1,1.12,0,0,0,1,90)")); + + verifyPosition(decoder, text( + "(TLN,356917050440515,250118,094723,+0.0,+0.0,0,0,0,0,3,5,000,00,0.00,12.25,7.95,27.11,0.0,0,1.13,0,0,0,4,86)")); + + verifyPosition(decoder, text( + "(TLA,356917050440515,250118,094733,+0.0,+0.0,0,0,0,0,3,5,000,00,0.00,12.25,7.95,27.20,0.0,0,1.12,0,0,0,0,0,0,0,000000000,0,1,0,0,0,0,0,1,0,0,5,70)")); + + verifyPosition(decoder, text( + "(TLN,356917050440515,250118,094733,+0.0,+0.0,0,0,0,0,3,5,000,00,0.00,12.25,7.95,27.20,0.0,0,1.13,0,0,0,6,87)")); + + verifyPosition(decoder, text( + "(TLN,356917050440515,250118,103541,+17.015546,+54.080841,0,0,31,12,1,5,000,00,0.0,0.00,8.04,28.59,M+0+0+0+0+0,0,1.12,0,0,2,48,30)")); + verifyPosition(decoder, text( "(TLN,356917050291991,090315,133525,+12.990582,+77.589080,0,0,944,13,1,5,000,00,0.00,10.88,6.31,29.55,0.00,0,0.99,66,0,0,88,95)")); -- cgit v1.2.3 From d6d7b9b95df252c611b1106fa84d325f34ae72da Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 26 Feb 2018 21:59:11 +1300 Subject: Add TL3000 test case --- test/org/traccar/protocol/Ivt401ProtocolDecoderTest.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/org/traccar/protocol/Ivt401ProtocolDecoderTest.java') diff --git a/test/org/traccar/protocol/Ivt401ProtocolDecoderTest.java b/test/org/traccar/protocol/Ivt401ProtocolDecoderTest.java index 032d252b4..3c4f25cb1 100644 --- a/test/org/traccar/protocol/Ivt401ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Ivt401ProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class Ivt401ProtocolDecoderTest extends ProtocolTest { Ivt401ProtocolDecoder decoder = new Ivt401ProtocolDecoder(new Ivt401Protocol()); + verifyPosition(decoder, text( + "(TLN,862107032006249,230218,180500,+18.479728,+73.896339,30,0,944,13,1,5,111,11,0.00,10.88,6.31,29.55,0.00,0,0.99,66,0,0,88,95)")); + verifyPosition(decoder, text( "(TLN,865933030026336,250118,063827,+18.598098,+73.806518,0,79,0,1,1,5,1200,0,0.0,11.50,4.00,36,0,0,1.00,0,0,12702,202,0)")); -- cgit v1.2.3 From 34499f29f0f20c4acecc455fde67c5332790e926 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 8 Mar 2018 05:30:22 +1300 Subject: Decode additional TL3000 data --- .../traccar/protocol/Ivt401ProtocolDecoder.java | 38 ++++++++++++++++++++++ .../protocol/Ivt401ProtocolDecoderTest.java | 3 ++ 2 files changed, 41 insertions(+) (limited to 'test/org/traccar/protocol/Ivt401ProtocolDecoderTest.java') diff --git a/src/org/traccar/protocol/Ivt401ProtocolDecoder.java b/src/org/traccar/protocol/Ivt401ProtocolDecoder.java index 6e11a763c..d2f1d3d69 100644 --- a/src/org/traccar/protocol/Ivt401ProtocolDecoder.java +++ b/src/org/traccar/protocol/Ivt401ProtocolDecoder.java @@ -58,6 +58,23 @@ public class Ivt401ProtocolDecoder extends BaseProtocolDecoder { .number("(-?d+),") // tilt .number("(d+),") // trip .number("(d+),") // odometer + .groupBegin() + .number("([01]),") // overspeed + .number("[01],") // input 2 misuse + .number("[01],") // immobilizer + .number("[01],") // temperature alert + .number("[0-2]+,") // geofence + .number("([0-3]),") // harsh driving + .number("[01],") // reconnect + .number("([01]),") // low battery + .number("([01]),") // power disconnected + .number("[01],") // gps failure + .number("([01]),") // towing + .number("[01],") // server unreachable + .number("[128],") // sleep mode + .expression("([^,]+)?,") // driver id + .number("d+,") // sms count + .groupEnd("?") .any() .compile(); @@ -138,6 +155,27 @@ public class Ivt401ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ODOMETER, parser.nextLong()); + if (parser.hasNext(6)) { + position.set(Position.KEY_ALARM, parser.nextInt() == 1 ? Position.ALARM_OVERSPEED : null); + switch (parser.nextInt()) { + case 1: + position.set(Position.KEY_ALARM, Position.ALARM_ACCELERATION); + break; + case 2: + position.set(Position.KEY_ALARM, Position.ALARM_BRAKING); + break; + case 3: + position.set(Position.KEY_ALARM, Position.ALARM_CORNERING); + break; + default: + break; + } + position.set(Position.KEY_ALARM, parser.nextInt() == 1 ? Position.ALARM_LOW_BATTERY : null); + position.set(Position.KEY_ALARM, parser.nextInt() == 1 ? Position.ALARM_POWER_CUT : null); + position.set(Position.KEY_ALARM, parser.nextInt() == 1 ? Position.ALARM_TOW : null); + position.set(Position.KEY_DRIVER_UNIQUE_ID, parser.next()); + } + return position; } diff --git a/test/org/traccar/protocol/Ivt401ProtocolDecoderTest.java b/test/org/traccar/protocol/Ivt401ProtocolDecoderTest.java index 3c4f25cb1..d8a67ad7b 100644 --- a/test/org/traccar/protocol/Ivt401ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Ivt401ProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class Ivt401ProtocolDecoderTest extends ProtocolTest { Ivt401ProtocolDecoder decoder = new Ivt401ProtocolDecoder(new Ivt401Protocol()); + verifyPosition(decoder, text( + "(TLA,356917051007891,190118,090211,+16.986606,+82.242416,0,66,4,13,1,5,000,00,0.0,11.59,8.30,37.77,0.0,1,1.02,0,0,208,0,0,0,0,000000000,0,0,0,0,0,0,0,1,8654604,5,9,114)")); + verifyPosition(decoder, text( "(TLN,862107032006249,230218,180500,+18.479728,+73.896339,30,0,944,13,1,5,111,11,0.00,10.88,6.31,29.55,0.00,0,0.99,66,0,0,88,95)")); -- cgit v1.2.3