aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java7
-rw-r--r--test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java3
2 files changed, 8 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index 72c28297c..2b1ea9434 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -59,7 +59,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
"\\|(\\p{XDigit}{2})" + // GSM
"\\|(\\p{XDigit}{8})|" + // Odometer
"(\\p{XDigit}{9})" + // Odometer
- "(?:\\|(\\p{XDigit}{5}))?)?)?)?)?" + // RFID
+ "(?:\\|(\\p{XDigit}{5,}))?)?)?)?)?" + // RFID
".*");
private static final int MSG_HEARTBEAT = 0x0001;
@@ -279,7 +279,10 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
}
// RFID
- position.set(Event.KEY_RFID, parser.group(index++));
+ String rfid = parser.group(index++);
+ if (rfid != null) {
+ position.set(Event.KEY_RFID, Integer.parseInt(rfid, 16));
+ }
return position;
}
diff --git a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
index 912b34f6f..620c43115 100644
--- a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
@@ -72,6 +72,9 @@ public class MeiligaoProtocolDecoderTest extends ProtocolDecoderTest {
verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
"2424007f3568960306760199553131303932342e3030302c412c343533342e323538352c4e2c30313933382e363531342c452c302e30302c2c3237303731342c2c2c412a37317c312e377c3130307c383030307c303737422c303030302c303030302c303030302c303030302c303030302c303030302c303030305dfc0d0a"))));
+
+ verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
+ "2424007f2015603256ffff99553230303230392e30302c412c313734342e36393434382c4e2c30383331392e30353537302c452c31302e3236322c3234382e35352c3236303631352c2c2c442a35437c302e39397c33312e397c303830317c303030302c303030637c3030303933303131367c3030376165313035d5550d0a"))));
}