diff options
-rw-r--r-- | src/org/traccar/protocol/Gps103ProtocolDecoder.java | 7 | ||||
-rw-r--r-- | test/org/traccar/protocol/Gps103ProtocolDecoderTest.java | 3 |
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,,,")); |