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:
NeilClack
2026-08-13 16:18:51 -05:00
parent 2f014aec8a
commit 1c14c0401e
+26 -2
View File
@@ -358,10 +358,34 @@ AccessPointInfo WifiDevice::getActiveAccessPoint() const {
return AccessPointInfo{}; // No active AP return AccessPointInfo{}; // No active AP
} }
// Would need to fetch AP properties here
// For now, return basic info
AccessPointInfo ap; AccessPointInfo ap;
ap.object_path = ap_path; 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; return ap;
} }