Skip to content

Commit

Permalink
Handling null WifiInformation (#16700)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaël L'hopital <gael@lhopital.org>
  • Loading branch information
clinique committed Apr 28, 2024
1 parent 1af3ecd commit 1437a2a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Expand Up @@ -46,14 +46,16 @@ public static record LanAccessPoint(String mac, String type, String uid, @Nullab
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;
}
}

Expand Down
Expand Up @@ -73,7 +73,7 @@ protected void internalPoll() throws FreeboxException {
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;
}
}
Expand Down

0 comments on commit 1437a2a

Please sign in to comment.