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 17:53:23 -0400 [thread overview]
Message-ID: <20220520215324.15537-1-jesse@twosheds.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 2420 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 | 19 ++++++++++++++-----
3 files changed, 20 insertions(+), 5 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..61dd690b 100644
--- a/src/station.c
+++ b/src/station.c
@@ -3716,6 +3716,7 @@ static struct l_dbus_message *station_dbus_signal_agent_register(
{
struct station *station = user_data;
const char *path, *sender;
+ struct l_dbus_message *reply;
struct l_dbus_message_iter level_iter;
int8_t levels[16];
int err;
@@ -3758,12 +3759,20 @@ 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.
- */
+ reply = l_dbus_message_new_method_return(message);
+ l_dbus_send(dbus, reply);
- return l_dbus_message_new_method_return(message);
+ if (station->connected_network)
+ {
+ struct netdev *netdev = station->netdev;
+ uint8_t level = netdev_get_rssi_level_idx(netdev);
+
+ station_signal_agent_notify(station->signal_agent,
+ netdev_get_path(netdev),
+ level);
+ }
+
+ return NULL;
}
static struct l_dbus_message *station_dbus_signal_agent_unregister(
--
2.36.0
next reply other threads:[~2022-05-20 21:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-20 21:53 Jesse Lentz [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-05-20 22:00 [PATCH 1/2] Initial signal level notification Denis Kenzior
2022-05-20 20:50 Jesse Lentz
2022-05-20 20:11 Denis Kenzior
2022-05-20 18:59 Jesse Lentz
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=20220520215324.15537-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.