aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-08-14 08:35:00 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2019-08-14 08:35:00 -0700
commit3ecbff1ae54759fdf212030d7721b7c66b0ea41b (patch)
tree710c465a005a4c52e8d21a916eed4d51bd72e8c4
parent127d7e59b3a21c8aa98c6f7953b86d6008f959f2 (diff)
downloadtraccar-server-3ecbff1ae54759fdf212030d7721b7c66b0ea41b.tar.gz
traccar-server-3ecbff1ae54759fdf212030d7721b7c66b0ea41b.tar.bz2
traccar-server-3ecbff1ae54759fdf212030d7721b7c66b0ea41b.zip
Fix batch decoding
-rw-r--r--src/main/java/org/traccar/protocol/NavisetProtocolDecoder.java4
-rw-r--r--src/test/java/org/traccar/protocol/NavisetProtocolDecoderTest.java3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/NavisetProtocolDecoder.java b/src/main/java/org/traccar/protocol/NavisetProtocolDecoder.java
index d67fae78c..10d71d76c 100644
--- a/src/main/java/org/traccar/protocol/NavisetProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/NavisetProtocolDecoder.java
@@ -72,15 +72,15 @@ public class NavisetProtocolDecoder extends BaseProtocolDecoder {
return null;
}
+ int blockMask = buf.readUnsignedByte();
+
while (buf.readableBytes() > 2) {
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
- int blockMask = buf.readUnsignedByte();
position.set(Position.KEY_INDEX, buf.readUnsignedShortLE());
position.set(Position.KEY_STATUS, buf.readUnsignedByte());
-
position.setValid(true);
position.setTime(new Date(buf.readUnsignedIntLE() * 1000));
position.setLatitude(buf.readUnsignedIntLE() * 0.000001);
diff --git a/src/test/java/org/traccar/protocol/NavisetProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/NavisetProtocolDecoderTest.java
index c4b0ca73a..09ea10f1f 100644
--- a/src/test/java/org/traccar/protocol/NavisetProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/NavisetProtocolDecoderTest.java
@@ -14,6 +14,9 @@ public class NavisetProtocolDecoderTest extends ProtocolTest {
"1310e4073836383230343030353935383436362a060716"));
verifyPositions(decoder, binary(
+ "6b511a203f95162b7822515d78a92503042df6030000ff040000c4003f1922471000001af3000030e4503490e8ff00000000000000000000000000000000ff27000000000000808080808080808000000000ffdd0000000000000000000000000000000000000000000000210000000000ff00000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000096160b7d22515d3ca92503e42cf6030000ff040000c7001ef521471000001af3000070e44034e0e8ff00000000000000000000000000000000ff27000000000000808080808080808000000000ffdd0000000000000000000000000000000000000000000000210000000000ff00000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000664a"));
+
+ verifyPositions(decoder, binary(
"b7501a203fab0d0bffcf4b5df0a82503a02cf6030000ff0c4200ba0007462a3a10000098280000f0f610fc4042ff00000000000000000000000000000000ff26000000000000808080808080808000000000ff000000000000000000000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000ff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008bff"));
verifyPositions(decoder, binary(