aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-03-08 05:30:22 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-03-08 05:30:22 +1300
commit34499f29f0f20c4acecc455fde67c5332790e926 (patch)
treeca7d5991fd1f0cc55c33d6a1b0210aadcc660f22
parent9145f9f823602c7da7a93a119b608c7a35d4ef60 (diff)
downloadtrackermap-server-34499f29f0f20c4acecc455fde67c5332790e926.tar.gz
trackermap-server-34499f29f0f20c4acecc455fde67c5332790e926.tar.bz2
trackermap-server-34499f29f0f20c4acecc455fde67c5332790e926.zip
Decode additional TL3000 data
-rw-r--r--src/org/traccar/protocol/Ivt401ProtocolDecoder.java38
-rw-r--r--test/org/traccar/protocol/Ivt401ProtocolDecoderTest.java3
2 files changed, 41 insertions, 0 deletions
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
@@ -11,6 +11,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)"));
verifyPosition(decoder, text(