diff mbox series

[07/14] station: add ConnectedBss property

Message ID 20240807181427.170515-7-prestwoj@gmail.com (mailing list archive)
State New
Headers show
Series [01/14] network: add network_bss_list_prune | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

James Prestwood Aug. 7, 2024, 6:14 p.m. UTC
This property is a path that corresponds to a BasicServiceSet
object, the one the station is currently connected to.
---
 src/station.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
diff mbox series

Patch

diff --git a/src/station.c b/src/station.c
index 2c4d686b..5a6360de 100644
--- a/src/station.c
+++ b/src/station.c
@@ -4363,6 +4363,23 @@  static bool station_property_get_connected_network(struct l_dbus *dbus,
 	return true;
 }
 
+static bool station_property_get_connected_bss(struct l_dbus *dbus,
+					struct l_dbus_message *message,
+					struct l_dbus_message_builder *builder,
+					void *user_data)
+{
+	struct station *station = user_data;
+
+	if (!station->connected_network)
+		return false;
+
+	l_dbus_message_builder_append_basic(builder, 'o',
+			network_bss_get_path(station->connected_network,
+						station->connected_bss));
+
+	return true;
+}
+
 static bool station_property_get_scanning(struct l_dbus *dbus,
 					struct l_dbus_message *message,
 					struct l_dbus_message_builder *builder,
@@ -4770,6 +4787,9 @@  static void station_setup_interface(struct l_dbus_interface *interface)
 	l_dbus_interface_property(interface, "ConnectedNetwork", 0, "o",
 					station_property_get_connected_network,
 					NULL);
+	l_dbus_interface_property(interface, "ConnectedBss", 0, "o",
+					station_property_get_connected_bss,
+					NULL);
 	l_dbus_interface_property(interface, "Scanning", 0, "b",
 					station_property_get_scanning, NULL);
 	l_dbus_interface_property(interface, "State", 0, "s",