aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-11-22 16:40:12 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2021-11-22 16:40:12 -0800
commit45690f44c55d5a6d0efc4d80a39f10578ff7e799 (patch)
tree7b41f483b31a04e421baedc88d284a62818e57dd /src
parent88e5b090d7a71255a29fe6ad2ae1525c1c0a03be (diff)
downloadtraccar-server-45690f44c55d5a6d0efc4d80a39f10578ff7e799.tar.gz
traccar-server-45690f44c55d5a6d0efc4d80a39f10578ff7e799.tar.bz2
traccar-server-45690f44c55d5a6d0efc4d80a39f10578ff7e799.zip
Fix tags decoding
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java
index 059041d6b..641a45864 100644
--- a/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java
@@ -124,6 +124,14 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder {
}
}
+ private String readTagId(ByteBuf buf) {
+ StringBuilder tagId = new StringBuilder();
+ for (int i = 0; i < 6; i++) {
+ tagId.insert(0, ByteBufUtil.hexDump(buf.readSlice(1)));
+ }
+ return tagId.toString();
+ }
+
@Override
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
@@ -214,7 +222,7 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder {
}
break;
case 0x23:
- position.set("tagId", ByteBufUtil.hexDump(buf.readSlice(6)));
+ position.set("tagId", readTagId(buf));
position.setLatitude(buf.readIntLE() * 0.0000001);
position.setLongitude(buf.readIntLE() * 0.0000001);
position.setValid(true);
@@ -228,9 +236,9 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder {
break;
case 0x28:
int beaconFlags = buf.readUnsignedByte();
- position.set("tagId", ByteBufUtil.hexDump(buf.readSlice(6)));
- position.set("tagRssi", buf.readUnsignedByte());
- buf.readUnsignedByte(); // 1m rssi
+ position.set("tagId", readTagId(buf));
+ position.set("tagRssi", (int) buf.readByte());
+ position.set("tag1mRssi", (int) buf.readByte());
if (BitUtil.check(beaconFlags, 7)) {
position.setLatitude(buf.readIntLE() * 0.0000001);
position.setLongitude(buf.readIntLE() * 0.0000001);