public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v2 1/5] device: Add btd_device_bdaddr_type_connected
@ 2025-07-14 20:35 Luiz Augusto von Dentz
  2025-07-14 20:35 ` [PATCH BlueZ v2 2/5] doc: Add org.bluez.Bearer.LE and org.bluez.Bearer.BREDR Luiz Augusto von Dentz
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Luiz Augusto von Dentz @ 2025-07-14 20:35 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds btd_device_bdaddr_type_connected which can return the
connected state based on the address type.
---
 src/device.c | 8 ++++++++
 src/device.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/src/device.c b/src/device.c
index a50d9ad5cee5..eed2edcf0dfc 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3632,6 +3632,14 @@ bool btd_device_bearer_is_connected(struct btd_device *dev)
 	return dev->bredr_state.connected || dev->le_state.connected;
 }
 
+bool btd_device_bdaddr_type_connected(struct btd_device *dev, uint8_t type)
+{
+	if (type == BDADDR_BREDR)
+		return dev->bredr_state.connected;
+
+	return dev->le_state.connected;
+}
+
 static void clear_temporary_timer(struct btd_device *dev)
 {
 	if (dev->temporary_timer) {
diff --git a/src/device.h b/src/device.h
index 4eebcebe9d5c..9e7c30ad7186 100644
--- a/src/device.h
+++ b/src/device.h
@@ -110,6 +110,7 @@ void device_set_tx_power(struct btd_device *device, int8_t tx_power);
 void device_set_flags(struct btd_device *device, uint8_t flags);
 bool btd_device_is_connected(struct btd_device *dev);
 bool btd_device_bearer_is_connected(struct btd_device *dev);
+bool btd_device_bdaddr_type_connected(struct btd_device *dev, uint8_t type);
 uint8_t btd_device_get_bdaddr_type(struct btd_device *dev);
 bool device_is_retrying(struct btd_device *device);
 void device_bonding_complete(struct btd_device *device, uint8_t bdaddr_type,
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-07-15 18:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-14 20:35 [PATCH BlueZ v2 1/5] device: Add btd_device_bdaddr_type_connected Luiz Augusto von Dentz
2025-07-14 20:35 ` [PATCH BlueZ v2 2/5] doc: Add org.bluez.Bearer.LE and org.bluez.Bearer.BREDR Luiz Augusto von Dentz
2025-07-14 20:35 ` [PATCH BlueZ v2 3/5] bearer: Add initial implementation of org.bluez.Bearer.{BREDR, LE} Luiz Augusto von Dentz
2025-07-14 20:35 ` [PATCH BlueZ v2 4/5] client: Add support for org.bluez.Bearer.{BREDR, LE}1 Luiz Augusto von Dentz
2025-07-14 20:35 ` [PATCH BlueZ v2 5/5] client: Rework handling of Disconnected signal Luiz Augusto von Dentz
2025-07-14 22:00 ` [BlueZ,v2,1/5] device: Add btd_device_bdaddr_type_connected bluez.test.bot
2025-07-15 18:30 ` [PATCH BlueZ v2 1/5] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox