diff mbox series

[v3,04/13] network: add ExtendedServiceSet DBus property

Message ID 20240812154613.126522-4-prestwoj@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series [v3,01/13] dbus: Add net.connman.iwd.BasicServiceSet interface | expand

Checks

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

Commit Message

James Prestwood Aug. 12, 2024, 3:46 p.m. UTC
This contains a list of all BasicServiceSet objects (paths) that
exist for a network.
---
 src/network.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
diff mbox series

Patch

diff --git a/src/network.c b/src/network.c
index 8c16d9a6..76238e56 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1149,6 +1149,9 @@  static bool network_unregister_bss(void *a, void *user_data)
 	l_dbus_unregister_object(dbus_get_bus(),
 					network_bss_get_path(network, bss));
 
+	l_dbus_property_changed(dbus_get_bus(), network->object_path,
+				IWD_NETWORK_INTERFACE, "ExtendedServiceSet");
+
 	return true;
 }
 
@@ -1174,6 +1177,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, "ExtendedServiceSet");
+
 	return true;
 }
 
@@ -1960,6 +1966,28 @@  static bool network_property_get_known_network(struct l_dbus *dbus,
 	return true;
 }
 
+static bool network_property_get_extended_service_set(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,
@@ -2259,6 +2287,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, "ExtendedServiceSet", 0, "ao",
+				network_property_get_extended_service_set, NULL);
 }
 
 static bool network_bss_property_get_address(struct l_dbus *dbus,