openhaystack: store battery status in FindMy packet
See also:
https://github.com/seemoo-lab/openhaystack/issues/185
e5a678e33d/FindMyFlipper/findmy_state.c (L126-L137)
From https://github.com/biemster/FindMy/issues/53
Advertising byte:
?xx1rrmrr
r: reserved
m: maintained
x: can be set. x must be:
00: full
01: medium
10: low
11: critical
this doesn't seem to correspond with the above links
master
parent
4d8c46ba51
commit
924f96300f
|
|
@ -1,3 +1,4 @@
|
|||
0.01: New App!
|
||||
0.02: Keep advertising when connected
|
||||
0.03: Use ble_advert module to work with other BLE advert apps
|
||||
0.04: Update battery status in advertising packet
|
||||
|
|
|
|||
|
|
@ -38,7 +38,12 @@ https://github.com/seemoo-lab/openhaystack/issues/59#issuecomment-1303236903
|
|||
{
|
||||
const key = E.toUint8Array(atob(${JSON.stringify(keyValue)})); // public key
|
||||
const mac = [ key[0] | 0b11000000, key[1], key[2], key[3], key[4], key[5] ].map(x => x.toString(16).padStart(2, '0')).join(':'); // mac address
|
||||
const adv = [ 0x1e, 0xff, 0x4c, 0x00, 0x12, 0x19, 0x00, key[6], key[7], key[8], key[9], key[10], key[11], key[12], key[13], key[14], key[15], key[16], key[17], key[18], key[19], key[20], key[21], key[22], key[23], key[24], key[25], key[26], key[27], key[0] >> 6, 0x00 ]; // advertising packet
|
||||
let batt = E.getBattery();
|
||||
if (batt > 80) batt = 0x0; // full
|
||||
else if (batt > 50) batt = 0x50; // medium
|
||||
else if (batt > 20) batt = 0xa0; // low
|
||||
else batt = 0xf0; // critical
|
||||
const adv = [ 0x1e, 0xff, 0x4c, 0x00, 0x12, 0x19, batt, key[6], key[7], key[8], key[9], key[10], key[11], key[12], key[13], key[14], key[15], key[16], key[17], key[18], key[19], key[20], key[21], key[22], key[23], key[24], key[25], key[26], key[27], key[0] >> 6, 0x00 ]; // advertising packet
|
||||
NRF.setAddress(mac);
|
||||
require("ble_advert").push(adv, {whenConnected: true, interval: 1000}); // advertise AirTag *and* normal device name (to remain connectable)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{ "id": "openhaystack",
|
||||
"name": "OpenHaystack (AirTag)",
|
||||
"icon": "icon.png",
|
||||
"version":"0.03",
|
||||
"version":"0.04",
|
||||
"description": "Copy a base64 key from https://github.com/seemoo-lab/openhaystack and make your Bangle.js trackable as if it's an AirTag",
|
||||
"tags": "openhaystack,bluetooth,ble,tracking,airtag",
|
||||
"type": "bootloader",
|
||||
|
|
|
|||
Loading…
Reference in New Issue