handle unknonw bearer types
This commit is contained in:
parent
5f202789c4
commit
468bdbd4fe
@ -325,7 +325,11 @@ void NymeaConnection::updateActiveBearers()
|
||||
QList<QNetworkConfiguration> configs = m_networkConfigManager->allConfigurations(QNetworkConfiguration::Active);
|
||||
// qDebug() << "Network configuations:" << configs.count();
|
||||
foreach (const QNetworkConfiguration &config, configs) {
|
||||
// qDebug() << "Candidate network config:" << config.name() << config.bearerTypeFamily() << config.bearerTypeName();
|
||||
qDebug() << "Candidate network config:" << config.name() << config.bearerTypeFamily() << config.bearerTypeName();
|
||||
|
||||
// NOTE: iOS doesn't correctly report bearer types. It'll be Unknown all the time
|
||||
// availableBearerTypes.setFlag(Connection::BearerTypeUnknown);
|
||||
|
||||
availableBearerTypes.setFlag(qBearerTypeToNymeaBearerType(config.bearerType()));
|
||||
}
|
||||
// qDebug() << "Available bearers:" << availableBearerTypes;
|
||||
@ -368,8 +372,8 @@ Connection::BearerType NymeaConnection::qBearerTypeToNymeaBearerType(QNetworkCon
|
||||
return Connection::BearerTypeCloud;
|
||||
case QNetworkConfiguration::BearerBluetooth:
|
||||
return Connection::BearerTypeBluetooth;
|
||||
default:
|
||||
qWarning() << "Unhandled Bearer Type Family:" << type;
|
||||
case QNetworkConfiguration::BearerUnknown:
|
||||
return Connection::BearerTypeUnknown;
|
||||
}
|
||||
return Connection::BearerTypeNone;
|
||||
}
|
||||
|
||||
@ -45,6 +45,7 @@ public:
|
||||
BearerTypeEthernet = 0x02,
|
||||
BearerTypeBluetooth = 0x04,
|
||||
BearerTypeCloud = 0x08,
|
||||
BearerTypeUnknown = 0xFF,
|
||||
BearerTypeAll = 0xFF
|
||||
};
|
||||
Q_ENUM(BearerType)
|
||||
|
||||
@ -206,7 +206,7 @@ bool NymeaHostsFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &s
|
||||
if (m_nymeaConnection && !m_showUneachableBearers) {
|
||||
bool hasReachableConnection = false;
|
||||
for (int i = 0; i < host->connections()->rowCount(); i++) {
|
||||
// qDebug() << "checking host for available bearer" << host->name() << host->connections()->get(i)->url();
|
||||
qDebug() << "checking host for available bearer" << host->name() << host->connections()->get(i)->url() << "available bearer types:" << m_nymeaConnection->availableBearerTypes() << "hosts bearer types" << host->connections()->get(i)->bearerType();
|
||||
if (m_nymeaConnection->availableBearerTypes().testFlag(host->connections()->get(i)->bearerType())) {
|
||||
hasReachableConnection = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user