Connecting to wifi



  • Hello,

    is there a better way to connect to wifi on embedded linux device(variscite DART-6UL) than to use Qprocess and manipulate terminal like so:

        QProcess process;
        QStringList arguments;
        QString stdout;
        process.start("ifconfig wlan0 up");
        process.waitForFinished(-1);
        arguments << "-c" << "iw dev wlan0 scan | grep SSID";
        process.start("sh" ,arguments);
        process.waitForFinished();
    

    I've seen a few posts recommending to look into QNetworkConfigurationManager but all it does is list network interfaces not wifi networks i could connect to.


  • Moderators

    @Eligijus If WLAN is activated on your device (ifconfig wlan0 up) then QNetworkConfigurationManager should actually show it.



  • WLAN is activated on my device and QNetworkConfigurationManager shows wlan0 but NOT the networks.

        ncm->updateConfigurations();
        myList = ncm->allConfigurations();
        for(int i = 0; i < myList.size(); i ++)
        {
            qDebug() << myList.at(i).name();
        }
    

    outputs:
    "Wired"
    "sit0"
    "wlan0"
    "can0"
    "eth0"
    "eth1"
    "eth0"
    And executing "iw dev wlan0 scan | grep SSID" i get:
    SSID: Lina
    SSID: VAI-FI
    SSID: Liblanka
    SSID: Cgates_FB5C
    SSID: 40
    SSID: Linksys2


  • Moderators

    @Eligijus What is your use case? Usually you connect to a network using the OS not your app.



  • @jsulm On embedded linux device a qt application is ran on startup. So within that application i need to provide interface for wifi(scanning networks, connecting to network, getting information about network...). Touchscreen is my only way to interact with application so i can't just whip out a terminal and connect to wifi :).
    Yesterday i have found a possible solution - libconnman-qt. It is a qt bindings for connman(network manager for linux) but haven't tested it yet.



  • I have the same problem. Have you you solved the problem ?


Log in to reply