Skip to content

Commit

Permalink
Improve MD500S decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Dec 21, 2022
1 parent 0a8273d commit b9cc31b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -524,12 +524,19 @@ private List<Position> decodeBinaryE(Channel channel, SocketAddress remoteAddres

paramCount = buf.readUnsignedByte();
for (int j = 0; j < paramCount; j++) {
if (buf.getUnsignedByte(buf.readerIndex()) == 0xFE) {
buf.readUnsignedShort(); // extension id
} else {
buf.readUnsignedByte(); // id
boolean extension = buf.getUnsignedByte(buf.readerIndex()) == 0xFE;
int id = extension ? buf.readUnsignedShort() : buf.readUnsignedByte();
int length = buf.readUnsignedByte();
switch (id) {
case 0xFE31:
buf.readUnsignedByte(); // alarm protocol
buf.readUnsignedByte(); // alarm type
buf.skipBytes(length - 2);
break;
default:
buf.skipBytes(length);
break;
}
buf.skipBytes(buf.readUnsignedByte()); // value
}

positions.add(position);
Expand Down

0 comments on commit b9cc31b

Please sign in to comment.