diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-01-11 22:32:46 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-01-11 22:32:46 +1300 |
commit | a56376ac42ef19cff0a664e518271e491ef737c9 (patch) | |
tree | fe0ca9d4e59da098d4d84850a20218e5e594278f /src/org/traccar/protocol/NvsProtocolDecoder.java | |
parent | 3899a1b71eed65ee42a35f75b9d82d235e8ff4d5 (diff) | |
download | trackermap-server-a56376ac42ef19cff0a664e518271e491ef737c9.tar.gz trackermap-server-a56376ac42ef19cff0a664e518271e491ef737c9.tar.bz2 trackermap-server-a56376ac42ef19cff0a664e518271e491ef737c9.zip |
Implement Navis protocol frame decoder
Diffstat (limited to 'src/org/traccar/protocol/NvsProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/NvsProtocolDecoder.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/NvsProtocolDecoder.java b/src/org/traccar/protocol/NvsProtocolDecoder.java index 3656f4be2..5597c8bbb 100644 --- a/src/org/traccar/protocol/NvsProtocolDecoder.java +++ b/src/org/traccar/protocol/NvsProtocolDecoder.java @@ -46,10 +46,8 @@ public class NvsProtocolDecoder extends BaseProtocolDecoder { ChannelBuffer buf = (ChannelBuffer) msg; - buf.skipBytes(4); // marker - int length = buf.readUnsignedShort(); - if (length == 15 + 3) { + if (buf.getUnsignedByte(buf.readerIndex()) == 0) { String imei = buf.toString(buf.readerIndex(), 15, Charset.defaultCharset()); @@ -63,6 +61,8 @@ public class NvsProtocolDecoder extends BaseProtocolDecoder { List<Position> positions = new LinkedList<>(); + buf.skipBytes(4); // marker + buf.readUnsignedShort(); // length buf.readLong(); // imei buf.readUnsignedByte(); // codec int count = buf.readUnsignedByte(); |