gengxin
author@CHENG <2393524978@qq.com>
Wed, 3 Jan 2024 11:02:22 +0000 (19:02 +0800)
committer@CHENG <2393524978@qq.com>
Wed, 3 Jan 2024 11:02:22 +0000 (19:02 +0800)
2.sdk/project/Z5_HA_K18/product/craneg_modem/config/watch/lv_watch_conf_CUSTOM.h
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_blood_pressure.h
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
2.sdk/sdk/gui/lv_watch/lv_apps/phonebook/phonebook.c
2.sdk/sdk/gui/lv_watch/lv_watch.c

index 633be02..6d4e05a 100644 (file)
@@ -970,13 +970,7 @@ void mmi_hengai_bp_calibrate_update_result(bool is_success)
        if(true != watch_ext->is_watting_result)
                return;
 
-       if(is_success)
-       {
-               nv_watch_hengai_health_data_t data = {0};
-
-               data.is_calibrated = 1;
-               mmi_hengai_blood_pressure_data_set(&data);
-       }
+       mmi_hengai_bp_calibrated_flag_set(is_success ? 1 : 0);
        mmi_hengai_bp_calibrate_result_screen(is_success);
 }
 
@@ -1861,7 +1855,7 @@ lv_obj_t * mmi_heng_ai_bp_screen_create(lv_obj_t * activity_obj)
                if(NULL == ext->tab_attempt_mode)
                        return NULL;
 
-               if(1 == mmi_hengai_bp_is_calibrated())
+               if(0 == mmi_hengai_bp_calibrated_flag_get())
                    lv_tileview_set_tile_act(tileview, 1, 0, LV_ANIM_OFF);
                else
                    lv_tileview_set_tile_act(tileview, 0, 0, LV_ANIM_OFF);
@@ -1888,7 +1882,7 @@ void mmi_heng_ai_blood_pressure_create_event_cb(lv_obj_t * btn, lv_event_t e)
 
 
 
-
+#if 0
 static void * __s_debug_timer_id = NULL;
 //TIMER_ID measure_timer_id;
 
@@ -1937,5 +1931,6 @@ void __debug_start(void)
 
        __debug_timer_start();
 }
+#endif
 
 #endif
index 96d837a..d42966a 100644 (file)
@@ -81,22 +81,6 @@ typedef struct
 
 
 
-
-
-
-
-
-void mmi_hengai_blood_pressure_nv_read(void);
-
-#if 0
-uint8_t mmi_hengai_bp_is_activated(void);
-char * mmi_hengai_bp_req_code_get(void);
-void mmi_hengai_bp_req_code_set(char * req_code);
-char * mmi_hengai_bp_act_code_get(void);
-void mmi_hengai_bp_act_code_set(char * act_code);
-void mmi_hengai_bp_activated_finish(void);
-#endif
-
 uint8_t mmi_hengai_bp_is_measuring(void);
 
 
