本文整理汇总了C++中QNetworkConfiguration::bearerTypeName方法的典型用法代码示例。如果您正苦于以下问题:C++ QNetworkConfiguration::bearerTypeName方法的具体用法?C++ QNetworkConfiguration::bearerTypeName怎么用?C++ QNetworkConfiguration::bearerTypeName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QNetworkConfiguration
的用法示例。
在下文中一共展示了QNetworkConfiguration::bearerTypeName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bearerType
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;
}
示例2: validWlanConfiguration
/*!
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;
}
示例3: printNetworkConfigStatus
void ConnectionManagerPrivate::printNetworkConfigStatus(const QNetworkConfiguration &config) {
qDebug() << "Bearer:" << config.bearerTypeName();
qDebug() << "Roaming available:" << config.isRoamingAvailable();
qDebug() << "Valid:" << config.isValid();
qDebug() << "Name:" << config.name();
qDebug() << "Purpose:" << config.purpose();
qDebug() << "State:" << config.state();
qDebug() << "Type:" << config.type();
}
示例4: updateSession
void SessionWidget::updateSession()
{
updateSessionState(session->state());
if (session->state() == QNetworkSession::Connected)
statsTimer = startTimer(1000);
else
killTimer(statsTimer);
if (session->configuration().type() == QNetworkConfiguration::InternetAccessPoint)
bearer->setText(session->configuration().bearerTypeName());
else {
QNetworkConfigurationManager mgr;
QNetworkConfiguration c = mgr.configurationFromIdentifier(session->sessionProperty("ActiveConfiguration").toString());
bearer->setText(c.bearerTypeName());
}
#ifndef QT_NO_NETWORKINTERFACE
interfaceName->setText(session->interface().humanReadableName());
interfaceGuid->setText(session->interface().name());
#endif
}
示例5: getHostAddress
// ----------------------------------------------------------------------------
// getHostAddress (static)
// ----------------------------------------------------------------------------
QHostAddress NetworkTools::getHostAddress(const QNetworkConfiguration &in_network_config)
{
if (in_network_config.isValid() == false) return QHostAddress();
qDebug() << "NetworkTools::getHostAddress - configuration bearer type:" << in_network_config.bearerTypeName();
QNetworkSession nws(in_network_config);
if (nws.state() == QNetworkSession::Invalid || nws.state() == QNetworkSession::NotAvailable) return QHostAddress();
qDebug() << "NetworkTools::getHostAddress - session state:" << nws.state();
QNetworkInterface nwi = nws.interface();
if (nwi.isValid() == false) return QHostAddress();
if (nwi.addressEntries().isEmpty()) return QHostAddress();
foreach(QNetworkAddressEntry temp, nwi.addressEntries())
qDebug() << "NetworkTools::getHostAddress - session addr entry:" << temp.ip().toString();
QNetworkAddressEntry nwae = nwi.addressEntries().first();
QHostAddress host_address = nwae.ip();
return host_address;
}
示例6: onNetworkOnlineStateChanged
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);
}
}
}