From: @CHENG <2393524978@qq.com> Date: Mon, 8 Jan 2024 01:17:20 +0000 (+0800) Subject: gengxin X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=5305029ab132efe2ea4f35413dfb044355e554e3;p=mirrors%2FASR3603_Z5.git gengxin --- 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 d633c23c..28f6c1d4 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 @@ -186,6 +186,7 @@ void mmi_hengai_bp_measure_raw_data_send(void) #endif //int test_number_array[] = {1012744,864594,698914,532908,402542,317532,235462,168856,142664,109818,42654}; +#if 0 cJSON * json_send = cJSON_CreateObject(); cJSON_AddItemToObject(json_send, "app_key", cJSON_CreateString(HENGAI_HTTP_POST_APP_KEY)); cJSON_AddItemToObject(json_send, "mac", cJSON_CreateString(imei)); @@ -196,6 +197,40 @@ void mmi_hengai_bp_measure_raw_data_send(void) char * post_data = cJSON_Print(json_send); cJSON_Delete(json_send); json_send = NULL; +#else + +int temp_len = 0; + char * post_data = lv_mem_alloc(MMI_HENGAI_BP_RAW_DATA_LEN * 9 + 256); + if(NULL == post_data) + return ; + _lv_memset_00(post_data, (MMI_HENGAI_BP_RAW_DATA_LEN * 9 + 256)); + + temp_len += sprintf(post_data + temp_len, "{\"app_key\":\"%s\",", HENGAI_HTTP_POST_APP_KEY); + + temp_len += sprintf(post_data + temp_len, "\"mac\":\"%s\",", imei); + + temp_len += sprintf(post_data + temp_len, "\"begin_time\":\"%s\",", begin_time_str); + + temp_len += sprintf(post_data + temp_len, "\"end_time\":\"%s\",", end_time_str); + + uint16_t i = 0; + int * temp_int_ptr = mmi_hengai_bp_raw_data_ptr_get(); + int temp_int_len = mmi_hengai_bp_raw_data_len_get(); + temp_len += sprintf(post_data + temp_len, "\"pulse_wave\":["); + for(i = 0; i < temp_int_len; i++) + { + if(i == (temp_int_len - 1)) + { + temp_len += sprintf(post_data + temp_len, "%d]", temp_int_ptr[i]); + } + else + { + temp_len += sprintf(post_data + temp_len, "%d,", temp_int_ptr[i]); + } + } + + temp_len += sprintf(post_data + temp_len, "\"sample_rate\":%d}", MMI_HENGAI_BP_RAW_DATA_SAMPLE_RATE); +#endif char url[256] = {0}; char * url_suffix = "/health/bp/measurement"; @@ -242,6 +277,11 @@ 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); diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_http_protocol.h b/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_http_protocol.h index eae84c83..78c930eb 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_http_protocol.h +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_http_protocol.h @@ -18,7 +18,7 @@ extern "C" { #ifdef __MMI_CUSTOM_HENGAI_HEALTH__ -//#define __HENGAI_HEALTH_DEBUG__ +#define __HENGAI_HEALTH_DEBUG__ #ifdef __HENGAI_HEALTH_DEBUG__ #define HENGAI_HEALTH_DEBUG_PRINTF(fmt, ...) printf(fmt, ##__VA_ARGS__) #else