diff mbox series

[06/14] network: add BasicServiceSets property on the network object

Message ID 20240807181427.170515-6-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 will hold an array of object paths pointing to each
BasicServiceSet object.
---
 src/network.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
diff mbox series

Patch

diff --git a/src/network.c b/src/network.c
index e3f5bee8..de56eaaf 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1176,6 +1176,9 @@  static bool network_register_bss(struct network *network, struct scan_bss *bss,
 					L_DBUS_INTERFACE_PROPERTIES, bss))
 		return false;
 
+	l_dbus_property_changed(dbus_get_bus(), network->object_path,
+				IWD_NETWORK_INTERFACE, "BasicServiceSets");
+
 	return true;
 }
 
@@ -1938,6 +1941,28 @@  static bool network_property_get_known_network(struct l_dbus *dbus,
 	return true;
 }
 
+static bool network_property_get_basic_service_sets(struct l_dbus *dbus,
+					struct l_dbus_message *message,
+					struct l_dbus_message_builder *builder,
+					void *user_data)
+{
+	struct network *network = user_data;
+	const struct l_queue_entry *e;
+
+	l_dbus_message_builder_enter_array(builder, "o");
+
+	for (e = l_queue_get_entries(network->bss_list); e; e = e->next) {
+		struct scan_bss *bss = e->data;
+		const char *path = network_bss_get_path(network, bss);
+
+		l_dbus_message_builder_append_basic(builder, 'o', path);
+	}
+
+	l_dbus_message_builder_leave_array(builder);
+
+	return true;
+}
+
 bool network_register(struct network *network, const char *path)
 {
 	if (!l_dbus_object_add_interface(dbus_get_bus(), path,
@@ -2236,6 +2261,9 @@  static void setup_network_interface(struct l_dbus_interface *interface)
 
 	l_dbus_interface_property(interface, "KnownNetwork", 0, "o",
 				network_property_get_known_network, NULL);
+
+	l_dbus_interface_property(interface, "BasicServiceSets", 0, "ao",
+				network_property_get_basic_service_sets, NULL);
 }
 
 static bool network_bss_property_get_bssid(struct l_dbus *dbus,