aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/AquilaProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-02-06 15:51:09 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-02-06 15:51:09 +1300
commit92fa1cd409393a10978a391c0a27f1eb37a0b74c (patch)
tree109dc1f61d865aa8416e2fe4bd9103d66bbc2745 /src/org/traccar/protocol/AquilaProtocolDecoder.java
parentdd0fe191acd245b6a66240bd5daa736e873d043e (diff)
downloadtrackermap-server-92fa1cd409393a10978a391c0a27f1eb37a0b74c.tar.gz
trackermap-server-92fa1cd409393a10978a391c0a27f1eb37a0b74c.tar.bz2
trackermap-server-92fa1cd409393a10978a391c0a27f1eb37a0b74c.zip
Decode Aquila sensor data
Diffstat (limited to 'src/org/traccar/protocol/AquilaProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/AquilaProtocolDecoder.java22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/AquilaProtocolDecoder.java b/src/org/traccar/protocol/AquilaProtocolDecoder.java
index 638affdc3..d8081612d 100644
--- a/src/org/traccar/protocol/AquilaProtocolDecoder.java
+++ b/src/org/traccar/protocol/AquilaProtocolDecoder.java
@@ -42,6 +42,7 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder {
.number("(dd)(dd)(dd)") // date (yymmdd)
.number("(dd)(dd)(dd),") // time (hhmmss)
.expression("([AV]),") // validity
+ .groupBegin()
.number("(d+),") // gsm
.number("(d+),") // speed
.number("(d+),") // distance
@@ -120,6 +121,10 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder {
.number("(d+),") // external voltage
.number("(d+),") // internal voltage
.groupEnd()
+ .or()
+ .number("(d+),") // sensor id
+ .expression("([^,]+),") // sensor data
+ .groupEnd()
.text("*")
.number("xx") // checksum
.compile();
@@ -150,11 +155,11 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder {
position.setValid(parser.next().equals("A"));
- position.set(Position.KEY_RSSI, parser.nextInt(0));
-
- position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble(0)));
-
- position.set(Position.KEY_ODOMETER, parser.nextInt(0));
+ if (parser.hasNext(3)) {
+ position.set(Position.KEY_RSSI, parser.nextInt(0));
+ position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble(0)));
+ position.set(Position.KEY_ODOMETER, parser.nextInt(0));
+ }
if (parser.hasNext(9)) {
@@ -186,7 +191,7 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder {
String dtcs = parser.next();
position.set(Position.KEY_DTCS, dtcs.substring(1, dtcs.length() - 1).replace('|', ' '));
- } else {
+ } else if (parser.hasNext(10)) {
position.setCourse(parser.nextInt(0));
@@ -200,6 +205,11 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_POWER, parser.nextInt(0));
position.set(Position.KEY_BATTERY, parser.nextInt(0));
+ } else if (parser.hasNext(2)) {
+
+ position.set("sensorId", parser.nextInt());
+ position.set("sensorData", parser.next());
+
}
return position;