add getApinfoBySsid

This commit is contained in:
jzxc95 2021-10-15 15:18:55 +08:00
parent d84c97cbc7
commit d834893eb1
9 changed files with 43 additions and 1 deletions

View File

@ -7,6 +7,7 @@ KyApConnectItem::KyApConnectItem(QObject *parent) : QObject(parent)
m_connectUuid = "";
m_ifaceName = "";
m_password = "";
m_band = "";
m_isActivated = false;
}

View File

@ -16,7 +16,9 @@ public:
QString m_connectUuid;
QString m_ifaceName;
QString m_password;
QString m_band;
bool m_isActivated;
};
#endif // KYLINAPCONNECTITEM_H

View File

@ -8,6 +8,9 @@
#include <NetworkManagerQt/VpnPlugin>
#include <NetworkManagerQt/VpnSetting>
const QString str2GBand = "2.4Ghz";
const QString str5GBand = "5Ghz";
static bool subLanListSort(const KyConnectItem* info1, const KyConnectItem* info2)
{
QString name1 = info1->m_connectName;
@ -549,6 +552,11 @@ KyApConnectItem *KyConnectResourse::getApConnectItem(NetworkManager::Connection:
KyApConnectItem *apConnectItem = new KyApConnectItem();
apConnectItem->m_connectName = connectPtr->name();
apConnectItem->m_connectUuid = connectPtr->uuid();
if (wirelessSetting->band() == NetworkManager::WirelessSetting::FrequencyBand::A) {
apConnectItem->m_band = str2GBand;
} else if (wirelessSetting->band() == NetworkManager::WirelessSetting::FrequencyBand::Bg) {
apConnectItem->m_band = str5GBand;
}
apConnectItem->m_ifaceName = settingPtr->interfaceName();
apConnectItem->m_isActivated = m_networkResourceInstance->isActiveConnection(connectPtr->uuid());

View File

@ -219,6 +219,14 @@ QStringList DbusAdaptor::getStoredApInfo()
return list;
}
QStringList DbusAdaptor::getApInfoBySsid(QString devName, QString ssid)
{
QStringList list;
list.clear();
parent()->getApInfoBySsid(devName, ssid, list);
return list;
}
//扫描
void DbusAdaptor::reScan()

View File

@ -80,6 +80,7 @@ public Q_SLOTS: // METHODS
void deactiveWirelessAp(const QString apName, const QString uuid);
//获取热点
QStringList getStoredApInfo();
QStringList getApInfoBySsid(QString devName, QString ssid);
//wifi扫描
void reScan();
Q_SIGNALS: // SIGNALS

View File

@ -437,12 +437,16 @@ void MainWindow::deactiveWirelessAp(const QString apName, const QString uuid)
* @brief MainWindow::activeWirelessAp dbus调用
* @param list
*/
void MainWindow::getApInfoBySsid(QString devName, QString ssid, QStringList &list)
{
m_wlanWidget->getApInfoBySsid(devName, ssid, list);
}
void MainWindow::getStoredApInfo(QStringList &list)
{
m_wlanWidget->getStoredApInfo(list);
}
void MainWindow::setWiredDeviceEnable(const QString& devName, bool enable)
{
m_lanWidget->setWiredDeviceEnable(devName, enable);

View File

@ -35,6 +35,7 @@ public:
void deactiveWirelessAp(const QString apName, const QString uuid);
//获取热点
void getStoredApInfo(QStringList &list);
void getApInfoBySsid(QString devName, QString ssid, QStringList &list);
//有线连接断开
void activateWired(const QString& devName, const QString& connUuid);
void deactivateWired(const QString& devName, const QString& connUuid);

View File

@ -842,6 +842,22 @@ void WlanPage::getStoredApInfo(QStringList &list)
list << apConnectItemList.at(0)->m_password;
list << apConnectItemList.at(0)->m_ifaceName;
list << (apConnectItemList.at(0)->m_isActivated? "true":"false");
list << apConnectItemList.at(0)->m_connectUuid;
list << apConnectItemList.at(0)->m_band;
}
}
void WlanPage::getApInfoBySsid(QString devName, QString ssid, QStringList &list)
{
list.clear();
QList<KyApConnectItem *> apConnectItemList;
m_apConnectResource->getApConnections(apConnectItemList);
for (int i = 0; i < apConnectItemList.size(); i++) {
if (apConnectItemList.at(i)->m_connectName == ssid
&& apConnectItemList.at(i)->m_ifaceName == devName) {
list << apConnectItemList.at(i)->m_password;
list << apConnectItemList.at(i)->m_band;
}
}
}

View File

@ -36,6 +36,7 @@ public:
void deactiveWirelessAp(const QString apName, const QString uuid);
//获取热点
void getStoredApInfo(QStringList &list);
void getApInfoBySsid(QString devName, QString ssid, QStringList &list);
void activateWireless(const QString& devName, const QString& ssid);
void deactivateWireless(const QString& devName, const QString& ssid);