diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-01-31 17:54:25 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-01-31 17:54:25 -0800 |
commit | 0b33d4c618e92814df00c3dc0eca54fced088f95 (patch) | |
tree | 6ff600b1de4df5c9598948881c2f25690c250523 /src | |
parent | c66d791b1a6ba1f04714d652b93aff3ca792cde4 (diff) | |
download | trackermap-server-0b33d4c618e92814df00c3dc0eca54fced088f95.tar.gz trackermap-server-0b33d4c618e92814df00c3dc0eca54fced088f95.tar.bz2 trackermap-server-0b33d4c618e92814df00c3dc0eca54fced088f95.zip |
Support second BLE type
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java | 13 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java | 3 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java index c38fd740d..89217a39b 100644 --- a/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 - 2020 Anton Tananaev (anton@traccar.org) + * Copyright 2019 - 2021 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -186,6 +186,17 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_BATTERY_LEVEL, BitUtil.from(status, 24)); position.set(Position.KEY_STATUS, status); break; + case 0x28: + int beaconFlags = buf.readUnsignedByte(); + position.set("tagId", ByteBufUtil.hexDump(buf.readSlice(6))); + buf.readUnsignedByte(); // rssi + buf.readUnsignedByte(); // 1m rssi + if (BitUtil.check(beaconFlags, 7)) { + position.setLatitude(buf.readIntLE() * 0.0000001); + position.setLongitude(buf.readIntLE() * 0.0000001); + hasLocation = true; + } + break; case 0x30: buf.readUnsignedInt(); // timestamp position.set(Position.KEY_STEPS, buf.readUnsignedInt()); diff --git a/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java index 8f438b431..18985a429 100644 --- a/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java @@ -13,6 +13,9 @@ public class Minifinder2ProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "ab10150076f1320003100133353534363530373130323933303602105a")); + verifyPositions(decoder, binary( + "ab183200c6bd020101100138363838333230343730323133363209247a0b146090087a641528c03a79ba309be5dec3c2024122c21c2407676267")); + verifyNotNull(decoder, binary( "ab18480066b107010110013836383833323034373030373832350924a230e35f8200ea312b22bc7894b4b86956a31cbdb989fdb8b502ad2449ea60ab646eea0d5663c59c3dcf05549eb3b095754322df")); |