From c48c31c3167e1e52cbfcb613f3bba0873e92c473 Mon Sep 17 00:00:00 2001 From: luocai Date: Fri, 30 Aug 2024 17:25:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A0=E7=BA=BF=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E5=8D=87=E7=BA=A7=E7=9A=84=E5=A4=84=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DeviceConnection.cpp | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/DeviceConnection.cpp b/DeviceConnection.cpp index 25ac8f8..3b2c37d 100644 --- a/DeviceConnection.cpp +++ b/DeviceConnection.cpp @@ -556,32 +556,22 @@ QString DeviceConnection::handleCommand(const std::string_view &replyText, const emit otaProgressChanged(true, m_otaProgress, "设备已进入升级状态......"); QTimer::singleShot(0, this, [this]() { transferBinContent(); }); } else if (value == "2") { + bool isWireConnect = true; + if (data.contains("is_eth")) { + isWireConnect = data.at("is_eth").as_int64() >= 1; + } LOG(info) << "md5 check finished"; m_otaProgress = 99; - emit otaProgressChanged(true, m_otaProgress, "设备正在升级中,请稍后......"); QTimer::singleShot(0, this, [this]() { m_commandSocket->close(); // 等待设备重新上线后,发起广播。由搜索服务触发重连 m_h264Socket->close(); - // if (m_otaTimer == nullptr) { - // m_otaTimer = new QTimer(this); - // m_otaTimer->setSingleShot(true); - // } - // #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - // Qt::ConnectionType type = Qt::SingleShotConnection; - // #else - // Qt::ConnectionType type = Qt::UniqueConnection; - // #endif - // m_otaTimer->callOnTimeout( - // this, - // [this]() { - // emit otaProgressChanged(false, m_otaProgress, - // "升级超时,请检查设备并重新尝试..."); m_otaProgress = -1; - // m_commandSocket->close(); - // m_h264Socket->close(); - // }, - // type); - // m_otaTimer->start(60 * 1000); }); + if (isWireConnect) { + emit otaProgressChanged(true, m_otaProgress, "设备正在升级中,请稍后......"); + } else { + m_otaTimer->stop(); // 这里不需要再超时了 + emit otaProgressChanged(true, 100, "设备正在升级中,请于一分钟后重新连接wifi搜索设备"); + } } else { const char *message = nullptr; if (value == "3") {