-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
4.7.2
-
None
I used the following codes to choose a WLAN networkConfiguration:
if(QNetworkConfiguration::BearerWLAN == temConfigration.bearerType ()
&& QNetworkConfiguration::Discovered == temConfigration.state())
{
myInterestConfigurations.append(temConfigration);
}
and then use the WLAN networkConfiguration to create a networkSession:
QNetworkConfiguration mytemConfigration = myInterestConfigurations.takeFirst(); qDebug()<< "create a session using this Configration: "<< mytemConfigration.name(); //set callbacks and start internet connection m_session = new QNetworkSession(mytemConfigration, this);
and at last open the networkSession:
connect(m_session, SIGNAL(opened()), this, SLOT(networkSessionOpened())); connect(m_session,SIGNAL(error(QNetworkSession::SessionError)),this,SLOT(error(QNetworkSession::SessionError))); m_session->open();
After the session has been opened, the app first start to connect to the WLAN network.
But if your phone has another internet access point e.g. named "CMNET", and its priority is higher than the priority of your WLAN, then finally this app will connect to CMNET other than the WLAN which the networkSession is based on.
We think the app should connect to WLAN directly, should not connect to CMNET regardless of their priorities.
Please check the attached demo as reference.