From: Caisking Date: Thu, 26 Jun 2025 02:12:27 +0000 (+0800) Subject: 增加判断设备是否有网接口 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=ad04ac55b9306578676fd680a353c690e22ef9d0;p=mirrors%2FFD230.git 增加判断设备是否有网接口 --- 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);