index 3d79d65..4e9cb56 100644 (file)
@@ -399,7 +399,7 @@ void mmi_hengai_bp_activation_feedback(void)
                        if(cJSON_GetIntValue(cJSON_GetObjectItem(json_recv, "status")))
                        {
                                // true
-                               mmi_hengai_bp_activated_finish();
+                               mmi_hengai_health_activated_flag_set(1);
                        }
                        else
                        {
@@ -434,7 +434,7 @@ void mmi_hengai_bp_activation_check_action(void)
        {
                char * post_data = NULL;
                cJSON * json_send = NULL;
-               char * req_code = mmi_hengai_bp_req_code_get();
+               char * req_code = mmi_hengai_health_req_code_get();
                char imei[16 + 1] = {0};
                app_adp_get_imei_req(imei);
                
@@ -470,7 +470,7 @@ void mmi_hengai_bp_activation_check_action(void)
                                        cJSON * json_data = cJSON_GetObjectItem(json_recv, "data");
                                        char * act_code = cJSON_GetStringValue(cJSON_GetObjectItem(json_data, "activation_code"));
                                                
-                                       mmi_hengai_bp_act_code_set(act_code);
+                                       mmi_hengai_health_act_code_set(act_code);
 
                                        // »ñµÃÁ˼¤»îÂ룬·¢Ë͸øÏ³Á¿â£¬²¢µÃµ½ÕýÈ··µ»ØºóÇëÇó
                                        // if()
@@ -573,75 +573,87 @@ void mmi_hengai_algorithm_interface_login_action(void)
 
 
 
-static nv_watch_hengai_health_data_t s_hengai_blood_pressure_data = {0};
+static nv_watch_hengai_health_data_t s_hengai_health_data = {0};
 
-void mmi_hengai_blood_pressure_nv_write(void)
+void mmi_hengai_health_data_nv_write(void)
 {
        uint32_t nv_data_length = sizeof(nv_watch_hengai_health_data_t);
        
-       if(nv_data_length != UI_NV_Write_Req(NV_SECTION_UI_HENGAI_HEALTH_DATA, 0, nv_data_length, (uint8_t *)&s_hengai_blood_pressure_data))
+       if(nv_data_length != UI_NV_Write_Req(NV_SECTION_UI_HENGAI_HEALTH_DATA, 0, nv_data_length, (uint8_t *)&s_hengai_health_data))
        {
                printf("[@CHENG_DEBUG][%s][%d]: nv write fail\n", __FUNCTION__, __LINE__);
        }
 }
 
-void mmi_hengai_blood_pressure_nv_read(void)
+void mmi_hengai_health_data_nv_read(void)
 {
        uint32_t nv_data_length = sizeof(nv_watch_hengai_health_data_t);
        
-       if(nv_data_length != UI_NV_Read_Req(NV_SECTION_UI_HENGAI_HEALTH_DATA, 0, nv_data_length, (uint8_t *)&s_hengai_blood_pressure_data))
+       if(nv_data_length != UI_NV_Read_Req(NV_SECTION_UI_HENGAI_HEALTH_DATA, 0, nv_data_length, (uint8_t *)&s_hengai_health_data))
        {
                printf("[@CHENG_DEBUG][%s][%d]: nv read fail\n", __FUNCTION__, __LINE__);
-               _lv_memset_00(&s_hengai_blood_pressure_data, sizeof(nv_watch_hengai_health_data_t));
+               _lv_memset_00(&s_hengai_health_data, sizeof(nv_watch_hengai_health_data_t));
        }
 }
 
-void mmi_hengai_blood_pressure_data_set(nv_watch_hengai_health_data_t * data)
+uint8_t mmi_hengai_health_activated_flag_get(void)
 {
-       if(NULL != data)
-       {
-               _lv_memset_00(&s_hengai_blood_pressure_data, sizeof(nv_watch_hengai_health_data_t));
-               _lv_memcpy(&s_hengai_blood_pressure_data, data, sizeof(nv_watch_hengai_health_data_t));
-               mmi_hengai_blood_pressure_nv_write();
-       }
+       return (s_hengai_health_data.is_activated);
+}
+
+void mmi_hengai_health_activated_flag_set(uint8_t flag)
+{
+       s_hengai_health_data.is_activated = flag;
+       mmi_hengai_health_data_nv_write();
 }
 
-uint8_t mmi_hengai_bp_is_calibrated(void)
+char * mmi_hengai_health_req_code_get(void)
 {
-       return (s_hengai_blood_pressure_data.is_calibrated);
+       return (s_hengai_health_data.req_code);
 }
 
-uint8_t mmi_hengai_bp_is_activated(void)
+void mmi_hengai_health_req_code_set(char * req_code)
 {
-       return (s_hengai_blood_pressure_data.is_activated);
+       _lv_memcpy(s_hengai_health_data.req_code, req_code, strlen(req_code));
+       mmi_hengai_health_data_nv_write();
 }
 
-char * mmi_hengai_bp_req_code_get(void)
+char * mmi_hengai_health_act_code_get(void)
 {
-       return (s_hengai_blood_pressure_data.req_code);
+       return (s_hengai_health_data.act_code);
 }
 
-void mmi_hengai_bp_req_code_set(char * req_code)
+void mmi_hengai_health_act_code_set(char * act_code)
 {
-       _lv_memcpy(s_hengai_blood_pressure_data.req_code, req_code, strlen(req_code));
+       _lv_memcpy(s_hengai_health_data.act_code, act_code, strlen(act_code));
+       mmi_hengai_health_data_nv_write();
 }
 
-char * mmi_hengai_bp_act_code_get(void)
+char * mmi_hengai_health_token_get(void)
 {
-       return (s_hengai_blood_pressure_data.act_code);
+       return (s_hengai_health_data.token);
 }
 
-void mmi_hengai_bp_act_code_set(char * act_code)
+void mmi_hengai_health_token_set(char * token)
 {
-       _lv_memcpy(s_hengai_blood_pressure_data.act_code, act_code, strlen(act_code));
+       _lv_memcpy(s_hengai_health_data.token, token, strlen(token));
+       mmi_hengai_health_data_nv_write();
 }
 
-void mmi_hengai_bp_activated_finish(void)
+uint8_t mmi_hengai_bp_calibrated_flag_get(void)
 {
-       s_hengai_blood_pressure_data.is_activated = 1;
-       mmi_hengai_blood_pressure_nv_write();
+       return (s_hengai_health_data.is_calibrated);
 }
 
+void mmi_hengai_bp_calibrated_flag_set(uint8_t flag)
+{
+       s_hengai_health_data.is_calibrated = flag;
+       mmi_hengai_health_data_nv_write();
+}
+
+
+
+
 
 
 
index 63e6c5b..40f1be4 100644 (file)
@@ -45,6 +45,22 @@ extern "C" {
 
 
 
+void mmi_hengai_health_data_nv_read(void);
+
+uint8_t mmi_hengai_health_activated_flag_get(void);
+void mmi_hengai_health_activated_flag_set(uint8_t flag);
+
+char * mmi_hengai_health_req_code_get(void);
+void mmi_hengai_health_req_code_set(char * req_code);
+
+char * mmi_hengai_health_act_code_get(void);
+void mmi_hengai_health_act_code_set(char * act_code);
+
+char * mmi_hengai_health_token_get(void);
+void mmi_hengai_health_token_set(char * token);
+
+uint8_t mmi_hengai_bp_calibrated_flag_get(void);
+void mmi_hengai_bp_calibrated_flag_set(uint8_t flag);
 
 
 
index 864e322..06ae104 100644 (file)
@@ -74,6 +74,11 @@ void phonebook_init(void)
 
 void phonebook_create_btn_event_cb(lv_obj_t * btn, lv_event_t e)
 {
+#ifdef __MMI_CUSTOM_HENGAI_HEALTH__
+
+       mmi_heng_ai_blood_pressure_create_event_cb(btn, e);
+#else
+
 #ifdef __MMI_ZHSX_SUPPORT_PHONEBOOK_LIST_STYLE__
        #ifdef __MMI_PHONEBOOK_CALLLOG_IN_ONE_MENU__
        mmi_phonebook_calllog_create_event_cb(btn, e);
@@ -88,6 +93,8 @@ void phonebook_create_btn_event_cb(lv_obj_t * btn, lv_event_t e)
         phonebook_create(NULL);
     }
 #endif
+
+#endif
 }
 
 void app_adaptor_update_phonebook_ind(app_adaptor_contact_t * contact_list, uint8_t count)
index 9de967a..47b89c5 100644 (file)
@@ -137,7 +137,7 @@ static void mmi_data_init_after_watch_create(void)
        mmi_sedentary_remind_mission_power_on_check();
 #endif
 #ifdef __MMI_CUSTOM_HENGAI_HEALTH__
-       mmi_hengai_blood_pressure_nv_read();
+       mmi_hengai_health_data_nv_read();
 #endif