KylinNM同步yangtze分支代码
This commit is contained in:
parent
699e58a2c2
commit
dca307b9b2
|
@ -43,9 +43,9 @@ BackThread::~BackThread()
|
||||||
}
|
}
|
||||||
|
|
||||||
//get the connection state of wired and wireles network
|
//get the connection state of wired and wireles network
|
||||||
IFace BackThread::execGetIface()
|
IFace* BackThread::execGetIface()
|
||||||
{
|
{
|
||||||
IFace iface;
|
IFace *iface = new IFace();
|
||||||
|
|
||||||
QString tmpPath = "/tmp/kylin-nm-iface-" + QDir::home().dirName();
|
QString tmpPath = "/tmp/kylin-nm-iface-" + QDir::home().dirName();
|
||||||
QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli -f TYPE,DEVICE,STATE device > " + tmpPath;
|
QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli -f TYPE,DEVICE,STATE device > " + tmpPath;
|
||||||
|
@ -64,8 +64,8 @@ IFace BackThread::execGetIface()
|
||||||
QStringList txtList = txt.split("\n");
|
QStringList txtList = txt.split("\n");
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
iface.lstate = 2;
|
iface->lstate = 2;
|
||||||
iface.wstate = 2;
|
iface->wstate = 2;
|
||||||
|
|
||||||
for (int i = 1; i < txtList.size(); i ++) {
|
for (int i = 1; i < txtList.size(); i ++) {
|
||||||
QString line = txtList.at(i);
|
QString line = txtList.at(i);
|
||||||
|
@ -77,32 +77,32 @@ IFace BackThread::execGetIface()
|
||||||
QString iname = lastStr.left(index2);
|
QString iname = lastStr.left(index2);
|
||||||
QString istateStr = lastStr.mid(index2).trimmed();
|
QString istateStr = lastStr.mid(index2).trimmed();
|
||||||
|
|
||||||
if (type == "ethernet" && iface.lstate != 0) {
|
if (type == "ethernet" && iface->lstate != 0) {
|
||||||
// if type is wired network
|
// if type is wired network
|
||||||
iface.lname = iname;
|
iface->lname = iname;
|
||||||
|
|
||||||
if (istateStr == "unmanaged") {
|
if (istateStr == "unmanaged") {
|
||||||
iface.lstate = 2; //switch of wired device is off
|
iface->lstate = 2; //switch of wired device is off
|
||||||
}
|
}
|
||||||
if (istateStr == "disconnected" || istateStr == "unavailable") {
|
if (istateStr == "disconnected" || istateStr == "unavailable") {
|
||||||
iface.lstate = 1; //wired network is disconnected
|
iface->lstate = 1; //wired network is disconnected
|
||||||
}
|
}
|
||||||
if (istateStr == "connected") {
|
if (istateStr == "connected") {
|
||||||
iface.lstate = 0; //wired network is connected
|
iface->lstate = 0; //wired network is connected
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type == "wifi" && iface.wstate != 0) {
|
if (type == "wifi" && iface->wstate != 0) {
|
||||||
// if type is wireless network
|
// if type is wireless network
|
||||||
iface.wname = iname;
|
iface->wname = iname;
|
||||||
|
|
||||||
if (istateStr == "unmanaged" || istateStr == "unavailable") {
|
if (istateStr == "unmanaged" || istateStr == "unavailable") {
|
||||||
iface.wstate = 2; //switch of wireless device is off
|
iface->wstate = 2; //switch of wireless device is off
|
||||||
}
|
}
|
||||||
if (istateStr == "disconnected") {
|
if (istateStr == "disconnected") {
|
||||||
iface.wstate = 1; //wireless network is disconnected
|
iface->wstate = 1; //wireless network is disconnected
|
||||||
}
|
}
|
||||||
if (istateStr == "connected") {
|
if (istateStr == "connected") {
|
||||||
iface.wstate = 0; //wireless network is connected
|
iface->wstate = 0; //wireless network is connected
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ void BackThread::execEnNet()
|
||||||
// int status = system("nmcli networking on");
|
// int status = system("nmcli networking on");
|
||||||
// if (status != 0){ syslog(LOG_ERR, "execute 'nmcli networking on' in function 'execEnNet' failed");}
|
// if (status != 0){ syslog(LOG_ERR, "execute 'nmcli networking on' in function 'execEnNet' failed");}
|
||||||
while (1) {
|
while (1) {
|
||||||
if (execGetIface().lstate != 2) {
|
if (execGetIface()->lstate != 2) {
|
||||||
sleep(3);
|
sleep(3);
|
||||||
emit enNetDone();
|
emit enNetDone();
|
||||||
emit btFinish();
|
emit btFinish();
|
||||||
|
@ -133,14 +133,14 @@ void BackThread::execEnNet()
|
||||||
//turn off the switch of wireless network first, then turn off the switch of network
|
//turn off the switch of wireless network first, then turn off the switch of network
|
||||||
void BackThread::execDisNet()
|
void BackThread::execDisNet()
|
||||||
{
|
{
|
||||||
if (execGetIface().wstate != 2) {
|
if (execGetIface()->wstate != 2) {
|
||||||
char *chr = "nmcli radio wifi off";
|
char *chr = "nmcli radio wifi off";
|
||||||
Utils::m_system(chr);
|
Utils::m_system(chr);
|
||||||
|
|
||||||
// int status = system("nmcli radio wifi off");
|
// int status = system("nmcli radio wifi off");
|
||||||
// if (status != 0){ syslog(LOG_ERR, "execute 'nmcli radio wifi off' in function 'execDisNet' failed");}
|
// if (status != 0){ syslog(LOG_ERR, "execute 'nmcli radio wifi off' in function 'execDisNet' failed");}
|
||||||
while (1) {
|
while (1) {
|
||||||
if (execGetIface().wstate == 2) {
|
if (execGetIface()->wstate == 2) {
|
||||||
emit disWifiDone();
|
emit disWifiDone();
|
||||||
emit btFinish();
|
emit btFinish();
|
||||||
break;
|
break;
|
||||||
|
@ -154,7 +154,7 @@ void BackThread::execDisNet()
|
||||||
// int status1 = system("nmcli networking off");
|
// int status1 = system("nmcli networking off");
|
||||||
// if (status1 != 0){ syslog(LOG_ERR, "execute 'nmcli networking off' in function 'execDisNet' failed");}
|
// if (status1 != 0){ syslog(LOG_ERR, "execute 'nmcli networking off' in function 'execDisNet' failed");}
|
||||||
while (1) {
|
while (1) {
|
||||||
if (execGetIface().lstate == 2) {
|
if (execGetIface()->lstate == 2) {
|
||||||
emit disNetDone();
|
emit disNetDone();
|
||||||
emit btFinish();
|
emit btFinish();
|
||||||
break;
|
break;
|
||||||
|
@ -185,7 +185,7 @@ void BackThread::execEnWifi()
|
||||||
//int status1 = system("nmcli radio wifi on");
|
//int status1 = system("nmcli radio wifi on");
|
||||||
//if (status1 != 0){ syslog(LOG_ERR, "execute 'nmcli radio wifi on' in function 'execEnWifi' failed");}
|
//if (status1 != 0){ syslog(LOG_ERR, "execute 'nmcli radio wifi on' in function 'execEnWifi' failed");}
|
||||||
while (1) {
|
while (1) {
|
||||||
if (execGetIface().wstate != 2) {
|
if (execGetIface()->wstate != 2) {
|
||||||
KylinDBus objKyDbus;
|
KylinDBus objKyDbus;
|
||||||
while (1) {
|
while (1) {
|
||||||
if (objKyDbus.getAccessPointsNumber() > 0) {
|
if (objKyDbus.getAccessPointsNumber() > 0) {
|
||||||
|
@ -211,7 +211,7 @@ void BackThread::execDisWifi()
|
||||||
// int status = system("nmcli radio wifi off");
|
// int status = system("nmcli radio wifi off");
|
||||||
// if (status != 0){ syslog(LOG_ERR, "execute 'nmcli radio wifi off' in function 'execDisWifi' failed");}
|
// if (status != 0){ syslog(LOG_ERR, "execute 'nmcli radio wifi off' in function 'execDisWifi' failed");}
|
||||||
while (1) {
|
while (1) {
|
||||||
if (execGetIface().wstate == 2) {
|
if (execGetIface()->wstate == 2) {
|
||||||
KylinNM::reflashWifiUi();
|
KylinNM::reflashWifiUi();
|
||||||
emit disWifiDone();
|
emit disWifiDone();
|
||||||
emit btFinish();
|
emit btFinish();
|
||||||
|
@ -233,8 +233,8 @@ void BackThread::execConnLan(QString connName)
|
||||||
Utils::m_system(cmd.toUtf8().data());
|
Utils::m_system(cmd.toUtf8().data());
|
||||||
// int status = system(cmd.toUtf8().data());
|
// int status = system(cmd.toUtf8().data());
|
||||||
// if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection up' in function 'execConnLan' failed");}
|
// if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection up' in function 'execConnLan' failed");}
|
||||||
qDebug()<<"debug: in function execConnLan, wired net state is: "<<QString::number(execGetIface().lstate);
|
qDebug()<<"debug: in function execConnLan, wired net state is: "<<QString::number(execGetIface()->lstate);
|
||||||
syslog(LOG_DEBUG, "In function execConnLan, wired net state is: %d", execGetIface().lstate);
|
syslog(LOG_DEBUG, "In function execConnLan, wired net state is: %d", execGetIface()->lstate);
|
||||||
emit connDone(0);
|
emit connDone(0);
|
||||||
} else {
|
} else {
|
||||||
qDebug()<<"connect wired network failed for without wired cable plug in.";
|
qDebug()<<"connect wired network failed for without wired cable plug in.";
|
||||||
|
@ -263,8 +263,8 @@ void BackThread::execConnWifiPWD(QString connName, QString password)
|
||||||
file.close();
|
file.close();
|
||||||
if (line.indexOf("successfully") != -1) {
|
if (line.indexOf("successfully") != -1) {
|
||||||
emit connDone(0);
|
emit connDone(0);
|
||||||
qDebug()<<"debug: in function execConnWifiPWD, wireless net state is: "<<QString::number(execGetIface().wstate);
|
qDebug()<<"debug: in function execConnWifiPWD, wireless net state is: "<<QString::number(execGetIface()->wstate);
|
||||||
syslog(LOG_DEBUG, "In function execConnWifiPWD, wireless net state is: %d", execGetIface().wstate);
|
syslog(LOG_DEBUG, "In function execConnWifiPWD, wireless net state is: %d", execGetIface()->wstate);
|
||||||
} else {
|
} else {
|
||||||
emit connDone(1);
|
emit connDone(1);
|
||||||
}
|
}
|
||||||
|
@ -293,8 +293,8 @@ void BackThread::on_readoutput()
|
||||||
qDebug()<<"on_readoutput: "<< str;
|
qDebug()<<"on_readoutput: "<< str;
|
||||||
if (str.indexOf("successfully") != -1) {
|
if (str.indexOf("successfully") != -1) {
|
||||||
emit connDone(0); //send this signal if connect net successfully
|
emit connDone(0); //send this signal if connect net successfully
|
||||||
qDebug()<<"debug: in function on_readoutput, wireless net state is: "<<QString::number(execGetIface().wstate);
|
qDebug()<<"debug: in function on_readoutput, wireless net state is: "<<QString::number(execGetIface()->wstate);
|
||||||
syslog(LOG_DEBUG, "In function on_readoutput, wireless net state is: %d", execGetIface().wstate);
|
syslog(LOG_DEBUG, "In function on_readoutput, wireless net state is: %d", execGetIface()->wstate);
|
||||||
} else if(str.indexOf("unknown") != -1) {
|
} else if(str.indexOf("unknown") != -1) {
|
||||||
emit connDone(2);
|
emit connDone(2);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -32,10 +32,10 @@
|
||||||
|
|
||||||
class IFace{
|
class IFace{
|
||||||
public:
|
public:
|
||||||
QString lname = "";
|
QString lname;
|
||||||
QString wname = "";
|
QString wname;
|
||||||
int lstate = 2; // 0已连接 1未连接 2已关闭
|
int lstate; // 0已连接 1未连接 2已关闭
|
||||||
int wstate = 2; // 0已连接 1未连接 2已关闭
|
int wstate; // 0已连接 1未连接 2已关闭
|
||||||
};
|
};
|
||||||
|
|
||||||
class BackThread : public QObject
|
class BackThread : public QObject
|
||||||
|
@ -45,7 +45,7 @@ public:
|
||||||
explicit BackThread(QObject *parent = nullptr);
|
explicit BackThread(QObject *parent = nullptr);
|
||||||
~BackThread();
|
~BackThread();
|
||||||
|
|
||||||
IFace execGetIface();
|
IFace* execGetIface();
|
||||||
QString getConnProp(QString connName);
|
QString getConnProp(QString connName);
|
||||||
QString execChkLanWidth(QString ethName);
|
QString execChkLanWidth(QString ethName);
|
||||||
QProcess *cmdConnWifi = nullptr;
|
QProcess *cmdConnWifi = nullptr;
|
||||||
|
|
|
@ -187,11 +187,8 @@ conlist *kylin_network_get_conlist_info()
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取当前活动网络连接
|
//获取当前活动网络连接
|
||||||
int kylin_network_get_activecon_info(activecon** activelist, int* count)
|
activecon *kylin_network_get_activecon_info()
|
||||||
{
|
{
|
||||||
if (*activelist != NULL || !count) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
pwd = getpwuid(getuid());
|
pwd = getpwuid(getuid());
|
||||||
char *name = pwd->pw_name;
|
char *name = pwd->pw_name;
|
||||||
|
@ -216,7 +213,6 @@ int kylin_network_get_activecon_info(activecon** activelist, int* count)
|
||||||
if((activefp=fopen(filename,"r"))==NULL)
|
if((activefp=fopen(filename,"r"))==NULL)
|
||||||
{
|
{
|
||||||
printf("error!");
|
printf("error!");
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
fgets(activeStrLine,1024,activefp);
|
fgets(activeStrLine,1024,activefp);
|
||||||
while(!feof(activefp))
|
while(!feof(activefp))
|
||||||
|
@ -226,22 +222,22 @@ int kylin_network_get_activecon_info(activecon** activelist, int* count)
|
||||||
}
|
}
|
||||||
// printf("%d\n",activenum);
|
// printf("%d\n",activenum);
|
||||||
fclose(activefp);
|
fclose(activefp);
|
||||||
*activelist=(activecon *)malloc(sizeof(activecon)*activenum);
|
activecon *activelist=(activecon *)malloc(sizeof(activecon)*activenum);
|
||||||
|
|
||||||
*count=0;
|
int count=0;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char StrLine[1024];
|
char StrLine[1024];
|
||||||
if((fp=fopen(filename,"r"))==NULL)
|
if((fp=fopen(filename,"r"))==NULL)
|
||||||
{
|
{
|
||||||
printf("error!");
|
printf("error!");
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
free(path);
|
free(path);
|
||||||
|
|
||||||
fgets(StrLine,1024,fp);
|
fgets(StrLine,1024,fp);
|
||||||
while(!feof(fp))
|
while(!feof(fp))
|
||||||
{
|
{
|
||||||
if(*count==activenum-1)break;
|
if(count==activenum-1)break;
|
||||||
|
|
||||||
fgets(StrLine,1024,fp);
|
fgets(StrLine,1024,fp);
|
||||||
|
|
||||||
|
@ -261,9 +257,10 @@ int kylin_network_get_activecon_info(activecon** activelist, int* count)
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("连接名称长度:%d\n",num);
|
// printf("连接名称长度:%d\n",num);
|
||||||
|
activelist[count].con_name=(char *)malloc(sizeof(char)*(num+1));
|
||||||
strncpy(conname,StrLine,num+1);
|
strncpy(conname,StrLine,num+1);
|
||||||
conname[num]='\0';
|
conname[num]='\0';
|
||||||
strncpy((*activelist)[*count].con_name,conname,num+1);
|
strncpy(activelist[count].con_name,conname,num+1);
|
||||||
// printf("%s\n",activelist[count].con_name);
|
// printf("%s\n",activelist[count].con_name);
|
||||||
|
|
||||||
//截取连接类型
|
//截取连接类型
|
||||||
|
@ -294,9 +291,10 @@ int kylin_network_get_activecon_info(activecon** activelist, int* count)
|
||||||
if(*index2==' ')break;
|
if(*index2==' ')break;
|
||||||
num1++;
|
num1++;
|
||||||
}
|
}
|
||||||
|
activelist[count].type=(char *)malloc(sizeof(char)*(num1+1));
|
||||||
strncpy(type,index1+2,num1+1);
|
strncpy(type,index1+2,num1+1);
|
||||||
type[num1]='\0';
|
type[num1]='\0';
|
||||||
strncpy((*activelist)[*count].type,type,num1+1);
|
strncpy(activelist[count].type,type,num1+1);
|
||||||
// printf("%s\n",activelist[count].type);
|
// printf("%s\n",activelist[count].type);
|
||||||
|
|
||||||
//截取连接所属设备
|
//截取连接所属设备
|
||||||
|
@ -317,14 +315,20 @@ int kylin_network_get_activecon_info(activecon** activelist, int* count)
|
||||||
if(*index4==' ')break;
|
if(*index4==' ')break;
|
||||||
num2++;
|
num2++;
|
||||||
}
|
}
|
||||||
|
activelist[count].dev=(char *)malloc(sizeof(char)*(num2+1));
|
||||||
strncpy(dev,index3+1,num2+1);
|
strncpy(dev,index3+1,num2+1);
|
||||||
dev[num2]='\0';
|
dev[num2]='\0';
|
||||||
strncpy((*activelist)[*count].dev,dev,num2+1);
|
strncpy(activelist[count].dev,dev,num2+1);
|
||||||
// printf("%s\n",activelist[count].dev);
|
// printf("%s\n",activelist[count].dev);
|
||||||
(*count)++;
|
count++;
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return 0;
|
|
||||||
|
activelist[count].con_name=NULL;
|
||||||
|
activelist[count].type=NULL;
|
||||||
|
activelist[count].dev=NULL;
|
||||||
|
|
||||||
|
return activelist;
|
||||||
}
|
}
|
||||||
|
|
||||||
//创建新的以太网连接
|
//创建新的以太网连接
|
||||||
|
@ -825,7 +829,6 @@ long *kylin_network_get_bytes(char *if_name)
|
||||||
if(i == 10)
|
if(i == 10)
|
||||||
{
|
{
|
||||||
rtbyt[1] = atol(value);
|
rtbyt[1] = atol(value);
|
||||||
free(value);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free(value);
|
free(value);
|
||||||
|
@ -866,7 +869,6 @@ long *kylin_network_get_packets(char *if_name)
|
||||||
if(i == 11)
|
if(i == 11)
|
||||||
{
|
{
|
||||||
rtpkt[1] = atol(value);
|
rtpkt[1] = atol(value);
|
||||||
free(value);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free(value);
|
free(value);
|
||||||
|
@ -907,7 +909,6 @@ long *kylin_network_get_errs(char *if_name)
|
||||||
if(i == 12)
|
if(i == 12)
|
||||||
{
|
{
|
||||||
rterrs[1] = atol(value);
|
rterrs[1] = atol(value);
|
||||||
free(value);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free(value);
|
free(value);
|
||||||
|
@ -948,7 +949,6 @@ long *kylin_network_get_drop(char *if_name)
|
||||||
if(i == 13)
|
if(i == 13)
|
||||||
{
|
{
|
||||||
rtdrop[1] = atol(value);
|
rtdrop[1] = atol(value);
|
||||||
free(value);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free(value);
|
free(value);
|
||||||
|
@ -989,7 +989,6 @@ long *kylin_network_get_fifo(char *if_name)
|
||||||
if(i == 14)
|
if(i == 14)
|
||||||
{
|
{
|
||||||
rtfifo[1] = atol(value);
|
rtfifo[1] = atol(value);
|
||||||
free(value);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free(value);
|
free(value);
|
||||||
|
|
|
@ -52,9 +52,9 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char con_name[128];//活动网络连接名称
|
char *con_name;//活动网络连接名称
|
||||||
char type[128];//活动网络连接类型
|
char *type;//活动网络连接类型
|
||||||
char dev[128];//活动网络所属设备
|
char *dev;//活动网络所属设备
|
||||||
}activecon;//存放当前活动网络连接
|
}activecon;//存放当前活动网络连接
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -71,9 +71,9 @@ conlist *kylin_network_get_conlist_info();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the active network connection.
|
* Get the active network connection.
|
||||||
* return the struct pointer and list count.
|
* return the struct pointer.
|
||||||
*/
|
*/
|
||||||
int kylin_network_get_activecon_info(activecon** activelist, int* count);
|
activecon *kylin_network_get_activecon_info();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a new Ethernet connection.
|
* Create a new Ethernet connection.
|
||||||
|
|
|
@ -489,26 +489,26 @@ void KylinNM::getInitLanSlist()
|
||||||
// 初始化网络
|
// 初始化网络
|
||||||
void KylinNM::initNetwork()
|
void KylinNM::initNetwork()
|
||||||
{
|
{
|
||||||
BackThread bt;
|
BackThread *bt = new BackThread();
|
||||||
IFace iface = bt.execGetIface();
|
IFace *iface = bt->execGetIface();
|
||||||
|
|
||||||
wname = iface.wname;
|
wname = iface->wname;
|
||||||
lwname = iface.wname;
|
lwname = iface->wname;
|
||||||
lname = iface.lname;
|
lname = iface->lname;
|
||||||
llname = iface.lname;
|
llname = iface->lname;
|
||||||
|
|
||||||
mwBandWidth = bt.execChkLanWidth(lname);
|
mwBandWidth = bt->execChkLanWidth(lname);
|
||||||
|
|
||||||
// 开关状态
|
// 开关状态
|
||||||
qDebug()<<"===";
|
qDebug()<<"===";
|
||||||
qDebug()<<"state of network: '0' is connected, '1' is disconnected, '2' is net device switch off";
|
qDebug()<<"state of network: '0' is connected, '1' is disconnected, '2' is net device switch off";
|
||||||
syslog(LOG_DEBUG, "state of network: '0' is connected, '1' is disconnected, '2' is net device switch off");
|
syslog(LOG_DEBUG, "state of network: '0' is connected, '1' is disconnected, '2' is net device switch off");
|
||||||
qDebug()<<"current network state: lan state ="<<iface.lstate<<", wifi state ="<<iface.wstate ;
|
qDebug()<<"current network state: lan state ="<<iface->lstate<<", wifi state ="<<iface->wstate ;
|
||||||
syslog(LOG_DEBUG, "current network state: wired state =%d, wifi state =%d", iface.lstate, iface.wstate);
|
syslog(LOG_DEBUG, "current network state: wired state =%d, wifi state =%d", iface->lstate, iface->wstate);
|
||||||
qDebug()<<"===";
|
qDebug()<<"===";
|
||||||
|
|
||||||
//ui->lbBtnNetBG->setStyleSheet(btnOnQss);
|
//ui->lbBtnNetBG->setStyleSheet(btnOnQss);
|
||||||
if (iface.wstate == 0 || iface.wstate == 1 || iface.wstate == 3) {
|
if (iface->wstate == 0 || iface->wstate == 1 || iface->wstate == 3) {
|
||||||
// ui->lbBtnWifiBG->setStyleSheet(btnBgOnQss);
|
// ui->lbBtnWifiBG->setStyleSheet(btnBgOnQss);
|
||||||
//ui->lbBtnWifiBall->move(X_RIGHT_WIFI_BALL, Y_WIFI_BALL);
|
//ui->lbBtnWifiBall->move(X_RIGHT_WIFI_BALL, Y_WIFI_BALL);
|
||||||
btnWireless->setSwitchStatus(true);
|
btnWireless->setSwitchStatus(true);
|
||||||
|
@ -519,11 +519,11 @@ void KylinNM::initNetwork()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化网络列表
|
// 初始化网络列表
|
||||||
if (iface.wstate != 2) {
|
if (iface->wstate != 2) {
|
||||||
if (iface.wstate == 0) {
|
if (iface->wstate == 0) {
|
||||||
connWifiDone(3);
|
connWifiDone(3);
|
||||||
} else {
|
} else {
|
||||||
if (iface.lstate == 0) {
|
if (iface->lstate == 0) {
|
||||||
connLanDone(3);
|
connLanDone(3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -533,8 +533,8 @@ void KylinNM::initNetwork()
|
||||||
ui->btnWifiList->setStyleSheet("QPushButton{border:none;}");
|
ui->btnWifiList->setStyleSheet("QPushButton{border:none;}");
|
||||||
} else {
|
} else {
|
||||||
objKyDBus->setWifiSwitchState(false); //通知控制面板wifi未开启
|
objKyDBus->setWifiSwitchState(false); //通知控制面板wifi未开启
|
||||||
if (iface.lstate != 2) {
|
if (iface->lstate != 2) {
|
||||||
if (iface.lstate == 0) {
|
if (iface->lstate == 0) {
|
||||||
connLanDone(3);
|
connLanDone(3);
|
||||||
}
|
}
|
||||||
onBtnNetListClicked();
|
onBtnNetListClicked();
|
||||||
|
@ -544,7 +544,7 @@ void KylinNM::initNetwork()
|
||||||
} else {
|
} else {
|
||||||
/*没看懂这段断开连接是什么意思,暂时关闭这段操作,会导致页面卡顿、某些情景还会自动断开网络
|
/*没看懂这段断开连接是什么意思,暂时关闭这段操作,会导致页面卡顿、某些情景还会自动断开网络
|
||||||
// BackThread *m_bt = new BackThread();
|
// BackThread *m_bt = new BackThread();
|
||||||
// m_bt->execGetIface();
|
// IFace *m_iface = m_bt->execGetIface();
|
||||||
|
|
||||||
// m_bt->disConnLanOrWifi("ethernet");
|
// m_bt->disConnLanOrWifi("ethernet");
|
||||||
// sleep(1);
|
// sleep(1);
|
||||||
|
@ -552,6 +552,7 @@ void KylinNM::initNetwork()
|
||||||
// sleep(1);
|
// sleep(1);
|
||||||
// m_bt->disConnLanOrWifi("ethernet");
|
// m_bt->disConnLanOrWifi("ethernet");
|
||||||
|
|
||||||
|
// delete m_iface;
|
||||||
// m_bt->deleteLater();
|
// m_bt->deleteLater();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -682,13 +683,16 @@ void KylinNM::updateNetList()
|
||||||
}
|
}
|
||||||
is_stop_check_net_state = 1;
|
is_stop_check_net_state = 1;
|
||||||
if (is_btnWifiList_clicked == 1) {
|
if (is_btnWifiList_clicked == 1) {
|
||||||
BackThread loop_bt;
|
BackThread *loop_bt = new BackThread();
|
||||||
IFace loop_iface = loop_bt.execGetIface();
|
IFace *loop_iface = loop_bt->execGetIface();
|
||||||
|
|
||||||
if (loop_iface.wstate != 2) {
|
if (loop_iface->wstate != 2) {
|
||||||
is_update_wifi_list = 1;
|
is_update_wifi_list = 1;
|
||||||
this->ksnm->execGetWifiList(); //更新wifi列表
|
this->ksnm->execGetWifiList(); //更新wifi列表
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete loop_iface;
|
||||||
|
loop_bt->deleteLater();
|
||||||
}
|
}
|
||||||
is_stop_check_net_state = 0;
|
is_stop_check_net_state = 0;
|
||||||
}
|
}
|
||||||
|
@ -720,13 +724,16 @@ void KylinNM::iconActivated(QSystemTrayIcon::ActivationReason reason)
|
||||||
}
|
}
|
||||||
is_stop_check_net_state = 1;
|
is_stop_check_net_state = 1;
|
||||||
if (is_btnWifiList_clicked == 1) {
|
if (is_btnWifiList_clicked == 1) {
|
||||||
BackThread loop_bt;
|
BackThread *loop_bt = new BackThread();
|
||||||
IFace loop_iface = loop_bt.execGetIface();
|
IFace *loop_iface = loop_bt->execGetIface();
|
||||||
|
|
||||||
if (loop_iface.wstate != 2) {
|
if (loop_iface->wstate != 2) {
|
||||||
is_update_wifi_list = 1;
|
is_update_wifi_list = 1;
|
||||||
this->ksnm->execGetWifiList(); //更新wifi列表
|
this->ksnm->execGetWifiList(); //更新wifi列表
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete loop_iface;
|
||||||
|
loop_bt->deleteLater();
|
||||||
}
|
}
|
||||||
is_stop_check_net_state = 0;
|
is_stop_check_net_state = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -905,13 +912,9 @@ void KylinNM::getActiveInfo()
|
||||||
QString actLanName = "--";
|
QString actLanName = "--";
|
||||||
QString actWifiName = "--";
|
QString actWifiName = "--";
|
||||||
|
|
||||||
activecon *act = NULL;
|
activecon *act = kylin_network_get_activecon_info();
|
||||||
int count = 0;
|
|
||||||
kylin_network_get_activecon_info(&act, &count);
|
|
||||||
if(!act)
|
|
||||||
return ;
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
while (act && index < count) {
|
while (act[index].con_name != NULL) {
|
||||||
if (QString(act[index].type) == "ethernet" || QString(act[index].type) == "802-3-ethernet") {
|
if (QString(act[index].type) == "ethernet" || QString(act[index].type) == "802-3-ethernet") {
|
||||||
actLanName = QString(act[index].con_name);
|
actLanName = QString(act[index].con_name);
|
||||||
}
|
}
|
||||||
|
@ -920,9 +923,7 @@ void KylinNM::getActiveInfo()
|
||||||
}
|
}
|
||||||
index ++;
|
index ++;
|
||||||
}
|
}
|
||||||
if (act) {
|
|
||||||
free(act);
|
|
||||||
}
|
|
||||||
|
|
||||||
//ukui3.0中获取currentActWifiSignalLv的值
|
//ukui3.0中获取currentActWifiSignalLv的值
|
||||||
if (activeWifiSignalLv > 75) {
|
if (activeWifiSignalLv > 75) {
|
||||||
|
@ -978,12 +979,14 @@ void KylinNM::onPhysicalCarrierChanged(bool flag)
|
||||||
qDebug()<<"拔出了有线网的网线";
|
qDebug()<<"拔出了有线网的网线";
|
||||||
syslog(LOG_DEBUG,"wired physical cable is already plug out");
|
syslog(LOG_DEBUG,"wired physical cable is already plug out");
|
||||||
|
|
||||||
BackThread bt;
|
BackThread *bt = new BackThread();
|
||||||
IFace iface = bt.execGetIface();
|
IFace *iface = bt->execGetIface();
|
||||||
if (iface.lstate != 0) {
|
if (iface->lstate != 0) {
|
||||||
is_stop_check_net_state = 1;
|
is_stop_check_net_state = 1;
|
||||||
wiredCableDownTimer->start(2000);
|
wiredCableDownTimer->start(2000);
|
||||||
}
|
}
|
||||||
|
delete iface;
|
||||||
|
bt->deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1014,12 +1017,13 @@ void KylinNM::onCarrierDownHandle()
|
||||||
void KylinNM::onDeleteLan()
|
void KylinNM::onDeleteLan()
|
||||||
{
|
{
|
||||||
deleteLanTimer->stop();
|
deleteLanTimer->stop();
|
||||||
BackThread btn_bt;
|
BackThread *btn_bt = new BackThread();
|
||||||
btn_bt.disConnLanOrWifi("ethernet");
|
btn_bt->disConnLanOrWifi("ethernet");
|
||||||
sleep(1);
|
sleep(1);
|
||||||
btn_bt.disConnLanOrWifi("ethernet");
|
btn_bt->disConnLanOrWifi("ethernet");
|
||||||
sleep(1);
|
sleep(1);
|
||||||
btn_bt.disConnLanOrWifi("ethernet");
|
btn_bt->disConnLanOrWifi("ethernet");
|
||||||
|
btn_bt->deleteLater();
|
||||||
|
|
||||||
this->stopLoading();
|
this->stopLoading();
|
||||||
onBtnNetListClicked(0);
|
onBtnNetListClicked(0);
|
||||||
|
@ -1075,36 +1079,42 @@ void KylinNM::checkIsWirelessDeviceOn()
|
||||||
|
|
||||||
void KylinNM::getLanBandWidth()
|
void KylinNM::getLanBandWidth()
|
||||||
{
|
{
|
||||||
BackThread bt;
|
BackThread *bt = new BackThread();
|
||||||
IFace iface = bt.execGetIface();
|
IFace *iface = bt->execGetIface();
|
||||||
|
|
||||||
lname = iface.lname;
|
lname = iface->lname;
|
||||||
|
|
||||||
mwBandWidth = bt.execChkLanWidth(lname);
|
mwBandWidth = bt->execChkLanWidth(lname);
|
||||||
}
|
}
|
||||||
|
|
||||||
//检测网络设备状态
|
//检测网络设备状态
|
||||||
bool KylinNM::checkLanOn()
|
bool KylinNM::checkLanOn()
|
||||||
{
|
{
|
||||||
BackThread bt;
|
BackThread *bt = new BackThread();
|
||||||
IFace iface = bt.execGetIface();
|
IFace *iface = bt->execGetIface();
|
||||||
|
|
||||||
if (iface.lstate == 2) {
|
if (iface->lstate == 2) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete iface;
|
||||||
|
bt->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KylinNM::checkWlOn()
|
bool KylinNM::checkWlOn()
|
||||||
{
|
{
|
||||||
BackThread bt;
|
BackThread *bt = new BackThread();
|
||||||
IFace iface = bt.execGetIface();
|
IFace *iface = bt->execGetIface();
|
||||||
|
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
if (iface.wstate == 2) {
|
if (iface->wstate == 2) {
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete iface;
|
||||||
|
bt->deleteLater();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1297,14 +1307,14 @@ void KylinNM::onBtnNetListClicked(int flag)
|
||||||
ui->lbNetListBG->setStyleSheet(btnOnQss);
|
ui->lbNetListBG->setStyleSheet(btnOnQss);
|
||||||
ui->lbWifiListBG->setStyleSheet(btnOffQss);
|
ui->lbWifiListBG->setStyleSheet(btnOffQss);
|
||||||
|
|
||||||
BackThread bt;
|
BackThread *bt = new BackThread();
|
||||||
IFace iface = bt.execGetIface();
|
IFace *iface = bt->execGetIface();
|
||||||
|
|
||||||
lbLoadDown->show();
|
lbLoadDown->show();
|
||||||
lbLoadUp->show();
|
lbLoadUp->show();
|
||||||
lbLoadDownImg->show();
|
lbLoadDownImg->show();
|
||||||
lbLoadUpImg->show();
|
lbLoadUpImg->show();
|
||||||
if (iface.lstate != 0) {
|
if (iface->lstate != 0) {
|
||||||
lbLoadDown->hide();
|
lbLoadDown->hide();
|
||||||
lbLoadUp->hide();
|
lbLoadUp->hide();
|
||||||
lbLoadDownImg->hide();
|
lbLoadDownImg->hide();
|
||||||
|
@ -1330,7 +1340,7 @@ void KylinNM::onBtnNetListClicked(int flag)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iface.lstate != 2) {
|
if (iface->lstate != 2) {
|
||||||
this->startLoading();
|
this->startLoading();
|
||||||
this->ksnm->execGetLanList();
|
this->ksnm->execGetLanList();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1350,6 +1360,10 @@ void KylinNM::onBtnNetListClicked(int flag)
|
||||||
ui->lbWifiListImg->setStyleSheet("QLabel{border-image:url(:/res/x/pb-wifi-n.png);background-position:center;background-repeat:no-repeat;}");
|
ui->lbWifiListImg->setStyleSheet("QLabel{border-image:url(:/res/x/pb-wifi-n.png);background-position:center;background-repeat:no-repeat;}");
|
||||||
lbNetListText->setStyleSheet("QLabel{color:rgba(47, 179, 232, 1);background-color:transparent;}");
|
lbNetListText->setStyleSheet("QLabel{color:rgba(47, 179, 232, 1);background-color:transparent;}");
|
||||||
lbWifiListText->setStyleSheet("QLabel{color:rgba(38, 38, 38, 0.75);background-color:transparent;}");
|
lbWifiListText->setStyleSheet("QLabel{color:rgba(38, 38, 38, 0.75);background-color:transparent;}");
|
||||||
|
|
||||||
|
|
||||||
|
delete iface;
|
||||||
|
bt->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当点击wifi标题的时候执行
|
// 当点击wifi标题的时候执行
|
||||||
|
@ -1358,14 +1372,14 @@ void KylinNM::on_btnWifiList_clicked()
|
||||||
this->is_btnWifiList_clicked = 1;
|
this->is_btnWifiList_clicked = 1;
|
||||||
this->is_btnNetList_clicked = 0;
|
this->is_btnNetList_clicked = 0;
|
||||||
|
|
||||||
BackThread bt;
|
BackThread *bt = new BackThread();
|
||||||
IFace iface = bt.execGetIface();
|
IFace *iface = bt->execGetIface();
|
||||||
|
|
||||||
lbLoadDown->show();
|
lbLoadDown->show();
|
||||||
lbLoadUp->show();
|
lbLoadUp->show();
|
||||||
lbLoadDownImg->show();
|
lbLoadDownImg->show();
|
||||||
lbLoadUpImg->show();
|
lbLoadUpImg->show();
|
||||||
if (iface.wstate != 0) {
|
if (iface->wstate != 0) {
|
||||||
lbLoadDown->hide();
|
lbLoadDown->hide();
|
||||||
lbLoadUp->hide();
|
lbLoadUp->hide();
|
||||||
lbLoadDownImg->hide();
|
lbLoadDownImg->hide();
|
||||||
|
@ -1380,7 +1394,7 @@ void KylinNM::on_btnWifiList_clicked()
|
||||||
btnWireless->show();
|
btnWireless->show();
|
||||||
//ui->lbBtnWifiBG->show();
|
//ui->lbBtnWifiBG->show();
|
||||||
//ui->lbBtnWifiBall->show();
|
//ui->lbBtnWifiBall->show();
|
||||||
if (iface.wstate == 0 || iface.wstate == 1 || iface.wstate == 3) {
|
if (iface->wstate == 0 || iface->wstate == 1 || iface->wstate == 3) {
|
||||||
//ui->lbBtnWifiBG->setStyleSheet(btnBgOnQss);
|
//ui->lbBtnWifiBG->setStyleSheet(btnBgOnQss);
|
||||||
//ui->lbBtnWifiBall->move(X_RIGHT_WIFI_BALL, Y_WIFI_BALL);
|
//ui->lbBtnWifiBall->move(X_RIGHT_WIFI_BALL, Y_WIFI_BALL);
|
||||||
btnWireless->setSwitchStatus(true);
|
btnWireless->setSwitchStatus(true);
|
||||||
|
@ -1390,7 +1404,7 @@ void KylinNM::on_btnWifiList_clicked()
|
||||||
btnWireless->setSwitchStatus(false);
|
btnWireless->setSwitchStatus(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iface.wstate != 2) {
|
if (iface->wstate != 2) {
|
||||||
//ui->lbBtnWifiBG->setStyleSheet(btnBgOnQss);
|
//ui->lbBtnWifiBG->setStyleSheet(btnBgOnQss);
|
||||||
//ui->lbBtnWifiBall->move(X_RIGHT_WIFI_BALL, Y_WIFI_BALL);
|
//ui->lbBtnWifiBall->move(X_RIGHT_WIFI_BALL, Y_WIFI_BALL);
|
||||||
btnWireless->setSwitchStatus(true);
|
btnWireless->setSwitchStatus(true);
|
||||||
|
@ -1448,6 +1462,9 @@ void KylinNM::on_btnWifiList_clicked()
|
||||||
this->scrollAreaw->show();
|
this->scrollAreaw->show();
|
||||||
this->topWifiListWidget->show();
|
this->topWifiListWidget->show();
|
||||||
on_btnWifiList_pressed();
|
on_btnWifiList_pressed();
|
||||||
|
|
||||||
|
delete iface;
|
||||||
|
bt->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KylinNM::on_btnNetList_pressed()
|
void KylinNM::on_btnNetList_pressed()
|
||||||
|
@ -1499,20 +1516,16 @@ void KylinNM::getLanListDone(QStringList slist)
|
||||||
|
|
||||||
// 获取当前连接的lan name
|
// 获取当前连接的lan name
|
||||||
QString actLanName = "--";
|
QString actLanName = "--";
|
||||||
activecon *act = NULL;
|
activecon *act = kylin_network_get_activecon_info();
|
||||||
int count = 0;
|
|
||||||
kylin_network_get_activecon_info(&act, &count);
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
while (act && index < count) {
|
while (act[index].con_name != NULL) {
|
||||||
if (QString(act[index].type) == "ethernet" || QString(act[index].type) == "802-3-ethernet") {
|
if (QString(act[index].type) == "ethernet" || QString(act[index].type) == "802-3-ethernet") {
|
||||||
actLanName = QString(act[index].con_name);
|
actLanName = QString(act[index].con_name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
index ++;
|
index ++;
|
||||||
}
|
}
|
||||||
if (act) {
|
|
||||||
free(act);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 若当前lan name为"--",设置OneConnForm
|
// 若当前lan name为"--",设置OneConnForm
|
||||||
OneLancForm *ccf = new OneLancForm(topLanListWidget, this, confForm, ksnm);
|
OneLancForm *ccf = new OneLancForm(topLanListWidget, this, confForm, ksnm);
|
||||||
|
@ -1673,21 +1686,15 @@ void KylinNM::loadWifiListDone(QStringList slist)
|
||||||
actWifiBssidList.append("--");
|
actWifiBssidList.append("--");
|
||||||
}
|
}
|
||||||
|
|
||||||
activecon *act = NULL;
|
activecon *act = kylin_network_get_activecon_info();
|
||||||
int wifiCount = 0;
|
|
||||||
kylin_network_get_activecon_info(&act, &wifiCount);
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
while (act && index < wifiCount) {
|
while (act[index].con_name != NULL) {
|
||||||
if (QString(act[index].type) == "wifi" || QString(act[index].type) == "802-11-wireless") {
|
if (QString(act[index].type) == "wifi" || QString(act[index].type) == "802-11-wireless") {
|
||||||
actWifiName = QString(act[index].con_name);
|
actWifiName = QString(act[index].con_name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
index ++;
|
index ++;
|
||||||
}
|
}
|
||||||
if (act) {
|
|
||||||
free(act);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据当前连接的wifi 设置OneConnForm
|
// 根据当前连接的wifi 设置OneConnForm
|
||||||
OneConnForm *ccf = new OneConnForm(topWifiListWidget, this, confForm, ksnm);
|
OneConnForm *ccf = new OneConnForm(topWifiListWidget, this, confForm, ksnm);
|
||||||
if (actWifiName == "--" && actWifiBssidList.at(0) == "--") {
|
if (actWifiName == "--" && actWifiBssidList.at(0) == "--") {
|
||||||
|
@ -2374,8 +2381,8 @@ void KylinNM::activeGetWifiList()
|
||||||
//网络开关处理,打开与关闭网络
|
//网络开关处理,打开与关闭网络
|
||||||
void KylinNM::enNetDone()
|
void KylinNM::enNetDone()
|
||||||
{
|
{
|
||||||
BackThread bt;
|
BackThread *bt = new BackThread();
|
||||||
mwBandWidth = bt.execChkLanWidth(lname);
|
mwBandWidth = bt->execChkLanWidth(lname);
|
||||||
|
|
||||||
ui->lbBtnNetBG->setStyleSheet(btnOnQss);
|
ui->lbBtnNetBG->setStyleSheet(btnOnQss);
|
||||||
|
|
||||||
|
@ -2463,6 +2470,7 @@ void KylinNM::enWifiDone()
|
||||||
|
|
||||||
qDebug()<<"debug: already turn on the switch of wifi network";
|
qDebug()<<"debug: already turn on the switch of wifi network";
|
||||||
syslog(LOG_DEBUG, "Already turn on the switch of wifi network");
|
syslog(LOG_DEBUG, "Already turn on the switch of wifi network");
|
||||||
|
QTimer::singleShot(200, this, &KylinNM::onConnectChanged);
|
||||||
}
|
}
|
||||||
void KylinNM::disWifiDone()
|
void KylinNM::disWifiDone()
|
||||||
{
|
{
|
||||||
|
@ -2598,13 +2606,16 @@ void KylinNM::onExternalWifiSwitchChange(bool wifiEnabled)
|
||||||
void KylinNM::on_checkWifiListChanged()
|
void KylinNM::on_checkWifiListChanged()
|
||||||
{
|
{
|
||||||
if (is_stop_check_net_state==0 && this->is_btnWifiList_clicked==1 && this->isVisible()) {
|
if (is_stop_check_net_state==0 && this->is_btnWifiList_clicked==1 && this->isVisible()) {
|
||||||
BackThread loop_bt;
|
BackThread *loop_bt = new BackThread();
|
||||||
IFace loop_iface = loop_bt.execGetIface();
|
IFace *loop_iface = loop_bt->execGetIface();
|
||||||
|
|
||||||
if (loop_iface.wstate != 2) {
|
if (loop_iface->wstate != 2) {
|
||||||
is_update_wifi_list = 1;
|
is_update_wifi_list = 1;
|
||||||
this->ksnm->execGetWifiList(); //更新wifi列表
|
this->ksnm->execGetWifiList(); //更新wifi列表
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete loop_iface;
|
||||||
|
loop_bt->deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2755,14 +2766,9 @@ int KylinNM::getConnectStatus()
|
||||||
QString actLanName = "--";
|
QString actLanName = "--";
|
||||||
QString actWifiName = "--";
|
QString actWifiName = "--";
|
||||||
|
|
||||||
activecon *act = NULL;
|
activecon *act = kylin_network_get_activecon_info();
|
||||||
int count = 0;
|
|
||||||
kylin_network_get_activecon_info(&act, &count);
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
if(!act){
|
while (act[index].con_name != NULL) {
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
while (act && index < count) {
|
|
||||||
if (QString(act[index].type) == "ethernet" || QString(act[index].type) == "802-3-ethernet") {
|
if (QString(act[index].type) == "ethernet" || QString(act[index].type) == "802-3-ethernet") {
|
||||||
actLanName = QString(act[index].con_name);
|
actLanName = QString(act[index].con_name);
|
||||||
}
|
}
|
||||||
|
@ -2771,9 +2777,6 @@ int KylinNM::getConnectStatus()
|
||||||
}
|
}
|
||||||
index ++;
|
index ++;
|
||||||
}
|
}
|
||||||
if (act) {
|
|
||||||
free(act);
|
|
||||||
}
|
|
||||||
|
|
||||||
//ukui3.0中获取currentActWifiSignalLv的值
|
//ukui3.0中获取currentActWifiSignalLv的值
|
||||||
if (activeWifiSignalLv > 75) {
|
if (activeWifiSignalLv > 75) {
|
||||||
|
|
Loading…
Reference in New Issue