From ad04ac55b9306578676fd680a353c690e22ef9d0 Mon Sep 17 00:00:00 2001 From: Caisking Date: Thu, 26 Jun 2025 10:12:27 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0=E5=88=A4=E6=96=AD=E8=AE=BE?= =?utf8?q?=E5=A4=87=E6=98=AF=E5=90=A6=E6=9C=89=E7=BD=91=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/applist/src/ApplistPresenter.cpp | 5 +---- .../nativeui/settings/src/SettingPresenter.cpp | 5 +---- .../service/ble_service/bleservice/bleService.c | 14 ++++++++++++++ .../service/ble_service/bleservice/bleService.h | 4 ++++ 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp index ae014eb2d..f50c4f33b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp @@ -188,15 +188,12 @@ namespace OHOS viewId = VIEW_CHECK_INVALID; } #if defined(BOARD_W9) || defined(BOARD_N9) - bool isbleconnected = get_ble_connect(); // 获取蓝牙连接状态 - bool is4Gconnected = uapi_dev_runtime_get_cat1_networkstat(); // 获取4G连接状态 - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"isbleconnected = %d is4Gconnected = %d",isbleconnected,is4Gconnected); if(viewId == VIEW_PRESSURE || viewId == VIEW_EMOTION || viewId == VIEW_ECG || viewId == VIEW_FATIGUE || viewId == VIEW_BLOOD_PRESSURE_CHECK || viewId == VIEW_BLOOD_PRESSURE_CALIBRATION) { // 必须至少有一个状态成功才可以正常进入应用,否则进入未连接界面。 - if (isbleconnected == false && is4Gconnected == false) + if (!uapi_is_device_online()) { viewId = VIEW_UNCONNECTED; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingPresenter.cpp index feac999bd..cb609bcc9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingPresenter.cpp @@ -150,13 +150,10 @@ namespace OHOS AppViewId viewId = settingItemView->GetViewId(); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "%d\n", viewId); #if defined(BOARD_W9) || defined(BOARD_N9) - bool isbleconnected = get_ble_connect(); // 获取蓝牙连接状态 - bool is4Gconnected = uapi_dev_runtime_get_cat1_networkstat(); // 获取4G连接状态 - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"isbleconnected = %d is4Gconnected = %d",isbleconnected,is4Gconnected); if( viewId == VIEW_BLOOD_PRESSURE_CHECK || viewId == VIEW_BLOOD_PRESSURE_CALIBRATION) { // 必须至少有一个状态成功才可以正常进入应用,否则进入未连接界面。 - if (isbleconnected == false && is4Gconnected == false) + if (!uapi_is_device_online()) { viewId = VIEW_UNCONNECTED; } diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c index d948c43f6..1eab3d538 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c @@ -2803,6 +2803,20 @@ int send_msg_data_into_Ai_msg_queue(void *buff,uint16_t len,uint8_t type) return ret; } +//获取设备是否有网(4G,蓝牙) +bool uapi_is_device_online(void) +{ + bool isbleconnected = get_ble_connect(); // 获取蓝牙连接状态 + bool is4Gconnected = uapi_dev_runtime_get_cat1_networkstat(); // 获取4G连接状态 + if(isbleconnected || is4Gconnected) + { + return true; + } + else + { + return false; + } +} #ifdef __cplusplus diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.h b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.h index a08ef4ce4..42b1eaf47 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.h +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.h @@ -82,6 +82,10 @@ void ble_test_ANCS_notify(uint8_t type); bool get_ble_connect(void); +//获取设备是否有网(4G,蓝牙) +bool uapi_is_device_online(void); + + bool get_ble_adv_status(void); void get_adv_data(char *data); -- 2.17.1