aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/NvsProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/NvsProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/NvsProtocolDecoder.java6
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();