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;
        }
    
  • Yes, I know this can do directed advertising, but in my description as above, our application will go to deep sleep by calling sd_power_system_off, after that, when our device wake up from deep sleep, the bonded handle had lost. So we can't go to the direct advertising successfully, and then the whitelist advertising will replace the directed advertising.

Reply Children
No Data
Related