Handling null WifiInformation (#16700)

Signed-off-by: Gaël L'hopital <gael@lhopital.org>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
Gaël L'hopital 2024-04-29 01:32:55 +02:00 committed by Ciprian Pascu
parent 7e062102fa
commit 84f97476e6
2 changed files with 7 additions and 5 deletions

View File

@ -46,14 +46,16 @@ public class APManager extends ListableRest<APManager.WifiAp, APManager.APRespon
long txBytes, // transmitted bytes (from Freebox to station)
long txRate, // reception data rate (in bytes/s)
long rxRate, // transmission data rate (in bytes/s)
WifiInformation wifiInformation) {
@Nullable WifiInformation wifiInformation) {
public int getSignal() {
return wifiInformation.signal();
public int getRSSI() {
WifiInformation local = wifiInformation;
return local != null ? local.signal : 1;
}
public @Nullable String getSsid() {
return wifiInformation().ssid();
WifiInformation local = wifiInformation;
return local != null ? local.ssid : null;
}
}

View File

@ -73,7 +73,7 @@ public class WifiStationHandler extends HostHandler {
LanAccessPoint lanAp = wifiHost.get().accessPoint();
if (lanAp != null) {
updateChannelString(GROUP_WIFI, WIFI_HOST, "%s-%s".formatted(lanAp.type(), lanAp.uid()));
updateWifiStationChannels(lanAp.getSignal(), lanAp.getSsid(), lanAp.rxRate(), lanAp.txRate());
updateWifiStationChannels(lanAp.getRSSI(), lanAp.getSsid(), lanAp.rxRate(), lanAp.txRate());
return;
}
}