当前位置: 首页>>代码示例>>C++>>正文


C++ QNetworkConfiguration::bearerType方法代码示例

本文整理汇总了C++中QNetworkConfiguration::bearerType方法的典型用法代码示例。如果您正苦于以下问题:C++ QNetworkConfiguration::bearerType方法的具体用法?C++ QNetworkConfiguration::bearerType怎么用?C++ QNetworkConfiguration::bearerType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QNetworkConfiguration的用法示例。


在下文中一共展示了QNetworkConfiguration::bearerType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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;
}
开发者ID:Alex237,项目名称:tic-tac-toe-qt,代码行数:29,代码来源:connectionmanager.cpp

示例2: 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;

}
开发者ID:Buschtrommel,项目名称:ocNews,代码行数:30,代码来源:ocnetwork.cpp

示例3: networkConfigIsQualified

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
}
开发者ID:strahlex,项目名称:QtQuickVcp,代码行数:23,代码来源:servicediscovery.cpp

示例4: 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);

		}
	}
}
开发者ID:AndrewDesign,项目名称:wpp-qt,代码行数:63,代码来源:Wpp.cpp


注:本文中的QNetworkConfiguration::bearerType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。