sta: add sta_connection_state enum

Make the connection state of a sta-info more readable by introducing an
enum for the STA connection state.

Also switch come comparison cases to use the explicit enum values to
make the code more readable.

Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
David Bauer
2021-09-27 19:35:55 +02:00
parent 30f9ba7617
commit d3ff0d59da
5 changed files with 17 additions and 11 deletions

4
sta.c
View File

@@ -111,7 +111,7 @@ usteer_sta_info_get(struct sta *sta, struct usteer_node *node, bool *create)
void
usteer_sta_info_update_timeout(struct sta_info *si, int timeout)
{
if (si->connected == 1)
if (si->connected == STA_CONNECTED)
usteer_timeout_cancel(&tq, &si->timeout);
else if (timeout > 0)
usteer_timeout_set(&tq, &si->timeout, timeout);
@@ -145,7 +145,7 @@ void
usteer_sta_info_update(struct sta_info *si, int signal, bool avg)
{
/* ignore probe request signal when connected */
if (si->connected == 1 && si->signal != NO_SIGNAL && !avg)
if (si->connected == STA_CONNECTED && si->signal != NO_SIGNAL && !avg)
signal = NO_SIGNAL;
if (signal != NO_SIGNAL)