Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. WiFi List
Forum Updated to NodeBB v4.3 + New Features

WiFi List

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 4 Posters 295 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cesar Olesk
    wrote on last edited by
    #1

    I'm using QT6.7, and I trying get a list of the wifi connections available. But I not find any example, just ones with deprecated classes from before QT6.
    I found the classes QNetworkAccessManager and QNetworkInformation in subdir QtNetwork, but I don't know how used it.
    Any easy way to do it?
    Thanks

    artwawA 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      AFAIK, there's no such functionality.
      QNAM is for making request and QNetworkInformation is for getting information about the current active network connection.
      If you really need that kind of low level information, you should check your platform API.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • C Cesar Olesk

        I'm using QT6.7, and I trying get a list of the wifi connections available. But I not find any example, just ones with deprecated classes from before QT6.
        I found the classes QNetworkAccessManager and QNetworkInformation in subdir QtNetwork, but I don't know how used it.
        Any easy way to do it?
        Thanks

        artwawA Offline
        artwawA Offline
        artwaw
        wrote on last edited by
        #3

        @Cesar-Olesk Hi, this is not supported.

        You can get existing interfaces using QNetworkInterface class but can't manipulate them.
        You should use, as suggested, native platform API in order to achieve your goal. Please bear in mind that on certain platforms in certain configurations any such action might require running your software with elevated privileges.

        For more information please re-read.

        Kind Regards,
        Artur

        1 Reply Last reply
        1
        • MesrineM Offline
          MesrineM Offline
          Mesrine
          wrote on last edited by
          #4

          Hi, I am trying to implement the same thing. What I am doing is using qtdbus to communicate with the IWD. In the same way, one can use another service like wpa_supplicant.

          This is some tests I am doing

          #include <QDBusArgument>
          #include <QDBusConnection>
          #include <QDBusInterface>
          
          int main(int argc, char *argv[])
          {
              QCoreApplication app(argc, argv);
          
              auto connection = QDBusConnection::systemBus();
          
              QDBusInterface iwdStation("net.connman.iwd",
                                        "/net/connman/iwd/0/4",
                                        "net.connman.iwd.Station",
                                        connection);
              if (iwdStation.isValid()) {
                  qDebug() << "is valid " << iwdStation.property("State").isValid();
                  auto message = iwdStation.call("GetOrderedNetworks");
                  qDebug() << "message:" << message;
                  auto args = message.arguments();
                  qDebug() << "args:" << args;
                  for (const auto &arg : args) {
                 
                      const auto argsI = arg.value<QDBusArgument>();
                      QDBusObjectPath opath;
                      qint16 strenght;
                      argsI.beginMap();
                      while (!argsI.atEnd()) {
                          argsI.beginMapEntry();
                          argsI >> opath >> strenght;
                          argsI.endMapEntry();
          
                          qDebug() << opath.path() << " " << strenght;
          
                          QDBusInterface network("net.connman.iwd",
                                                 opath.path(),
                                                 "net.connman.iwd.Network",
                                                 connection);
                          qDebug() << "network Name: " << network.property("Name").toString() << "\n"
                                   << network.property("Connected").toBool() << "\n"
                                   << network.property("Type").toString();
                      }
                      argsI.endMap();
                  }
              }
          
              return app.exec();
          }
          

          This gives me the available networks. Still, there is much room for improvement.

          1 Reply Last reply
          2

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved