2420528_en-US

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

2420528_en-US

2420528_en-US

KW47: Is it necessary to wait for gAdvertisingStateChanged_c before calling Gap_StartAdvertising?

Hello,

I am implementing advertising control on the KW47.

To stop advertising, I use Gap_StopAdvertising(). However, there are cases where I would like to start advertising again before receiving the gAdvertisingStateChanged_c event after issuing the stop request.

In this situation, is it safe to call Gap_StartAdvertising() while the Gap_StopAdvertising() operation is still in progress?

Specifically, which of the following sequences is recommended?

---
Gap_StopAdvertising()
↓
Wait for gAdvertisingStateChanged_c
↓
Gap_StartAdvertising()
----

or

---
Gap_StopAdvertising()
↓
Gap_StartAdvertising()
---

Does the SDK handle the state transition internally, or is it necessary to wait for the gAdvertisingStateChanged_c event that indicates advertising has stopped before calling Gap_StartAdvertising()?

Thank you for your support.

Best regards.

Protocol: BluetoothRe: KW47: Is it necessary to wait for gAdvertisingStateChanged_c before calling Gap_StartAdvertising

Hello @hyama,

Could you provide a more context on the scenario where you would like to restart advertising before receiving the gAdvertisingStateChanged_c event?

The recommended approach is to wait for the gAdvertisingStateChanged_c event to verify that the advertising state transition has completed successfully. While Gap_StopAdvertising() initiates the procedure, the callback confirms the result of the operation. For example, instead of receiving a gAdvertisingStateChanged_c event, the application may receive a gAdvertisingCommandFailed_c event indicating that the requested operation could not be completed.


BR
Habib

Re: KW47: Is it necessary to wait for gAdvertisingStateChanged_c before calling Gap_StartAdvertising

Thank you for the clarification.

We asked this question because we expected the SDK might internally handle the stop and start requests in sequence, even if Gap_StartAdvertising() was called before receiving the gAdvertisingStateChanged_c event.

Since waiting for the gAdvertisingStateChanged_c event is the recommended approach, we will modify our implementation accordingly.

Thank you for your support.

Tags (1)
No ratings
Version history
Last update:
Tuesday
Updated by: