Initial signal level notification
Jesse Lentz
PATCH 1/2 Initial signal level notification
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(-)
src/netdev.c +5 -0
@@ -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)
src/netdev.h +1 -0
@@ -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);
src/station.c +14 -5
@@ -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(
Signature · 1 line
2.36.0
Jesse Lentz
PATCH 2/2 Document initial signal level notification
Document the initial "Changed" method call following SignalLevelAgent registration.
--- doc/station-api.txt | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)
doc/station-api.txt +14 -13
@@ -182,16 +182,17 @@ Methods void Release(object device) [noreply] void Changed(object device, uint8 level) [noreply] This method gets called when the signal strength - measurement for the device's connected network - changes enough to go from one level to another out - of the N ranges defined by the array of (N-1) - threshold values passed to RegisterSignalLevelAgent(). - The level parameter is in the range from 0 to N, - 0 being the strongest signal or above the first - threshold value in the array, and N being the - weakest and below the last threshold value. For - example if RegisterSignalLevelAgent was called with - the array [-40, -50, -60], the 'level' parameter of - 0 would mean signal is received at -40 or more dBm - and 3 would mean below -60 dBm and might correspond - to 1 out of 4 bars on a UI signal meter. + measurement for the device's connected network changes + enough to go from one level to another out of the N + ranges defined by the array of (N-1) threshold values + passed to RegisterSignalLevelAgent(). It also gets + called immediately after the signal level agent is + registered. The level parameter is in the range from 0 + to N, 0 being the strongest signal or above the first + threshold value in the array, and N being the weakest + and below the last threshold value. For example if + RegisterSignalLevelAgent was called with the array [-40, + -50, -60], the 'level' parameter of 0 would mean signal + is received at -40 or more dBm and 3 would mean below + -60 dBm and might correspond to 1 out of 4 bars on a UI + signal meter.
Signature · 1 line
2.36.0
Denis Kenzior
Hi Jesse,
Quoted 8 lines · Jesse Lentz
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(-)
I added a 'station:' prefix to the commit message and...
src/station.c static struct l_dbus_message *station_dbus_signal_agent_register( · line 3766
Quoted 2 lines
src/station.c +2
-0+if (station->connected_network) + {
... since we use the kernel coding style, I amended this to:
if (..) {
Both patches applied, thanks!
Regards,
-Denis