aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/H02ProtocolDecoder.java13
-rw-r--r--test/org/traccar/protocol/H02ProtocolDecoderTest.java3
2 files changed, 14 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java
index b11a1e0e6..b78f21d8d 100644
--- a/src/org/traccar/protocol/H02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/H02ProtocolDecoder.java
@@ -179,9 +179,12 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
.number("(x+),") // lac
.number("(x+)#") // cid
.or()
- .expression(",.*")
+ .number(",(d+),")
+ .number("(d+),")
+ .number("(d+),")
+ .number("(d+)#")
.or()
- .text("#")
+ .any()
.groupEnd()
.compile();
@@ -262,6 +265,12 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
position.setNetwork(new Network(CellTower.fromLacCid(parser.nextInt(16), parser.nextInt(16))));
}
+ if (parser.hasNext(4)) {
+ for (int i = 1; i <= 4; i++) {
+ position.set(Position.PREFIX_IO + i, parser.nextInt());
+ }
+ }
+
return position;
}
diff --git a/test/org/traccar/protocol/H02ProtocolDecoderTest.java b/test/org/traccar/protocol/H02ProtocolDecoderTest.java
index ad3a2e589..7498bbcd7 100644
--- a/test/org/traccar/protocol/H02ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/H02ProtocolDecoderTest.java
@@ -10,6 +10,9 @@ public class H02ProtocolDecoderTest extends ProtocolTest {
H02ProtocolDecoder decoder = new H02ProtocolDecoder(new H02Protocol());
+ verifyPosition(decoder, buffer(
+ "*HQ,8161289587,V1,181933,A,5444.3994,N,02516.3844,E,000.05,000,090317,FFFFBBFF,246,03,00002,41565#"));
+
verifyPosition(decoder, binary(
"2421305109380127171003170520046500100286297e003085ffffdfffff03440069129344006400001151415a20"));