This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

problems in advertsing after disconnect

hiii....

1.can any one tell where do we call advertising_start() function if we want to advertise after getting disconnect from a central device.

2.in ble_evt_dispatch() function there are many functions ryt? eg: ble_dlogs_on_ble_evt(&m_dlogs, p_ble_evt); ble_conn_params_on_ble_evt(p_ble_evt); on_ble_evt(p_ble_evt);

when and how these works?

    1. Your on_ble_evt function should have a case to handle BLE_GAP_EVT_DISCONNECTED. That would be an appropriate place to restart advertising.

    2. The ble_evt_dispatch function allows you to distribute ble events to any functions your application needs that may want to do some handling of a ble event. At a minimum you probably need the generic on_ble_evt and ble_conn_params_on_ble_evt calls. This allows your application to react appropriately to ble events. In my case I also call the bond manager ble event handler and my own custom event handler. My custom handler allows my custom service and characteristics to react appropriately to connect and disconnect events. You need to understand the needs of your application and handle ble events as needed.

  • john

    thanks for the replay.your second answer clear my doubt..

    1. i am trying to develop a custom profile with concurrent broadcast feature. ie. when ever there is an active connection device starts a non-connectable advertisement.. if get disconnected it starts connectable advertisement.

    what we are doing is in on_ble_evt() function. in case BLE_GAP_EVT_CONNECTED: starts non-connectable advertsement and in case BLE_GAP_EVT_DISCONNECTED:stops non-connectable advertisement and starts connectable advertisement.

    everything working fine. but some times even though there is no active connection device shows non connectable advertisement... my assumption is may be disconnect event is not properly receiving.. is there any chance to miss disconnect event? or i have to call advertisements some where else too/...?

  • That is hard for me to say without being able to debug the code myself. That said, I have never seen a disconnect event not be sent up from the stack when a disconnect occurs. Perhaps you could keep counts of connect and disconnect events and when this occurs check the counts to see if you missed one?

Related