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

Advertise in non-connectable and then directed

Dear Sir,

I am talking with respect to the ble_app_hrs example in the SDK 15 for nrf52832. I am using softdevice S132.

In the example the code is implemented such that it does a connectable undirected connection.

I need the following scenario.

1.)Advertise in non-connectable mode.

2.)Receive the scan req report which gives the peer addresses and rssi value.

3.)Find the peer with highest rssi value.

4.)Connect the device to that peer 

I made the following channge to make the device advertise in non connectable mode. Inside the function "set_adv_mode_fast" i modified the line as follows

#endif // !defined (S112)
p_advertising->adv_params.properties.type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_SCANNABLE_UNDIRECTED;//BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED;
#if !defined (S112)

I enabled the corresponding variable to receive the scan repoprt.

And I manged to get the peer address of the phone with highest rssi.

Now I want to do a directed advertising with this peer address.

In order to do this , Do I need to call the function "ble_advertising_start"  with  mode as BLE_ADV_MODE_DIRECTED?.

I am calling  "err_code = ble_advertising_peer_addr_reply();"  function from  the switch case (:case BLE_ADV_EVT_PEER_ADDR_REQUEST:)   inside the function "  on_adv_evt().".

Are these modifications sufficient to serve my purpose?

with regards,

Geetha

Related