From a2eb10a76df0a8be9725cbcfb83a205c728be9a8 Mon Sep 17 00:00:00 2001 From: Piotr Pryga Date: Thu, 19 Sep 2019 01:14:26 -0700 Subject: [PATCH] Bluetooth: host: Configurable time to run slave conn param update Enable possibility to configure time a slave will wait until start of connection parameters update procedure after BT connection is established. Signed-off-by: Piotr Pryga --- subsys/bluetooth/host/Kconfig | 17 ++++++++++++++--- subsys/bluetooth/host/hci_core.c | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/host/Kconfig b/subsys/bluetooth/host/Kconfig index dbfb9a4706c..6724e7d852f 100644 --- a/subsys/bluetooth/host/Kconfig +++ b/subsys/bluetooth/host/Kconfig @@ -355,9 +355,20 @@ config BT_MAX_PAIRED default) number is 1. config BT_CREATE_CONN_TIMEOUT - int "Timeout for pending LE Create Connection command in seconds" - default 3 - range 1 65535 + int "Timeout for pending LE Create Connection command in seconds" + default 3 + range 1 65535 + +config BT_CONN_PARAM_UPDATE_TIMEOUT + int "Peripheral connection parameter update timeout in milliseconds" + default 5000 + range 1 65535 + + help + The value is a timeout used by peripheral device to wait until it + starts the connection parameters update procedure to change default + connection parameters. The default value is set to 5s, to comply + with BT protocol specification: Core 4.2 Vol 3, Part C, 9.3.12.2 endif # BT_CONN diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index cf8a02b3e96..2804ed8e2cc 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -47,7 +47,7 @@ #include "settings.h" /* Peripheral timeout to initialize Connection Parameter Update procedure */ -#define CONN_UPDATE_TIMEOUT K_SECONDS(5) +#define CONN_UPDATE_TIMEOUT K_MSEC(CONFIG_BT_CONN_PARAM_UPDATE_TIMEOUT) #define RPA_TIMEOUT K_SECONDS(CONFIG_BT_RPA_TIMEOUT) #define HCI_CMD_TIMEOUT K_SECONDS(10)