aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java7
-rw-r--r--src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java3
2 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java
index 70972f847..4a23d57d0 100644
--- a/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java
@@ -206,7 +206,12 @@ public class FifotrackProtocolDecoder extends BaseProtocolDecoder {
}
if (parser.hasNext()) {
- position.set(Position.KEY_DRIVER_UNIQUE_ID, String.valueOf(parser.nextHexInt()));
+ String rfid = parser.next();
+ if (rfid.matches("\\p{XDigit}+")) {
+ position.set(Position.KEY_DRIVER_UNIQUE_ID, String.valueOf(Integer.parseInt(rfid, 16)));
+ } else {
+ position.set("driverLicense", rfid);
+ }
}
if (parser.hasNext()) {
diff --git a/src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java
index fdac158dd..218cafbeb 100644
--- a/src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class FifotrackProtocolDecoderTest extends ProtocolTest {
var decoder = new FifotrackProtocolDecoder(null);
+ verifyPosition(decoder, buffer(
+ "$$274,863003046499158,18D0,A01,,211026081639,A,13.934116,100.000463,0,263,16,366959,345180,80000040,02,0,520|0|FA8|1A9B5B9,9DE|141|2D,% ^YENSABAICHAI$SONGKRAN$MR.^^?;6007643190300472637=150519870412=?+ 14 1 0000155 00103 ?,*69"));
+
verifyAttribute(decoder, buffer(
"$$25,863003046473534,1,B03,OK*4D"),
Position.KEY_RESULT, "OK");