This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Search a specific BLE peripheral device

Hello,

we have developed a custom BLE peripheral device. All peripheral devices have the same name. If we want to indetify a specific peripheral device with a smartphone APP, we use the manufacturer data during advertising to set a Flag, if the user press a button on the pheripheral device. After the smartphone find the specific peripheral device we perform a bonding and in addition the smartphone save the MAC Address from the periheral device, to ensure that the Smartphone only try to connect to this device. After the bonding is performed the peripheral allows only devices from the whitelist. Is this the right way to indentify a specific peripheral device and ensure that the smartphone always reconnect to the same device?

Parents
  • Hello Frederic,

    Why so complicated when you have "unique" MAC (Advertising) address of the peripheral device from the beginning (advertising, active scanning, target of connection)? Even BLE stack on handset side is using it for "db" of known devices (e.g. when you disable "Service Changed" characteristic on peripheral side then phones will use short service discovery just based on 6-byte MAC address and GATT handles from BLE peripheral stack will be "cached").

    If you are worried about "uniqueness" of the MAC across your device base then you can either check it during manufacturing process (because then I assume your solution is based on that value and thus you read/log it at some point) or you can easily assign your unique 43-bit number, write it to the flash (e.g. to UICR region) and use as Adv. Address during every boot of the device. But even Nordic does guarantee neither 100% uniqueness nor randomness of the 8-byte Device Address (which I personally completely understand) I'd bet you will never see two equal MAC addresses in the field.

    Cheers Jan

  • And how this scale with more than one phone? What you do when you see advertisement with flag set but that was done after connection with another phone? I'm either missing something from your high-level use case or it's rather "why to do it simple if we can make it complicated" story:)

Reply Children
No Data
Related