aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-12-20 16:25:24 -0800
committerAnton Tananaev <anton@traccar.org>2022-12-20 16:25:24 -0800
commitb9cc31bf3ab278df45fa90f6481f929e325326f0 (patch)
treee8638563e4bbf936d9c29e91012d9429bb6c8df6 /src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java
parent0a8273d87ab5fd4270aab6000d6cefa1472bb024 (diff)
downloadtrackermap-server-b9cc31bf3ab278df45fa90f6481f929e325326f0.tar.gz
trackermap-server-b9cc31bf3ab278df45fa90f6481f929e325326f0.tar.bz2
trackermap-server-b9cc31bf3ab278df45fa90f6481f929e325326f0.zip
Improve MD500S decoding
Diffstat (limited to 'src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java
index 1935b2c2a..82c8f0087 100644
--- a/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java
@@ -524,12 +524,19 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
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);