From d491405561a6d74bd11453d25b990f7c1b2661aa Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Fri, 5 Jan 2024 16:54:42 +0100 Subject: [PATCH] softdevice: add support for connection timeout on connect This adds support for the "connection supervision timeout", basically the connection timeout while the connection is active (as opposed to while connecting). --- gap_nrf528xx-central.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gap_nrf528xx-central.go b/gap_nrf528xx-central.go index a50b6c4e..a0c8db78 100644 --- a/gap_nrf528xx-central.go +++ b/gap_nrf528xx-central.go @@ -149,6 +149,9 @@ func (a *Adapter) Connect(address Address, params ConnectionParams) (Device, err slave_latency: 0, // mostly relevant to connected keyboards etc conn_sup_timeout: 200, // 2 seconds (in 10ms units), the minimum recommended by Apple } + if params.Timeout != 0 { + connectionParams.conn_sup_timeout = uint16(params.Timeout / 16) + } // Flag to the event handler that we are waiting for incoming connections. // This should be safe as long as Connect is not called concurrently. And