From ad841c867d5959e7f8ac9530f0a59d2d733b10fd Mon Sep 17 00:00:00 2001 From: penglei <1624952103@qq.com> Date: Wed, 6 Aug 2025 13:46:44 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8D=E7=9D=A1=E7=9C=A0=E5=8D=A1?= =?utf8?q?=E7=89=87=E6=97=B6=E9=97=B4=E6=88=B3=E6=98=BE=E7=A4=BAbug?= =?utf8?q?=EF=BC=8C=E5=A2=9E=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 --- .../nativeui/sleep/src/SleepModel.cpp | 4 +- .../config/target_config/brandy/config.py | 4 + code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c | 81 ++++++++++--------- code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c | 8 ++ .../drivers/ppg/ppgBleService/ppgBleService.c | 14 ++-- .../battery/service/battery_service.cpp | 25 ------ .../ble_service/bleservice/bleService.c | 14 ++++ 7 files changed, 77 insertions(+), 73 deletions(-) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/sleep/src/SleepModel.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/sleep/src/SleepModel.cpp index fbb2ca912..22db1f507 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/sleep/src/SleepModel.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/sleep/src/SleepModel.cpp @@ -2,7 +2,7 @@ * @Author: penglei 1624952103@qq.com * @Date: SLEPPNOTIFY24-06-26 19:36:48 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2025-07-31 17:21:20 + * @LastEditTime: 2025-08-06 10:42:09 * @FilePath: * /FD230/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp * @Description: @@ -385,7 +385,7 @@ namespace OHOS #endif //获取最新的出睡时间 - sleep_fall_asleep_timestamp = nap_wake_up_timestamp>sleep_wake_up_timestamp?nap_fall_asleep_timestamp:sleep_fall_asleep_timestamp; + sleep_update_time = nap_wake_up_timestamp>sleep_wake_up_timestamp?nap_wake_up_timestamp:sleep_wake_up_timestamp; OHOS::SleepModel::GetInstance().set_sleep_total(sleep_total); OHOS::SleepModel::GetInstance().set_nap_total(nap_total); diff --git a/code/sdk/build/config/target_config/brandy/config.py b/code/sdk/build/config/target_config/brandy/config.py index 3d4aa300b..d553a55c2 100644 --- a/code/sdk/build/config/target_config/brandy/config.py +++ b/code/sdk/build/config/target_config/brandy/config.py @@ -982,6 +982,10 @@ target = { # 'AILPAY_SUPPORT', 'SUPPORT_FACT_SERVICE', # 'MEMORY_CORRUPTION', + # 'SUPPORT_GNSS', + # 'DISABLE_UART_LOG', + # 'CONFIG_GNSS_UART_WITH_FLOWCTRL', + # 'DOWNLOAD_GNSS_SWITCH', ], #添加自定义应用 diff --git a/code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c b/code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c index 7cd7be5b7..cc1fdb5da 100644 --- a/code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c +++ b/code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c @@ -839,45 +839,46 @@ uint32_t cywee_get_sport_data(uint8_t type) uint32_t data = 0; switch (type) { - case STEP: - data = stepcount; - break; - case HISTORY_STEP: - data = history_step; - break; - case HISTORY_DISTANCE: - data = history_distances; - break; - case HISTORY_CALORIES: - data = history_calories; - break; - case HISTORY_FAT: - data = history_fat; - break; - case HISTORY_STEP_: - data = history_step_; - break; - case HISTORY_DISTANCE_: - data = history_distances_; - break; - case HISTORY_CALORIES_: - data = history_calories_; - break; - case HISTORY_FAT_: - data = history_fat_; - break; - case NEW_DISTANCE: - data = new_distance; - break; - case NEW_CALORIES: - data = new_calories; - break; - case NEW_FAT: - data = new_fat; - default: - break; + case STEP: + data = stepcount; + break; + case HISTORY_STEP: + data = history_step; + break; + case HISTORY_DISTANCE: + data = history_distances; + break; + case HISTORY_CALORIES: + data = history_calories; + break; + case HISTORY_FAT: + data = history_fat; + break; + case HISTORY_STEP_: + data = history_step_; + break; + case HISTORY_DISTANCE_: + data = history_distances_; + break; + case HISTORY_CALORIES_: + data = history_calories_; + break; + case HISTORY_FAT_: + data = history_fat_; + break; + case NEW_DISTANCE: + data = new_distance; + break; + case NEW_CALORIES: + data = new_calories; + break; + case NEW_FAT: + data = new_fat; + break; + default: + break; } - return 0; + return data; } void cywee_set_sport_data(uint32_t data,uint8_t type) @@ -1056,7 +1057,7 @@ void cywee_oncharging_update(int oncharging_status) void cywee_wearstatus_update(int wearstatus) { -#if 0 +#if 1 uapi_dev_runtime_set_wear_status(wearstatus); memset(&csd, 0, sizeof(CUSTOM_OFFBODY_DETECT)); csd.sensorType = CUSTOM_OFFBODY_DETECT; @@ -1357,7 +1358,7 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) { if((int)sensorEVT->fData[1] == CUSTOM_OFFBODY_DETECT) { CWM_OS_dbgPrintf("CUSTOM_OFFBODY_DETECT !!! \r\n"); -#if 0 +#if 1 if((int)sensorEVT->fData[2] == 1) { #ifdef SUPPORT_PPG_SERVICE diff --git a/code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c b/code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c index 70a850dfa..769ba699d 100644 --- a/code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c +++ b/code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c @@ -3038,6 +3038,14 @@ void hx3695_hrs_ppg_Int_handle(void) msg_count++; if(msg_count >= 3) { + +#ifdef SUPPORT_PPG_BLE_SERVICE + if(uapi_dev_runtime_get_hrs_ble_status()) + { + ble_ppgtest_server_send_input_report(&hrs_result,1); + } +#endif + msg_count = 0; // if(func != NULL) // { diff --git a/code/sdk/zhihui/drivers/ppg/ppgBleService/ppgBleService.c b/code/sdk/zhihui/drivers/ppg/ppgBleService/ppgBleService.c index 51d59db2c..9d8bce28a 100644 --- a/code/sdk/zhihui/drivers/ppg/ppgBleService/ppgBleService.c +++ b/code/sdk/zhihui/drivers/ppg/ppgBleService/ppgBleService.c @@ -113,21 +113,24 @@ errcode_t ble_ppgtest_server_send_input_report(const uint8_t *data, uint8_t len) // printf("ble_hid_server_send_input_report:%d %d %d",data[0],data[1],len); gatts_ntf_ind_t param = {0}; param.attr_handle = (uint16_t)g_ppgtest_notify_report_att_hdl; - param.value_len = len; - param.value = bt_os_new(len); + param.value_len = len + 1; + param.value = bt_os_new(param.value_len); if (param.value == NULL) { printf( "[ppgtest][ERROR]send input report new fail\r\n"); return ERRCODE_BT_MALLOC_FAIL; } - if (memcpy_s(param.value, param.value_len, data, len) != EOK) { + if (memcpy_s(param.value + 1, param.value_len, data, len) != EOK) { printf( "[ppgtest][ERROR]send input report memcpy fail\r\n"); bt_os_free(param.value); return ERRCODE_BT_FAIL; } 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", @@ -136,7 +139,6 @@ errcode_t ble_ppgtest_server_send_input_report(const uint8_t *data, uint8_t len) return ERRCODE_BT_SUCCESS; } - void ble_ppgtest_store_report_handle(uint16_t srvc_handle) { printf("g_ppgtest_notify_report_att_hdl: 0x%X\r\n",srvc_handle); diff --git a/code/sdk/zhihui/services/battery/service/battery_service.cpp b/code/sdk/zhihui/services/battery/service/battery_service.cpp index 3565642c0..37722dbee 100644 --- a/code/sdk/zhihui/services/battery/service/battery_service.cpp +++ b/code/sdk/zhihui/services/battery/service/battery_service.cpp @@ -233,31 +233,6 @@ uint8_t battery_get_percent_onstart(void) return 0; } -static uint32_t get_current_timestamp(void) -{ - uint32_t timestamp = 0; - struct timeval current_time = {0}; - if (gettimeofday(¤t_time, NULL)) { - return 0; - } - struct tm tm; - localtime_r(¤t_time.tv_sec, &tm); - timestamp = (uint32_t)current_time.tv_sec; - return timestamp; -} -/*获取秒级时间戳*/ -static errcode_t get_timestampe_ss(uint32_t *tm) -{ - if (tm == NULL) { - return ERRCODE_FAIL; - } - - *tm = get_current_timestamp(); - //printf("[timestamp:%u]\n", *tm); - return ERRCODE_SUCC; -} - - static void battery_timer_start_check_released(uint32_t rtc_ms) { if (osTimerIsRunning(g_battery_timer)) osTimerStop(g_battery_timer); diff --git a/code/sdk/zhihui/services/ble_service/bleservice/bleService.c b/code/sdk/zhihui/services/ble_service/bleservice/bleService.c index e3e9c03d9..94a7aee1d 100644 --- a/code/sdk/zhihui/services/ble_service/bleservice/bleService.c +++ b/code/sdk/zhihui/services/ble_service/bleservice/bleService.c @@ -330,6 +330,20 @@ static void svr_ble_adv_data_set(int adv_id) adv_data_len = sizeof(ble_adv_type); // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"adv_data_len!!!!:%d\r\n",adv_data_len); + // 2. 添加心率服务UUID(0x180D) + if(uapi_dev_runtime_get_hrs_ble_status()) + { + // 格式:[长度(0x03)][类型(0x03)][UUID低字节(0x0D)][UUID高字节(0x18)] + if (adv_data_len + 4 <= BLE_ADV_DATA_MAX_LENGTH) { + adv_data[adv_data_len++] = 0x03; // 长度:3字节(类型+UUID) + adv_data[adv_data_len++] = 0x03; // 类型:16位服务UUID列表 + adv_data[adv_data_len++] = 0x0D; // 心率服务UUID低字节 + adv_data[adv_data_len++] = 0x18; // 心率服务UUID高字节 + } else { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "No space for heart rate UUID"); + } + } + adv_data[adv_data_len++] = 0x0f;//长度 adv_data[adv_data_len++] = 0xff;//数据类型 manufactory data adv_data[adv_data_len++] = 'J'; -- 2.17.1