mirror of
https://gitee.com/drabel/LibQQt.git
synced 2025-01-04 10:18:44 +08:00
更新ethnet manager的说明
This commit is contained in:
parent
c50b5b6549
commit
0ab8042a50
@ -357,7 +357,8 @@ void QQtEthenetManager::restoreWifi()
|
||||
bzero ( cmdbuf, MAX_PATH );
|
||||
bzero ( cmdresult, MAX_PATH );
|
||||
#if 0
|
||||
sprintf(cmdbuf, "wpa_passphrase %s %s | awk 'NR==4{print $1}'", name.toLatin1().data(), wifiPassword.toLatin1().data());
|
||||
sprintf ( cmdbuf, "wpa_passphrase %s %s | awk 'NR==4{print $1}'", name.toLatin1().data(),
|
||||
wifiPassword.toLatin1().data() );
|
||||
FILE* pp = popen ( cmdbuf, "r" ); //建立管道
|
||||
fgets ( cmdresult, sizeof ( cmdresult ), pp ) ; //""
|
||||
pclose ( pp );
|
||||
@ -402,7 +403,7 @@ void QQtEthenetManager::saveScript()
|
||||
QString ip, mask, gw, dns;
|
||||
getAddr ( ip, mask, gw, dns );
|
||||
|
||||
QFile script("./net.sh");
|
||||
QFile script ( "./init_net.sh" );
|
||||
script.open ( QFile::WriteOnly );
|
||||
char cmdbuf[MAX_PATH];
|
||||
bzero ( cmdbuf, MAX_PATH );
|
||||
@ -441,7 +442,7 @@ void QQtEthenetManager::saveScript()
|
||||
script.close();
|
||||
|
||||
bzero ( cmdbuf, MAX_PATH );
|
||||
sprintf(cmdbuf, "chmod +x ./net.sh");
|
||||
sprintf ( cmdbuf, "chmod +x ./init_net.sh" );
|
||||
system ( cmdbuf );
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,24 @@ private:
|
||||
};
|
||||
|
||||
// thread unsafe
|
||||
/**
|
||||
* @brief The QQtEthenetManager class
|
||||
* 原理:
|
||||
* S1:系统启动,调用init_net.sh
|
||||
* S2:系统运行,用户通过页面设置WiFi或者有线的IP等,或者设置为自动获取。
|
||||
* 保存IP到配置文件,启动时显示到用户页面上
|
||||
* 保存IP等到init_net.sh,系统启动时,网络连接状态正常。
|
||||
* 保存WiFi设置等到/etc/wpa_supplicant.conf
|
||||
* S3:用户插拔网线,WiFi自动切换为有线。
|
||||
* S4:用户重启系统,进入S1.
|
||||
*
|
||||
* 使用说明:
|
||||
* 调用QQtEthnetManager::Instance(parent),并且连接相应的WiFi信号和用户的槽
|
||||
* 通过wifiList(),显示给用户看WiFi列表。每5s自动更新一次。在槽当中调用并更新界面
|
||||
* 通过setCurrentWiFi()更换用户连接的WiFi。用户点击更改输入密码了,就调这个保存。会自动配置WiFi和根据用户IP或者DHCP重来连接新WiFi。
|
||||
*
|
||||
*
|
||||
*/
|
||||
class QQTSHARED_EXPORT QQtEthenetManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -57,7 +75,7 @@ public:
|
||||
/**
|
||||
* @brief configIPAddress
|
||||
* wpa_suplicant.conf
|
||||
* net.sh
|
||||
* init_net.sh
|
||||
* ipaddr.conf
|
||||
*/
|
||||
void ipconfig();
|
||||
|
Loading…
x
Reference in New Issue
Block a user