diff mbox series

[BlueZ,v3,3/4] src/device: Added function to set connection parameters

Message ID 20240510150938.1492169-3-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit d391bf4cf320743e780faed31b294c44040762c9
Headers show
Series [BlueZ,v3,1/4] profiles/gap: Some code cleanup | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Luiz Augusto von Dentz May 10, 2024, 3:09 p.m. UTC
From: "Felipe F. Tonello" <eu@felipetonello.com>

This function allows plugins to set the connection parameters of the
respective btd_device object.

It is useful for GAP Peripheral Preferred Connection Parameters
characteristic for example.
---
 src/device.c | 14 ++++++++++++++
 src/device.h |  3 +++
 2 files changed, 17 insertions(+)
diff mbox series

Patch

diff --git a/src/device.c b/src/device.c
index 1d4b8ab36720..79d8bb7ebc9b 100644
--- a/src/device.c
+++ b/src/device.c
@@ -7322,3 +7322,17 @@  void btd_device_foreach_ad(struct btd_device *dev, bt_ad_func_t func,
 {
 	bt_ad_foreach_data(dev->ad, func, data);
 }
+
+void btd_device_set_conn_param(struct btd_device *device, uint16_t min_interval,
+					uint16_t max_interval, uint16_t latency,
+					uint16_t timeout)
+{
+	btd_adapter_store_conn_param(device->adapter, &device->bdaddr,
+					device->bdaddr_type, min_interval,
+					max_interval, latency,
+					timeout);
+	btd_adapter_load_conn_param(device->adapter, &device->bdaddr,
+					device->bdaddr_type, min_interval,
+					max_interval, latency,
+					timeout);
+}
diff --git a/src/device.h b/src/device.h
index 5722ca9cafe0..1a9f7e72a00f 100644
--- a/src/device.h
+++ b/src/device.h
@@ -204,3 +204,6 @@  typedef void (*bt_device_ad_func_t)(void *data, void *user_data);
 
 void btd_device_foreach_ad(struct btd_device *dev, bt_device_ad_func_t func,
 							void *data);
+void btd_device_set_conn_param(struct btd_device *device, uint16_t min_interval,
+					uint16_t max_interval, uint16_t latency,
+					uint16_t timeout);