aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/Pt502ProtocolDecoder.java7
-rw-r--r--test/org/traccar/protocol/Pt502ProtocolDecoderTest.java6
2 files changed, 6 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
index 310c345b0..d2436302d 100644
--- a/src/org/traccar/protocol/Pt502ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
@@ -16,15 +16,12 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
+import java.net.SocketAddress;
import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelHandlerContext;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Event;
import org.traccar.model.Position;
@@ -51,7 +48,7 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder {
"./" +
"([01])+," + // Input
"([01])+/" + // Output
- "([^/]+)/" + // ADC
+ "([^/]+)?/" + // ADC
"(\\d+)" + // Odometer
"(?:/([^/]+)?/" + // RFID
"(\\p{XDigit}{3}))?" + // State
diff --git a/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java b/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java
index f012c8e8a..06740a271 100644
--- a/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import org.traccar.helper.TestIdentityManager;
-import static org.traccar.helper.DecoderVerifier.verify;
import org.junit.Test;
+import static org.traccar.helper.DecoderVerifier.verify;
public class Pt502ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -10,6 +9,9 @@ public class Pt502ProtocolDecoderTest extends ProtocolDecoderTest {
public void testDecode() throws Exception {
Pt502ProtocolDecoder decoder = new Pt502ProtocolDecoder(new Pt502Protocol());
+
+ verify(decoder.decode(null, null,
+ "$POS,216769295715,163237.000,A,3258.1738,S,02755.4350,E,0.00,215.88,100915,,,A/0000,0//232300//5b3/"));
verify(decoder.decode(null, null,
"$POS,11023456,033731.000,A,0335.2617,N,09841.1587,E,0.00,88.12,210615,,,A/0000,0/1f8/388900//f33//"));