mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-05 00:05:59 +08:00
Fix active AP (#21511)
* Revert "Qt logging through cloudlog (#21452)"
This reverts commit 54b6a9f121.
* set activeAp after scan so it's not blocking
* Revert "Revert "Qt logging through cloudlog (#21452)""
This reverts commit d9689a55057d53f7afe8e2ea28542eb80175a705.
* clean up
* move to another PR
This commit is contained in:
@@ -335,6 +335,7 @@ void WifiManager::stateChange(unsigned int new_state, unsigned int previous_stat
|
||||
void WifiManager::propertyChange(const QString &interface, const QVariantMap &props, const QStringList &invalidated_props) {
|
||||
if (interface == NM_DBUS_INTERFACE_DEVICE_WIRELESS && props.contains("LastScan")) {
|
||||
if (this->isVisible() || firstScan) {
|
||||
activeAp = getActiveAp();
|
||||
refreshNetworks();
|
||||
emit refreshSignal();
|
||||
firstScan = false;
|
||||
@@ -449,6 +450,16 @@ void WifiManager::setTetheringEnabled(bool enabled) {
|
||||
}
|
||||
}
|
||||
|
||||
QString WifiManager::getActiveAp() {
|
||||
QDBusInterface device_props(NM_DBUS_SERVICE, adapter, NM_DBUS_INTERFACE_PROPERTIES, bus);
|
||||
device_props.setTimeout(DBUS_TIMEOUT);
|
||||
|
||||
QDBusMessage response = device_props.call("Get", NM_DBUS_INTERFACE_DEVICE_WIRELESS, "ActiveAccessPoint");
|
||||
QDBusObjectPath r = get_response<QDBusObjectPath>(response);
|
||||
return r.path();
|
||||
}
|
||||
|
||||
|
||||
bool WifiManager::isTetheringEnabled() {
|
||||
if (activeAp != "" && activeAp != "/") {
|
||||
return get_property(activeAp, "Ssid") == tethering_ssid;
|
||||
|
||||
@@ -70,6 +70,7 @@ private:
|
||||
QList<Network> get_networks();
|
||||
void connect(const QByteArray &ssid, const QString &username, const QString &password, SecurityType security_type);
|
||||
QString activeAp;
|
||||
QString getActiveAp();
|
||||
void deactivateConnection(const QString &ssid);
|
||||
QVector<QDBusObjectPath> get_active_connections();
|
||||
uint get_wifi_device_state();
|
||||
|
||||
Reference in New Issue
Block a user