diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-09-28 01:47:17 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-09-28 01:47:17 +1300 |
commit | 7573aa48ebc870005cd03c6246290efed5c8e657 (patch) | |
tree | ed8e96fa019b9afa97cc1dd890d1be55fcaae8ac | |
parent | 4ef26b62cb97fc2afa5fdcf260c5fffbdc454c25 (diff) | |
download | trackermap-server-7573aa48ebc870005cd03c6246290efed5c8e657.tar.gz trackermap-server-7573aa48ebc870005cd03c6246290efed5c8e657.tar.bz2 trackermap-server-7573aa48ebc870005cd03c6246290efed5c8e657.zip |
Support new H02 message types
-rw-r--r-- | src/org/traccar/protocol/H02ProtocolDecoder.java | 8 | ||||
-rw-r--r-- | test/org/traccar/protocol/H02ProtocolDecoderTest.java | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java index dd5d4abd7..4414870d2 100644 --- a/src/org/traccar/protocol/H02ProtocolDecoder.java +++ b/src/org/traccar/protocol/H02ProtocolDecoder.java @@ -161,7 +161,11 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { .groupEnd() .number("(?:(dd)(dd)(dd))?,") // time (hhmmss) .groupEnd() + .groupBegin() .expression("([ABV])?,") // validity + .or() + .number("(d+),") // coding scheme + .groupEnd() .groupBegin() .number("-(d+)-(d+.d+),") // latitude .or() @@ -279,6 +283,10 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { if (parser.hasNext()) { position.setValid(parser.next().equals("A")); } + if (parser.hasNext()) { + parser.nextInt(); // coding scheme + position.setValid(true); + } if (parser.hasNext(2)) { position.setLatitude(-parser.nextCoordinate()); diff --git a/test/org/traccar/protocol/H02ProtocolDecoderTest.java b/test/org/traccar/protocol/H02ProtocolDecoderTest.java index e0130aa5d..bea65a540 100644 --- a/test/org/traccar/protocol/H02ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/H02ProtocolDecoderTest.java @@ -11,7 +11,7 @@ public class H02ProtocolDecoderTest extends ProtocolTest { H02ProtocolDecoder decoder = new H02ProtocolDecoder(new H02Protocol()); - verifyNull(decoder, buffer( + verifyPosition(decoder, buffer( "*HQ,353505221264507,VI1,075146,0,5238.25900,N,00507.33429,E,0.54,0,250917,FFFFFFFF,cc,28, db,d75b#")); verifyNull(decoder, buffer( |