decoder icon indicating copy to clipboard operation
decoder copied to clipboard

Give decoders access to the device's Bluetooth address

Open koenvervloesem opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe.

I'd like to implement a decoder for AirTag advertisements. The public key advertised by an AirTag is partly encoded in the device's Bluetooth address. So the decoder should have access to this address.

Describe the solution you'd like

A function device_address that returns a hex string of the Bluetooth address, e.g. de479e575f8b.

Describe alternatives you've considered

None

Additional context

I think I'll also need some kind of concatenation function for hex strings. See https://github.com/koenvervloesem/openhaystack-zephyr/blob/main/modules/openhaystack/src/openhaystack.c for how the public key is encoded. The first six bytes of the public key are encoded in the Bluetooth address, then come some bytes encoded in the manufacturer data.

koenvervloesem avatar Mar 06 '22 19:03 koenvervloesem

Hi @koenvervloesem, just to clarify a few points

• will a property function device_address suffice (initially), or would a model condition and/or property condtion for the MAC address also be required? • With a property function something like "decoder":["string_from_mac_address", 6, 6] to get a substring from index 6 with length 6? • For string concatenation an additional functionality could be implemented in post_proc, so that one substring could be acquired in a .cal property, then post_proc concatenated with a second substring acquired through "string_from_hex_data"!?!

DigiH avatar Aug 19 '22 14:08 DigiH

A string_from_mac_address function seems like an excellent solution.

Concatenation of hex strings in post_proc seems fine too.

koenvervloesem avatar Aug 19 '22 17:08 koenvervloesem

Not following this up at the moment because with the constantly rotating MAC address this would never allow to identify one specific AirTag, but only show an ever changing cryptic public key, which would not really be useful for any user implementation.

Decoder accessing the MAC address and implementing a future string concatenation functionality is still on the table if and when such functionalities are required for utilitarian properties.

DigiH avatar Aug 20 '22 17:08 DigiH

Implemented model condition access to device's MAC address in correct order or reversed with

https://github.com/theengs/decoder/pull/263

DigiH avatar Jan 20 '23 11:01 DigiH

Closing as implemented.

DigiH avatar Aug 10 '23 10:08 DigiH