Is it possible to advertise in non-connectable mode while scanning/connecting/connected as a Central?
Is it possible to advertise in non-connectable mode while scanning/connecting/connected as a Central?
Yes, it is possible.
You can use ble_advdata_set(..) to set the packet data and then start advertising with the SoftDevice call sd_ble_gap_adv_start(..). See the ble_app_beacon example for how to do this in more detail.
To do non-connectable advertising you should not use the ble_advertising module. You can use ble_advdata_set(..)
to set the packet data and then start advertising with the SoftDevice call sd_ble_gap_adv_start(..)
. See the ble_app_beacon example for how to do this in more detail.
Updated ;)
I'm seeing issues when I try to use the ble_advertising module to enable "connectable" advertising after using sd_ble_gap_adv_start() to start nonconnectable advertising. Specifically, I get a hardfault when the ble_advertising_init() routine does its thing.
You can't do connectable advertising and non-connectable advertising at the same time (using the SoftDevice). If you are going to do connectable advertising you have to stop non-connectable advertising first.
Alternatively you can do non-connectable advertising in timeslot. See the multiactivity example in the SDK for more detail.