app_easy_gap_disconnect and callback

4 posts / 0 new
Last post
CD
Offline
Last seen:3 years 9 months ago
加入:2015-11-18 02:51
app_easy_gap_disconnect and callback

Hello,

Please let me ask the question about app_easy_gap_disconnect() function.

1. If we call app_easy_gap_disconnect() function, is always gapc_disconnect_ind_handler() called?
Even we call app_easy_gap_disconnect(), rarely our app can't detect app_on_disconnect event. Is it possible to happen??

2. How about the case the connection is already "DISCONNECT" when the app call app_easy_gap_disconnect()?
Is app_on_disconnect called in this case??

3.In the gapc_disconnect_ind_handler(), there are some conditions to execute callback "app_on_disconnect()" as following:
if( (state == APP_SECURITY) || (state == APP_CONNECTED) || (state == APP_PARAM_UPD) )
Are there any timings that gapc_disconnect_ind_handler() is called when the state is not matches with above?

I think, problem exists on our app codes, but I would like to know the condition for these related things with app_easy_gap_disconnect().
Thank you very much for your support in advance.

Best Regards,
CD

Device:
Joacimwe
Offline
Last seen:1 year 4 months ago
Guru
加入:2014-01-14 06:45
When you call app_easy_gap

When you call app_easy_gap_disconnect(), it will tell the stack to shut down the current link if there is any. When the link has been disconnected for any reason, your gapc_disconnect_ind_handler will be called. So if you call app_easy_gap_disconnect() your gapc_disconnect_ind_handler should be called very soon as long as there was an active connection when you disconnected. Are you seeing a different behaviour?

Your gapc_disconnect_ind_handler() will not be called unless there is an active connection.

The app states are entirely in the userspace code and not managed by ROM code. I guess the check for the state is there for debugging purposes. Your gapc_disconnect_ind_handler won't be called spuriously.

MT_dialog
Offline
Last seen:1 month 5 days ago
Staff
加入:2015-06-08 11:34
Hi CD,

Hi CD,

1. Yes if you send a GAPC_DISCONNECT_CMD the response is going to be a GAPC_DISCONNECT_IND, those are the messages to the appropriate callbacks you mentioned. I dont see how this is possible to disconnect from your application and not being able to get the disconnect indication. check the gapc_disconnect_ind_handler() callback, this is the callback that invokes the app_on_disconnect and check the state your application.

2. If you are advertising and you send a GAPC_DISCONNECT_CMD for instance, the indication is not going to be sent thus the app_on_disconnect isn't going to be called as well.

3.t条件检查he state of your application, if the disconnection occured while the application state was during security, or during a parameter update or while the application was in connected state. As soon as the device is disconnected, and the indication for the disconnection is sent from the stack the callback will be executed.

Thanks MT_dialog

CD
Offline
Last seen:3 years 9 months ago
加入:2015-11-18 02:51
Hello Joacimwe and MT,

Hello Joacimwe and MT,

Thank you very much for your so quick reply!

I totally understood them. I think the connection state in our app code may be wrong even in case the state machine for the connection "is" totally correct... I will feed it back to our team.
Thank you for your cooperation!

Best Regards,
CD