Fix: Main Menu footer shows 'WiFi Not Connected'
Updated WiFiDevice::getActiveAccessPoint() to read the AP's SSID so connectedSSID() can report which network is in use.
This commit is contained in:
@@ -358,10 +358,34 @@ AccessPointInfo WifiDevice::getActiveAccessPoint() const {
|
||||
return AccessPointInfo{}; // No active AP
|
||||
}
|
||||
|
||||
// Would need to fetch AP properties here
|
||||
// For now, return basic info
|
||||
AccessPointInfo ap;
|
||||
ap.object_path = ap_path;
|
||||
|
||||
// Read the active AP's SSID bytes so connectedSSID() (and the Home footer)
|
||||
// can report which network is in use.
|
||||
sd_bus_message* ssid_msg = nullptr;
|
||||
sd_bus_error ssid_error = SD_BUS_ERROR_NULL;
|
||||
int r = sd_bus_get_property(
|
||||
impl_->bus,
|
||||
"org.freedesktop.NetworkManager",
|
||||
ap_path,
|
||||
"org.freedesktop.NetworkManager.AccessPoint",
|
||||
"Ssid",
|
||||
&ssid_error,
|
||||
&ssid_msg,
|
||||
"ay"
|
||||
);
|
||||
if (r >= 0 && ssid_msg) {
|
||||
const uint8_t* ssid_data = nullptr;
|
||||
size_t ssid_len = 0;
|
||||
r = sd_bus_message_read_array(ssid_msg, 'y', (const void**)&ssid_data, &ssid_len);
|
||||
if (r >= 0 && ssid_data && ssid_len > 0) {
|
||||
ap.ssid = std::string(reinterpret_cast<const char*>(ssid_data), ssid_len);
|
||||
}
|
||||
sd_bus_message_unref(ssid_msg);
|
||||
}
|
||||
sd_bus_error_free(&ssid_error);
|
||||
|
||||
return ap;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user