/*! Returns true if \a configuration is a valid WLAN network configuration. False otherwise. */ bool ConnectionManager::validWlanConfiguration( QNetworkConfiguration &configuration) const { bool valid = #ifdef Q_OS_SYMBIAN (configuration.isValid() && configuration.bearerType() == QNetworkConfiguration::BearerWLAN); #else (configuration.isValid() && (configuration.bearerType() == QNetworkConfiguration::BearerWLAN || configuration.type() == QNetworkConfiguration::ServiceNetwork)); #endif if (valid) { qDebug() << "ConnectionManager::validWlanConfiguration():" << configuration.name() << configuration.bearerTypeName() << configuration.bearerType() << configuration.type() << configuration.state() << configuration.isValid(); } return valid; }
int OcNetwork::bearerType() { QNetworkConfiguration netConf = this->activeConfiguration(); QLOG_DEBUG() << "Network bearer type name: " << netConf.bearerTypeName(); QNetworkConfiguration::BearerType bt; bt = netConf.bearerType(); int btNum; switch (bt) { case QNetworkConfiguration::BearerEthernet: case QNetworkConfiguration::BearerWLAN: btNum = 1; break; case QNetworkConfiguration::Bearer2G: case QNetworkConfiguration::BearerCDMA2000: case QNetworkConfiguration::BearerWCDMA: case QNetworkConfiguration::BearerHSPA: btNum = 2; break; case QNetworkConfiguration::BearerUnknown: default: btNum = 0; break; } return btNum; }
bool ServiceDiscovery::networkConfigIsQualified(const QNetworkConfiguration &config) { switch (config.bearerType()) { case QNetworkConfiguration::BearerEthernet: case QNetworkConfiguration::BearerWLAN: return true; case QNetworkConfiguration::BearerUnknown: // unknown is usually ethernet or any other local network return !config.name().contains("Teredo"); case QNetworkConfiguration::Bearer2G: case QNetworkConfiguration::BearerBluetooth: case QNetworkConfiguration::BearerCDMA2000: case QNetworkConfiguration::BearerEVDO: case QNetworkConfiguration::BearerWCDMA: case QNetworkConfiguration::BearerHSPA: case QNetworkConfiguration::Bearer3G: case QNetworkConfiguration::BearerWiMAX: case QNetworkConfiguration::BearerLTE: case QNetworkConfiguration::Bearer4G: return false; } return false; // can never be reached }
void Wpp::onNetworkOnlineStateChanged(bool isOnline) { qDebug() << "Wpp::onNetworkOnlineStateChanged(" << isOnline << ")"; if ( !isOnline ) { setHasNetwork(false); setNetwork(""); setIsSlowNetwork(true); } else { setHasNetwork(true); QNetworkConfiguration networkConfig = networkConfigurationManager.defaultConfiguration(); QNetworkConfiguration::BearerType bearerType = networkConfig.bearerType(); qDebug() << "Wpp::onNetworkOnlineStateChanged():default:" << networkConfig.bearerTypeName(); setNetwork( networkConfig.bearerTypeName() ); switch ( bearerType ) { case QNetworkConfiguration::BearerUnknown: qDebug() << "QNetworkConfiguration::BearerUnknown"; setIsSlowNetwork(true); break; case QNetworkConfiguration::BearerEthernet: qDebug() << "QNetworkConfiguration::BearerEthernet"; setIsSlowNetwork(false); break; case QNetworkConfiguration::BearerWLAN: qDebug() << "QNetworkConfiguration::BearerWLAN"; setIsSlowNetwork(false); break; case QNetworkConfiguration::Bearer2G: qDebug() << "QNetworkConfiguration::Bearer2G"; setIsSlowNetwork(true); break; case QNetworkConfiguration::BearerCDMA2000: qDebug() << "QNetworkConfiguration::BearerCDMA2000"; setIsSlowNetwork(true); break; case QNetworkConfiguration::BearerWCDMA: qDebug() << "QNetworkConfiguration::BearerWCDMA"; setIsSlowNetwork(true); break; case QNetworkConfiguration::BearerHSPA: qDebug() << "QNetworkConfiguration::BearerHSPA"; setIsSlowNetwork(true); break; case QNetworkConfiguration::BearerBluetooth: qDebug() << "QNetworkConfiguration::BearerBluetooth"; setIsSlowNetwork(true); break; case QNetworkConfiguration::BearerWiMAX: qDebug() << "QNetworkConfiguration::BearerWiMAX"; setIsSlowNetwork(true); break; default: qDebug() << "QNetworkConfiguration::default..."; setIsSlowNetwork(true); } } }