remote: close file on usteer_init_local_id fread fail
[project/usteer.git] / sta.c
diff --git a/sta.c b/sta.c
index af4f17e9f474a2e920fa6da61a018f4f9264c74f..ed7e40ecb032224828378f42b262812eeceb6f7b 100644 (file)
--- a/sta.c
+++ b/sta.c
@@ -149,6 +149,8 @@ usteer_sta_get(const uint8_t *addr, bool create)
 void usteer_sta_disconnected(struct sta_info *si)
 {
        si->connected = STA_NOT_CONNECTED;
+       si->kick_time = 0;
+       si->connected_since = 0;
        usteer_sta_info_update_timeout(si, config.local_sta_timeout);
 }
 
@@ -159,8 +161,10 @@ usteer_sta_info_update(struct sta_info *si, int signal, bool avg)
        if (si->connected == STA_CONNECTED && si->signal != NO_SIGNAL && !avg)
                signal = NO_SIGNAL;
 
-       if (signal != NO_SIGNAL)
+       if (signal != NO_SIGNAL) {
                si->signal = signal;
+               usteer_band_steering_sta_update(si);
+       }
 
        si->seen = current_time;
 
@@ -210,20 +214,26 @@ usteer_handle_sta_event(struct usteer_node *node, const uint8_t *addr,
 }
 
 bool
-usteer_sta_supports_beacon_measurement_mode(struct sta *sta, enum usteer_beacon_measurement_mode mode)
+usteer_sta_supports_beacon_measurement_mode(struct sta_info *si, enum usteer_beacon_measurement_mode mode)
 {
        switch (mode) {
                case BEACON_MEASUREMENT_PASSIVE:
-                       return sta->rrm & (1 << 4);
+                       return si->rrm & (1 << 4);
                case BEACON_MEASUREMENT_ACTIVE:
-                       return sta->rrm & (1 << 5);
+                       return si->rrm & (1 << 5);
                case BEACON_MEASUREMENT_TABLE:
-                       return sta->rrm & (1 << 6);
+                       return si->rrm & (1 << 6);
        }
 
        return false;
 }
 
+bool
+usteer_sta_supports_link_measurement(struct sta_info *si)
+{
+       return si->rrm & (1 << 0);
+}
+
 static void __usteer_init usteer_sta_init(void)
 {
        usteer_timeout_init(&tq);