diff mbox series

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

Message ID 20240808174236.218750-4-prestwoj@gmail.com (mailing list archive)
State New
Headers show
Series [v2,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. 8, 2024, 5:42 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(+)

v2:
 * Renamed BasicServiceSets to ExtendedServiceSet
diff mbox series

Patch

diff --git a/src/network.c b/src/network.c
index 9c197731..35e7ba4a 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;
 }
 
@@ -1176,6 +1179,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;
 }
 
@@ -1950,6 +1956,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,
@@ -2249,6 +2277,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,