From 7c9f6aa63a3326a64c7975cadd4d57cca82520fd Mon Sep 17 00:00:00 2001 From: fuqipeng <1285534278@qq.com> Date: Wed, 1 Mar 2023 16:55:57 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Modules/hotcameramodule.cpp | 64 ++++++++++++++++++++++++++++++------- Modules/hotcameramodule.h | 1 + 2 files changed, 53 insertions(+), 12 deletions(-) diff --git a/Modules/hotcameramodule.cpp b/Modules/hotcameramodule.cpp index 6df10799..946d4491 100644 --- a/Modules/hotcameramodule.cpp +++ b/Modules/hotcameramodule.cpp @@ -37,7 +37,6 @@ HotCameraModule::~HotCameraModule() void HotCameraModule::onSavePicture(QByteArray &d) { - qDebug()<<"onSavePicture\n"; QString save_path; @@ -231,6 +230,8 @@ void HotCameraModule::appTimerProcess() //连接成功,删除长连接断线告警文件 eventConnectBrokeAlarmCheck(); + //热像仪功能关闭/打开控制 + eventConnectSwitch(); } bool HotCameraModule::eventParaChangedCheck() @@ -305,9 +306,12 @@ bool HotCameraModule::eventCapPictureCheck() if(fileInfo.exists() == true) { qDebug()<< QString("%1 changed, start capture picture!").arg(file_name)<GetPicture(); - + if(module_enabled == true) + { + net->GetPicture(); + } + else{ + } QFile file1(file_name); file1.remove(); @@ -348,19 +352,23 @@ bool HotCameraModule::eventTimeChangeCheck() bool HotCameraModule::eventConnectTimeCheck() { - QDateTime dateTime = QDateTime::currentDateTime(); - uint32_t start_minute = para.start_hour * 60 + para.start_minute; - uint32_t end_minute = para.end_hour * 60 + para.end_minute; - uint32_t now_minute = dateTime.time().hour() * 60 + dateTime.time().minute(); + if(module_enabled){ - if(now_minute >= start_minute && now_minute <= end_minute){ + QDateTime dateTime = QDateTime::currentDateTime(); + uint32_t start_minute = para.start_hour * 60 + para.start_minute; + uint32_t end_minute = para.end_hour * 60 + para.end_minute; + uint32_t now_minute = dateTime.time().hour() * 60 + dateTime.time().minute(); - moduleConnect(); + if(now_minute >= start_minute && now_minute <= end_minute){ - }else{ + moduleConnect(); - modleDisConnect(); + }else{ + modleDisConnect(); + } + }else if(net->KeepState() != NET_DISCONNECT){ + modleDisConnect(); } return true; @@ -388,8 +396,40 @@ bool HotCameraModule::eventConnectBrokeAlarmCheck() file.remove(); return true; } + return false; +} +bool HotCameraModule::eventConnectSwitch() +{ + QString time_change_file; + if(id == 0){ + time_change_file = "/home/data/connect_rxy1.txt"; + }else if(id == 1){ + time_change_file = "/home/data/connect_rxy2.txt"; + }else{ + return false; + } + QFile file(time_change_file); //文件路径 + if (file.open(QFile::ReadOnly) == true) + { + QTextStream set_wifi_connect(&file); + if(set_wifi_connect.readLine().toInt() == 1) + { + //打开热像仪 + module_enabled = true; +// qDebug()<<"eventConnectSwitch_Open hot!"; + } + else + { + //关闭热像仪 + module_enabled = false; +// qDebug()<<"eventConnectSwitch_Close hot!"; + } + } + else{ + ; + } return false; } diff --git a/Modules/hotcameramodule.h b/Modules/hotcameramodule.h index 5226eabf..0b619b91 100644 --- a/Modules/hotcameramodule.h +++ b/Modules/hotcameramodule.h @@ -90,6 +90,7 @@ private: bool eventTimeChangeCheck(); bool eventConnectTimeCheck(); bool eventConnectBrokeAlarmCheck(); + bool eventConnectSwitch(); void moduleConnect(); void modleDisConnect(); -- 2.34.1