How to set default access point using Qt Mobility APIs
m (corrected one small minor mistake)
m (moved How To Set Default Access Point Using Qt Mobility APIs to How to set default access point using Qt Mobility APIs)
Revision as of 13:26, 17 May 2010
|ID||Creation date||29th Mar 2010|
|Platform||S60 5th Edition||Tested on devices||Nokia N97|
|Category||Qt for Symbian||Subcategory||Qt Mobility API|
|Keywords (APIs, classes, methods, functions): QNetworkSession, QNetworkConfigurationManager,QConfigurationManager|
- This article will explain how to set default access point using the Bearer Management APIs of the Qt Mobility Package.
Project Configuration File (.pro file)
- Add the Qt Mobility project configuration option in the .Pro file as shown below
CONFIG += mobility
MOBILITY += bearer
- Do add the Qt mobility name space before using any Qt mobility APIs,
- declare a QNetworkSession object in the header file which will help in opening the network connections.
- After declaring the QNetworkSession object we need to use the QNetworkConfigurationManager and QNetworkConfiguration class to ask the user about the access point and make that as a default connection.
A sample function is shown below :
const bool selectIap = (manager.capabilities()& QNetworkConfigurationManager::CanStartAndStopInterfaces);
QNetworkConfiguration defaultIap = manager.defaultConfiguration();
if(!defaultIap.isValid() && (!selectIap && defaultIap.state() != QNetworkConfiguration::Active))
// let the user know that there is no access point available
session = new QNetworkSession(defaultIap,this);
- In one of my previous article i explained the HTTP GET and POST mechanism using QT APIs, that article can be easily extended to ask the user at first to select an access point and make that as default connection.
- The screenshots shown below illustrates the above point clearly: