Merge branch 'new-dbus' into 'dbus-interface'
modify connection property See merge request kylin-desktop/kylin-nm!175
This commit is contained in:
commit
1e22ae3a42
|
@ -124,7 +124,6 @@ void modifyEapMethodPeapSettings(NetworkManager::ConnectionSettings::Ptr connSet
|
||||||
|
|
||||||
QList<NetworkManager::Security8021xSetting::EapMethod> list;
|
QList<NetworkManager::Security8021xSetting::EapMethod> list;
|
||||||
list.append(NetworkManager::Security8021xSetting::EapMethod::EapMethodPeap);
|
list.append(NetworkManager::Security8021xSetting::EapMethod::EapMethodPeap);
|
||||||
wifi_8021x_sett->setInitialized(true);
|
|
||||||
wifi_8021x_sett->setEapMethods(list);
|
wifi_8021x_sett->setEapMethods(list);
|
||||||
wifi_8021x_sett->setPhase2AuthMethod((NetworkManager::Security8021xSetting::AuthMethod)peapInfo.phase2AuthMethod);
|
wifi_8021x_sett->setPhase2AuthMethod((NetworkManager::Security8021xSetting::AuthMethod)peapInfo.phase2AuthMethod);
|
||||||
wifi_8021x_sett->setIdentity(peapInfo.userName);
|
wifi_8021x_sett->setIdentity(peapInfo.userName);
|
||||||
|
|
|
@ -75,12 +75,12 @@ public:
|
||||||
bool bChanged;
|
bool bChanged;
|
||||||
};
|
};
|
||||||
|
|
||||||
void assembleEapMethodTlsSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodTlsInfo &);
|
void assembleEapMethodTlsSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodTlsInfo &tlsInfo);
|
||||||
void assembleEapMethodPeapSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodPeapInfo &);
|
void assembleEapMethodPeapSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodPeapInfo &peapInfo);
|
||||||
void assembleEapMethodTtlsSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodTtlsInfo &);
|
void assembleEapMethodTtlsSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodTtlsInfo &ttlsInfo);
|
||||||
|
|
||||||
void modifyEapMethodTlsSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodTlsInfo &);
|
void modifyEapMethodTlsSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodTlsInfo &tlsInfo);
|
||||||
void modifyEapMethodPeapSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodPeapInfo &);
|
void modifyEapMethodPeapSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodPeapInfo &peapInfo);
|
||||||
void modifyEapMethodTtlsSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodTtlsInfo &);
|
void modifyEapMethodTtlsSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodTtlsInfo &ttlsInfo);
|
||||||
|
|
||||||
#endif // KYENTERPRICESETTINGINFO_H
|
#endif // KYENTERPRICESETTINGINFO_H
|
||||||
|
|
|
@ -52,13 +52,16 @@ NetworkManager::ConnectionSettings::Ptr assembleWirelessSettings(const KyWireles
|
||||||
wifi_sett->setSsid(connSettingInfo.m_ssid.toUtf8());
|
wifi_sett->setSsid(connSettingInfo.m_ssid.toUtf8());
|
||||||
wifi_sett->setSecurity("802-11-wireless-security");
|
wifi_sett->setSecurity("802-11-wireless-security");
|
||||||
|
|
||||||
NetworkManager::WirelessSecuritySetting::Ptr security_sett
|
if (connSettingInfo.m_type != KyKeyMgmt::WpaNone && connSettingInfo.m_type != KyKeyMgmt::Unknown)
|
||||||
= settings->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast<NetworkManager::WirelessSecuritySetting>();
|
|
||||||
security_sett->setInitialized(true);
|
|
||||||
security_sett->setKeyMgmt((NetworkManager::WirelessSecuritySetting::KeyMgmt)connSettingInfo.m_type);
|
|
||||||
if (KyKeyMgmt::SAE == connSettingInfo.m_type || KyKeyMgmt::WpaPsk == connSettingInfo.m_type)
|
|
||||||
{
|
{
|
||||||
security_sett->setPsk(connSettingInfo.m_psk);
|
NetworkManager::WirelessSecuritySetting::Ptr security_sett
|
||||||
|
= settings->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast<NetworkManager::WirelessSecuritySetting>();
|
||||||
|
security_sett->setInitialized(true);
|
||||||
|
security_sett->setKeyMgmt((NetworkManager::WirelessSecuritySetting::KeyMgmt)connSettingInfo.m_type);
|
||||||
|
if (KyKeyMgmt::SAE == connSettingInfo.m_type || KyKeyMgmt::WpaPsk == connSettingInfo.m_type)
|
||||||
|
{
|
||||||
|
security_sett->setPsk(connSettingInfo.m_psk);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
@ -288,6 +291,10 @@ void KyWirelessConnectOperation::updateWirelessPersonalConnect(const QString &uu
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NetworkManager::Security8021xSetting::Ptr wifi_8021x_sett
|
||||||
|
= connectionSettings->setting(NetworkManager::Setting::Security8021x).dynamicCast<NetworkManager::Security8021xSetting>();
|
||||||
|
wifi_8021x_sett->setInitialized(false);
|
||||||
|
|
||||||
updateWirelessSecu(connectionSettings, connSettingInfo, bPwdChange);
|
updateWirelessSecu(connectionSettings, connSettingInfo, bPwdChange);
|
||||||
connectPtr->update(connectionSettings->toMap());
|
connectPtr->update(connectionSettings->toMap());
|
||||||
return;
|
return;
|
||||||
|
@ -357,8 +364,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessConnect(QString & devIface,
|
||||||
NMVariantMapMap map_settings;
|
NMVariantMapMap map_settings;
|
||||||
|
|
||||||
NetworkManager::WirelessNetwork::Ptr wifiNet = checkWifiNetExist(connSettingInfo.m_ssid, devIface);
|
NetworkManager::WirelessNetwork::Ptr wifiNet = checkWifiNetExist(connSettingInfo.m_ssid, devIface);
|
||||||
if (!isHidden && wifiNet.isNull())
|
if (!isHidden && wifiNet.isNull()) {
|
||||||
{
|
|
||||||
qDebug() << "addAndActiveWirelessConnect can not find " << connSettingInfo.m_ssid << " in " << devIface;
|
qDebug() << "addAndActiveWirelessConnect can not find " << connSettingInfo.m_ssid << " in " << devIface;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -366,8 +372,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessConnect(QString & devIface,
|
||||||
qDebug() << "addAndActiveWirelessConnect find " << connSettingInfo.m_ssid << " in " << devIface << " or hide";
|
qDebug() << "addAndActiveWirelessConnect find " << connSettingInfo.m_ssid << " in " << devIface << " or hide";
|
||||||
|
|
||||||
auto dev = m_networkResourceInstance->findDeviceInterface(devIface);
|
auto dev = m_networkResourceInstance->findDeviceInterface(devIface);
|
||||||
if (dev.isNull())
|
if (dev.isNull()) {
|
||||||
{
|
|
||||||
emit andAndActivateConnectionError("can not find device");
|
emit andAndActivateConnectionError("can not find device");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -375,16 +380,11 @@ void KyWirelessConnectOperation::addAndActiveWirelessConnect(QString & devIface,
|
||||||
qDebug() << "addAndActiveWirelessConnect device " << devIface << " exist";
|
qDebug() << "addAndActiveWirelessConnect device " << devIface << " exist";
|
||||||
dev_uni = dev->uni();
|
dev_uni = dev->uni();
|
||||||
auto spec_dev = dev->as<NetworkManager::WirelessDevice>();
|
auto spec_dev = dev->as<NetworkManager::WirelessDevice>();
|
||||||
qDebug() << dev_uni;
|
if (!isHidden) {
|
||||||
if (!isHidden)
|
|
||||||
{
|
|
||||||
qDebug() << "start assemble";
|
qDebug() << "start assemble";
|
||||||
auto access_point = wifiNet->referenceAccessPoint();
|
auto access_point = wifiNet->referenceAccessPoint();
|
||||||
qDebug() << "1";
|
|
||||||
conn_uni = access_point->uni();
|
conn_uni = access_point->uni();
|
||||||
qDebug() << "2";
|
|
||||||
conn_name = access_point->ssid();
|
conn_name = access_point->ssid();
|
||||||
qDebug() << "3";
|
|
||||||
spec_object = conn_uni;
|
spec_object = conn_uni;
|
||||||
qDebug() << "start findBestWirelessSecurity";
|
qDebug() << "start findBestWirelessSecurity";
|
||||||
NetworkManager::WirelessSecurityType sec_type = NetworkManager::findBestWirelessSecurity(spec_dev->wirelessCapabilities()
|
NetworkManager::WirelessSecurityType sec_type = NetworkManager::findBestWirelessSecurity(spec_dev->wirelessCapabilities()
|
||||||
|
@ -402,11 +402,9 @@ qDebug() << dev_uni;
|
||||||
break;
|
break;
|
||||||
case NetworkManager::WpaPsk:
|
case NetworkManager::WpaPsk:
|
||||||
case NetworkManager::Wpa2Psk:
|
case NetworkManager::Wpa2Psk:
|
||||||
if (NetworkManager::ConnectionSettings::Ptr settings = assembleWpaXPskSettings(access_point, connSettingInfo.m_psk, connSettingInfo.isAutoConnect))
|
if (NetworkManager::ConnectionSettings::Ptr settings = assembleWpaXPskSettings(access_point, connSettingInfo.m_psk, connSettingInfo.isAutoConnect)) {
|
||||||
{
|
|
||||||
map_settings = settings->toMap();
|
map_settings = settings->toMap();
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
qWarning() << QStringLiteral("connection settings assembly for '%1' failed, abandoning activation...").arg(conn_name);
|
qWarning() << QStringLiteral("connection settings assembly for '%1' failed, abandoning activation...").arg(conn_name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -427,8 +425,7 @@ qDebug() << dev_uni;
|
||||||
QDBusPendingCallWatcher * watcher;
|
QDBusPendingCallWatcher * watcher;
|
||||||
watcher = new QDBusPendingCallWatcher{NetworkManager::addAndActivateConnection(map_settings, dev_uni, spec_object), this};
|
watcher = new QDBusPendingCallWatcher{NetworkManager::addAndActivateConnection(map_settings, dev_uni, spec_object), this};
|
||||||
connect(watcher, &QDBusPendingCallWatcher::finished, [&] (QDBusPendingCallWatcher * watcher) {
|
connect(watcher, &QDBusPendingCallWatcher::finished, [&] (QDBusPendingCallWatcher * watcher) {
|
||||||
if (watcher->isError() || !watcher->isValid())
|
if (watcher->isError() || !watcher->isValid()) {
|
||||||
{
|
|
||||||
QString errorMessage = watcher->error().message();
|
QString errorMessage = watcher->error().message();
|
||||||
qDebug() << "activation of connection failed " << errorMessage;
|
qDebug() << "activation of connection failed " << errorMessage;
|
||||||
emit andAndActivateConnectionError(errorMessage);
|
emit andAndActivateConnectionError(errorMessage);
|
||||||
|
@ -439,15 +436,12 @@ qDebug() << dev_uni;
|
||||||
|
|
||||||
void KyWirelessConnectOperation::requestWirelessScan()
|
void KyWirelessConnectOperation::requestWirelessScan()
|
||||||
{
|
{
|
||||||
for (auto const & dev : m_networkResourceInstance->m_devices)
|
for (auto const & dev : m_networkResourceInstance->m_devices) {
|
||||||
{
|
|
||||||
auto spec_dev = dev->as<NetworkManager::WirelessDevice>();
|
auto spec_dev = dev->as<NetworkManager::WirelessDevice>();
|
||||||
if (nullptr != spec_dev)
|
if (nullptr != spec_dev) {
|
||||||
{
|
|
||||||
m_networkResourceInstance->requestScan(spec_dev);
|
m_networkResourceInstance->requestScan(spec_dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KyWirelessConnectOperation::addAndActiveWirelessEnterPriseTlsConnect(KyEapMethodTlsInfo &info, KyWirelessConnectSetting &connSettingInfo,
|
void KyWirelessConnectOperation::addAndActiveWirelessEnterPriseTlsConnect(KyEapMethodTlsInfo &info, KyWirelessConnectSetting &connSettingInfo,
|
||||||
|
@ -459,11 +453,9 @@ void KyWirelessConnectOperation::addAndActiveWirelessEnterPriseTlsConnect(KyEapM
|
||||||
QString spec_object;
|
QString spec_object;
|
||||||
NMVariantMapMap map_settings;
|
NMVariantMapMap map_settings;
|
||||||
|
|
||||||
if (!isHidden)
|
if (!isHidden) {
|
||||||
{
|
|
||||||
NetworkManager::WirelessNetwork::Ptr wifiNet = checkWifiNetExist(connSettingInfo.m_ssid, devIface);
|
NetworkManager::WirelessNetwork::Ptr wifiNet = checkWifiNetExist(connSettingInfo.m_ssid, devIface);
|
||||||
if (wifiNet.isNull())
|
if (wifiNet.isNull()) {
|
||||||
{
|
|
||||||
qDebug() << "addAndActiveWirelessEnterPriseTlsConnect can not find " << connSettingInfo.m_ssid << " in " << devIface;
|
qDebug() << "addAndActiveWirelessEnterPriseTlsConnect can not find " << connSettingInfo.m_ssid << " in " << devIface;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -475,8 +467,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessEnterPriseTlsConnect(KyEapM
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dev = m_networkResourceInstance->findDeviceInterface(devIface);
|
auto dev = m_networkResourceInstance->findDeviceInterface(devIface);
|
||||||
if (dev.isNull())
|
if (dev.isNull()) {
|
||||||
{
|
|
||||||
emit andAndActivateConnectionError("can not find device");
|
emit andAndActivateConnectionError("can not find device");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -485,8 +476,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessEnterPriseTlsConnect(KyEapM
|
||||||
NetworkManager::ConnectionSettings::Ptr settings = assembleWirelessSettings(connSettingInfo);
|
NetworkManager::ConnectionSettings::Ptr settings = assembleWirelessSettings(connSettingInfo);
|
||||||
assembleEapMethodTlsSettings(settings, info);
|
assembleEapMethodTlsSettings(settings, info);
|
||||||
|
|
||||||
if(settings.isNull())
|
if(settings.isNull()) {
|
||||||
{
|
|
||||||
qDebug() << "assembleEapMethodTlsSettings failed";
|
qDebug() << "assembleEapMethodTlsSettings failed";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -496,8 +486,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessEnterPriseTlsConnect(KyEapM
|
||||||
QDBusPendingCallWatcher * watcher;
|
QDBusPendingCallWatcher * watcher;
|
||||||
watcher = new QDBusPendingCallWatcher{NetworkManager::addAndActivateConnection(map_settings, dev_uni, spec_object), this};
|
watcher = new QDBusPendingCallWatcher{NetworkManager::addAndActivateConnection(map_settings, dev_uni, spec_object), this};
|
||||||
connect(watcher, &QDBusPendingCallWatcher::finished, [&] (QDBusPendingCallWatcher * watcher) {
|
connect(watcher, &QDBusPendingCallWatcher::finished, [&] (QDBusPendingCallWatcher * watcher) {
|
||||||
if (watcher->isError() || !watcher->isValid())
|
if (watcher->isError() || !watcher->isValid()) {
|
||||||
{
|
|
||||||
QString errorMessage = watcher->error().message();
|
QString errorMessage = watcher->error().message();
|
||||||
qDebug() << "addAndActiveWirelessEnterPriseTlsConnect failed " << errorMessage;
|
qDebug() << "addAndActiveWirelessEnterPriseTlsConnect failed " << errorMessage;
|
||||||
emit andAndActivateConnectionError(errorMessage);
|
emit andAndActivateConnectionError(errorMessage);
|
||||||
|
@ -520,8 +509,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessEnterPrisePeapConnect(KyEap
|
||||||
if (!isHidden)
|
if (!isHidden)
|
||||||
{
|
{
|
||||||
NetworkManager::WirelessNetwork::Ptr wifiNet = checkWifiNetExist(connSettingInfo.m_ssid, devIface);
|
NetworkManager::WirelessNetwork::Ptr wifiNet = checkWifiNetExist(connSettingInfo.m_ssid, devIface);
|
||||||
if (wifiNet.isNull())
|
if (wifiNet.isNull()) {
|
||||||
{
|
|
||||||
qDebug() << "addAndActiveWirelessEnterPrisePeapConnect can not find " << connSettingInfo.m_ssid << " in " << devIface;
|
qDebug() << "addAndActiveWirelessEnterPrisePeapConnect can not find " << connSettingInfo.m_ssid << " in " << devIface;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -534,8 +522,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessEnterPrisePeapConnect(KyEap
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dev = m_networkResourceInstance->findDeviceInterface(devIface);
|
auto dev = m_networkResourceInstance->findDeviceInterface(devIface);
|
||||||
if (dev.isNull())
|
if (dev.isNull()) {
|
||||||
{
|
|
||||||
emit andAndActivateConnectionError("can not find device");
|
emit andAndActivateConnectionError("can not find device");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -544,8 +531,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessEnterPrisePeapConnect(KyEap
|
||||||
NetworkManager::ConnectionSettings::Ptr settings = assembleWirelessSettings(connSettingInfo);
|
NetworkManager::ConnectionSettings::Ptr settings = assembleWirelessSettings(connSettingInfo);
|
||||||
assembleEapMethodPeapSettings(settings, info);
|
assembleEapMethodPeapSettings(settings, info);
|
||||||
|
|
||||||
if(settings.isNull())
|
if(settings.isNull()) {
|
||||||
{
|
|
||||||
qDebug() << "assembleEapMethodPeapSettings failed";
|
qDebug() << "assembleEapMethodPeapSettings failed";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -554,8 +540,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessEnterPrisePeapConnect(KyEap
|
||||||
QDBusPendingCallWatcher * watcher;
|
QDBusPendingCallWatcher * watcher;
|
||||||
watcher = new QDBusPendingCallWatcher{NetworkManager::addAndActivateConnection(map_settings, dev_uni, spec_object), this};
|
watcher = new QDBusPendingCallWatcher{NetworkManager::addAndActivateConnection(map_settings, dev_uni, spec_object), this};
|
||||||
connect(watcher, &QDBusPendingCallWatcher::finished, [&] (QDBusPendingCallWatcher * watcher) {
|
connect(watcher, &QDBusPendingCallWatcher::finished, [&] (QDBusPendingCallWatcher * watcher) {
|
||||||
if (watcher->isError() || !watcher->isValid())
|
if (watcher->isError() || !watcher->isValid()) {
|
||||||
{
|
|
||||||
QString errorMessage = watcher->error().message();
|
QString errorMessage = watcher->error().message();
|
||||||
qDebug() << "addAndActiveWirelessEnterPrisePeapConnect failed " << errorMessage;
|
qDebug() << "addAndActiveWirelessEnterPrisePeapConnect failed " << errorMessage;
|
||||||
emit andAndActivateConnectionError(errorMessage);
|
emit andAndActivateConnectionError(errorMessage);
|
||||||
|
@ -574,11 +559,9 @@ void KyWirelessConnectOperation::addAndActiveWirelessEnterPriseTtlsConnect(KyEap
|
||||||
QString spec_object;
|
QString spec_object;
|
||||||
NMVariantMapMap map_settings;
|
NMVariantMapMap map_settings;
|
||||||
|
|
||||||
if (!isHidden)
|
if (!isHidden) {
|
||||||
{
|
|
||||||
NetworkManager::WirelessNetwork::Ptr wifiNet = checkWifiNetExist(connSettingInfo.m_ssid, devIface);
|
NetworkManager::WirelessNetwork::Ptr wifiNet = checkWifiNetExist(connSettingInfo.m_ssid, devIface);
|
||||||
if (wifiNet.isNull())
|
if (wifiNet.isNull()) {
|
||||||
{
|
|
||||||
qDebug() << "addAndActiveWirelessEnterPriseTtlsConnect can not find " << connSettingInfo.m_ssid << " in " << devIface;
|
qDebug() << "addAndActiveWirelessEnterPriseTtlsConnect can not find " << connSettingInfo.m_ssid << " in " << devIface;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -590,8 +573,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessEnterPriseTtlsConnect(KyEap
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dev = m_networkResourceInstance->findDeviceInterface(devIface);
|
auto dev = m_networkResourceInstance->findDeviceInterface(devIface);
|
||||||
if (dev.isNull())
|
if (dev.isNull()) {
|
||||||
{
|
|
||||||
emit andAndActivateConnectionError("can not find device");
|
emit andAndActivateConnectionError("can not find device");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -600,8 +582,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessEnterPriseTtlsConnect(KyEap
|
||||||
NetworkManager::ConnectionSettings::Ptr settings = assembleWirelessSettings(connSettingInfo);
|
NetworkManager::ConnectionSettings::Ptr settings = assembleWirelessSettings(connSettingInfo);
|
||||||
assembleEapMethodTtlsSettings(settings, info);
|
assembleEapMethodTtlsSettings(settings, info);
|
||||||
|
|
||||||
if(settings.isNull())
|
if(settings.isNull()) {
|
||||||
{
|
|
||||||
qDebug() << "assembleEapMethodTtlsSettings failed";
|
qDebug() << "assembleEapMethodTtlsSettings failed";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -611,8 +592,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessEnterPriseTtlsConnect(KyEap
|
||||||
QDBusPendingCallWatcher * watcher;
|
QDBusPendingCallWatcher * watcher;
|
||||||
watcher = new QDBusPendingCallWatcher{NetworkManager::addAndActivateConnection(map_settings, dev_uni, spec_object), this};
|
watcher = new QDBusPendingCallWatcher{NetworkManager::addAndActivateConnection(map_settings, dev_uni, spec_object), this};
|
||||||
connect(watcher, &QDBusPendingCallWatcher::finished, [&] (QDBusPendingCallWatcher * watcher) {
|
connect(watcher, &QDBusPendingCallWatcher::finished, [&] (QDBusPendingCallWatcher * watcher) {
|
||||||
if (watcher->isError() || !watcher->isValid())
|
if (watcher->isError() || !watcher->isValid()) {
|
||||||
{
|
|
||||||
QString errorMessage = watcher->error().message();
|
QString errorMessage = watcher->error().message();
|
||||||
qDebug() << "addAndActiveWirelessEnterPriseTtlsConnect failed " << errorMessage;
|
qDebug() << "addAndActiveWirelessEnterPriseTtlsConnect failed " << errorMessage;
|
||||||
emit andAndActivateConnectionError(errorMessage);
|
emit andAndActivateConnectionError(errorMessage);
|
||||||
|
@ -636,8 +616,7 @@ bool KyWirelessConnectOperation::getConnSecretFlags(QString &connUuid, NetworkMa
|
||||||
{
|
{
|
||||||
NetworkManager::Connection::Ptr conn;
|
NetworkManager::Connection::Ptr conn;
|
||||||
conn = m_networkResourceInstance->getConnect(connUuid);
|
conn = m_networkResourceInstance->getConnect(connUuid);
|
||||||
if (conn.isNull())
|
if (conn.isNull()) {
|
||||||
{
|
|
||||||
qDebug() <<"get failed";
|
qDebug() <<"get failed";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -761,19 +740,15 @@ void KyWirelessConnectOperation::deactiveWirelessAp(const QString apName, const
|
||||||
//private
|
//private
|
||||||
NetworkManager::WirelessNetwork::Ptr KyWirelessConnectOperation::checkWifiNetExist(QString ssid, QString devName)
|
NetworkManager::WirelessNetwork::Ptr KyWirelessConnectOperation::checkWifiNetExist(QString ssid, QString devName)
|
||||||
{
|
{
|
||||||
for (auto const & net : m_networkResourceInstance->m_wifiNets)
|
for (auto const & net : m_networkResourceInstance->m_wifiNets) {
|
||||||
{
|
|
||||||
auto dev = m_networkResourceInstance->findDeviceUni(net->device());
|
auto dev = m_networkResourceInstance->findDeviceUni(net->device());
|
||||||
if (dev == nullptr)
|
if (dev == nullptr) {
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (dev->type() != NetworkManager::Device::Wifi || dev->interfaceName() != devName)
|
if (dev->type() != NetworkManager::Device::Wifi || dev->interfaceName() != devName) {
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (ssid == net->ssid())
|
if (ssid == net->ssid()) {
|
||||||
{
|
|
||||||
return net;
|
return net;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -803,9 +778,14 @@ void KyWirelessConnectOperation::updateWirelessSecu(NetworkManager::ConnectionSe
|
||||||
|
|
||||||
KyKeyMgmt type = connSettingInfo.m_type;
|
KyKeyMgmt type = connSettingInfo.m_type;
|
||||||
qDebug() << "set keyMgmt " << type;
|
qDebug() << "set keyMgmt " << type;
|
||||||
// security_sett->setKeyMgmt((NetworkManager::WirelessSecuritySetting::KeyMgmt)type);
|
if (type == WpaNone) {
|
||||||
if (bPwdChange)
|
security_sett->setInitialized(false);
|
||||||
{
|
return;
|
||||||
|
} else {
|
||||||
|
security_sett->setInitialized(true);
|
||||||
|
}
|
||||||
|
security_sett->setKeyMgmt((NetworkManager::WirelessSecuritySetting::KeyMgmt)type);
|
||||||
|
if (bPwdChange) {
|
||||||
qDebug() << "get psk " << security_sett->psk();
|
qDebug() << "get psk " << security_sett->psk();
|
||||||
security_sett->setPsk(connSettingInfo.m_psk);
|
security_sett->setPsk(connSettingInfo.m_psk);
|
||||||
}
|
}
|
||||||
|
@ -817,6 +797,7 @@ void KyWirelessConnectOperation::setWirelessSecuWpaXEap(NetworkManager::Connecti
|
||||||
NetworkManager::WirelessSecuritySetting::Ptr security_sett
|
NetworkManager::WirelessSecuritySetting::Ptr security_sett
|
||||||
= connSettingPtr->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast<NetworkManager::WirelessSecuritySetting>();
|
= connSettingPtr->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast<NetworkManager::WirelessSecuritySetting>();
|
||||||
|
|
||||||
|
security_sett->setInitialized(true);
|
||||||
security_sett->setKeyMgmt(NetworkManager::WirelessSecuritySetting::KeyMgmt::WpaEap);
|
security_sett->setKeyMgmt(NetworkManager::WirelessSecuritySetting::KeyMgmt::WpaEap);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ KyWirelessNetItem::KyWirelessNetItem(NetworkManager::WirelessNetwork::Ptr net)
|
||||||
m_connName = "";
|
m_connName = "";
|
||||||
m_connDbusPath = "";
|
m_connDbusPath = "";
|
||||||
m_secuType = "";
|
m_secuType = "";
|
||||||
|
m_device = "";
|
||||||
|
|
||||||
init(net);
|
init(net);
|
||||||
}
|
}
|
||||||
|
@ -57,6 +58,7 @@ void KyWirelessNetItem::init(NetworkManager::WirelessNetwork::Ptr net)
|
||||||
NetworkManager::AccessPoint::WpaFlags rsnFlag = net->referenceAccessPoint()->rsnFlags();
|
NetworkManager::AccessPoint::WpaFlags rsnFlag = net->referenceAccessPoint()->rsnFlags();
|
||||||
m_secuType = enumToQstring(cap, wpaFlag, rsnFlag);
|
m_secuType = enumToQstring(cap, wpaFlag, rsnFlag);
|
||||||
m_bssid = net->referenceAccessPoint()->hardwareAddress();
|
m_bssid = net->referenceAccessPoint()->hardwareAddress();
|
||||||
|
m_device = net->device();
|
||||||
initInfoBySsid();
|
initInfoBySsid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,19 +73,13 @@ void KyWirelessNetItem::initInfoBySsid()
|
||||||
}
|
}
|
||||||
NetworkManager::WirelessSetting::Ptr wifi_sett
|
NetworkManager::WirelessSetting::Ptr wifi_sett
|
||||||
= settings->setting(NetworkManager::Setting::Wireless).dynamicCast<NetworkManager::WirelessSetting>();
|
= settings->setting(NetworkManager::Setting::Wireless).dynamicCast<NetworkManager::WirelessSetting>();
|
||||||
if (wifi_sett->ssid() == m_NetSsid)
|
QString devName = m_networkResourceInstance->findDeviceUni(m_device)->interfaceName();
|
||||||
|
if (wifi_sett->ssid() == m_NetSsid && (settings->interfaceName().compare(devName) == 0 || settings->interfaceName().isEmpty()))
|
||||||
{
|
{
|
||||||
m_connectUuid = settings->uuid();
|
m_connectUuid = settings->uuid();
|
||||||
m_connName = conn->name();
|
m_connName = conn->name();
|
||||||
m_connDbusPath = conn->path();
|
m_connDbusPath = conn->path();
|
||||||
m_isConfigured = true;
|
m_isConfigured = true;
|
||||||
|
|
||||||
if(wifi_sett->ssid() == "NewWifi")
|
|
||||||
{
|
|
||||||
NetworkManager::WirelessSecuritySetting::Ptr security_sett
|
|
||||||
= settings->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast<NetworkManager::WirelessSecuritySetting>();
|
|
||||||
qDebug() << security_sett->keyMgmt();
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KyNetworkResourceManager *m_networkResourceInstance = nullptr;
|
KyNetworkResourceManager *m_networkResourceInstance = nullptr;
|
||||||
|
QString m_device;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ KyWirelessNetResource::KyWirelessNetResource(QObject *parent)
|
||||||
{
|
{
|
||||||
qDebug()<<"KyWirelessNetResource";
|
qDebug()<<"KyWirelessNetResource";
|
||||||
m_networkResourceInstance = KyNetworkResourceManager::getInstance();
|
m_networkResourceInstance = KyNetworkResourceManager::getInstance();
|
||||||
|
m_connectResource = new KyConnectResourse(this);
|
||||||
|
|
||||||
kyWirelessNetItemListInit();
|
kyWirelessNetItemListInit();
|
||||||
|
|
||||||
|
@ -14,8 +15,9 @@ KyWirelessNetResource::KyWirelessNetResource(QObject *parent)
|
||||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkPropertyChange, this, &KyWirelessNetResource::onWifiNetworkPropertyChange);
|
connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkPropertyChange, this, &KyWirelessNetResource::onWifiNetworkPropertyChange);
|
||||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkDeviceDisappear, this, &KyWirelessNetResource::onWifiNetworkDeviceDisappear);
|
connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkDeviceDisappear, this, &KyWirelessNetResource::onWifiNetworkDeviceDisappear);
|
||||||
|
|
||||||
//connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionAdd, this, &KyWirelessNetResource::onConnectionAdd);
|
connect(m_connectResource, &KyConnectResourse::connectionAdd, this, &KyWirelessNetResource::onConnectionAdd);
|
||||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionRemove, this, &KyWirelessNetResource::onConnectionRemove);
|
connect(m_connectResource, &KyConnectResourse::connectionRemove, this, &KyWirelessNetResource::onConnectionRemove);
|
||||||
|
connect(m_connectResource, &KyConnectResourse::connectionUpdate, this, &KyWirelessNetResource::onConnectionUpdate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +28,7 @@ KyWirelessNetResource::~KyWirelessNetResource()
|
||||||
|
|
||||||
bool KyWirelessNetResource::getAllDeviceWifiNetwork(QMap<QString,QList<KyWirelessNetItem> > &map)
|
bool KyWirelessNetResource::getAllDeviceWifiNetwork(QMap<QString,QList<KyWirelessNetItem> > &map)
|
||||||
{
|
{
|
||||||
onWifiNetworkDeviceDisappear();
|
// onWifiNetworkDeviceDisappear();
|
||||||
if (m_WifiNetworkList.isEmpty()) {
|
if (m_WifiNetworkList.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -38,7 +40,7 @@ bool KyWirelessNetResource::getAllDeviceWifiNetwork(QMap<QString,QList<KyWireles
|
||||||
|
|
||||||
bool KyWirelessNetResource::getDeviceWifiNetwork(QString devIfaceName, QList<KyWirelessNetItem> &wirelessNetResource)
|
bool KyWirelessNetResource::getDeviceWifiNetwork(QString devIfaceName, QList<KyWirelessNetItem> &wirelessNetResource)
|
||||||
{
|
{
|
||||||
onWifiNetworkDeviceDisappear();
|
// onWifiNetworkDeviceDisappear();
|
||||||
|
|
||||||
if (!m_WifiNetworkList.contains(devIfaceName)) {
|
if (!m_WifiNetworkList.contains(devIfaceName)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -50,7 +52,7 @@ bool KyWirelessNetResource::getDeviceWifiNetwork(QString devIfaceName, QList<KyW
|
||||||
|
|
||||||
bool KyWirelessNetResource::getWifiNetwork(QString &devIfaceName, QString &ssid, KyWirelessNetItem &wirelessNetResource)
|
bool KyWirelessNetResource::getWifiNetwork(QString &devIfaceName, QString &ssid, KyWirelessNetItem &wirelessNetResource)
|
||||||
{
|
{
|
||||||
onWifiNetworkDeviceDisappear();
|
// onWifiNetworkDeviceDisappear();
|
||||||
|
|
||||||
if (!m_WifiNetworkList.contains(devIfaceName)) {
|
if (!m_WifiNetworkList.contains(devIfaceName)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -66,9 +68,10 @@ bool KyWirelessNetResource::getWifiNetwork(QString &devIfaceName, QString &ssid,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KyWirelessNetResource::getWirelessActiveConnection(QMap<QString,QStringList> &map)
|
void KyWirelessNetResource::getWirelessActiveConnection(NetworkManager::ActiveConnection::State state, QMap<QString,QStringList> &map)
|
||||||
{
|
{
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
map.clear();
|
||||||
NetworkManager::ActiveConnection::List activeConnectionList;
|
NetworkManager::ActiveConnection::List activeConnectionList;
|
||||||
|
|
||||||
map.clear();
|
map.clear();
|
||||||
|
@ -76,8 +79,7 @@ bool KyWirelessNetResource::getWirelessActiveConnection(QMap<QString,QStringList
|
||||||
activeConnectionList = m_networkResourceInstance->m_activeConns;
|
activeConnectionList = m_networkResourceInstance->m_activeConns;
|
||||||
if (activeConnectionList.isEmpty())
|
if (activeConnectionList.isEmpty())
|
||||||
{
|
{
|
||||||
map.clear();
|
return;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkManager::ActiveConnection::Ptr activeConnectionPtr = nullptr;
|
NetworkManager::ActiveConnection::Ptr activeConnectionPtr = nullptr;
|
||||||
|
@ -88,7 +90,7 @@ bool KyWirelessNetResource::getWirelessActiveConnection(QMap<QString,QStringList
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (NetworkManager::ActiveConnection::Activated != activeConnectionPtr->state())
|
if (state != activeConnectionPtr->state())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +104,7 @@ bool KyWirelessNetResource::getWirelessActiveConnection(QMap<QString,QStringList
|
||||||
map.insert(ifaceName,list);
|
map.insert(ifaceName,list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString KyWirelessNetResource::getDeviceIFace(NetworkManager::ActiveConnection::Ptr actConn,
|
QString KyWirelessNetResource::getDeviceIFace(NetworkManager::ActiveConnection::Ptr actConn,
|
||||||
|
@ -114,7 +116,8 @@ QString KyWirelessNetResource::getDeviceIFace(NetworkManager::ActiveConnection::
|
||||||
|
|
||||||
NetworkManager::Connection::Ptr conn = actConn->connection();
|
NetworkManager::Connection::Ptr conn = actConn->connection();
|
||||||
NetworkManager::ConnectionSettings::Ptr sett = conn->settings();
|
NetworkManager::ConnectionSettings::Ptr sett = conn->settings();
|
||||||
wirelessNetResourcessid = sett->id();
|
NetworkManager::WirelessSetting::Ptr wireless_sett = sett->setting(NetworkManager::Setting::Wireless).dynamicCast<NetworkManager::WirelessSetting>();
|
||||||
|
wirelessNetResourcessid = wireless_sett->ssid();
|
||||||
|
|
||||||
return sett->interfaceName();
|
return sett->interfaceName();
|
||||||
}
|
}
|
||||||
|
@ -410,13 +413,13 @@ bool KyWirelessNetResource::getEnterPriseInfoTtls(QString &uuid, KyEapMethodTtls
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void KyWirelessNetResource::onConnectionAdd(NetworkManager::Connection::Ptr conn)
|
void KyWirelessNetResource::onConnectionAdd(QString uuid)
|
||||||
{
|
{
|
||||||
qDebug() << "onConnectionAdd add " << conn->name();
|
qDebug() << "onConnectionAdd " << uuid;
|
||||||
QString devIfaceName;
|
NetworkManager::Connection::Ptr conn = m_networkResourceInstance->getConnect(uuid);
|
||||||
QString ssid;
|
|
||||||
if (conn.isNull())
|
if (conn.isNull())
|
||||||
{
|
{
|
||||||
|
qDebug() << "onConnectionAdd can not find connection" << uuid;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
NetworkManager::ConnectionSettings::Ptr sett= conn->settings();
|
NetworkManager::ConnectionSettings::Ptr sett= conn->settings();
|
||||||
|
@ -425,15 +428,14 @@ void KyWirelessNetResource::onConnectionAdd(NetworkManager::Connection::Ptr conn
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
NetworkManager::WirelessSetting::Ptr wireless_sett = sett->setting(NetworkManager::Setting::Wireless).dynamicCast<NetworkManager::WirelessSetting>();
|
NetworkManager::WirelessSetting::Ptr wireless_sett = sett->setting(NetworkManager::Setting::Wireless).dynamicCast<NetworkManager::WirelessSetting>();
|
||||||
bool isFind = false;
|
QMap<QString, QString> map;
|
||||||
|
map.clear();
|
||||||
QMap<QString, QList<KyWirelessNetItem> >::iterator iter = m_WifiNetworkList.begin();
|
QMap<QString, QList<KyWirelessNetItem> >::iterator iter = m_WifiNetworkList.begin();
|
||||||
while (iter != m_WifiNetworkList.end())
|
while (iter != m_WifiNetworkList.end()) {
|
||||||
{
|
for(int i = 0; i < iter.value().size(); i++) {
|
||||||
for(int i = 0; i < iter.value().size(); i++)
|
if (iter.value().at(i).m_NetSsid == wireless_sett->ssid() && (sett->interfaceName() == iter.key() || sett->interfaceName().isEmpty())) {
|
||||||
{
|
QString devIfaceName;
|
||||||
if (iter.value().at(i).m_NetSsid == wireless_sett->ssid())
|
QString ssid;
|
||||||
{
|
|
||||||
isFind = true;
|
|
||||||
m_WifiNetworkList[iter.key()][i].m_isConfigured = true;
|
m_WifiNetworkList[iter.key()][i].m_isConfigured = true;
|
||||||
m_WifiNetworkList[iter.key()][i].m_connName = conn->name();
|
m_WifiNetworkList[iter.key()][i].m_connName = conn->name();
|
||||||
m_WifiNetworkList[iter.key()][i].m_connectUuid = conn->uuid();
|
m_WifiNetworkList[iter.key()][i].m_connectUuid = conn->uuid();
|
||||||
|
@ -441,22 +443,27 @@ void KyWirelessNetResource::onConnectionAdd(NetworkManager::Connection::Ptr conn
|
||||||
|
|
||||||
devIfaceName = sett->interfaceName();
|
devIfaceName = sett->interfaceName();
|
||||||
ssid = iter.value().at(i).m_NetSsid;
|
ssid = iter.value().at(i).m_NetSsid;
|
||||||
|
map.insert(devIfaceName, ssid);
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
iter++;
|
iter++;
|
||||||
}
|
}
|
||||||
if (isFind)
|
if (!map.isEmpty()) {
|
||||||
{
|
for(auto var = map.cbegin(); var != map.cend(); var++) {
|
||||||
emit connectionAdd(devIfaceName, ssid);
|
QString devIfaceName = var.key();
|
||||||
|
QString ssid = var.value();
|
||||||
|
emit connectionAdd(devIfaceName, ssid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KyWirelessNetResource::onConnectionRemove(QString path)
|
void KyWirelessNetResource::onConnectionRemove(QString path)
|
||||||
{
|
{
|
||||||
qDebug() << "onConnectionRemove remove " << path;
|
qDebug() << "onConnectionRemove remove " << path;
|
||||||
bool isFind = false;
|
QMap<QString, QString> map;
|
||||||
QString devIfaceName;
|
map.clear();
|
||||||
QString ssid;
|
|
||||||
|
|
||||||
QMap<QString, QList<KyWirelessNetItem> >::iterator iter = m_WifiNetworkList.begin();
|
QMap<QString, QList<KyWirelessNetItem> >::iterator iter = m_WifiNetworkList.begin();
|
||||||
while (iter != m_WifiNetworkList.end())
|
while (iter != m_WifiNetworkList.end())
|
||||||
|
@ -467,7 +474,8 @@ void KyWirelessNetResource::onConnectionRemove(QString path)
|
||||||
qDebug() << iter.value().at(i).m_connDbusPath;
|
qDebug() << iter.value().at(i).m_connDbusPath;
|
||||||
if (iter.value().at(i).m_connDbusPath == path)
|
if (iter.value().at(i).m_connDbusPath == path)
|
||||||
{
|
{
|
||||||
isFind = true;
|
QString devIfaceName;
|
||||||
|
QString ssid;
|
||||||
m_WifiNetworkList[iter.key()][i].m_isConfigured = false;
|
m_WifiNetworkList[iter.key()][i].m_isConfigured = false;
|
||||||
m_WifiNetworkList[iter.key()][i].m_connName = "";
|
m_WifiNetworkList[iter.key()][i].m_connName = "";
|
||||||
m_WifiNetworkList[iter.key()][i].m_connectUuid = "";
|
m_WifiNetworkList[iter.key()][i].m_connectUuid = "";
|
||||||
|
@ -475,14 +483,38 @@ void KyWirelessNetResource::onConnectionRemove(QString path)
|
||||||
|
|
||||||
devIfaceName = iter.key();
|
devIfaceName = iter.key();
|
||||||
ssid = iter.value().at(i).m_NetSsid;
|
ssid = iter.value().at(i).m_NetSsid;
|
||||||
|
map.insert(devIfaceName, ssid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
iter++;
|
iter++;
|
||||||
|
}
|
||||||
|
if (!map.isEmpty()) {
|
||||||
|
for(auto var = map.cbegin(); var != map.cend(); var++) {
|
||||||
|
QString devIfaceName = var.key();
|
||||||
|
QString ssid = var.value();
|
||||||
|
emit connectionRemove(devIfaceName, ssid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isFind)
|
}
|
||||||
{
|
|
||||||
emit connectionRemove(devIfaceName, ssid);
|
|
||||||
}
|
void KyWirelessNetResource::onConnectionUpdate(QString uuid)
|
||||||
|
{
|
||||||
|
qDebug() << "onConnectionUpdate " << uuid;
|
||||||
|
NetworkManager::Connection::Ptr conn = m_networkResourceInstance->getConnect(uuid);
|
||||||
|
if (conn.isNull())
|
||||||
|
{
|
||||||
|
qDebug() << "onConnectionAdd can not find connection" << uuid;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
NetworkManager::ConnectionSettings::Ptr sett= conn->settings();
|
||||||
|
if (sett->connectionType() != NetworkManager::ConnectionSettings::ConnectionType::Wireless)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_WifiNetworkList.clear();
|
||||||
|
kyWirelessNetItemListInit();
|
||||||
|
emit wifiNetworkUpadte();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "kywirelessnetitem.h"
|
#include "kywirelessnetitem.h"
|
||||||
#include "kylinnetworkresourcemanager.h"
|
#include "kylinnetworkresourcemanager.h"
|
||||||
#include "kyenterpricesettinginfo.h"
|
#include "kyenterpricesettinginfo.h"
|
||||||
|
#include "kylinconnectresource.h"
|
||||||
|
|
||||||
|
|
||||||
//class KyWirelessNetItem;
|
//class KyWirelessNetItem;
|
||||||
|
@ -25,7 +26,7 @@ public:
|
||||||
bool getEnterPriseInfoPeap(QString &uuid, KyEapMethodPeapInfo &info);
|
bool getEnterPriseInfoPeap(QString &uuid, KyEapMethodPeapInfo &info);
|
||||||
bool getEnterPriseInfoTtls(QString &uuid, KyEapMethodTtlsInfo &info);
|
bool getEnterPriseInfoTtls(QString &uuid, KyEapMethodTtlsInfo &info);
|
||||||
|
|
||||||
bool getWirelessActiveConnection(QMap<QString, QStringList> &map);
|
void getWirelessActiveConnection(NetworkManager::ActiveConnection::State state, QMap<QString, QStringList> &map);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -39,7 +40,8 @@ public slots:
|
||||||
void onWifiNetworkPropertyChange(NetworkManager::WirelessNetwork * net);
|
void onWifiNetworkPropertyChange(NetworkManager::WirelessNetwork * net);
|
||||||
void onWifiNetworkDeviceDisappear();
|
void onWifiNetworkDeviceDisappear();
|
||||||
|
|
||||||
void onConnectionAdd(NetworkManager::Connection::Ptr conn);
|
void onConnectionAdd(QString uuid);
|
||||||
|
void onConnectionUpdate(QString uuid);
|
||||||
void onConnectionRemove(QString);
|
void onConnectionRemove(QString);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -48,11 +50,13 @@ signals:
|
||||||
void secuTypeChange(QString, QString, QString);
|
void secuTypeChange(QString, QString, QString);
|
||||||
void connectionRemove(QString, QString);
|
void connectionRemove(QString, QString);
|
||||||
void connectionAdd(QString, QString);
|
void connectionAdd(QString, QString);
|
||||||
|
void wifiNetworkUpadte();
|
||||||
void wifiNetworkAdd(QString, KyWirelessNetItem&);
|
void wifiNetworkAdd(QString, KyWirelessNetItem&);
|
||||||
void wifiNetworkRemove(QString, QString);
|
void wifiNetworkRemove(QString, QString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KyNetworkResourceManager *m_networkResourceInstance = nullptr;
|
KyNetworkResourceManager *m_networkResourceInstance = nullptr;
|
||||||
|
KyConnectResourse *m_connectResource = nullptr;
|
||||||
QMap<QString, QList<KyWirelessNetItem> > m_WifiNetworkList;
|
QMap<QString, QList<KyWirelessNetItem> > m_WifiNetworkList;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -127,8 +127,9 @@ void NmDemo::initConnect()
|
||||||
|
|
||||||
//ui button
|
//ui button
|
||||||
connect(refreshButton, &QPushButton::clicked, [=](){
|
connect(refreshButton, &QPushButton::clicked, [=](){
|
||||||
appendDebugLog("init refreshButton clicked...");
|
// appendDebugLog("init refreshButton clicked...");
|
||||||
m_wco->requestWirelessScan();
|
// m_wco->requestWirelessScan();
|
||||||
|
getWifiList();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(connectButton, &QPushButton::clicked, this, &NmDemo::onConnectClicked);
|
connect(connectButton, &QPushButton::clicked, this, &NmDemo::onConnectClicked);
|
||||||
|
@ -153,8 +154,11 @@ void NmDemo::initConnect()
|
||||||
connect(m_wnr, &KyWirelessNetResource::secuTypeChange, this ,&NmDemo::onSecuTypeChange);
|
connect(m_wnr, &KyWirelessNetResource::secuTypeChange, this ,&NmDemo::onSecuTypeChange);
|
||||||
connect(m_wnr, &KyWirelessNetResource::signalStrengthChange, this ,&NmDemo::onSignalStrengthChange);
|
connect(m_wnr, &KyWirelessNetResource::signalStrengthChange, this ,&NmDemo::onSignalStrengthChange);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
connect(m_wnr, &KyWirelessNetResource::connectionRemove, this ,&NmDemo::onConnectionRemove);
|
connect(m_wnr, &KyWirelessNetResource::connectionRemove, this ,&NmDemo::onConnectionRemove);
|
||||||
connect(m_wnr, &KyWirelessNetResource::connectionAdd, this ,&NmDemo::onConnectionAdd);
|
connect(m_wnr, &KyWirelessNetResource::connectionAdd, this ,&NmDemo::onConnectionAdd);
|
||||||
|
connect(m_wnr, &KyWirelessNetResource::wifiNetworkUpadte, this ,&NmDemo::onWifiNetworkUpdate);
|
||||||
connect(m_wnr, &KyWirelessNetResource::wifiNetworkAdd, this ,&NmDemo::onWifiNetworkAdd);
|
connect(m_wnr, &KyWirelessNetResource::wifiNetworkAdd, this ,&NmDemo::onWifiNetworkAdd);
|
||||||
connect(m_wnr, &KyWirelessNetResource::wifiNetworkRemove, this ,&NmDemo::onWifiNetworkRemove);
|
connect(m_wnr, &KyWirelessNetResource::wifiNetworkRemove, this ,&NmDemo::onWifiNetworkRemove);
|
||||||
|
|
||||||
|
@ -221,6 +225,12 @@ void NmDemo::onWifiNetworkRemove(QString devIface, QString ssid)
|
||||||
getWifiList();
|
getWifiList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NmDemo::onWifiNetworkUpdate()
|
||||||
|
{
|
||||||
|
appendDebugLog("onWifiNetworkUpdate...");
|
||||||
|
getWifiList();
|
||||||
|
}
|
||||||
|
|
||||||
void NmDemo::onConnectClicked()
|
void NmDemo::onConnectClicked()
|
||||||
{
|
{
|
||||||
appendDebugLog("onConnectClicked...");
|
appendDebugLog("onConnectClicked...");
|
||||||
|
@ -259,8 +269,6 @@ void NmDemo::onConnectClicked()
|
||||||
}
|
}
|
||||||
if (isEnterPirse)
|
if (isEnterPirse)
|
||||||
{
|
{
|
||||||
qDebug() <<"EnterPrice";
|
|
||||||
return;
|
|
||||||
if(!isNew)
|
if(!isNew)
|
||||||
{
|
{
|
||||||
KyEapMethodPeapInfo a;
|
KyEapMethodPeapInfo a;
|
||||||
|
@ -273,14 +281,22 @@ void NmDemo::onConnectClicked()
|
||||||
m_wco->activeWirelessConnect(devIface,uuid);
|
m_wco->activeWirelessConnect(devIface,uuid);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
KyEapMethodTtlsInfo c;
|
KyEapMethodPeapInfo c;
|
||||||
c.authType = AUTH_NO_EAP;
|
c.m_passwdFlag = NetworkManager::Setting::SecretFlagType::None;
|
||||||
c.authNoEapMethod = KyAuthMethodMschapv2;
|
c.phase2AuthMethod = KyAuthMethodMschapv2;
|
||||||
c.userName = "steve";
|
c.userName = "steve";
|
||||||
c.userPWD = "testing";
|
c.userPWD = "testing";
|
||||||
|
|
||||||
|
KyWirelessConnectSetting a;
|
||||||
|
a.m_connectName = ssid;
|
||||||
|
a.m_ssid = ssid;
|
||||||
|
a.isAutoConnect = true;
|
||||||
|
a.m_type = WpaEap;
|
||||||
|
|
||||||
appendDebugLog("addAndActiveWirelessEnterPriseTtlsConnect...");
|
appendDebugLog("addAndActiveWirelessEnterPriseTtlsConnect...");
|
||||||
qDebug() << "addAndActiveWirelessEnterPriseTtlsConnect";
|
qDebug() << "addAndActiveWirelessEnterPriseTtlsConnect";
|
||||||
// m_wco->addAndActiveWirelessEnterPriseTtlsConnect(c, devIface, isHidden, true, 0);
|
// m_wco->addAndActiveWirelessEnterPriseTtlsConnect(c, devIface, isHidden, true, 0);
|
||||||
|
m_wco->addAndActiveWirelessEnterPrisePeapConnect(c, a, devIface, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -292,7 +308,7 @@ void NmDemo::onConnectClicked()
|
||||||
a.m_ssid = ssid;
|
a.m_ssid = ssid;
|
||||||
a.isAutoConnect = true;
|
a.isAutoConnect = true;
|
||||||
a.m_psk = pwd;
|
a.m_psk = pwd;
|
||||||
a.m_type = WpaPsk;
|
a.m_type = WpaNone;
|
||||||
|
|
||||||
|
|
||||||
m_wco->addAndActiveWirelessConnect(devIface,a, isHidden);
|
m_wco->addAndActiveWirelessConnect(devIface,a, isHidden);
|
||||||
|
@ -363,14 +379,19 @@ void NmDemo::onModifyClicked()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString psk = m_wco->getPsk(uuid);
|
|
||||||
appendDebugLog(ssid +" getPsk is " + psk);
|
// KyEapMethodTtlsInfo info;
|
||||||
return;
|
// m_wco->updateWirelessEnterPriseTtlsConnect(uuid, info);
|
||||||
|
|
||||||
|
// QString psk = m_wco->getPsk(uuid);
|
||||||
|
// appendDebugLog(ssid +" getPsk is " + psk);
|
||||||
|
// return;
|
||||||
|
|
||||||
appendDebugLog("getConnectKeyMgmt" + QString::number(m_wco->getConnectKeyMgmt(uuid)));
|
appendDebugLog("getConnectKeyMgmt" + QString::number(m_wco->getConnectKeyMgmt(uuid)));
|
||||||
|
|
||||||
KyWirelessConnectSetting wcs;
|
KyWirelessConnectSetting wcs;
|
||||||
wcs.m_type = SAE;
|
wcs.m_type = WpaPsk;
|
||||||
|
wcs.m_psk = "123456zsx";
|
||||||
m_wco->updateWirelessPersonalConnect(uuid, wcs ,true);
|
m_wco->updateWirelessPersonalConnect(uuid, wcs ,true);
|
||||||
appendDebugLog("getConnectKeyMgmt" + QString::number(m_wco->getConnectKeyMgmt(uuid)));
|
appendDebugLog("getConnectKeyMgmt" + QString::number(m_wco->getConnectKeyMgmt(uuid)));
|
||||||
return;
|
return;
|
||||||
|
@ -462,17 +483,17 @@ void NmDemo::onAddClick()
|
||||||
{
|
{
|
||||||
appendDebugLog("onAddClick...");
|
appendDebugLog("onAddClick...");
|
||||||
KyWirelessConnectSetting sett;
|
KyWirelessConnectSetting sett;
|
||||||
sett.m_connectName = "zsx";
|
sett.m_connectName = "test";
|
||||||
sett.m_ssid = "zsxsz";
|
sett.m_ssid = "test";
|
||||||
sett.isAutoConnect = false;
|
sett.isAutoConnect = false;
|
||||||
sett.m_psk = "123456zsx";
|
sett.m_psk = "";
|
||||||
sett.m_type = Wep;
|
sett.m_type = WpaEap;
|
||||||
//ipv4
|
// //ipv4
|
||||||
sett.setIpConfigType(IPADDRESS_V4, CONFIG_IP_MANUAL);
|
sett.setIpConfigType(IPADDRESS_V4, CONFIG_IP_DHCP);
|
||||||
QString ipv4Address("192.168.1.17"), ipv4NetMask("255.255.255.0"), ipv4GateWay("192.168.1.0");
|
// QString ipv4Address("192.168.1.17"), ipv4NetMask("255.255.255.0"), ipv4GateWay("192.168.1.0");
|
||||||
QStringList list;
|
// QStringList list;
|
||||||
list << "127.17.50.100";
|
// list << "127.17.50.100";
|
||||||
sett.ipv4AddressConstruct(ipv4Address, ipv4NetMask, ipv4GateWay, list);
|
// sett.ipv4AddressConstruct(ipv4Address, ipv4NetMask, ipv4GateWay, list);
|
||||||
// m_wco->addConnect(sett);
|
// m_wco->addConnect(sett);
|
||||||
KyEapMethodPeapInfo peap;
|
KyEapMethodPeapInfo peap;
|
||||||
peap.phase2AuthMethod = KyAuthMethodMschapv2;
|
peap.phase2AuthMethod = KyAuthMethodMschapv2;
|
||||||
|
@ -530,21 +551,44 @@ void NmDemo::getWifiList()
|
||||||
qDebug() << "getWifiList";
|
qDebug() << "getWifiList";
|
||||||
wifiList->clear();
|
wifiList->clear();
|
||||||
QMap<QString,QStringList> actMap;
|
QMap<QString,QStringList> actMap;
|
||||||
if (!m_wnr->getWirelessActiveConnection(actMap))
|
m_wnr->getWirelessActiveConnection(NetworkManager::ActiveConnection::State::Activated, actMap);
|
||||||
{
|
appendDebugLog("getWirelessActiveConnection Activated " +QString::number(actMap.size()));
|
||||||
return;
|
|
||||||
}
|
|
||||||
QMap<QString,QStringList>::iterator iter1 = actMap.begin();
|
QMap<QString,QStringList>::iterator iter1 = actMap.begin();
|
||||||
while (iter1 != actMap.end())
|
while (iter1 != actMap.end())
|
||||||
{
|
{
|
||||||
wifiList->append(iter1.key());
|
wifiList->append(iter1.key());
|
||||||
for (int i = 0; i < iter1->size(); i++)
|
for (int i = 0; i < iter1->size(); i++)
|
||||||
{
|
{
|
||||||
wifiList->append(iter1->at(i));
|
wifiList->append("Activated" + iter1->at(i));
|
||||||
}
|
}
|
||||||
wifiList->append("====================================");
|
wifiList->append("====================================");
|
||||||
iter1++;
|
iter1++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_wnr->getWirelessActiveConnection(NetworkManager::ActiveConnection::State::Activating, actMap);
|
||||||
|
appendDebugLog("getWirelessActiveConnection Activating " +QString::number(actMap.size()));
|
||||||
|
|
||||||
|
QMap<QString,QStringList>::iterator iter2 = actMap.begin();
|
||||||
|
while (iter2 != actMap.end())
|
||||||
|
{
|
||||||
|
wifiList->append(iter2.key());
|
||||||
|
for (int i = 0; i < iter2->size(); i++)
|
||||||
|
{
|
||||||
|
wifiList->append("Activating" + iter2->at(i));
|
||||||
|
}
|
||||||
|
wifiList->append("====================================");
|
||||||
|
iter2++;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_wnr->getWirelessActiveConnection(NetworkManager::ActiveConnection::State::Deactivating, actMap);
|
||||||
|
appendDebugLog("getWirelessActiveConnection Deactivating " +QString::number(actMap.size()));
|
||||||
|
|
||||||
|
m_wnr->getWirelessActiveConnection(NetworkManager::ActiveConnection::State::Deactivated, actMap);
|
||||||
|
appendDebugLog("getWirelessActiveConnection Deactivated " +QString::number(actMap.size()));
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
QMap<QString, QList<KyWirelessNetItem> > map;
|
QMap<QString, QList<KyWirelessNetItem> > map;
|
||||||
if (!m_wnr->getAllDeviceWifiNetwork(map))
|
if (!m_wnr->getAllDeviceWifiNetwork(map))
|
||||||
{
|
{
|
||||||
|
@ -553,6 +597,7 @@ void NmDemo::getWifiList()
|
||||||
QMap<QString, QList<KyWirelessNetItem> >::iterator iter = map.begin();
|
QMap<QString, QList<KyWirelessNetItem> >::iterator iter = map.begin();
|
||||||
while (iter != map.end())
|
while (iter != map.end())
|
||||||
{
|
{
|
||||||
|
qDebug() << iter.key() << iter.value().size();
|
||||||
for (int i = 0; i < iter.value().size(); i++)
|
for (int i = 0; i < iter.value().size(); i++)
|
||||||
{
|
{
|
||||||
qDebug() << iter.value().at(i).m_NetSsid;
|
qDebug() << iter.value().at(i).m_NetSsid;
|
||||||
|
|
|
@ -70,6 +70,7 @@ public slots:
|
||||||
void onConnectionAdd(QString, QString);
|
void onConnectionAdd(QString, QString);
|
||||||
void onWifiNetworkAdd(QString, KyWirelessNetItem&);
|
void onWifiNetworkAdd(QString, KyWirelessNetItem&);
|
||||||
void onWifiNetworkRemove(QString, QString);
|
void onWifiNetworkRemove(QString, QString);
|
||||||
|
void onWifiNetworkUpdate();
|
||||||
|
|
||||||
void onConnectClicked();
|
void onConnectClicked();
|
||||||
void onDisConnectClicked();
|
void onDisConnectClicked();
|
||||||
|
|
Loading…
Reference in New Issue