Skip to main content

How to advertise while connected(14585)?

2 years ago

How to advertise while connected(14585)?

Posted byGavin Sun0 points 1 reply
0 upvotes

I want to keep advertising while connected, how can I do it?

2 years ago

PM_Dialog

Hi Gavin Sun,

When you are connected to a peer device the user_app_adv_undirect_complete() will be triggered (the stack will cancel the advertising), and the completion status will have a value 0x00. So, I would suggest you to modify the check in the “if” argument as follow: if(status == GAP_ERR_CANCELED || status == 0x00 ). By this way, when you are connected, you will be still able to advertise. But you should take care of the state of the application, for example, when the device is disconnected from a peer device, the SDK will send a GAPC_DISCONNECT_IND and then the gapc_disconnect_ind_handler() will be triggered. Although, the state should been changed from APP_CONNECTED to APP_CONNECTABLE (since you have started advertising after the connection).

Thanks, PM_Dialog