Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to get the current SSID? What are QNetworkConfigurations?



  • Finally I would like to get the list of available SSIDs of available Wifi access points, like in the Windows panel wifi applet or the corresponding Linux wifi applet which let you select the wifi network (access point). Is it possible with Qt? I have come to the conclusion that it's not.

    But right now it would be enough to just get the name of the currently active WiFi connection in Windows 7 and especially in Android. Is even that possible? I have thought that the list of QNetworkConfigurations given by QNetworkAccessManager would do that. But I don't get any reasonable list. I have this code:

    void Connection::slotNetworksUpdated() {
        QNetworkAccessManager accMgr(nullptr);
        qDebug() << accMgr.activeConfiguration().name();
        QList<QNetworkConfiguration> confList = this->m_netMgr.allConfigurations();
        for (auto conf: confList){
            this->networksStringList << conf.name();
    
            qDebug() << conf.name() <<  conf.state() << conf.type() << conf.bearerType() << (conf == accMgr.activeConfiguration());
            QList<QNetworkConfiguration> childList{conf.children()};
            for (auto child: childList) {
                qDebug() << child.name();
            }
        }
    

    The list is quite much nonsense.

    Connection::slotNetworksUpdated 230: ""
    Connection::slotNetworksUpdated 235: "Lähiverkkoyhteys" QFlags(0x2) 0 1 false
    Connection::slotNetworksUpdated 235: "isatap.{C35FD744-57B2-46B6-B089-D07B4F408FE3}" QFlags(0x2) 0 0 false
    Connection::slotNetworksUpdated 235: "Teredo Tunneling Pseudo-Interface" QFlags(0x2) 0 0 false

    So, there's no active connection? And no wireless bearers at all? Even though the machine is connected to a wireless network even while typing this. Only "Lähiverkkoyhteys" is meaninful, the others are some technical garbage.

    Does this have something to do with the fact that the wireless connection is through a usb stick?


Log in to reply