3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

station: send initial signal level notification

After registration of a SignalLevelAgent, make iwd inform the client of
the initial signal level via a "Changed" method call.
This commit is contained in:
Jesse Lentz 2022-05-20 17:53:23 -04:00 committed by Denis Kenzior
parent 0b9e7eb120
commit 3d27d0d80a
3 changed files with 19 additions and 5 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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,19 @@ 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(