修改无线连接升级的处理。

This commit is contained in:
luocai 2024-08-30 17:25:31 +08:00
parent aa3f4ebb29
commit c48c31c316

View File

@ -556,32 +556,22 @@ QString DeviceConnection::handleCommand(const std::string_view &replyText, const
emit otaProgressChanged(true, m_otaProgress, "设备已进入升级状态......"); emit otaProgressChanged(true, m_otaProgress, "设备已进入升级状态......");
QTimer::singleShot(0, this, [this]() { transferBinContent(); }); QTimer::singleShot(0, this, [this]() { transferBinContent(); });
} else if (value == "2") { } 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"; LOG(info) << "md5 check finished";
m_otaProgress = 99; m_otaProgress = 99;
emit otaProgressChanged(true, m_otaProgress, "设备正在升级中,请稍后......");
QTimer::singleShot(0, this, [this]() { QTimer::singleShot(0, this, [this]() {
m_commandSocket->close(); // 等待设备重新上线后,发起广播。由搜索服务触发重连 m_commandSocket->close(); // 等待设备重新上线后,发起广播。由搜索服务触发重连
m_h264Socket->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 { } else {
const char *message = nullptr; const char *message = nullptr;
if (value == "3") { if (value == "3") {