From: penglei <1624952103@qq.com> Date: Sat, 23 Nov 2024 14:27:44 +0000 (+0800) Subject: 默认关闭心率广播,debug界面增加心率广播开关 X-Git-Tag: fd230_release_V1.3.102~21^2~12 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F1458%2Fhead;p=mirrors%2FFD230.git 默认关闭心率广播,debug界面增加心率广播开关 --- diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp index 78d7eaf56..13ffba3d5 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp @@ -57,6 +57,7 @@ #include #include #include "displaybrightness/include/DisplayBrightnessModel.h" +#include "ppg_service.h" namespace OHOS { /**************************************************************************************************** */ @@ -158,6 +159,8 @@ namespace OHOS debugOutputItemInfo[index++] = {index, "battery_percent"}; //离线日志开关控制窗口,需要采用 ./autobuild.sh uoffline 【CONFIG_DFX_SUPPORT_OFFLINE_LOG_FILE=1】编译才有效 debugOutputItemInfo[index++] = {index, "offline_log"}; + //心率广播 + debugOutputItemInfo[index++] = {index, "hrs_ble_swtich"}; usedLen = index; /* -------------------------------- Add data -------------------------------- */ @@ -729,6 +732,21 @@ namespace OHOS // viewIndex = GetCurViewIndex(); return true; //进行UI刷新 } + else if (viewId == "hrs_ble_switch") { + if (toggleButtonOffline) { + if (toggleButtonOffline->GetState() == false) { + send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_CLOSE_HRS_BLE); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"hrs_ble_switch false"); + } + else { + send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_OPEN_HRS_BLE); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"hrs_ble_switch true"); + } + } else { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"组件不存在"); + } + return true; //进行UI刷新 + } else // 如果点击的是列表中的itemview { DebugOutputItemView *debugOutputItemView = static_cast(&view); @@ -807,9 +825,22 @@ namespace OHOS if (toggleButtonOffline) { if (toggleButtonOffline->IsVisible() == false) { toggleButtonOffline->SetVisible(true); + toggleButtonOffline->SetViewId("offline_log_switch"); } } break; + case 18: + // str = get_hrs_ble_status(); + str = ""; + if(toggleButtonOffline) + { + if(toggleButtonOffline->IsVisible() == false) + { + toggleButtonOffline->SetViewId("hrs_ble_switch"); + toggleButtonOffline->SetVisible(true); + } + } + break; default: str = "--"; break; diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c index efb52c575..bbdbee1e1 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c @@ -68,7 +68,7 @@ int32_t PPG_buf_vec[8]; // #include "sys_init.h" // #include "cwm_api.h" -#define HANKCREAT_APK 1 +static uint8_t hrs_ble_falg = 0; #define PPG_DATA_LEN_MAX 17 int32_t s_buf[256]; uint32_t cnt_num = 0; @@ -2715,6 +2715,17 @@ static void get_avg_hrs(int32_t hrs) } } +void hx3695_set_hrs_ble_swtich(uint8_t cmd) +{ + hrs_ble_falg = cmd; + // PRINT("hrs_ble_falg : %d \n",hrs_ble_falg); +} + +uint8_t hx3695_get_hrs_ble_swtich(void) +{ + uint8_t cmd = hrs_ble_falg; + return cmd; +} void hx3695_wearstatus_update(void) { @@ -3095,8 +3106,7 @@ void hx3695_hrs_ppg_Int_handle(void) ble_rawdata_send_handler(); #endif - -#if HANKCREAT_APK + if(hrs_ble_falg) { uint8_t encoded_hrm[PPG_DATA_LEN_MAX] = {0};//PPG_DATA_LEN_MAX>17会导致APP连接提示定义设备与所选类型不匹配 uint8_t red_bit = 0; @@ -3146,7 +3156,6 @@ void hx3695_hrs_ppg_Int_handle(void) // sizeof(encoded_hrm)/sizeof(encoded_hrm[0]), ATT_OP_NOTIFY);//heartrate } } -#endif //////////////////////////////////////////////////////////////////////////////////// @@ -3535,7 +3544,7 @@ void hx3695_spo2_ppg_Int_handle(void) } #endif -#if HANKCREAT_APK +if(hrs_ble_falg) { uint8_t encoded_hrm[PPG_DATA_LEN_MAX] = {0};//PPG_DATA_LEN_MAX>17会导致APP连接提示定义设备与所选类型不匹配 @@ -3589,7 +3598,6 @@ void hx3695_spo2_ppg_Int_handle(void) ble_ppgtest_server_send_input_report(encoded_hrm,PPG_DATA_LEN_MAX); } } -#endif ///////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.h b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.h index cd2d55f07..228abb14b 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.h +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.h @@ -299,6 +299,8 @@ void wear_mode_timeout_handler(void * p_context); void Efuse_Mode_Check(void); void hx3695_wearstatus_update(void); void hx3695_unwearstatus_update(void); +void hx3695_set_hrs_ble_swtich(uint8_t cmd); +uint8_t hx3695_get_hrs_ble_swtich(void); #include "hx3695_hal.h" #endif diff --git a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp index 934be6382..0e4634fa3 100644 --- a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp +++ b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp @@ -331,6 +331,16 @@ static void ppg_service_check_task(void *arg) cmd = "spo2"; enable = 0; } + else if (mail == PPG_SERVICE_CMD_TYPE_OPEN_HRS_BLE) + { + hx3695_set_hrs_ble_swtich(1); + continue ; + } + else if (mail == PPG_SERVICE_CMD_TYPE_CLOSE_HRS_BLE) + { + hx3695_set_hrs_ble_swtich(0); + continue ; + } if (ppg_service_running_stat == true && enable ==1 ) { PRINT_ERR("ppg service already started! \r\n"); diff --git a/code/sdk/drivers/peripheral/ppg/service/ppg_service.h b/code/sdk/drivers/peripheral/ppg/service/ppg_service.h index ff1a26cfa..9e2f8ff80 100644 --- a/code/sdk/drivers/peripheral/ppg/service/ppg_service.h +++ b/code/sdk/drivers/peripheral/ppg/service/ppg_service.h @@ -1,8 +1,8 @@ /* * @Author: penglei 1624952103@qq.com * @Date: 2024-03-27 09:07:00 - * @LastEditors: SnickerSun snickersun@163.com - * @LastEditTime: 2024-07-09 16:49:38 + * @LastEditors: penglei 1624952103@qq.com + * @LastEditTime: 2024-11-23 22:07:09 * @FilePath: /FD230/code/sdk/drivers/peripheral/ppg/service/ppg_service.h * @Description: * @@ -43,6 +43,8 @@ extern "C" { #define PPG_SERVICE_CMD_TYPE_STOP_WEAR_MODE_TEST 0x21 #define PPG_SERVICE_CMD_TYPE_DO_LED_OFF_MODE_TEST 0x22 #define PPG_SERVICE_CMD_TYPE_DO_SINGLE_CHECK_MODE_TEST 0x23 +#define PPG_SERVICE_CMD_TYPE_OPEN_HRS_BLE 0x24 +#define PPG_SERVICE_CMD_TYPE_CLOSE_HRS_BLE 0x25 errcode_t uapi_ppg_service_init(void); void uapi_ppg_service_deinit(void);