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 .
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With