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

Distinguish new connection from previous

Hello,

I am developing a wearable device that utilises nRF51822. Right now, I am having a problem because when the wearable device is connected to a new phone, it needs to be able to know that and reset memory.

How should I go about distinguishing a new mobile phone from a re-connection to a previously bonded phone?

I tried to use the peer address to do this, but it changes everytime I disable then enable bluetooth on my iPhone.

Parents
  • Two other solutions come to mind:

    The first solution is only valid if memory isn't accessed before you bond. If you are bonded to the central, you will receive the BLE_GAP_EVT_SEC_INFO_REQUEST event when the central wants to encrypt the link, see this. If you are not bonded you will receive the BLE_GAP_EVT_SEC_PARAMS_REQUEST event when the central wants to bond, see this. You can use this event to trigger a memory reset.

    The second solution is to try to resolve the device address with the IRK(s) of the currently bonded central(s). Have a look at Ulrich's answer here. If you are able to resolve, don't reset memory, if you are not, reset memory.

Reply
  • Two other solutions come to mind:

    The first solution is only valid if memory isn't accessed before you bond. If you are bonded to the central, you will receive the BLE_GAP_EVT_SEC_INFO_REQUEST event when the central wants to encrypt the link, see this. If you are not bonded you will receive the BLE_GAP_EVT_SEC_PARAMS_REQUEST event when the central wants to bond, see this. You can use this event to trigger a memory reset.

    The second solution is to try to resolve the device address with the IRK(s) of the currently bonded central(s). Have a look at Ulrich's answer here. If you are able to resolve, don't reset memory, if you are not, reset memory.

Children
No Data
Related