Wireless Daemon for Linux
 help / color / mirror / Atom feed
* [PATCH v2 1/4] ap: add Name property
@ 2021-02-01 23:52 James Prestwood
  2021-02-01 23:52 ` [PATCH v2 2/4] doc: document Name property on AP interface James Prestwood
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: James Prestwood @ 2021-02-01 23:52 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 2105 bytes --]

Its useful being able to refer to the network Name/SSID once
an AP is started. For example opening an iwctl session with an
already started AP provides no way of obtaining the SSID.
---
 src/ap.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

v2:
 * changed 'SSID' to 'Name'

diff --git a/src/ap.c b/src/ap.c
index 37dd05b9..f33d73e1 100644
--- a/src/ap.c
+++ b/src/ap.c
@@ -2971,12 +2971,18 @@ static void ap_if_event_func(enum ap_event_type type, const void *event_data,
 		l_dbus_property_changed(dbus_get_bus(),
 					netdev_get_path(ap_if->netdev),
 					IWD_AP_INTERFACE, "Started");
+		l_dbus_property_changed(dbus_get_bus(),
+					netdev_get_path(ap_if->netdev),
+					IWD_AP_INTERFACE, "Name");
 		break;
 
 	case AP_EVENT_STOPPING:
 		l_dbus_property_changed(dbus_get_bus(),
 					netdev_get_path(ap_if->netdev),
 					IWD_AP_INTERFACE, "Started");
+		l_dbus_property_changed(dbus_get_bus(),
+					netdev_get_path(ap_if->netdev),
+					IWD_AP_INTERFACE, "Name");
 
 		if (!ap_if->pending)
 			ap_if->ap = NULL;
@@ -3112,6 +3118,22 @@ static bool ap_dbus_property_get_started(struct l_dbus *dbus,
 	return true;
 }
 
+static bool ap_dbus_property_get_name(struct l_dbus *dbus,
+					struct l_dbus_message *message,
+					struct l_dbus_message_builder *builder,
+					void *user_data)
+{
+	struct ap_if_data *ap_if = user_data;
+
+	if (!ap_if->ap || !ap_if->ap->config || !ap_if->ap->started)
+		return false;
+
+	l_dbus_message_builder_append_basic(builder, 's',
+						ap_if->ap->config->ssid);
+
+	return true;
+}
+
 static void ap_setup_interface(struct l_dbus_interface *interface)
 {
 	l_dbus_interface_method(interface, "Start", 0, ap_dbus_start, "",
@@ -3123,6 +3145,8 @@ static void ap_setup_interface(struct l_dbus_interface *interface)
 
 	l_dbus_interface_property(interface, "Started", 0, "b",
 					ap_dbus_property_get_started, NULL);
+	l_dbus_interface_property(interface, "Name", 0, "s",
+					ap_dbus_property_get_name, NULL);
 }
 
 static void ap_destroy_interface(void *user_data)
-- 
2.26.2

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

end of thread, other threads:[~2021-02-02 21:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-01 23:52 [PATCH v2 1/4] ap: add Name property James Prestwood
2021-02-01 23:52 ` [PATCH v2 2/4] doc: document Name property on AP interface James Prestwood
2021-02-01 23:52 ` [PATCH v2 3/4] client: ap: show Name in 'ap <wlan> show' James Prestwood
2021-02-01 23:52 ` [PATCH v2 4/4] ap: tie diagnostic interface to AP Start/Stop James Prestwood
2021-02-02 21:55 ` [PATCH v2 1/4] ap: add Name property Denis Kenzior

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