From 23d0d8d80e1a4acdf1ac6ed12fe26632e2f03c79 Mon Sep 17 00:00:00 2001 From: zhangsheng Date: Sat, 4 Jan 2025 13:40:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=964G=20=E5=A4=8D=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- threadfunc/SH_ThreadFunc.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/threadfunc/SH_ThreadFunc.cpp b/threadfunc/SH_ThreadFunc.cpp index ecea19b..f7393cb 100644 --- a/threadfunc/SH_ThreadFunc.cpp +++ b/threadfunc/SH_ThreadFunc.cpp @@ -25,6 +25,7 @@ static long long connect_lost_time = 0; //ms static long long connect_time = 0; //ms Dial dial; +int fd = -1; void CheckThread() { @@ -126,7 +127,15 @@ void CheckThread() iRet = data_publish(str2.c_str(), GlobalConfig::Topic_G.mPubCmd.c_str()); if(iRet != 0 ) { - LOG_ERROR("MQTT connect failed ,time check\n"); + LOG_ERROR("MQTT connect failed ,time check\n"); +#ifdef Q4G_MODULE + if(fd){ + LOG_ERROR("MQTT connect failed ,4G Module\n"); + write_data(fd,"AT+CFUN=1,1\r\n",15); + system("reboot"); + } +#endif + #ifdef IMX6UL_GATEWAY char connect[10]={0x00}; readStringValue("config", "connect",connect,(char*)GlobalConfig::Config_G.c_str()); @@ -567,7 +576,7 @@ open5G: #endif #ifdef Q4G_MODULE //4G - int fd = -1; + open4G: fd = config_uart("/dev/ttyUSB2",115200); if (fd < 0){