Connecting to wifi in raspberry pi



  • Re: Qt - Connecting to wireless networks

    with this sample code :

    QNetworkConfiguration cfg;
    QNetworkConfigurationManager ncm;
    auto nc = ncm.allConfigurations();
    
    for (auto &x : nc)
    {
    if (x.bearerType() == QNetworkConfiguration::BearerWLAN)
    {
    if (x.name() == "YouDesiredNetwork")
    cfg = x;
    }
    }
    
    auto session = new QNetworkSession(cfg, this);
    session->open();
    

    I can find and connect to my wifi when running in my pc (Ubuntu 18.04).

    But when I run this code on Raspberry pi 3, this doesn't work!
    All configuration names are names of network interfaces (e.g wlan0, eth0, ...) not ssids! And also type of wlan0 is Ethernet!

    Anyone know how to use qt network api to connect to wifi nets in Raspberry pi?