aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-02-14 07:45:17 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-02-14 07:45:17 +1300
commitb2e05a3552da93ad667c10406c5e9aa0ec702469 (patch)
tree3f120585ba8c3497de28fa138714214ecd8f48ec
parent5465e58749ecf553839484f4a41ca94a1621bbb8 (diff)
downloadtrackermap-server-b2e05a3552da93ad667c10406c5e9aa0ec702469.tar.gz
trackermap-server-b2e05a3552da93ad667c10406c5e9aa0ec702469.tar.bz2
trackermap-server-b2e05a3552da93ad667c10406c5e9aa0ec702469.zip
Fix H02 status decoding
-rw-r--r--src/org/traccar/protocol/H02ProtocolDecoder.java12
-rw-r--r--test/org/traccar/protocol/H02ProtocolDecoderTest.java6
2 files changed, 9 insertions, 9 deletions
diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java
index 37f6294be..d2d274eeb 100644
--- a/src/org/traccar/protocol/H02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/H02ProtocolDecoder.java
@@ -165,16 +165,10 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
.expression("([EW]),")
.number("(d+.?d*),") // speed
.number("(d+.?d*)?,") // course
- .number("(?:(dd)(dd)(dd))?,") // date (ddmmyy)
- .any()
- .number("(x{8})") // status
- .groupBegin()
- .number(", *(x+),") // mcc
- .number(" *(x+),") // mnc
- .number(" *(x+),") // lac
- .number(" *(x+)") // cid
- .groupEnd("?")
+ .number("(?:(dd)(dd)(dd))?") // date (ddmmyy)
.any()
+ .number(",(x{8})") // status
+ .expression("(?:#|,.*)")
.compile();
private static final Pattern PATTERN_NBR = new PatternBuilder()
diff --git a/test/org/traccar/protocol/H02ProtocolDecoderTest.java b/test/org/traccar/protocol/H02ProtocolDecoderTest.java
index 55bad63c8..90a1470c6 100644
--- a/test/org/traccar/protocol/H02ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/H02ProtocolDecoderTest.java
@@ -10,6 +10,12 @@ public class H02ProtocolDecoderTest extends ProtocolTest {
H02ProtocolDecoder decoder = new H02ProtocolDecoder(new H02Protocol());
+ verifyPosition(decoder, buffer(
+ "*HQ,4109179024,V19,103732,V,3853.2770,S,06205.8678,W,000.00,000,100217,,5492932630888,8954314165044716555?,FFFFFBFF#"));
+
+ verifyAttributes(decoder, buffer(
+ "*HQ,4109179024,NBR,103732,722,310,0,6,8106,32010,23,8101,22007,25,8106,12010,23,8106,22105,22,8101,22012,16,8106,42010,5,100217,FFFFFBFF,5#"));
+
verifyNothing(decoder, buffer(
"*HQ,355488020930796,V3,002339,62160,06,024852,035421,148,0,024852,035425,143,,022251,036482,137,,024852,000335,133,,024852,031751,133,,024852,035423,133,,02A1,0,X,010104,EFE7FBFF#"));