From a6b8f7f7ef0fa3b58dcdfee38b18e61bd7ce18b4 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 30 Sep 2015 12:17:38 +1300 Subject: Decode course for Aquila protocol --- src/org/traccar/protocol/AquilaProtocolDecoder.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/protocol/AquilaProtocolDecoder.java b/src/org/traccar/protocol/AquilaProtocolDecoder.java index 8430165ff..60a6286e8 100644 --- a/src/org/traccar/protocol/AquilaProtocolDecoder.java +++ b/src/org/traccar/protocol/AquilaProtocolDecoder.java @@ -57,7 +57,14 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder { "\\d+," + // Reserved "([01])," + // Ignition "[01]," + // Ignition off event - ".*"); + "(?:\\d+,){7}" + // Reserved + "[01]," + // Corner packet + "(?:\\d+,){8}" + // Reserved + "([01])," + // Course bit 0 + "([01])," + // Course bit 1 + "([01])," + // Course bit 2 + "([01])," + // Course bit 3 + "\\*(\\p{XDigit}{2})"); // Checksum @Override protected Object decode( @@ -111,6 +118,16 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder { position.set(Event.KEY_IGNITION, parser.group(index++).equals("1")); + int course = + (Integer.parseInt(parser.group(index++)) << 3) + + (Integer.parseInt(parser.group(index++)) << 2) + + (Integer.parseInt(parser.group(index++)) << 1) + + (Integer.parseInt(parser.group(index++))); + + if (course > 0) { + position.setCourse((course - 1) * 45); + } + return position; } -- cgit v1.2.3