How to advertise while connected(14585)?

Learn MoreFAQsTutorials

2 posts / 0 new
Last post
Gavin Sun
Offline
Last seen:2 months 1 week ago
加入:2015-02-10 09:08
How to advertise while connected(14585)?

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

Device:
PM_Dialog
Offline
Last seen:6天12 hours ago
工作人员
加入:2018-02-08 11:03
Hi Gavin Sun,

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