Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi All,

I am trying to modify the BLE hello sensor app to control BLE advertisement. I am using WICED_SDK_3.5.2.

I have seen that when that BLE peripheral is connected to a master BLE advertisement stops and restart again once it is disconnected from the central.

Now I want to control start and stop advertisement irrespective of connection status. For this I have used the below APIs

        result =  wiced_bt_start_advertisements( BTM_BLE_ADVERT_UNDIRECTED_HIGH, 0, NULL );   //to start BLE adv

        result =  wiced_bt_start_advertisements( BTM_BLE_ADVERT_OFF, 0, NULL );  //to stop BLE

I have observed that BLE starts adverting successfully with above API, but Stop does not seems to work.

So my query is that is it possible to stop BLE adv irrespective of connection status. If so, why is it failing with the api is used? Is there any additional steps required for Stopping BLE adv?

I would really help me if i get a link/reference document giving a brief on the API used in the WICED_SDK. Any help is highly appriciated.

Thanks in advance.

0 Likes
1 Solution
Anonymous
Not applicable

Hi all,

I found that the below API was successfully stopping advertisement.

result =  wiced_bt_start_advertisements( BTM_BLE_ADVERT_OFF, 0, NULL );

It can be validated using below API

wiced_bt_ble_advert_mode_t wiced_bt_ble_get_current_advert_mode(void);

Earlier the problem was once the  wiced_bt_start_advertisements( BTM_BLE_ADVERT_OFF, 0, NULL) is called, we get the ble link callback (event BTM_BLE_ADVERT_STATE_CHANGED_EVT) and it was enabling advertisement again. Disabling the hello_sensor_advertisement_stopped() function call in the callback solved this issue.

Thanks.

View solution in original post

5 Replies