Skip to content

Commit

Permalink
Handle alternative GT06 message format
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Aug 2, 2018
1 parent e8357f9 commit a4ad137
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/org/traccar/protocol/Gt06ProtocolDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ private boolean decodeLbs(Position position, ByteBuf buf, boolean hasLength) {
position.setNetwork(new Network(CellTower.from(
BitUtil.to(mcc, 15), mnc, buf.readUnsignedShort(), buf.readUnsignedMedium())));

if (length > 0) {
buf.skipBytes(length - (hasLength ? 9 : 8));
if (length > 9) {
buf.skipBytes(length - 9);
}

return true;
Expand Down
3 changes: 3 additions & 0 deletions test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public void testDecode() throws Exception {
verifyNull(decoder, binary(
"78780D01086471700328358100093F040D0A"));

verifyNotNull(decoder, binary(
"78781219028f0a29e10036f12003040102000875dc0d0a"));

verifyAttributes(decoder, binary(
"79790008940000ed0289d6860d0a"));

Expand Down

0 comments on commit a4ad137

Please sign in to comment.