aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-04-01 16:13:46 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-04-01 16:13:46 +1300
commit6a294a6f574c610e6577224c0eea0e65ce8993f2 (patch)
tree6736fc4c90b0bb651bce5a5720b0030d4c556bdf
parent571078422b3e1162870d777124a3844da56583b0 (diff)
downloadtrackermap-server-6a294a6f574c610e6577224c0eea0e65ce8993f2.tar.gz
trackermap-server-6a294a6f574c610e6577224c0eea0e65ce8993f2.tar.bz2
trackermap-server-6a294a6f574c610e6577224c0eea0e65ce8993f2.zip
Add new Aquila protocol format
-rw-r--r--src/org/traccar/protocol/AquilaProtocolDecoder.java47
-rw-r--r--test/org/traccar/protocol/AquilaProtocolDecoderTest.java9
2 files changed, 53 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/AquilaProtocolDecoder.java b/src/org/traccar/protocol/AquilaProtocolDecoder.java
index 56723e0ef..5f421727f 100644
--- a/src/org/traccar/protocol/AquilaProtocolDecoder.java
+++ b/src/org/traccar/protocol/AquilaProtocolDecoder.java
@@ -92,6 +92,33 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder {
.number("-?d+,") // accelerometer y
.number("-?d+,") // accelerometer z
.number("d+,") // delta distance
+ .or()
+ .number("(d+),") // course
+ .number("(d+),") // satellites
+ .number("(d+.d+),") // hdop
+ .number("(?:d+,){2}") // reserved
+ .number("(d+),") // adc 1
+ .number("([01]),") // di 1
+ .number("[01],") // case open
+ .number("[01],") // over speed start
+ .number("[01],") // over speed end
+ .number("(?:[01],){2}") // reserved
+ .number("[01],") // immobilizer
+ .number("([01]),") // power status
+ .number("([01]),") // di 2
+ .number("(?:[01],){2}") // reserved
+ .number("([01]),") // ignition
+ .number("(?:[01],){6}") // reserved
+ .number("[01],") // low battery
+ .number("[01],") // corner packet
+ .number("(?:[01],){4}") // reserved
+ .number("[01],") // do 1
+ .number("[01],") // reserved
+ .number("[01],") // hard acceleration
+ .number("[01],") // hard breaking
+ .number("(?:[01],){4}") // reserved
+ .number("(d+),") // external voltage
+ .number("(d+),") // internal voltage
.groupEnd()
.text("*")
.number("xx") // checksum
@@ -133,9 +160,9 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder {
if (parser.hasNext(9)) {
position.set(Position.KEY_FUEL_LEVEL, parser.next());
- position.set(Position.PREFIX_IO + 1, parser.next());
+ position.set(Position.PREFIX_IN + 1, parser.next());
position.set(Position.KEY_CHARGE, parser.next());
- position.set(Position.PREFIX_IO + 2, parser.next());
+ position.set(Position.PREFIX_IN + 2, parser.next());
position.set(Position.KEY_IGNITION, parser.nextInt() == 1);
@@ -144,7 +171,7 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder {
position.setCourse((course - 1) * 45);
}
- } else {
+ } else if (parser.hasNext(7)) {
position.setCourse(parser.nextInt());
@@ -159,6 +186,20 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder {
String dtcs = parser.next();
position.set(Position.KEY_DTCS, dtcs.substring(1, dtcs.length() - 1).replace('|', ' '));
+ } else {
+
+ position.setCourse(parser.nextInt());
+
+ position.set(Position.KEY_SATELLITES, parser.nextInt());
+ position.set(Position.KEY_HDOP, parser.nextDouble());
+ position.set(Position.PREFIX_ADC + 1, parser.nextInt());
+ position.set(Position.PREFIX_IN + 1, parser.nextInt());
+ position.set(Position.KEY_CHARGE, parser.next());
+ position.set(Position.PREFIX_IN + 2, parser.nextInt());
+ position.set(Position.KEY_IGNITION, parser.nextInt() == 1);
+ position.set(Position.KEY_POWER, parser.nextInt());
+ position.set(Position.KEY_BATTERY, parser.nextInt());
+
}
return position;
diff --git a/test/org/traccar/protocol/AquilaProtocolDecoderTest.java b/test/org/traccar/protocol/AquilaProtocolDecoderTest.java
index 3e823d74d..de50176ae 100644
--- a/test/org/traccar/protocol/AquilaProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/AquilaProtocolDecoderTest.java
@@ -11,6 +11,15 @@ public class AquilaProtocolDecoderTest extends ProtocolTest {
AquilaProtocolDecoder decoder = new AquilaProtocolDecoder(new AquilaProtocol());
verifyPosition(decoder, text(
+ "$$CLIENT_1ZF,170222318,101,22.846016,75.949104,170321103506,A,0,0,244991,0,10,0.860000,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,12483,294,*3D"));
+
+ verifyNothing(decoder, text(
+ "$$CLIENT_1ZF,170222318,15,2_00AP,70.35.195.185,5089,internet,T1:10 S,T2:1 M,Ad1:9164061023,Ad2:9164061023,TOF:0 S,,OSC:75 KM,OST:0 S,GPS:YES,Ignition:ON,*75"));
+
+ verifyPosition(decoder, text(
+ "$$CLIENT_1ZF,170222318,1,22.836912,75.942215,170321110736,A,11,12,247196,103,10,0.810000,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,13325,306,*36"));
+
+ verifyPosition(decoder, text(
"$$CLIENT_1ZF,130329214,1,12.962985,77.576484,140127165433,A,22,0,0,140,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1253,420,1,0,1,0,0,1,P(01:410104000102|05:410521|0C:410C0000|0D:410D65|21:4121161C),D(P0121|B2105),-895,745,-145,300,*26"));
verifyPosition(decoder, text(