From 622cb389f02c0684dcc1a7418b2bbdbff3ad7e6b Mon Sep 17 00:00:00 2001 From: Caisking Date: Sat, 27 Sep 2025 15:33:57 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?utf8?q?=E8=A7=A3=E7=BB=91=E7=9A=84=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../thunderbird/include/ThunderBirdModel.h | 2 ++ .../thunderbird/src/ThunderBirdModel.cpp | 16 ++++++++++++++++ .../thunderbird/src/ThunderBirdPresenter.cpp | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h index 235b07faa..4c7a1dcbf 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h @@ -240,6 +240,8 @@ namespace OHOS bool is_all_services_ready = false; bool init_falg = false; bool bind_status = false; + + int net_count = 0; }; } diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp index 7f81c0b0c..c5d607da9 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp @@ -1045,13 +1045,29 @@ if(get_is_ln_get_device_token_success() == 0) { do_ln_http_server_send_data(LN_HTTP_SERVICE_CMD_GET_DEVICE_TOKEN, NULL, 0); + // 重置网络计数 + net_count = 0; } else { if (init_falg == false) { + // 有网之后需要延迟5s + net_count ++; + if(net_count < 5) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "有网之后需要延迟 %d", net_count); + return; + } //发送获取绑定用户ID do_ln_http_server_send_data(LN_HTTP_SERVICE_CMD_GET_USER_ID, NULL, 0); + // 获取到设备是未绑定状态,但是内部有绑定记录 需要恢复出厂 + if(bind_status == true && uapi_ln_is_device_bound() == 0) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "恢复出厂"); + restore_factory_settings(); + return; + } // 网络连接成功,调用HTTP服务获取设备Token // 获取一下OTA 是否有最新版本 int ota = ota_update_boot(); diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp index 243235900..b75e9ada2 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp @@ -141,7 +141,7 @@ namespace OHOS { #ifdef CUSTOM_UTILS if(custom_get_factory_test_flag()) - return; + return; #endif //如果在二维码界面 判断是否绑定 if(ThunderBirdMainView::GetInstance() != nullptr) -- 2.17.1