aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-02-28 08:32:46 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-02-28 08:32:46 +1300
commit5012663d8688fa521fa7de02116f42ddbb57e7fb (patch)
tree9ae38a32d186d2bd667f72d26aaeb39849e6b42f
parent9120ff19ab2bdd466ae5c30632efd1917faa71b1 (diff)
downloadtraccar-server-5012663d8688fa521fa7de02116f42ddbb57e7fb.tar.gz
traccar-server-5012663d8688fa521fa7de02116f42ddbb57e7fb.tar.bz2
traccar-server-5012663d8688fa521fa7de02116f42ddbb57e7fb.zip
Additional T55 attributes
-rw-r--r--src/org/traccar/protocol/T55ProtocolDecoder.java12
-rw-r--r--test/org/traccar/protocol/T55ProtocolDecoderTest.java3
2 files changed, 13 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java
index faf9c4b7d..a41da427a 100644
--- a/src/org/traccar/protocol/T55ProtocolDecoder.java
+++ b/src/org/traccar/protocol/T55ProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 2017 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,9 +50,10 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
.expression("[^,]+")
.number(",(d+)") // satellites
.number(",(d+)") // imei
- .number(",([01])") // ignition
+ .expression(",([01])") // ignition
.number(",(d+)") // fuel
.number(",(d+)").optional(5) // battery
+ .number("((?:,d+)+)?") // parameters
.any()
.compile();
@@ -139,6 +140,13 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_BATTERY, parser.nextInt());
}
+ if (parser.hasNext()) {
+ String[] parameters = parser.next().split(",");
+ for (int i = 1; i < parameters.length; i++) {
+ position.set(Position.PREFIX_IO + i, parameters[i]);
+ }
+ }
+
if (deviceSession != null) {
return position;
} else {
diff --git a/test/org/traccar/protocol/T55ProtocolDecoderTest.java b/test/org/traccar/protocol/T55ProtocolDecoderTest.java
index 4cc5f549a..83f60f5b4 100644
--- a/test/org/traccar/protocol/T55ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/T55ProtocolDecoderTest.java
@@ -16,6 +16,9 @@ public class T55ProtocolDecoderTest extends ProtocolTest {
verifyNothing(decoder, text(
"358244017671308"));
+ verifyPosition(decoder, text(
+ "$GPRMC,073446.000,A,1255.5125,N,07738.2948,E,0.00,0.53,080316,D*71,11,865733027593268,1,090,086,123,456,789,987,12345"));
+
verifyNotNull(decoder, text(
"$GPRMC,161223.000,A,2517.0545,S,05739.1788,W,0.0,0.0,011196,,,A*61"));