diff options
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r-- | src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java | 13 |
1 files changed, 12 insertions, 1 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; } |