aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2022-01-21 18:59:49 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2022-01-21 18:59:49 -0800
commitcb07c34f3b79d82d85ab6c0df8f64c3c3facc3a0 (patch)
tree3830f47a8a06d60863faffdeee7cef6064f22032 /src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java
parent2284044f7e9e00935e6ec5020e68ef2492326dda (diff)
downloadtrackermap-server-cb07c34f3b79d82d85ab6c0df8f64c3c3facc3a0.tar.gz
trackermap-server-cb07c34f3b79d82d85ab6c0df8f64c3c3facc3a0.tar.bz2
trackermap-server-cb07c34f3b79d82d85ab6c0df8f64c3c3facc3a0.zip
Update Armoli protocol
Diffstat (limited to 'src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java b/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java
index 46bdb484e..40beedbf6 100644
--- a/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java
@@ -50,6 +50,13 @@ public class ArmoliProtocolDecoder extends BaseProtocolDecoder {
.number("(xx)") // status
.number("(xx)") // max speed
.number("(x{6})") // distance
+ .number("(dd)?") // hdop
+ .number("xx") // idle
+ .number(":(x+)").optional() // alarms
+ .number("G(x{6})").optional() // g-sensor
+ .number("H(x{3})").optional() // power
+ .number("E(x{3})").optional() // battery
+ .number("!(x+)").optional() // driver
.any()
.compile();
@@ -60,8 +67,14 @@ public class ArmoliProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
char type = sentence.charAt(1);
+ Position position = new Position(getProtocolName());
+
if (type != 'M') {
- if (channel != null && (type == 'Q' || type == 'L')) {
+ if (type == 'W') {
+ getLastLocation(position, null);
+ position.set(Position.KEY_RESULT, sentence.substring(sentence.indexOf(',') + 1, sentence.length() - 2));
+ return position;
+ } else if (channel != null && (type == 'Q' || type == 'L')) {
channel.writeAndFlush(new NetworkMessage("[TX,];;", remoteAddress));
}
return null;
@@ -77,7 +90,6 @@ public class ArmoliProtocolDecoder extends BaseProtocolDecoder {
return null;
}
- Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS));
@@ -96,6 +108,25 @@ public class ArmoliProtocolDecoder extends BaseProtocolDecoder {
position.set("maxSpeed", parser.nextHexInt());
position.set(Position.KEY_ODOMETER, parser.nextHexInt());
+ if (parser.hasNext()) {
+ position.set(Position.KEY_HDOP, parser.nextInt() * 0.1);
+ }
+ if (parser.hasNext()) {
+ position.set("alarms", parser.next());
+ }
+ if (parser.hasNext()) {
+ position.set(Position.KEY_G_SENSOR, parser.next());
+ }
+ if (parser.hasNext()) {
+ position.set(Position.KEY_POWER, parser.nextHexInt() * 0.01);
+ }
+ if (parser.hasNext()) {
+ position.set(Position.KEY_BATTERY, parser.nextHexInt() * 0.01);
+ }
+ if (parser.hasNext()) {
+ position.set(Position.KEY_DRIVER_UNIQUE_ID, parser.next());
+ }
+
return position;
}