station: Simplify usage of station_signal_agent_notify()
Jesse Lentz
PATCH 1/2 station: Simplify usage of station_signal_agent_notify()
station_signal_agent_notify() has been refactored so that its usage is simpler. station_rssi_level_changed() has been replaced by an inlined call to station_signal_agent_notify().
--- src/station.c | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-)
src/station.c +12 -26
@@ -1438,6 +1438,8 @@ static void station_set_drop_unicast_l2_multicast(struct station *station, "drop_unicast_in_l2_multicast", v); } +static void station_signal_agent_notify (struct station *station); +static void station_enter_state (struct station *station,enum station_state state) {
@@ -2754,9 +2756,6 @@ static void station_event_channel_switched(struct station *station,network_bss_update (network, station->connected_bss); } -static void station_rssi_level_changed (struct station *station, -uint8_t level_idx); -static bool station_try_next_bss (struct station *station) {struct scan_bss *next;
@@ -3011,7 +3010,8 @@ static void station_netdev_event(struct netdev *netdev, enum netdev_event event,station_ok_rssi (station);break ;case NETDEV_EVENT_RSSI_LEVEL_NOTIFY : -station_rssi_level_changed (station,l_get_u8 (event_data)); +if (station->signal_agent) +station_signal_agent_notify (station);break ;case NETDEV_EVENT_ROAMING :station_enter_state (station,STATION_STATE_ROAMING );
@@ -3645,9 +3645,13 @@ struct signal_agent {unsigned int disconnect_watch; }; -static void station_signal_agent_notify (struct signal_agent *agent, -const char *device_path,uint8_t level) +static void station_signal_agent_notify (struct station *station) { +struct signal_agent *agent = station->signal_agent; +struct netdev *netdev = station->netdev; +const char *device_path =netdev_get_path (netdev); +uint8_t level =netdev_get_rssi_level_idx (netdev); +struct l_dbus_message *msg; msg = l_dbus_message_new_method_call(dbus_get_bus(),
@@ -3660,18 +3664,6 @@ static void station_signal_agent_notify(struct signal_agent *agent,l_dbus_send (dbus_get_bus (), msg); } -static void station_rssi_level_changed (struct station *station, -uint8_t level_idx) -{ -struct netdev *netdev = station->netdev; - -if (!station->signal_agent) -return ; - -station_signal_agent_notify (station->signal_agent, -netdev_get_path (netdev), level_idx); -} -static void station_signal_agent_release (struct signal_agent *agent,const char *device_path) {
@@ -3762,14 +3754,8 @@ static struct l_dbus_message *station_dbus_signal_agent_register( reply =l_dbus_message_new_method_return (message);l_dbus_send (dbus, reply); -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); - } +if (station->connected_network) +station_signal_agent_notify (station);return NULL ; }
Signature · 1 line
2.36.0
Jesse Lentz
PATCH 2/2 station: Provide SignalLevelAgent update while connecting
When a station enters the "connecting" state, if a SignalLevelAgent is registered, provide an initial signal level via a "Changed" method call.
--- src/station.c | 3 +++ 1 file changed, 3 insertions(+)
src/station.c +3 -0
@@ -1487,6 +1487,9 @@ static void station_enter_state(struct station *station,network_get_path (station->connected_network), IWD_NETWORK_INTERFACE, "Connected"); +if (station->signal_agent) +station_signal_agent_notify (station); +periodic_scan_stop (station);break ;case STATION_STATE_CONNECTED :
Signature · 1 line
2.36.0
Denis Kenzior
Hi Jesse,
Quoted 7 lines · Jesse Lentz
station_signal_agent_notify()has been refactored so that its usage is simpler.station_rssi_level_changed()has been replaced by an inlined call tostation_signal_agent_notify().--- src/station.c | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-)
Both applied, thanks.
Regards,
-Denis