Skip to main content
SWenn.1
Senior III
April 8, 2024
Question

Forcing a server to disconnect?

  • April 8, 2024
  • 2 replies
  • 993 views

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

 

2 replies

STTwo-32
Technical Moderator
May 23, 2024

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
SWenn.1Author
Senior III
May 24, 2024

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

STTwo-32
Technical Moderator
May 28, 2024

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.