aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-01-06 23:36:55 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-01-06 23:36:55 -0800
commit90a88ff7584c9d4200f2a32800bf6eaf417955ac (patch)
tree788eaf50c893b10ff0cce28640801f3e64e17adc
parentacaf8a43c33ec97e4553b806a486fd79c93a316d (diff)
downloadtrackermap-server-90a88ff7584c9d4200f2a32800bf6eaf417955ac.tar.gz
trackermap-server-90a88ff7584c9d4200f2a32800bf6eaf417955ac.tar.bz2
trackermap-server-90a88ff7584c9d4200f2a32800bf6eaf417955ac.zip
Decode Atrack driver id
-rw-r--r--src/org/traccar/protocol/AtrackProtocolDecoder.java7
-rw-r--r--test/org/traccar/protocol/AtrackProtocolDecoderTest.java3
2 files changed, 9 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java
index 1963763ed..71bb6791c 100644
--- a/src/org/traccar/protocol/AtrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java
@@ -381,7 +381,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
.number("(d+),") // speed
.number("(d+),") // outputs
.number("(d+),") // adc
- .number("[^,]*,") // driver
+ .number("([^,]+)?,") // driver
.number("(d+),") // temp1
.number("(d+),") // temp2
.expression("[^,]*,") // text message
@@ -455,6 +455,11 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_OUTPUT, parser.nextInt());
position.set(Position.PREFIX_ADC + 1, parser.nextInt());
+
+ if (parser.hasNext()) {
+ position.set(Position.KEY_DRIVER_UNIQUE_ID, parser.next());
+ }
+
position.set(Position.PREFIX_TEMP + 1, parser.nextInt());
position.set(Position.PREFIX_TEMP + 2, parser.nextInt());
diff --git a/test/org/traccar/protocol/AtrackProtocolDecoderTest.java b/test/org/traccar/protocol/AtrackProtocolDecoderTest.java
index 82b4c92af..3a9382086 100644
--- a/test/org/traccar/protocol/AtrackProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/AtrackProtocolDecoderTest.java
@@ -35,6 +35,9 @@ public class AtrackProtocolDecoderTest extends ProtocolTest {
decoder.setCustom(true);
verifyPositions(decoder, buffer(
+ "@P,9493,402,143,356961075931165,1546830150,1546830151,1546830151,-88429209,44271154,54,10,0,10,1,0,0,0,1858AE010000,2000,2000,\u001A,%CI%FL%ML%VN%PD%FC%EL%ET%AT%MF%MV%BV%DT%GN%GV%ME%RL%RP%SA%SM%TR%IA%MP,0,0,2T1KR32E28C706185,0,1,0,7,251,89,118,41,0,00A5001A040800A5001A040B00A5001A040C00A5001A040900A4001C040D00A50019040900A60019040900A4001B040B00A5001A040900A7001A040E\u001A,008CFE7C03C4\u001A,356961075931165,0,0,12,0,18,5,0\n"));
+
+ verifyPositions(decoder, buffer(
"@P,FD34,720,12256,357520076794151,1535445349,1535445354,1535500603,106784149,-6283086,105,2,138,0,3,0,0,0,,2000,2000,,%CI%TR%MV%BV%AT%SA%ET%GQ%GS%PC%RP%OD%AV1%XS%VS,0,0,0,0,0,0,0,0,1011677,0,138,0,0,0\r\n",
"1535445376,1535445374,1535500603,106783763,-6282981,105,101,138,6,2,0,0,0,,2000,2000,,%CI%TR%MV%BV%AT%SA%ET%GQ%GS%PC%RP%OD%AV1%XS%VS,0,141,41,60,12,0,0,7,1011677,0,138,0,0,0\r\n",
"1535445380,1535445378,1535500603,106783763,-6282981,105,103,138,6,2,0,0,0,,2000,2000,,%CI%TR%MV%BV%AT%SA%ET%GQ%GS%PC%RP%OD%AV1%XS%VS,0,135,41,61,12,0,0,9,1011677,0,138,0,0,0\r\n",