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

How can I use directed advertizing when my application reset or wake up from sd_power_system_off?

Hi, every one,

In my application , we need to bond my device with host , and then our application will go to deep sleep by calling sd_power_system_off. When I wake up my application by a wake up pin, how to do the directed advertizing when I had bonded my device with host successfully before?

Parents
  • You can use the ble_advertising module, look into the documentation here

    You then you just use ble_advertising_start(BLE_ADV_MODE_DIRECTED);

    and then implement the peer address fetch in your application ble_event handler as below

        case BLE_ADV_EVT_PEER_ADDR_REQUEST:
        {
            ble_gap_addr_t peer_address;
    
            // Only Give peer address if we have a handle to the bonded peer.
            if(m_bonded_peer_handle.appl_id != DM_INVALID_ID)
            {
                            
                err_code = dm_peer_addr_get(&m_bonded_peer_handle, &peer_address);
                APP_ERROR_CHECK(err_code);
            
                err_code = ble_advertising_peer_addr_reply(&peer_address);
                APP_ERROR_CHECK(err_code);
                
            }
            break;
        }
    
  • You have to use device manager, Make sure that you are bonding, not just pairing because only bond information is stored on flash (if you use device manager) device manager will read flash and take out the bond information when booting up. So using it will be effective in your case when the system is waking up from deep sleep.

Reply Children
No Data
Related