-
Bug
-
Resolution: Incomplete
-
Not Evaluated
-
None
-
4.7.2
-
None
-
Qt SDK 1.1 beta
Ovi Suite 3.0.0.290
Hi,
I'm working an app (for Symbian) that needs to connect over 3G only (not WiFi). So I've written a bit of code that lists all the 'network configurations' available and picks up the first 3G connection it can find.
To save time I develop for Desktop (Windows) and use a phone connected by USB (and Nokia Ovi Suite to manage the connection). My code looks like this:
QNetworkConfigurationManager* confManager = new QNetworkConfigurationManager();
QList<QNetworkConfiguration> confList = confManager->allConfigurations();
QNetworkConfiguration defaultConf = confManager->defaultConfiguration();
qDebug() << "Number of network confs = " << confList.count();
int found = -1;
for ( int i=0 ; i< confList.count() ; i++ )
{
qDebug() << " conf #" << i << " = " << confList[i].name()
<< ", bearer name = " << confList[i].bearerTypeName()
<< ", bearer id = " << confList[i].bearerType()
<< ", state = " << confList[i].state()
<< ", type = " << confList[i].type();
if ( ( confList[i].bearerType() == QNetworkConfiguration::BearerCDMA2000 )
( confList[i].bearerType() == QNetworkConfiguration::BearerWCDMA ) |
---|
( confList[i].bearerType() == QNetworkConfiguration::BearerHSPA ) // Phone connected to PC using Ovi Suite on Windows XP |
( confList[i].name().contains("Nokia Ovi Suite", Qt::CaseInsensitive) ) ) { // We select the first entry that matches our criteria, so // hopefully we'll pick up the 3G 'Destination' with the highest // ranking... if ( found == -1 ) found = i; } } |
delete confManager;
accessManager = new QNetworkAccessManager(this);
if ( found >=0 )
else
{ qDebug() << "Using default conf = " << defaultConf.name() << ", bearer name = " << defaultConf.bearerTypeName() << ", bearer id = " << defaultConf.bearerType(); } // When connected to the office network, we use a proxy
if ( (found==-1) && (defaultConf.bearerType()==QNetworkConfiguration::BearerEthernet) )
On Windows XP, it works fine: the tethering connection has a readable name, something like "Nokia X6 [connected with Nokia Ovi Suite] so my code picks it up fine even though the bearerName is "Unknown" and the bearerType is BearerUnknown.
On Windows 7 (64-bit), the information I get is not usable. It seems to have a lot of 'spurious' entries (I'm sure there is a meaning behind them, but it's strange there aren't nowhere as many on Windows XP). Even with my ethernet cable pulled out and my WiFi deactivated, I can't find a combination of parameters that let me verify I'm on 3G. My output looks like this:
Number of network confs = 25
conf # 0 = "Local Area Connection* 2" , bearer name = "Unknown" , bearer id = 0 , state = QFlags(0x2) , type = 0
conf # 1 = "Local Area Connection* 10" , bearer name = "Unknown" , bearer id = 0 , state = QFlags(0x2) , type = 0
conf # 2 = "Local Area Connection" , bearer name = "Ethernet" , bearer id = 1 , state = QFlags(0x2) , type = 0
conf # 3 = "Wireless Network Connection" , bearer name = "Ethernet" , bearer id = 1 , state = QFlags(0x2) , type = 0
conf # 4 = "isatap.
" , bearer name = "Unknown" , bearer id = 0 , state = QFlags(0x2) , type = 0
conf # 5 = "Teredo Tunneling Pseudo-Interface" , bearer name = "Unknown" , bearer id = 0 , state = QFlags(0x2) , type = 0
conf # 6 = "isatap.rd.francetelecom.fr" , bearer name = "Unknown" , bearer id = 0 , state = QFlags(0x2) , type = 0
conf # 7 = "isatap.
" , bearer name = "Unknown" , bearer id = 0 , state = QFlags(0x2) , type = 0
conf # 8 = "Local Area Connection* 13" , bearer name = "Ethernet" , bearer id = 1 , state = QFlags(0x2) , type = 0
conf # 9 = "Local Area Connection* 11-QoS Packet Scheduler-0000" , bearer name = "Unknown" , bearer id = 0 , state = QFlags(0x2) , type = 0
conf # 10 = "Local Area Connection* 12" , bearer name = "Ethernet" , bearer id = 1 , state = QFlags(0x2) , type = 0
conf # 11 = "Local Area Connection* 11-WFP LightWeight Filter-0000" , bearer name = "Unknown" , bearer id = 0 , state = QFlags(0x2) , type = 0
conf # 12 = "Local Area Connection* 13-QoS Packet Scheduler-0000" , bearer name = "Unknown" , bearer id = 0 , state = QFlags(0x2) , type = 0
conf # 13 = "Local Area Connection* 12-QoS Packet Scheduler-0000" , bearer name = "Unknown" , bearer id = 0 , state = QFlags(0x2) , type = 0
conf # 14 = "Local Area Connection* 6-QoS Packet Scheduler-0000" , bearer name = "Unknown" , bearer id = 0 , state = QFlags(0x2) , type = 0
conf # 15 = "Wireless Network Connection-Native WiFi Filter Driver-0000" , bearer name = "Unknown" , bearer id = 0 , state = QFlags(0x2) , type = 0
conf # 16 = "Local Area Connection* 9-QoS Packet Scheduler-0000" , bearer name = "Unknown" , bearer id = 0 , state = QFlags(0x2) , type = 0
conf # 17 = "Local Area Connection* 11" , bearer name = "Ethernet" , bearer id = 1 , state = QFlags(0x2) , type = 0
conf # 18 = "Local Area Connection* 9" , bearer name = "Ethernet" , bearer id = 1 , state = QFlags(0x2) , type = 0
conf # 19 = "Local Area Connection* 6" , bearer name = "Unknown" , bearer id = 0 , state = QFlags(0x2) , type = 0
conf # 20 = "Local Area Connection* 7" , bearer name = "Unknown" , bearer id = 0 , state = QFlags(0x2) , type = 0
conf # 21 = "Local Area Connection* 8" , bearer name = "Unknown" , bearer id = 0 , state = QFlags(0x2) , type = 0
conf # 22 = "Local Area Connection 2" , bearer name = "Unknown" , bearer id = 0 , state = QFlags(0x2) , type = 0
conf # 23 = "Local Area Connection* 9-WFP LightWeight Filter-0000" , bearer name = "Unknown" , bearer id = 0 , state = QFlags(0x2) , type = 0
conf # 24 = "Local Area Connection* 14" , bearer name = "Unknown" , bearer id = 0 , state = QFlags(0x2) , type = 0
Using default conf = "" , bearer name = "" , bearer id = 0
The Ovi Suite connection does not seem to have a meaningful name anymore, and I can't even use the state to find it because all the have their state == 0x2.
Worse: I can't use the name of the default configuration to see which entry was eventually selected in the list because its name is empty.
When I try the same code on my personal laptop (Windows 7 32-bit) at home, I get the same amount of 'spurious' connections, plus my WiFi connection is displayed with bearerType == BearerEthernet and not BearerWLAN! So my code tries and use a proxy (my office configuration)
I don't think that behaviour is correct (especially the wrong bearerType). Is there anyway to discriminate between 'logical' connections (e.g. VPN) and 'physical' connections (ethernet, WiFi)?
Thanks for your help!
Regards,
Jerome
- relates to
-
QTBUG-18824 QNetworkSession::open does not complete for network interfaces with status "media disconnected" in windows 7
-
- Closed
-