gengxin
author@CHENG <2393524978@qq.com>
Mon, 8 Jan 2024 03:29:04 +0000 (11:29 +0800)
committer@CHENG <2393524978@qq.com>
Mon, 8 Jan 2024 03:29:04 +0000 (11:29 +0800)
2.sdk/project/Z5_HA_K18/gui/lv_watch/resource/png/dial_default_ambient/am_digit.json
2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_blood_pressure.c
2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_http_protocol.c

index 9b19048..b35949b 100644 (file)
@@ -6,7 +6,7 @@
   "element_ll": [
     {
       "element_pos": {
-        "x": 140,
+        "x": 117,
         "y": 180
       },
       "element_cnt": 1,
index e84a7f9..154a118 100644 (file)
@@ -193,11 +193,13 @@ void mmi_hengai_bp_raw_data_fill(void)
                lv_mem_free(s_hengai_bp_raw_data_ptr);
                s_hengai_bp_raw_data_ptr = NULL;
        }
-       s_hengai_bp_raw_data_ptr = (int *)lv_mem_alloc(MMI_HENGAI_BP_RAW_DATA_LEN * sizeof(int));
-       _lv_memset_00(s_hengai_bp_raw_data_ptr, MMI_HENGAI_BP_RAW_DATA_LEN * sizeof(int));
-       _lv_memcpy(s_hengai_bp_raw_data_ptr, fr8012haq_blood_data_get(&s_hengai_bp_raw_data_len), MMI_HENGAI_BP_RAW_DATA_LEN * sizeof(int));
 
-       HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: raw_data_len=%d\n", __FUNCTION__, __LINE__, s_hengai_bp_raw_data_len);
+       int temp_len = MMI_HENGAI_BP_RAW_DATA_LEN * sizeof(int);
+       s_hengai_bp_raw_data_ptr = (int *)lv_mem_alloc(temp_len);
+       _lv_memset_00(s_hengai_bp_raw_data_ptr, temp_len);
+       _lv_memcpy(s_hengai_bp_raw_data_ptr, fr8012haq_blood_data_get(&s_hengai_bp_raw_data_len), temp_len);
+
+       HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: raw_data_len=%d, temp_len=%d\n", __FUNCTION__, __LINE__, s_hengai_bp_raw_data_len, temp_len);
 }
 
 int * mmi_hengai_bp_raw_data_ptr_get(void)
index a56509e..b00cd69 100644 (file)
@@ -72,9 +72,13 @@ int mmi_hengai_http_post_json_data(char * url, char * post_data, char * token)
 {
     int response_code= 0;
     int ret = 0;
-    struct http_client_list * header = NULL;
-    if (s_hengai_http_client != NULL)
-        return -2;
+
+       if (NULL != s_hengai_http_client)
+       {
+               HENGAI_HEALTH_DEBUG_PRINTF("client not null\n");
+               ret = -2;
+               goto EXIT;
+       }
     
     s_hengai_http_client = http_client_init();
     http_client_setopt(s_hengai_http_client, HTTPCLIENT_OPT_URL, url);    /*set URL:support http/https and ip4/ip6*/
@@ -199,11 +203,12 @@ void mmi_hengai_bp_measure_raw_data_send(void)
        json_send = NULL;
 #else
 
-int temp_len = 0;
-       char * post_data = lv_mem_alloc(MMI_HENGAI_BP_RAW_DATA_LEN * 9 + 256);
+       int temp_len = 0;
+       int post_data_len = MMI_HENGAI_BP_RAW_DATA_LEN * 9 + 256;
+       char * post_data = lv_mem_alloc(post_data_len);
        if(NULL == post_data)
                return ;
-       _lv_memset_00(post_data, (MMI_HENGAI_BP_RAW_DATA_LEN * 9 + 256));
+       _lv_memset_00(post_data, post_data_len);
        
        temp_len += sprintf(post_data + temp_len, "{\"app_key\":\"%s\",", HENGAI_HTTP_POST_APP_KEY);
 
@@ -358,6 +363,7 @@ void mmi_hengai_bp_calibrate_raw_data_send(uint8_t calibrate_times, uint16_t bp_
        char * begin_time_str = mmi_hengai_bp_measure_action_time_string_get(1);
        char * end_time_str = mmi_hengai_bp_measure_action_time_string_get(0);
        
+#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));
@@ -370,6 +376,45 @@ void mmi_hengai_bp_calibrate_raw_data_send(uint8_t calibrate_times, uint16_t bp_
        char * post_data = cJSON_Print(json_send);
        cJSON_Delete(json_send);
        json_send = NULL;
+#else
+       int temp_len = 0;
+       int post_data_len = MMI_HENGAI_BP_RAW_DATA_LEN * 9 + 256;
+       char * post_data = lv_mem_alloc(post_data_len);
+       if(NULL == post_data)
+               return ;
+       _lv_memset_00(post_data, post_data_len);
+
+       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);
+
+       temp_len += sprintf(post_data + temp_len, "\"sbp\":%d,", bp_value_high);
+
+       temp_len += sprintf(post_data + temp_len, "\"dbp\":%d}", bp_value_low);
+
+#endif
 
        char url[256] = {0};
        char * url_suffix = "/health/bp/calibration";