NimBLE-Arduino icon indicating copy to clipboard operation
NimBLE-Arduino copied to clipboard

presence detection

Open mkohns opened this issue 2 years ago • 2 comments
trafficstars

Have a question. One important feature for smart home applications is to detect presence of persons (or their phones). Due to changing random MAC addresses of i.e smart phones, this is not possible with ble scan of advertises. I mean - this is also a good privacy protection of getting tracked - so don´t get me wrong.

Currently - the only good way which is known to me is using hcitool. With i.e

hcitool name MAC 

You can try to get the name of the static "real" MAC address. You can get also more info like vendor, rssi ... All you need is to have the real mac, which you can get from the phones "about" menu.

So for presence, this known macs are available - and this is nice. I think these calls are called "name request" - but I am not sure.

Is something like this possible with NimBLE? At the end - I am actually looking for a mac based ble ping. If response is there -> device is there. If not - absense.

mkohns avatar Feb 26 '23 21:02 mkohns

Another idea would be to offer a service from within the presence monitor peripheral. Once paired and trusted, the IRK could be used to decode the advertised random MAC to real mac. What about this idea?

https://www.bluetooth.com/blog/bluetooth-technology-protecting-your-privacy/

mkohns avatar Feb 27 '23 06:02 mkohns

This is what hcidump tells you if you make a name request to a known (NOT Advertised) real MAC

hcitool name MAC

< HCI Command: Remote Name Request (0x01|0x0019) plen 10
    bdaddr DC:XX:85:XX:82:XX mode 2 clkoffset 0x0000
> HCI Event: Command Status (0x0f) plen 4
    Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> HCI Event: Remote Host Supported Features Notification (0x3d) plen 14
    bdaddr DC:XX:85:XX:82:XX
    Features: 0x0f 0x00 0x00 0x00 0x00 0x00 0x00 0x00
> HCI Event: Remote Name Req Complete (0x07) plen 255
    status 0x00 bdaddr DC:XX:85:XX:82:XX name 'HERE IS THE NAME'

mkohns avatar Feb 27 '23 10:02 mkohns

NimBLE cannot get the static mac address unless bonded with the phone to get the IRK.

h2zero avatar Jun 04 '24 22:06 h2zero