Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do you connect to a Wireless WIFI Network in QT or windows API? [closed]

Tags:

c++

windows

qt

api

is there any APIs for detecting wireless networks? , or any QT class for detecting wireless networks and connecting to them . QNetworkInterface is the closest class but it does not support it .

like image 664
Meysam Hit Avatar asked Oct 29 '13 11:10

Meysam Hit


1 Answers

You can use QNetworkConfigurationManager and QNetworkSession

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();

It first searches for the network with you desired name and then tries to connect to it.

like image 62
masoud Avatar answered Oct 14 '22 05:10

masoud