Skip to content

Commit

Permalink
Support second BLE type
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Feb 1, 2021
1 parent c66d791 commit 0b33d4c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019 - 2020 Anton Tananaev ([email protected])
* Copyright 2019 - 2021 Anton Tananaev ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -186,6 +186,17 @@ protected Object decode(
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ public void testDecode() throws Exception {
verifyNull(decoder, binary(
"ab10150076f1320003100133353534363530373130323933303602105a"));

verifyPositions(decoder, binary(
"ab183200c6bd020101100138363838333230343730323133363209247a0b146090087a641528c03a79ba309be5dec3c2024122c21c2407676267"));

verifyNotNull(decoder, binary(
"ab18480066b107010110013836383833323034373030373832350924a230e35f8200ea312b22bc7894b4b86956a31cbdb989fdb8b502ad2449ea60ab646eea0d5663c59c3dcf05549eb3b095754322df"));

Expand Down

0 comments on commit 0b33d4c

Please sign in to comment.