I want to make the slave disconnect with the master in a minute automatically.
However, It's failure when I have motified the codes like below:
#define MIN_CONN_INTERVAL MSEC_TO_UNITS(20, UNIT_1_25_MS) /**< Minimum acceptable connection interval (20 ms), Connection interval uses 1.25 ms units. */
#define MAX_CONN_INTERVAL MSEC_TO_UNITS(75, UNIT_1_25_MS) /**< Maximum acceptable connection interval (75 ms), Connection interval uses 1.25 ms units. */
#define SLAVE_LATENCY 0 /**< Slave latency. */
#define CONN_SUP_TIMEOUT MSEC_TO_UNITS(4000, UNIT_10_MS) /**< Connection supervisory timeout (4 seconds), Supervision Timeout uses 10 ms units. */
#define FIRST_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(5000) /**< Time from initiating event (connect or start of notification) to first time sd_ble_gap_conn_param_update is called (5 seconds). */
#define NEXT_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(30000) /**< Time between each call to sd_ble_gap_conn_param_update after the first call (30 seconds). */
#define MAX_CONN_PARAMS_UPDATE_COUNT 3 /**< Number of attempts before giving up the connection parameter negotiation. */
Whatever I change NEXT_CONN_PARAMS_UPDATE_DELAY to xxx value, it doesn't work.
1. What should I do to make the slave disconnecting automatically in a minute?
SDK version: 16.0.0. Softdevice version:7.0.1
Hello Yoole,There might be a mismatch in what you want to achieve and what you are changing here.First of all, I see no mention of which setting you have changed to a minute in the code.
This is the delay before the peripheral requests to update the parameters of the connection, to suit the peripherals requirements. This is not how you initiate a disconnection of the link.The timeout supervision is used to set how long the device will keep the connection live when it does not hear anything from its peer. So, for example, the central will not report the link as broken even though it has not heard anything until the supervision times out.
If you would like the connection to be terminated after a given time, you can use the sd_ble_gap_disconnect function, in connection to a timer ( such as the app_timer ).So, to disconnect after 60 seconds, you should set up a timer which is started on the CONNECTED event, and have the disconnect function called in the timer's expiration handler.Please do not hesitate to ask if anything should be unclear, or if you should encounter any other issues or questions.Best regards,Karl
Thanks for your reply.
Here is a strange performance, I connect the module(slave) with iPhone11(master) and the connection will be disconnected automatically in about 30 seconds. When I debug to check disconnected event, I cannot find that "p_ble_evt->header.evt_id" was called in "ble_evt_handler".
On account of the auto-disconnection, I have no means to use app_timer to revise that timeout.
Can I have your analysis?