From 45bfbcdb2f2881b45505ef66e572dff4704494a3 Mon Sep 17 00:00:00 2001 From: penglei <1624952103@qq.com> Date: Tue, 15 Jul 2025 17:56:42 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96ppg=E4=B8=8A=E7=94=B5=EF=BC=8C?= =?utf8?q?=E4=BC=98=E5=8C=96=E8=A1=80=E5=8E=8B=E6=B5=8B=E8=AF=95=E6=B5=81?= =?utf8?q?=E7=A8=8B=EF=BC=8C=E5=8E=9F=E7=9B=B8=E5=BF=83=E7=8E=87=E5=A2=9E?= =?utf8?q?=E5=8A=A0=E5=BF=83=E7=8E=87=E5=B9=BF=E6=92=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../debug_output_notification.cpp | 4 +- code/sdk/drivers/peripheral/bp/bn02/bn02.c | 4 +- .../peripheral/bp/service/bp_tcp_server.c | 60 +++++++++++-------- .../peripheral/bp/service/bp_tcp_server.h | 1 + .../ppg/gh3x2x/src/gh3x2x_afe_user.c | 7 ++- code/sdk/drivers/peripheral/ppg/hal/ppg_hal.c | 14 ++--- .../drivers/peripheral/ppg/hx3695/hx3695.c | 17 +----- .../pah_hr/V303009/test_library_HRD.c | 2 +- .../ppg/pah8009/sensor/pah800x_main.c | 50 +++++++++++++++- .../ppg/ppgBleService/ppgBleService.c | 7 ++- .../peripheral/ppg/service/ppg_service.cpp | 15 +---- .../peripheral/ppg/service/ppg_service.h | 8 +-- .../drivers/peripheral/utils/custom_runtime.c | 12 ++++ .../drivers/peripheral/utils/custom_runtime.h | 3 + 14 files changed, 129 insertions(+), 75 deletions(-) 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 0ed7073ec..efdde7162 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 @@ -884,11 +884,11 @@ namespace OHOS { if (toggleButtonOffline) { if (toggleButtonOffline->GetState() == false) { - send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_CLOSE_HRS_BLE); + uapi_dev_runtime_set_hrs_ble_status(0); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"hrs_ble_switch false"); } else { - send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_OPEN_HRS_BLE); + uapi_dev_runtime_set_hrs_ble_status(1); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"hrs_ble_switch true"); } } else { diff --git a/code/sdk/drivers/peripheral/bp/bn02/bn02.c b/code/sdk/drivers/peripheral/bp/bn02/bn02.c index 3a85e45cb..a6c4647d8 100644 --- a/code/sdk/drivers/peripheral/bp/bn02/bn02.c +++ b/code/sdk/drivers/peripheral/bp/bn02/bn02.c @@ -2,7 +2,7 @@ * @Author: penglei 1624952103@qq.com * @Date: 2025-01-16 12:35:15 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2025-07-10 10:45:40 + * @LastEditTime: 2025-07-15 17:48:37 * @FilePath: /sdk615/code/sdk/zhihui/drivers/bp/bn02/bn02.c * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -170,7 +170,7 @@ void bn02_int_handle(void) } if(uapi_cat1_get_power_stat()) - do_bp_tcp_server_send_data(BP_TCP_SERVICE_CMD_DATA_UPLOAD,(void *)reply_data,cnt); + do_bp_tcp_server_send_data(BP_TCP_SERVICE_CMD_SEND_DATA,(void *)reply_data,cnt); if(bn02_data && fp) { diff --git a/code/sdk/drivers/peripheral/bp/service/bp_tcp_server.c b/code/sdk/drivers/peripheral/bp/service/bp_tcp_server.c index 020db01a6..5f24a5bc7 100644 --- a/code/sdk/drivers/peripheral/bp/service/bp_tcp_server.c +++ b/code/sdk/drivers/peripheral/bp/service/bp_tcp_server.c @@ -309,7 +309,7 @@ static void dns_found(const char* hostname, const ip_addr_t *ipaddr, void *arg) (void)osSemaphoreRelease(ip_sem->dns_done_sem); } -int tcp_socket_init(void) +int bp_tcp_socket_init(void) { uint8_t cnt = pm_veto_get_id_cnt(PM_ID_CAT1); if (cnt == 0) { @@ -555,7 +555,7 @@ void tcp_recv_data_handler(const char *input, int input_len) } -int tcp_send(int listen_socket, const char *data, size_t size) +static int tcp_send(int listen_socket, const char *data, size_t size) { if (data == NULL || size == 0) return -1; @@ -835,7 +835,7 @@ void get_request_code(char *req_code) * @param cnt int数据个数 * @return Base64编码后的长度,失败返回-1 */ -int calculate_base64_length(int cnt) +static int calculate_base64_length(int cnt) { if (cnt <= 0) return -1; @@ -855,7 +855,7 @@ int calculate_base64_length(int cnt) return base64_length; } -static void upload_bp_data(int *data, int cnt) +static void upload_bp_data(void) { #if 0 if (data == NULL || cnt == 0) @@ -1195,9 +1195,15 @@ FAILED: printf("free\n"); #else - if (data == NULL || cnt == 0) + if (tcp_data == NULL || tcp_data_cnt == 0) return; + if(LK_STATUS != 1) + { + printf("NOT LK\n"); + return; + } + int ret = -1; char *data_str = NULL; int data_len = 0; @@ -1274,7 +1280,7 @@ FAILED: } // 分配JSON缓冲区 - int json_len = 512 + calculate_base64_length(cnt); + int json_len = 512 + calculate_base64_length(tcp_data_cnt); char *json_data = (char *)malloc(json_len); if (json_data == NULL) { @@ -1297,15 +1303,15 @@ FAILED: // printf("bp_measure_type : %d\n",bp_measure_type); - for(int i = 0; i < cnt; i++) + for(int i = 0; i < tcp_data_cnt; i++) { - if(i == (cnt - 1)) + if(i == (tcp_data_cnt - 1)) { - temp_len += snprintf(json_data + temp_len, json_len - temp_len, "%d],", data[i]); + temp_len += snprintf(json_data + temp_len, json_len - temp_len, "%d],", tcp_data[i]); } else { - temp_len += snprintf(json_data + temp_len, json_len - temp_len, "%d,", data[i]); + temp_len += snprintf(json_data + temp_len, json_len - temp_len, "%d,", tcp_data[i]); } } @@ -1913,7 +1919,7 @@ void bp_tcp_data_clean(void) void do_bp_tcp_server_send_data(int cmd,int *data,uint32_t len) { - if((data == NULL || len == 0) && cmd == BP_TCP_SERVICE_CMD_DATA_UPLOAD) + if((data == NULL || len == 0) && cmd == BP_TCP_SERVICE_CMD_SEND_DATA) return; errcode_t ret; @@ -2034,26 +2040,27 @@ static void tcp_data_handler(int *data,int len) if(tcp_data_cnt >= MAX_CNT) { - printf("tcp_data_cnt : %d\n",tcp_data_cnt); - bp_stop(); + return; + // printf("tcp_data_cnt : %d\n",tcp_data_cnt); + // bp_stop(); // for(int i = 0; i < tcp_data_cnt; i ++) // { // printf("data[%d]:%d\n",i,tcp_data[i]); // } // memset((void*)tcp_data,0,MAX_CNT * sizeof(int)); - LOS_Msleep(1000); + // LOS_Msleep(1000); - if(LK_STATUS == 1) - { - upload_bp_data(tcp_data,tcp_data_cnt); - // do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_BP_TEST, NULL, 0); - } + // if(LK_STATUS == 1) + // { + // upload_bp_data(tcp_data,tcp_data_cnt); + // // do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_BP_TEST, NULL, 0); + // } - else - printf("NOT LK\n"); + // else + // printf("NOT LK\n"); // LOS_Msleep(2000); - bp_tcp_data_clean(); + // bp_tcp_data_clean(); } else { @@ -2084,7 +2091,7 @@ static void bp_tcp_server_send_task(void const *arg) continue; } - if(mail.cmd == BP_TCP_SERVICE_CMD_DATA_UPLOAD) + if(mail.cmd == BP_TCP_SERVICE_CMD_SEND_DATA) { tcp_data_handler((int *)mail.data,mail.len); } @@ -2096,6 +2103,11 @@ static void bp_tcp_server_send_task(void const *arg) { bp_tcp_deinit(); } + else if(mail.cmd == BP_TCP_SERVICE_CMD_DATA_UPLOAD) + { + upload_bp_data(); + bp_tcp_data_clean(); + } } } @@ -2124,7 +2136,7 @@ void bp_tcp_server_recv_task(void *pvParameters) } if (g_listen_sock < 0) { - g_listen_sock = tcp_socket_init(); + g_listen_sock = bp_tcp_socket_init(); if (g_listen_sock < 0) { PRINT("wating tcp socket init\n"); diff --git a/code/sdk/drivers/peripheral/bp/service/bp_tcp_server.h b/code/sdk/drivers/peripheral/bp/service/bp_tcp_server.h index e5ce290b1..42c9450f3 100644 --- a/code/sdk/drivers/peripheral/bp/service/bp_tcp_server.h +++ b/code/sdk/drivers/peripheral/bp/service/bp_tcp_server.h @@ -41,6 +41,7 @@ typedef struct #define BP_TCP_SERVICE_CMD_DATA_UPLOAD 0x1 #define BP_TCP_SERVICE_CMD_SERVER_INIT 0x2 #define BP_TCP_SERVICE_CMD_SERVER_DEINIT 0x3 +#define BP_TCP_SERVICE_CMD_SEND_DATA 0x4 void do_bp_tcp_server_send_data(int cmd,int *data,uint32_t len); void tcp_recv_data_handler(const char *input, int input_len) ; diff --git a/code/sdk/drivers/peripheral/ppg/gh3x2x/src/gh3x2x_afe_user.c b/code/sdk/drivers/peripheral/ppg/gh3x2x/src/gh3x2x_afe_user.c index c067d1a5b..72781f957 100644 --- a/code/sdk/drivers/peripheral/ppg/gh3x2x/src/gh3x2x_afe_user.c +++ b/code/sdk/drivers/peripheral/ppg/gh3x2x/src/gh3x2x_afe_user.c @@ -134,7 +134,7 @@ void hal_gh3x2x_afe_i2c_init(void) GU8 hal_gh3x2x_afe_i2c_write(GU8 device_id, const GU8 write_buffer[], GU16 length) { // custom_i2c_transfer(0x14,write_buffer, length, NULL, 0, GH3X2X_I2C_BUS); - custom_i2c_write_reg(0x14, 0, 0, write_buffer, length, GH3X2X_I2C_BUS); + custom_i2c_write_reg(device_id, 0, 0, write_buffer, length, GH3X2X_I2C_BUS); return 1; } @@ -160,7 +160,10 @@ GU8 hal_gh3x2x_afe_i2c_read(GU8 device_id, const GU8 write_buffer[], GU16 write_ { // custom_i2c_transfer(0x14,write_buffer, write_length, read_buffer, read_length, GH3X2X_I2C_BUS); // custom_i2c_write_reg(0x14, 0, 0, write_buffer, length, GH3X2X_I2C_BUS); - custom_i2c_read_regs(0x14, write_buffer, write_length, read_buffer,read_length, GH3X2X_I2C_BUS); + + // printf("write_buffer[:0x%x%x]\n",write_buffer[0],write_buffer[1]); + + custom_i2c_transfer(device_id,write_buffer, write_length, read_buffer, read_length, GH3X2X_I2C_BUS); return 1; } diff --git a/code/sdk/drivers/peripheral/ppg/hal/ppg_hal.c b/code/sdk/drivers/peripheral/ppg/hal/ppg_hal.c index 65b7e207a..9f4ef78d6 100644 --- a/code/sdk/drivers/peripheral/ppg/hal/ppg_hal.c +++ b/code/sdk/drivers/peripheral/ppg/hal/ppg_hal.c @@ -2,7 +2,7 @@ * @Author: penglei 1624952103@qq.com * @Date: 2024-03-13 15:08:38 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2025-07-10 17:18:40 + * @LastEditTime: 2025-07-15 12:13:23 * @FilePath: /FD230/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c * @Description: * @@ -34,7 +34,7 @@ #endif #ifdef PPG_GH3X2X -// #include "gh3x2x_afe_drv.h" +#include "gh3x2x_afe_drv.h" #endif @@ -54,11 +54,11 @@ void ppg_power_on(void) uapi_pin_set_mode(GPIO_PIN_PRG_RESET, (pin_mode_t)HAL_PIO_FUNC_GPIO); uapi_gpio_set_dir(GPIO_PIN_PRG_RESET, GPIO_DIRECTION_OUTPUT); uapi_gpio_set_val(GPIO_PIN_PRG_RESET, GPIO_LEVEL_HIGH); - + LOS_Mdelay(10); uapi_pin_set_mode(GPIO_PIN_PRG_LED_ON, (pin_mode_t)HAL_PIO_FUNC_GPIO); uapi_gpio_set_dir(GPIO_PIN_PRG_LED_ON, GPIO_DIRECTION_OUTPUT); uapi_gpio_set_val(GPIO_PIN_PRG_LED_ON, GPIO_LEVEL_HIGH); - LOS_Mdelay(50); + LOS_Mdelay(100); } void ppg_power_off(void) @@ -67,11 +67,11 @@ void ppg_power_off(void) uapi_pin_set_mode(GPIO_PIN_PRG_RESET, (pin_mode_t)HAL_PIO_FUNC_GPIO); uapi_gpio_set_dir(GPIO_PIN_PRG_RESET, GPIO_DIRECTION_OUTPUT); uapi_gpio_set_val(GPIO_PIN_PRG_RESET, GPIO_LEVEL_LOW); - + LOS_Mdelay(10); uapi_pin_set_mode(GPIO_PIN_PRG_LED_ON, (pin_mode_t)HAL_PIO_FUNC_GPIO); uapi_gpio_set_dir(GPIO_PIN_PRG_LED_ON, GPIO_DIRECTION_OUTPUT); uapi_gpio_set_val(GPIO_PIN_PRG_LED_ON, GPIO_LEVEL_LOW); - LOS_Mdelay(50); + LOS_Mdelay(100); } uint8_t ppg_get_hrs(void) @@ -153,7 +153,7 @@ void ppg_send_cmd_to_driver(char* mode, uint8_t enable) #elif defined PPG_PAH8009 pah8009_control(mode,enable); #elif defined PPG_GH3X2X - // gh3x2x_control(mode,enable); + gh3x2x_control(mode,enable); #endif if(!enable) ppg_power_off(); diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c index b98ba29e3..8494713bb 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c @@ -75,7 +75,7 @@ int32_t PPG_buf_vec[8]; // #include "sys_init.h" // #include "cwm_api.h" -static uint8_t hrs_ble_falg = 0; + #define PPG_DATA_LEN_MAX 17 int32_t s_buf[256]; uint32_t cnt_num = 0; @@ -2709,17 +2709,6 @@ 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) { @@ -3110,7 +3099,7 @@ void hx3695_hrs_ppg_Int_handle(void) ble_rawdata_send_handler(); #endif - if(hrs_ble_falg) + if(uapi_dev_runtime_get_hrs_ble_status()) { uint8_t encoded_hrm[PPG_DATA_LEN_MAX] = {0};//PPG_DATA_LEN_MAX>17会导致APP连接提示定义设备与所选类型不匹配 uint8_t red_bit = 0; @@ -3548,7 +3537,7 @@ void hx3695_spo2_ppg_Int_handle(void) } #endif -if(hrs_ble_falg) +if(uapi_dev_runtime_get_hrs_ble_status()) { uint8_t encoded_hrm[PPG_DATA_LEN_MAX] = {0};//PPG_DATA_LEN_MAX>17会导致APP连接提示定义设备与所选类型不匹配 diff --git a/code/sdk/drivers/peripheral/ppg/pah8009/algorithm/pah_hr/V303009/test_library_HRD.c b/code/sdk/drivers/peripheral/ppg/pah8009/algorithm/pah_hr/V303009/test_library_HRD.c index 204d61376..0730dc245 100644 --- a/code/sdk/drivers/peripheral/ppg/pah8009/algorithm/pah_hr/V303009/test_library_HRD.c +++ b/code/sdk/drivers/peripheral/ppg/pah8009/algorithm/pah_hr/V303009/test_library_HRD.c @@ -113,5 +113,5 @@ void test_library_HRD(void) void log_printf(char *s, float f) { - printf("%s: %f\n", s, f); + // printf("%s: %f\n", s, f); } \ No newline at end of file diff --git a/code/sdk/drivers/peripheral/ppg/pah8009/sensor/pah800x_main.c b/code/sdk/drivers/peripheral/ppg/pah8009/sensor/pah800x_main.c index 2229772e8..c650f00b1 100644 --- a/code/sdk/drivers/peripheral/ppg/pah8009/sensor/pah800x_main.c +++ b/code/sdk/drivers/peripheral/ppg/pah8009/sensor/pah800x_main.c @@ -16,7 +16,7 @@ #include "cywee_service.h" #endif #include "custom_runtime.h" - +#include "ppgBleService.h" //============================================================================ // Static Global Variable //============================================================================ @@ -89,6 +89,8 @@ static uint8_t time_cnt = 0; static int history_wear_status = -1; +static int data_cnt = 0; + //============================================================================ // Private function //============================================================================ @@ -445,6 +447,8 @@ void hr_algorithm_disable(void) _main.hr_is_enabled = false; } + + void hr_alg_task(void) { if(Check_alg_enable()) @@ -501,7 +505,7 @@ void hr_alg_task(void) time_cnt++; ppg_msg_callback_t func = ppg_get_send_msg_callback_func(); - + int ii=0; if(func != NULL && time_cnt >= 25) { uint8_t data = (uint8_t)hr; @@ -509,7 +513,49 @@ void hr_alg_task(void) // data = cywee_wear_status; // func(PPG_MSG_TYPE_WEARSTAT_UPDATE, &data, 1); time_cnt = 0; + + data_cnt+=8; + + if(uapi_dev_runtime_get_hrs_ble_status()) + { + uint8_t encoded_hrm[17] = {0};//PPG_DATA_LEN_MAX>17会导致APP连接提示定义设备与所选类型不匹配 + + for(ii = 0; ii<8; ii++) + { + + encoded_hrm[0] = 0x55;//心率标志位,一定要设置正确 + encoded_hrm[1] = (uint8_t)(data_cnt - 8 + ii) % 256;//原始data_cnt会一直自加,但是这里只有一个字节,0-255循环 + encoded_hrm[2] = (uint8_t)hr;//心率值 + + encoded_hrm[3] = 0; //绿灯原始数据 + encoded_hrm[4] = 0; //绿灯原始数据 + encoded_hrm[5] = 0; //绿灯原始数据 + + encoded_hrm[6] = 0; //ir原始数据 + encoded_hrm[7] = 0; //ir原始数据 + encoded_hrm[8] = 0; //ir原始数据 + + encoded_hrm[9] = 0;//模拟x,1234换成填入自己的x数据 + encoded_hrm[10] = 0; + encoded_hrm[11] = 0;//模拟y,-1234换成填入自己的y数据 + encoded_hrm[12] = 0; + encoded_hrm[13] = 0;//模拟z,3987换成填入自己的z数据 + encoded_hrm[14] = 0; + + encoded_hrm[15] = 0;//绿灯电流 + encoded_hrm[16] = 0;//红外电流 + + // if(cm_custom_ble_service_on_flag()) + ble_ppgtest_server_send_input_report(encoded_hrm,17); + + // ble_op_att_send_data(ATT_CHARACTERISTIC_2a37_01_VALUE_HANDLE,encoded_hrm, \ + // sizeof(encoded_hrm)/sizeof(encoded_hrm[0]), ATT_OP_NOTIFY);//heartrate + } + } + } + + #endif report_hr_data(&ppg_mems_data_alg, ret, hr, hr_grader); diff --git a/code/sdk/drivers/peripheral/ppg/ppgBleService/ppgBleService.c b/code/sdk/drivers/peripheral/ppg/ppgBleService/ppgBleService.c index 53d176cc2..fc1668d6b 100644 --- a/code/sdk/drivers/peripheral/ppg/ppgBleService/ppgBleService.c +++ b/code/sdk/drivers/peripheral/ppg/ppgBleService/ppgBleService.c @@ -127,8 +127,11 @@ errcode_t ble_ppgtest_server_send_input_report(const uint8_t *data, uint8_t len) } errcode_t ret = 0; - if(g_ble_conn_id==0) - return ERRCODE_BT_FAIL; + // if(g_ble_conn_id==0) + // { + // printf( "g_ble_conn_id==0\r\n"); + // return ERRCODE_BT_FAIL; + // } ret = gatts_notify_indicate(g_ble_server_id, g_ble_conn_id, ¶m); //printf("ble_ppgtest_server_send_input_report: 0x%x g_ble_conn_id:%d g_ppgtest_notify_report_att_hdl:%d\r\n", diff --git a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp index 1d934b103..08cb73371 100644 --- a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp +++ b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp @@ -309,20 +309,7 @@ static void ppg_service_check_task(void *arg) cmd = "spo2"; enable = 0; } - else if (mail == PPG_SERVICE_CMD_TYPE_OPEN_HRS_BLE) - { -#ifdef PPG_HX3695 - hx3695_set_hrs_ble_swtich(1); -#endif - continue ; - } - else if (mail == PPG_SERVICE_CMD_TYPE_CLOSE_HRS_BLE) - { -#ifdef PPG_HX3695 - hx3695_set_hrs_ble_swtich(0); -#endif - continue ; - }else if (mail == PPG_SERVICE_CMD_TYPE_INT_HANDLER){ + else if (mail == PPG_SERVICE_CMD_TYPE_INT_HANDLER){ // #ifdef PPG_VC9202 // vc9202_usr_interrupt_handler(SPORT_TYPE_NORMAL,0); // #elif defined PPG_VC921X diff --git a/code/sdk/drivers/peripheral/ppg/service/ppg_service.h b/code/sdk/drivers/peripheral/ppg/service/ppg_service.h index 094718ddd..e434fda30 100644 --- a/code/sdk/drivers/peripheral/ppg/service/ppg_service.h +++ b/code/sdk/drivers/peripheral/ppg/service/ppg_service.h @@ -2,7 +2,7 @@ * @Author: penglei 1624952103@qq.com * @Date: 2024-03-27 09:07:00 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2025-06-05 14:24:03 + * @LastEditTime: 2025-07-14 13:58:55 * @FilePath: /FD230/code/sdk/drivers/peripheral/ppg/service/ppg_service.h * @Description: * @@ -44,10 +44,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 -#define PPG_SERVICE_CMD_TYPE_FPC_TEST 0x27 -#define PPG_SERVICE_CMD_TYPE_FACTORY_TEST 0x28 +#define PPG_SERVICE_CMD_TYPE_FPC_TEST 0x24 +#define PPG_SERVICE_CMD_TYPE_FACTORY_TEST 0x25 errcode_t uapi_ppg_service_init(void); void uapi_ppg_service_deinit(void); diff --git a/code/sdk/drivers/peripheral/utils/custom_runtime.c b/code/sdk/drivers/peripheral/utils/custom_runtime.c index e56618ffc..5ce3a98ec 100644 --- a/code/sdk/drivers/peripheral/utils/custom_runtime.c +++ b/code/sdk/drivers/peripheral/utils/custom_runtime.c @@ -108,6 +108,7 @@ typedef struct uint8_t atuoota_status;//是否处于自动ota状态 uint8_t voice_status;//是否处于使用语音助手 uint8_t bp_status;//血压测量状态 + uint8_t hrs_ble_status;//心率蓝牙广播 } runtime_status_t; @@ -671,3 +672,14 @@ uint8_t uapi_dev_runtime_get_bp_status_flag(void) { return g_runtime.bp_status; } + +// 设置是否为心率蓝牙广播状态 +void uapi_dev_runtime_set_hrs_ble_status(uint8_t status) +{ + g_runtime.hrs_ble_status = status; +} +// 获取是否为心率蓝牙广播状态 +uint8_t uapi_dev_runtime_get_hrs_ble_status(void) +{ + return g_runtime.hrs_ble_status; +} diff --git a/code/sdk/drivers/peripheral/utils/custom_runtime.h b/code/sdk/drivers/peripheral/utils/custom_runtime.h index 0fb18c413..f9b1fc619 100644 --- a/code/sdk/drivers/peripheral/utils/custom_runtime.h +++ b/code/sdk/drivers/peripheral/utils/custom_runtime.h @@ -332,6 +332,9 @@ uint32_t uapi_get_gate_AudioStreamType_status(void); bool uapi_get_gate_mixture_status(void); +void uapi_dev_runtime_set_hrs_ble_status(uint8_t status); +uint8_t uapi_dev_runtime_get_hrs_ble_status(void); + #ifdef __cplusplus #if __cplusplus } -- 2.17.1