gengxin
author@CHENG <2393524978@qq.com>
Mon, 8 Jan 2024 01:17:20 +0000 (09:17 +0800)
committer@CHENG <2393524978@qq.com>
Mon, 8 Jan 2024 01:17:20 +0000 (09:17 +0800)
2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_http_protocol.c
2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_http_protocol.h

index d633c23..28f6c1d 100644 (file)
@@ -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);
index eae84c8..78c930e 100644 (file)
@@ -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