From: Jesse Lentz <jesse at twosheds.org>
To: iwd at lists.01.org
Subject: [PATCH 1/2] Initial signal level notification
Date: Fri, 20 May 2022 14:59:47 -0400 [thread overview]
Message-ID: <20220520185948.9533-1-jesse@twosheds.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 2404 bytes --]
After registration of a SignalLevelAgent, make iwd inform the client of
the initial signal level via a "Changed" method call.
---
src/netdev.c | 5 +++++
src/netdev.h | 1 +
src/station.c | 16 ++++++++++++----
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/netdev.c b/src/netdev.c
index e483edf8..8b2143fd 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -450,6 +450,11 @@ const char *netdev_get_path(struct netdev *netdev)
return path;
}
+uint8_t netdev_get_rssi_level_idx(struct netdev *netdev)
+{
+ return netdev->cur_rssi_level_idx;
+}
+
static void netdev_set_powered_result(int error, uint16_t type,
const void *data,
uint32_t len, void *user_data)
diff --git a/src/netdev.h b/src/netdev.h
index 0094d5f9..f093c499 100644
--- a/src/netdev.h
+++ b/src/netdev.h
@@ -145,6 +145,7 @@ bool netdev_get_4addr(struct netdev *netdev);
const char *netdev_get_name(struct netdev *netdev);
bool netdev_get_is_up(struct netdev *netdev);
const char *netdev_get_path(struct netdev *netdev);
+uint8_t netdev_get_rssi_level_idx(struct netdev *netdev);
struct handshake_state *netdev_handshake_state_new(struct netdev *netdev);
struct handshake_state *netdev_get_handshake(struct netdev *netdev);
diff --git a/src/station.c b/src/station.c
index 2d85054c..7be256fe 100644
--- a/src/station.c
+++ b/src/station.c
@@ -3709,6 +3709,16 @@ static void signal_agent_disconnect(struct l_dbus *dbus, void *user_data)
netdev_set_rssi_report_levels(station->netdev, NULL, 0);
}
+static void signal_agent_notify_initial(void *user_data)
+{
+ struct station *station = user_data;
+ struct netdev *netdev = station->netdev;
+
+ station_signal_agent_notify(station->signal_agent,
+ netdev_get_path(netdev),
+ netdev_get_rssi_level_idx(netdev));
+}
+
static struct l_dbus_message *station_dbus_signal_agent_register(
struct l_dbus *dbus,
struct l_dbus_message *message,
@@ -3758,10 +3768,8 @@ static struct l_dbus_message *station_dbus_signal_agent_register(
l_debug("agent %s path %s", sender, path);
- /*
- * TODO: send an initial notification in a oneshot idle callback,
- * if state is connected.
- */
+ if (station->connected_network)
+ l_idle_oneshot(signal_agent_notify_initial, station, NULL);
return l_dbus_message_new_method_return(message);
}
--
2.36.0
next reply other threads:[~2022-05-20 18:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-20 18:59 Jesse Lentz [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-05-20 20:11 [PATCH 1/2] Initial signal level notification Denis Kenzior
2022-05-20 20:50 Jesse Lentz
2022-05-20 21:53 Jesse Lentz
2022-05-20 22:00 Denis Kenzior
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=20220520185948.9533-1-jesse@twosheds.org \
--to=unknown@example.com \
/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.