aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-02-02 23:23:24 +1100
committerAnton Tananaev <anton.tananaev@gmail.com>2016-02-02 23:23:24 +1100
commit59f9f7dc90cd6bb6acad1254389406e21fbacc96 (patch)
tree7b924204629c8ca3abfb05a44e720158b3482e5f
parent4807127711bb934ab6dbcbbe5d92290a1e576166 (diff)
downloadtrackermap-server-59f9f7dc90cd6bb6acad1254389406e21fbacc96.tar.gz
trackermap-server-59f9f7dc90cd6bb6acad1254389406e21fbacc96.tar.bz2
trackermap-server-59f9f7dc90cd6bb6acad1254389406e21fbacc96.zip
Add RFID support for GPS103 protocol
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java7
-rw-r--r--test/org/traccar/protocol/Gps103ProtocolDecoderTest.java3
2 files changed, 9 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index f6cd57d9e..2c7397231 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -37,7 +37,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
.expression("([^,]+),") // alarm
.number("(dd)/?(dd)/?(dd) ?") // local date
.number("(dd):?(dd)(?:dd)?,") // local time
- .expression("[^,]*,")
+ .expression("([^,]+)?,") // rfid
.expression("[FL],") // full / low
.groupBegin()
.number("(dd)(dd)(dd).(d+)") // time utc (hhmmss.sss)
@@ -147,6 +147,11 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
int localHours = parser.nextInt();
int localMinutes = parser.nextInt();
+ String rfid = parser.next();
+ if (alarm.equals("rfid")) {
+ position.set(Event.KEY_RFID, rfid);
+ }
+
String utcHours = parser.next();
String utcMinutes = parser.next();
diff --git a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
index e53f701ff..9f5b386cc 100644
--- a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
@@ -10,6 +10,9 @@ public class Gps103ProtocolDecoderTest extends ProtocolTest {
Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(new Gps103Protocol());
+ verifyPosition(decoder, text(
+ "imei:868683020235846,rfid,160202091347,49121185,F,011344.000,A,0447.7273,N,07538.9934,W,0.00,0,,0,0,0.00%,,"));
+
verifyAttributes(decoder, text(
"imei:359710049075097,help me,,,L,,,113b,,558f,,,,,0,0,,,"));