extmod/network_cyw43: Add support to get STA RSSI using status() method.

This enables the use of WLAN(0).status('rssi') to get current RSSI of the
AP that the STA is connected to.

Signed-off-by: Damien George <damien@micropython.org>
pull/11009/head
Oliver Joos 2023-03-11 15:59:31 +01:00 zatwierdzone przez Damien George
rodzic 11b5ee0d7c
commit f34af3e42e
1 zmienionych plików z 8 dodań i 0 usunięć

Wyświetl plik

@ -314,6 +314,14 @@ STATIC mp_obj_t network_cyw43_status(size_t n_args, const mp_obj_t *args) {
// one argument: return status based on query parameter
switch (mp_obj_str_get_qstr(args[1])) {
case MP_QSTR_rssi: {
if (self->itf != CYW43_ITF_STA) {
mp_raise_ValueError(MP_ERROR_TEXT("STA required"));
}
int32_t rssi;
cyw43_wifi_get_rssi(self->cyw, &rssi);
return mp_obj_new_int(rssi);
}
case MP_QSTR_stations: {
// return list of connected stations
if (self->itf != CYW43_ITF_AP) {