All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 3/5] ap: add SSID property
Date: Mon, 01 Feb 2021 14:05:16 -0800	[thread overview]
Message-ID: <20210201220518.36975-3-prestwoj@gmail.com> (raw)
In-Reply-To: <20210201220518.36975-1-prestwoj@gmail.com>

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

Its useful being able to refer to the 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 | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/src/ap.c b/src/ap.c
index fddf0255..d58932dd 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, "SSID");
 		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, "SSID");
 
 		if (!ap_if->pending)
 			ap_if->ap = NULL;
@@ -3112,6 +3118,24 @@ static bool ap_dbus_property_get_started(struct l_dbus *dbus,
 	return true;
 }
 
+static bool ap_dbus_property_get_ssid(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;
+	const char *ssid;
+
+	if (!ap_if->ap || !ap_if->ap->config || !ap_if->ap->started)
+		ssid = "";
+	else
+		ssid = ap_if->ap->config->ssid;
+
+	l_dbus_message_builder_append_basic(builder, 's', 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 +3147,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, "SSID", 0, "s",
+					ap_dbus_property_get_ssid, NULL);
 }
 
 static void ap_destroy_interface(void *user_data)
-- 
2.26.2

  parent reply	other threads:[~2021-02-01 22:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-01 22:05 [PATCH 1/5] ap: return error from GetDiagnostics if not started James Prestwood
2021-02-01 22:05 ` [PATCH 2/5] client: ap: handle NotFound on diagnostic interface James Prestwood
2021-02-01 22:05 ` James Prestwood [this message]
2021-02-01 22:05 ` [PATCH 4/5] doc: document SSID property on AP interface James Prestwood
2021-02-01 22:21   ` Denis Kenzior
2021-02-01 22:05 ` [PATCH 5/5] client: ap: show SSID in 'ap <wlan> show' James Prestwood
2021-02-01 22:10   ` James Prestwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210201220518.36975-3-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.