#include "mainwindow.h"
mcu_arm1 *ARM_1;//调用串口通信
-QString line_lan_ip,line_4G_ip;;//LAN的IP地址
+QString line_lan_ip,line_4G_ip;//LAN的IP地址
bool WIFI_HOST_state;
-QString WIFI_HOST_Name;
+QString WIFI_HOST_Name = "";
QString WIFI_HOST_code;
bool lowpower_mode_flag=false;
aXiang = "";
bXiang = "";
cXiang = "";
- eth1_ip = "";
share_num = 0;
net_ok = true;
- eth1_ip_kong = false;//网线ip状态判断
- eth1_line_lan_flag = true;
+
Pop_alarm_T_err_flag = true;
sharememery_test = new QSharedMemory;
connect(CCID_check, SIGNAL(sig4gstate(bool)),
this, SLOT(onGgTuBiaoStateUpdate(bool)));
+ connect(CCID_check, SIGNAL(sigLanState(bool)),
+ this, SLOT(onLanTuBiaoStateUpdate(bool)));
// ledctl = new ledcontrol();
// ledctl->moveToThread(&threadLed);
QLOG_TRACE() << "--trace msg dispPopWindwows :"<<timedebuge.elapsed()/1000.0<<"s";
}
-void MainWindow::dispNet()
-{
- QElapsedTimer timedebuge;//声明一个时钟对象
- timedebuge.start();//开始计时
-
-//#ifdef LINUX
-// std::system("ifconfig eth1 | grep \"inet addr\" | awk '{ print $2}' | awk -F: '{print $2}' > /home/LAN_IP");
-//#endif
- QFile file_read_iplan("/home/LAN_IP");
- if(file_read_iplan.open(QIODevice::ReadOnly | QIODevice::Text))
- {
- QTextStream in(&file_read_iplan);//创建一个对象让它去读文件
- line_lan_ip=in.readLine();
- eth1_ip = line_lan_ip;
- QPixmap *pixmap = nullptr;
- if(line_lan_ip=="")
- {
- pixmap = new QPixmap(":/image/image/yitaiyang_disconnect.png");
- }
- else{
- pixmap = new QPixmap(":/image/image/yitaiyang.png");
- }
-
- pixmap->scaled(ui->label_tubiao_youxian->size(), Qt::KeepAspectRatio);//设置图片适应lable大小
- ui->label_tubiao_youxian->setScaledContents(true);
- ui->label_tubiao_youxian->setPixmap(*pixmap);
- if(pixmap != nullptr){
- delete pixmap;
- pixmap =nullptr;
- }
- }
- file_read_iplan.close();
-
- if(eth1_ip == "")
- {
- if(eth1_ip_kong == false)
- {
- eth1_line_lan_flag = false;
- eth1_ip_kong = true;
- QFile file_read_gip("/home/4G_IP");
- if(file_read_gip.open(QIODevice::ReadOnly | QIODevice::Text))
- {
- QTextStream in(&file_read_gip);//创建一个对象让它去读文件
- line_4G_ip=in.readLine();
- }
- file_read_gip.close();
-
- QFile file_read_wifi_ip("/home/WIFI_IP");
- QString wifi_ip;
- if(file_read_wifi_ip.open(QIODevice::ReadOnly | QIODevice::Text))
- {
- QTextStream in(&file_read_wifi_ip);//创建一个对象让它去读文件
- wifi_ip=in.readLine();
- }
- file_read_wifi_ip.close();
-
- if(line_4G_ip == "")
- {
- if(wifi_ip == "")
- {
- //eth1_ip_kong = false;
- }else{
-#ifdef LINUX
- QString wifi_ip_reset="route del default gw "+wifi_ip;
- std::system(wifi_ip_reset.toLatin1());
- QString wifi_ip_set="route add default gw "+wifi_ip;
- std::system(wifi_ip_set.toLatin1());
-#endif
- }
- }else{
-#ifdef LINUX
- QString IP_4G_set="route add default gw "+line_4G_ip;
- QString IP_4G_reset="route del default gw "+line_4G_ip;
- std::system(IP_4G_reset.toLatin1());
- std::system(IP_4G_set.toLatin1());
-#endif
- if(wifi_ip == "")
- {
-
- }else{
-#ifdef LINUX
- QString wifi_ip_reset="route del default gw "+wifi_ip;
- std::system(wifi_ip_reset.toLatin1());
- QString wifi_ip_set="route add default dev mlan0 metric 20 gw "+wifi_ip;
- std::system(wifi_ip_set.toLatin1());
-#endif
- }
- }
- }else{
-
- }
- }else{
- eth1_ip_kong = false;
- if(eth1_line_lan_flag == false)
- {
- int local = line_lan_ip.indexOf('.',9,Qt::CaseInsensitive);//意思是从第9位往后找,找到的第一个‘.’所在的位置
- line_lan_ip=line_lan_ip.left(local+1);//从左向右截取n个字符串
- line_lan_ip=line_lan_ip+"1";
-
- line_lan_ip="route add default gw "+line_lan_ip;
-#ifdef LINUX
- std::system(line_lan_ip.toLatin1());
-#endif
- eth1_line_lan_flag = true;
- }else{
- if(net_ok == false)
- {
- int local = line_lan_ip.indexOf('.',9,Qt::CaseInsensitive);//意思是从第9位往后找,找到的第一个‘.’所在的位置
- line_lan_ip=line_lan_ip.left(local+1);//从左向右截取n个字符串
- line_lan_ip=line_lan_ip+"1";
-
- line_lan_ip="route add default gw "+line_lan_ip;
-#ifdef LINUX
- std::system(line_lan_ip.toLatin1());
-#endif
- }
- }
- }
- QLOG_TRACE() << "--trace msg dispNet :"<<timedebuge.elapsed()/1000.0<<"s";
-}
-
void MainWindow::label_1_show(int a)
{
if(a==1)
mian_page=1;
label_1_show(1);//页面1有功电量显示开启
+
+ if(widget){
+ delete widget;
+ }
+ widget = new mainpage_A_V(ui->centralwidget);
+ widget->setObjectName(QString::fromUtf8("widget1"));
+
+ widget->setGeometry(QRect(30, 180, 731, 361));
+ widget->show();
}
void MainWindow::label_0_3_clicked()//页面3label点击槽函数
}
file_net_read.close();
- dispNet();
-
QLOG_TRACE() << "--trace msg timerTimeout :"<<timedebuge.elapsed()/1000.0<<"s";
}
void MainWindow::onAlarmCheck(uint32_t data_alarm)
{
- qDebug()<< "onAlarmCheck:"<<data_alarm;
alarm_battery_flag = (data_alarm & BIT(4)) ? true: false;
alarm_flag5 = (data_alarm & BIT(3)) ? true: false;
alarm_flag3 = (data_alarm & BIT(1)) ? true: false;
alarm_flag1 = (data_alarm & BIT(0)) ? true: false;
- qDebug()<< "onAlarmCheck:"<<alarm_flag1<<alarm_flag3<<alarm_flag2<<alarm_flag5;
}
void MainWindow::onSelfTestCheck(uint32_t data_alarm)
{
- qDebug()<< "onSelfTestCheck:"<<data_alarm;
alarm_flag15 = (data_alarm & BIT(6)) ? false: true;
alarm_flag14 = (data_alarm & BIT(5)) ? false: true;
alarm_flag13 = (data_alarm & BIT(4)) ? false: true;
alarm_flag12 = (data_alarm & BIT(3)) ? false: true;
- qDebug()<< "onSelfTestCheck:"<<alarm_flag12<<alarm_flag13<<alarm_flag14<<alarm_flag15;
+}
+
+void MainWindow::onLanTuBiaoStateUpdate(bool state)
+{
+ QPixmap *pixmap = nullptr;
+ if(state){
+ pixmap = new QPixmap(":/image/image/yitaiyang.png");
+ }else {
+ pixmap = new QPixmap(":/image/image/yitaiyang_disconnect.png");
+ }
+ pixmap->scaled(ui->label_tubiao_youxian->size(), Qt::KeepAspectRatio);//设置图片适应lable大小
+ ui->label_tubiao_youxian->setScaledContents(true);
+ ui->label_tubiao_youxian->setPixmap(*pixmap);
+ if(pixmap != nullptr){
+ delete pixmap;
+ pixmap =nullptr;
+ }
}
void MainWindow::fun_4G_start()
Delay_MSec3(10000);
kaiji->setText("正在加载热像仪模块,请稍后...");
Delay_MSec3(5000);
+ if(line_4G_ip != "")
+ {
#ifdef LINUX
- std::system(IP_4G_reset.toLatin1());
- Delay_MSec3(1000);
- std::system(IP_4G_set.toLatin1());
- Delay_MSec3(1000);
+ std::system(IP_4G_reset.toLatin1());
+ Delay_MSec3(1000);
+ std::system(IP_4G_set.toLatin1());
+ Delay_MSec3(1000);
#endif
+ }
}
void MainWindow::first_statr_wifi()//开机连WIFI
// wifi_ip=wifi_ip.left(local+1);//从左向右截取n个字符串
// wifi_ip=wifi_ip+"1";
- QString wifi_ip_reset="route del default gw "+wifi_ip;
- //wifi_ip="route del default gw "+wifi_ip;
- Delay_MSec3(1000);
+ if(wifi_ip != "")
+ {
+ QString wifi_ip_reset="route del default gw "+wifi_ip;
+ Delay_MSec3(1000);
#ifdef LINUX
- std::system(wifi_ip_reset.toLatin1());
- Delay_MSec3(1000);
- QString wifi_ip_set="route add default dev mlan0 metric 20 gw "+wifi_ip;
- //wifi_ip="route add default gw "+wifi_ip;
+ std::system(wifi_ip_reset.toLatin1());
+ Delay_MSec3(1000);
+ QString wifi_ip_set="route add default dev mlan0 metric 20 gw "+wifi_ip;
- std::system(wifi_ip_set.toLatin1());
+ std::system(wifi_ip_set.toLatin1());
#endif
+ }
}
void MainWindow::button_buzzer_Clicked()