aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java13
-rw-r--r--src/test/java/org/traccar/protocol/ArmoliProtocolDecoderTest.java6
2 files changed, 17 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java b/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java
index 400e4ad89..50af039d6 100644
--- a/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java
@@ -20,6 +20,7 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
+import org.traccar.helper.ObdDecoder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
@@ -51,12 +52,13 @@ public class ArmoliProtocolDecoder extends BaseProtocolDecoder {
.number("(xx)") // max speed
.number("(x{6})") // distance
.number("(dd)?") // hdop
- .number("xx") // idle
+ .number("x{4}") // 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
+ .expression("@A([>0-9A-F]+)").optional() // obd
.any()
.compile();
@@ -133,6 +135,15 @@ public class ArmoliProtocolDecoder extends BaseProtocolDecoder {
if (parser.hasNext()) {
position.set(Position.KEY_DRIVER_UNIQUE_ID, parser.next());
}
+ if (parser.hasNext()) {
+ String[] values = parser.next().split(">");
+ for (int i = 1; i < values.length; i++) {
+ String value = values[i];
+ position.add(ObdDecoder.decodeData(
+ Integer.parseInt(value.substring(4, 6), 16),
+ Long.parseLong(value.substring(6), 16), true));
+ }
+ }
return position;
}
diff --git a/src/test/java/org/traccar/protocol/ArmoliProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/ArmoliProtocolDecoderTest.java
index c64fbd411..da2542b34 100644
--- a/src/test/java/org/traccar/protocol/ArmoliProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/ArmoliProtocolDecoderTest.java
@@ -11,11 +11,15 @@ public class ArmoliProtocolDecoderTest extends ProtocolTest {
var decoder = new ArmoliProtocolDecoder(null);
+ verifyAttribute(decoder, text(
+ "[M869867039550712160821153237N41.033508E029.2697032F00036000000410006B336FFFFG458563@A6D>04410C2482>03410F56>03412F19>0441210000>034130FF>0441313A7>03410D30>04411F01B6>0341048C>04410C1C98];"),
+ Position.KEY_RPM, 1830L);
+
verifyPosition(decoder, text(
"[M869867038698074210122125205N38.735641E035.4727751E003340000000C00000E9E07FF:106AG505283H60E]"));
verifyAttribute(decoder, text(
- "[W869867038698074,O,1234,2657,1]"),
+ "[W869867038698074,O,1234,2657,1]"),
Position.KEY_RESULT, "O,1234,2657,1");
verifyNull(decoder, text(