mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-02-04 03:14:07 +01:00
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:
parent
7e062102fa
commit
84f97476e6
@ -46,14 +46,16 @@ public class APManager extends ListableRest<APManager.WifiAp, APManager.APRespon
|
|||||||
long txBytes, // transmitted bytes (from Freebox to station)
|
long txBytes, // transmitted bytes (from Freebox to station)
|
||||||
long txRate, // reception data rate (in bytes/s)
|
long txRate, // reception data rate (in bytes/s)
|
||||||
long rxRate, // transmission data rate (in bytes/s)
|
long rxRate, // transmission data rate (in bytes/s)
|
||||||
WifiInformation wifiInformation) {
|
@Nullable WifiInformation wifiInformation) {
|
||||||
|
|
||||||
public int getSignal() {
|
public int getRSSI() {
|
||||||
return wifiInformation.signal();
|
WifiInformation local = wifiInformation;
|
||||||
|
return local != null ? local.signal : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @Nullable String getSsid() {
|
public @Nullable String getSsid() {
|
||||||
return wifiInformation().ssid();
|
WifiInformation local = wifiInformation;
|
||||||
|
return local != null ? local.ssid : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ public class WifiStationHandler extends HostHandler {
|
|||||||
LanAccessPoint lanAp = wifiHost.get().accessPoint();
|
LanAccessPoint lanAp = wifiHost.get().accessPoint();
|
||||||
if (lanAp != null) {
|
if (lanAp != null) {
|
||||||
updateChannelString(GROUP_WIFI, WIFI_HOST, "%s-%s".formatted(lanAp.type(), lanAp.uid()));
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user