From: @CHENG <2393524978@qq.com> Date: Thu, 11 Jan 2024 09:43:43 +0000 (+0800) Subject: gengxin X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=b9359b01fbcde180b287aa10873680abfd1a4256;p=mirrors%2FASR3603_Z5.git gengxin --- diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_blood_pressure.c b/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_blood_pressure.c index 582ff511..3e0c421d 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_blood_pressure.c +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_blood_pressure.c @@ -64,11 +64,11 @@ void mmi_hengai_bp_raw_data_fill(void) int * mmi_hengai_bp_raw_data_ptr_get(void) { HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); - HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG]: [0]=%d,[1]=%d,[2]=%d,[3]=%d\n", - s_hengai_bp_raw_data_ptr[0], - s_hengai_bp_raw_data_ptr[1], - s_hengai_bp_raw_data_ptr[2], - s_hengai_bp_raw_data_ptr[3]); + //HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG]: [0]=%d,[1]=%d,[2]=%d,[3]=%d\n", + // s_hengai_bp_raw_data_ptr[0], + // s_hengai_bp_raw_data_ptr[1], + // s_hengai_bp_raw_data_ptr[2], + // s_hengai_bp_raw_data_ptr[3]); return s_hengai_bp_raw_data_ptr; } diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_http_protocol.c b/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_http_protocol.c index 08396cc5..5e76265a 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_http_protocol.c +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_http_protocol.c @@ -31,8 +31,9 @@ static void response_cb(char * data, int len, int num, void *cbdata) HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: data_len=%d\n", __FUNCTION__, __LINE__, len); temp = (void*)malloc(response_len + len); - if (!temp) { - HENGAI_HEALTH_DEBUG_PRINTF("Malloc failed...\n"); + if (NULL == temp) + { + HENGAI_HEALTH_DEBUG_PRINTF("malloc failed\n"); return; } memset(temp, 0, response_len + len); @@ -127,6 +128,12 @@ int mmi_hengai_http_post_json_data(char * url, char * post_data, char * token) s_hengai_http_revceive_buf = NULL; } s_hengai_http_revceive_buf = lv_mem_alloc(response_len + 1); + if(NULL == s_hengai_http_revceive_buf) + { + HENGAI_HEALTH_DEBUG_PRINTF("malloc failed\n"); + ret = -4; + goto EXIT; + } _lv_memset_00(s_hengai_http_revceive_buf, response_len + 1); _lv_memcpy(s_hengai_http_revceive_buf, response_data, response_len); HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: data_len=%d\n", __FUNCTION__, __LINE__, response_len); @@ -235,12 +242,21 @@ void mmi_hengai_bp_measure_raw_data_send(void) } temp_len += sprintf(post_data + temp_len, "\"sample_rate\":%d}", MMI_HENGAI_BP_RAW_DATA_SAMPLE_RATE); + + HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, temp_len); #endif char url[256] = {0}; char * url_suffix = "/health/bp/measurement"; sprintf(url, "%s%s", HENGAI_HTTP_POST_URL_COMMON_PREFIX, url_suffix); int ret = mmi_hengai_http_post_data(url, post_data, token); + + if(NULL != post_data) + { + lv_mem_free(post_data); + post_data = NULL; + } + if(0 == ret) { HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, strlen(s_hengai_http_revceive_buf)); @@ -282,11 +298,6 @@ void mmi_hengai_bp_measure_raw_data_send(void) } } - - lv_mem_free(post_data); - post_data = NULL; - - if(NULL != s_hengai_http_revceive_buf) { lv_mem_free(s_hengai_http_revceive_buf); @@ -416,12 +427,20 @@ void mmi_hengai_bp_calibrate_raw_data_send(uint8_t calibrate_times, uint16_t bp_ temp_len += sprintf(post_data + temp_len, "\"category\":%d}", calibrate_times); + HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, temp_len); #endif char url[256] = {0}; char * url_suffix = "/health/bp/calibration"; sprintf(url, "%s%s", HENGAI_HTTP_POST_URL_COMMON_PREFIX, url_suffix); int ret = mmi_hengai_http_post_data(url, post_data, token); + + if(NULL != post_data) + { + lv_mem_free(post_data); + post_data = NULL; + } + if(0 == ret) { HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, strlen(s_hengai_http_revceive_buf)); @@ -469,7 +488,7 @@ void mmi_hengai_bp_calibrate_raw_data_send(uint8_t calibrate_times, uint16_t bp_ } -#if 0 + void mmi_hengai_bp_activation_feedback(void) { char * post_data = NULL; @@ -488,7 +507,7 @@ void mmi_hengai_bp_activation_feedback(void) char url[256] = {0}; char * url_suffix = "/sinklib/activation/feedback"; sprintf(url, "%s%s", HENGAI_HTTP_POST_URL_COMMON_PREFIX, url_suffix); - int ret = mmi_hengai_http_post_data(url, post_data); + int ret = mmi_hengai_http_post_data(url, post_data, NULL); if(0 == ret) { cJSON * json_recv = NULL; @@ -532,7 +551,7 @@ void mmi_hengai_bp_activation_check_action(void) { HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); - if(0 == mmi_hengai_bp_is_activated()) + if(0 == mmi_hengai_health_activated_flag_get()) { char * post_data = NULL; cJSON * json_send = NULL; @@ -556,7 +575,7 @@ void mmi_hengai_bp_activation_check_action(void) char url[256] = {0}; char * url_suffix = "/sinklib/activation"; sprintf(url, "%s%s", HENGAI_HTTP_POST_URL_COMMON_PREFIX, url_suffix); - int ret = mmi_hengai_http_post_data(url, post_data); + int ret = mmi_hengai_http_post_data(url, post_data, NULL); if(0 == ret) { cJSON * json_recv = NULL; @@ -573,12 +592,6 @@ void mmi_hengai_bp_activation_check_action(void) char * act_code = cJSON_GetStringValue(cJSON_GetObjectItem(json_data, "activation_code")); mmi_hengai_health_act_code_set(act_code); - - // ����˼����룬���͸��³��⣬���õ���ȷ���غ����� - // if() - { - mmi_hengai_bp_activation_feedback(); - } } else // false { @@ -605,8 +618,6 @@ void mmi_hengai_bp_activation_check_action(void) } } } -#endif - void mmi_hengai_algorithm_interface_login_action(void) { @@ -751,6 +762,13 @@ void mmi_hengai_health_act_code_set(char * act_code) HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG]: %s\n", act_code); _lv_memcpy(s_hengai_health_data.act_code, act_code, strlen(act_code)); mmi_hengai_health_data_nv_write(); + +/* + if() + { + mmi_hengai_bp_activation_feedback(); + } +*/ } char * mmi_hengai_health_token_get(void)