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

How to change Peripheral Role to Central Role without having concurrent Role?

How to change Peripheral Role to Central Role without having concurrent Role?

I know S130 Can have 8 Concurrent Role as Central, Peripheral, Observer, Broadcaster.

But I'd like to make one Single Role, not as an concurrent Role.

For Example, When this DEVICE A turns on for the first time, It needs to work as Peripheral Role till Central device Connect this. When the dedicated work is done, this Central Role disconnects it's connection, and DEVICE A changes it's role from peripheral to Central Role. And this DEVICE A connects to other peripheral device. And when some dedicated work is done, DEVICE A disconnect's it's connection. And DEVICE A REPEATS THIS PROCESS.

Why I would like not to make Concurrent Role is to make other devices not to search this DEVICE A. If DEVICE A is in Central Role, it can't be found by other devices. (Also, It's low of battery power, so I must make it low powered.)

In this scenario, how I can make this done with Softdevice? How do I have to set PERIPHERAL_LINK_COUNT and CENTRAL_LINK_COUNT ? (does it makes any affect?)

And How can I change to Central Role? Can I just (literally JUST) change to Central just after ble_advertising_start?

Is there any Example with this changing Central and Peripheral Role within Single app?

  • Hi Daniel,

    The initialization of SoftDevice is the same, you set how many roles of each type you want to run simultaneously. If you want to run only one Central or one Peripheral then you init SD with 1 and 1. The roles are then activated by particular SoftDevice API function calls such as sd_ble_gap_adv_start, sd_ble_gap_adv_stop, sd_ble_gap_connect etc. If you don't want to be your device discoverable, then simply don't start Advertisement (if there has Peripheral connection ended) or stop it (if it is ongoing). Similar in Central role if you don't want to connect then don't scan and problem is solved. Please study all message sequence charts here, they should tell you more. SoftDevice initialization isn't commitment to running any GAP configuration later during the run time;)

    When it comes to example simple use BLE Central&Peripheral experimental BLE Relay example, just modify sequence of SD function calls to use each GAP role when you need.

    Cheers Jan

  • Thanks, Really. I really mean it.

    I thought, Internally in SoftDevice, If the ADV is on, Softdevice recognize as an peripheral and restrict it's functionality as only to just peripheral role. (I thought it can't use any function of central role.)

    Thanks Really!

Related