aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-09-30 12:17:38 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-09-30 12:17:38 +1300
commita6b8f7f7ef0fa3b58dcdfee38b18e61bd7ce18b4 (patch)
treeb0fed6ef4d82325193d4fc45f0af46bbf7cf3491
parentc3d71d9b2d49ef70a5a02c7b26bdc0cae9fde77b (diff)
downloadtraccar-server-a6b8f7f7ef0fa3b58dcdfee38b18e61bd7ce18b4.tar.gz
traccar-server-a6b8f7f7ef0fa3b58dcdfee38b18e61bd7ce18b4.tar.bz2
traccar-server-a6b8f7f7ef0fa3b58dcdfee38b18e61bd7ce18b4.zip
Decode course for Aquila protocol
-rw-r--r--src/org/traccar/protocol/AquilaProtocolDecoder.java19
1 files changed, 18 insertions, 1 deletions
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;
}