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

Advertisment not stopping

after connecting and disconnecting advertisment not stopping when i try to stop it ( sdk 11). Without establishing connection i am able to stop it. Nrf51822

Parents
  • If you are using Nordic stack aka Soft Device there is no way it would "automatically" advertise unless you use API to request it. Once the connection is established the advertising stops automatically (that is required by BT SIG specification) meaning if you want to advertise along existing connection you need to start new advertising activity (GAP "slot"). However once connection ends the advertising isn't started unless you call sd_ble_gap_adv_start.

    In case you get BLE_GAP_EVT_CONNECTED event then advertising is already stopped. If you try to stop it by AD API call then it will throw error back. So you either don't do it at all or (e.g. if you do this in some distant module - which is illogical but can be;) you need to set some global flag and not do it in case that connection is ongoing or you should be more careful how you assert return codes from that sd_ble_gap_adv_stop function call.

  • Once the connection is established, the advertising stops automatically. Even if you disconnect later there is no advertising running so nothing to be stopped. If you start it again then you can stop any time later. What part of this isn't your experience?

Reply Children
No Data
Related