cancel
Showing results for 
Search instead for 
Did you mean: 

Forcing a server to disconnect?

SWenn.1
Senior III

Hello ....

I have an apk that seems to lose comms with a server.  We have not been able to make it periodic or obvious as to the reason.  We would like the server to timeout after 30 seconds of not receiving read/write rqsts from the client and force it's state to HCI_DISCONNECTION_COMPLETE_EVT_CODE which in turn will put it back into advertising mode.

Can someone tell me what function can I call to set the parameter for the function SVCCTL_App_Notification(void *p_Pckt) which is a registered task in the sequencer?  I would like to set the state and then I will call UTIL_SEQ_SetTask function

Thanks

 

3 REPLIES 3
STTwo-32
ST Employee

Hello @SWenn.1 

For such a use case, you would typically need to create a timer that starts counting upon the last read/write request from the client. If the timer reaches 30 seconds without any new read/write requests, you would then programmatically trigger a disconnection.

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

SWenn.1
Senior III

Thank you for the response...yes but the question is in the details of exactly what to do to "programmatically trigger a disconnect"?

Since the exact function to set such a parameter is not available, I cannot give you a specific function call to achieve this. If the functionality is similar to the one used for the notification measurements timer, you would need to:

  1. Create a timer with a 30-second timeout.
  2. Start the timer.
  3. In the callback function triggered by the timer, set the server state to HCI_DISCONNECTION_COMPLETE_EVT_CODE.

Best Reagrds.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.