#if 0
static lv_obj_t * mmi_heng_ai_warning_screen_create(lv_obj_t * activity_obj)
{
- printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
if(NULL == activity_obj)
{
lv_watch_activity_ext_t activity_ext = {0};
static uint8_t s_hengai_bp_measure_count = 0;
static uint8_t s_hengai_bp_calibrate_times = 0;
static uint16_t s_bp_value_high = 0, s_bp_value_low = 0;
-static uint8_t s_hengai_bp_measuring = 0;
+static bool s_hengai_bp_measuring = false;
static char s_hengai_bp_begin_time_str[24] = {0}, s_hengai_bp_end_time_str[24] = {0};
static int * s_hengai_bp_raw_data_ptr = NULL;
static int s_hengai_bp_raw_data_len = 0;
-uint8_t mmi_hengai_bp_is_measuring(void)
+bool mmi_hengai_bp_measuring_flag_get(void)
{
return (s_hengai_bp_measuring);
}
+void mmi_hengai_bp_measuring_flag_set(bool flag)
+{
+ s_hengai_bp_measuring = flag;
+}
+
char * mmi_hengai_bp_measure_action_time_string_get(uint8_t is_begin)
{
return ((1 == is_begin) ? s_hengai_bp_begin_time_str : s_hengai_bp_end_time_str);
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_SAMPLE_RATE * MMI_BP_MEASURE_TOTAL_COUNT * sizeof(int));
+ 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, sizeof(s_hengai_bp_raw_data_ptr));
_lv_memcpy(s_hengai_bp_raw_data_ptr, fr8012haq_blood_data_get(&s_hengai_bp_raw_data_len), sizeof(s_hengai_bp_raw_data_ptr));
- printf("[@CHENG_DEBUG][%s][%d]: raw_data_len=%d\n", __FUNCTION__, __LINE__, s_hengai_bp_raw_data_len);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: raw_data_len=%d\n", __FUNCTION__, __LINE__, s_hengai_bp_raw_data_len);
}
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]);
+
return s_hengai_bp_raw_data_ptr;
}
static void mmi_heng_ai_bp_screen_prepare_destory(lv_obj_t * activity_obj)
{
- printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
mmi_hengai_bp_raw_data_free();
lv_obj_t * activity_obj = lv_watch_get_activity_obj(ACT_ID_HENG_AI_BP);
if(NULL != activity_obj)
{
- printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
mmi_heng_ai_bp_screen_prepare_destory(NULL);
lv_obj_del(activity_obj);
}
watch_set_suspend_enable(true, ACT_ID_HENG_AI_BP_MEASURE, 0);
lv_watch_png_cache_all_free();
+ if(mmi_hengai_bp_measuring_flag_get())
+ {
+ mmi_hsensor_close();
+ mmi_hengai_bp_measuring_flag_set(false);
+ }
+
lv_heng_ai_bp_measure_ext_t * watch_ext = (lv_heng_ai_bp_measure_ext_t *)mmi_heng_ai_bp_measure_screen_ext_get();
if(NULL != watch_ext)
{
lv_obj_t * activity_obj = lv_watch_get_activity_obj(ACT_ID_HENG_AI_BP_MEASURE);
if(NULL != activity_obj)
{
- printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
mmi_heng_ai_bp_measure_screen_prepare_destory(NULL);
lv_obj_del(activity_obj);
}
if(LV_EVENT_CLICKED != e)
return;
- printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
mmi_heng_ai_bp_measure_screen_clean();
}
else
{
lv_obj_t * label_title_high = lv_label_create(watch_ext->cont, NULL);
- lv_obj_add_style(label_title_high, LV_LABEL_PART_MAIN, &lv_watch_font24);
+ lv_obj_add_style(label_title_high, LV_LABEL_PART_MAIN, &lv_watch_font24_gray);
lv_label_set_align(label_title_high, LV_LABEL_ALIGN_CENTER);
lv_label_set_text_id(label_title_high, WATCH_TEXT_ID_SYSTOLIC_BP);
- lv_obj_align(label_title_high, NULL, LV_ALIGN_IN_TOP_LEFT, 103, 104);
+ lv_obj_align(label_title_high, NULL, LV_ALIGN_IN_TOP_LEFT, 103, 104 + 20);
lv_obj_set_click(label_title_high, false);
lv_obj_t * label_value_high = lv_label_create(watch_ext->cont, NULL);
lv_obj_set_click(label_value_high, false);
lv_obj_t * label_uint_high = lv_label_create(watch_ext->cont, NULL);
- lv_obj_add_style(label_uint_high, LV_LABEL_PART_MAIN, &lv_watch_font24);
+ lv_obj_add_style(label_uint_high, LV_LABEL_PART_MAIN, &lv_watch_font24_gray);
lv_label_set_align(label_uint_high, LV_LABEL_ALIGN_CENTER);
lv_label_set_text(label_uint_high, "mmHg");
- lv_obj_align(label_uint_high, label_value_high, LV_ALIGN_OUT_BOTTOM_MID, 0, 15);
+ lv_obj_align(label_uint_high, label_value_high, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
lv_obj_set_click(label_uint_high, false);
lv_obj_t * label_title_low = lv_label_create(watch_ext->cont, label_title_high);
lv_label_set_text_id(label_title_low, WATCH_TEXT_ID_DIASTOLIC_BP);
- lv_obj_align(label_title_low, NULL, LV_ALIGN_IN_TOP_LEFT, 280, 104);
+ lv_obj_align(label_title_low, NULL, LV_ALIGN_IN_TOP_LEFT, 280, 104 + 20);
lv_obj_t * label_value_low = lv_label_create(watch_ext->cont, label_value_high);
sprintf(value_str, "%d", s_bp_value_low);
lv_obj_t * label_uint_low = lv_label_create(watch_ext->cont, label_uint_high);
lv_label_set_text(label_uint_low, "mmHg");
- lv_obj_align(label_uint_low, label_value_low, LV_ALIGN_OUT_BOTTOM_MID, 0, 15);
+ lv_obj_align(label_uint_low, label_value_low, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
hal_rtc_t cur_time = {0};
char time_str[24] = {0};
void mmi_hengai_bp_measure_result_timeout(void * para)
{
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
mmi_hengai_bp_measure_result_screen(3);
}
-void mmi_hengai_bp_measure_update_result(bool state, uint16_t bp_value_high, uint16_t bp_value_low, char * description)
+void mmi_ui_msg_update_hengai_bp_measure_result(bool state, uint16_t bp_value_high, uint16_t bp_value_low)
{
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+
lv_heng_ai_bp_measure_ext_t * watch_ext = (lv_heng_ai_bp_measure_ext_t *)mmi_heng_ai_bp_measure_screen_ext_get();
if(NULL == watch_ext)
return;
if(true != watch_ext->is_watting_result)
return;
+ if(NULL != watch_ext->result_timer_id)
+ {
+ Hal_Timer_Stop(watch_ext->result_timer_id);
+ watch_ext->result_timer_id = NULL;
+ }
+
if(true == state)
{
s_bp_value_high = bp_value_high;
s_bp_value_low = bp_value_low;
- if(NULL != description)
- {
-
- }
+ mmi_protocol_action_send_blood(s_bp_value_high, s_bp_value_low);
mmi_hengai_bp_measure_result_screen(0);
}
else
}
}
-void mmi_hengai_bp_measure_finish_screen(void)
+void mmi_hengai_bp_measure_data_send_task_cb(lv_task_t * task)
{
- mmi_hsensor_close();
- mmi_hengai_bp_measure_action_time_string_set(0);
+ mmi_hengai_bp_measure_raw_data_send();
+}
+void mmi_hengai_bp_measure_finish_screen(void)
+{
lv_heng_ai_bp_measure_ext_t * watch_ext = (lv_heng_ai_bp_measure_ext_t *)mmi_heng_ai_bp_measure_screen_ext_get();
if(NULL == watch_ext)
return;
lv_label_set_text_id(label_prompt, WATCH_TEXT_ID_WAIT_RESULT);
lv_obj_align(label_prompt, NULL, LV_ALIGN_IN_TOP_MID, 0, 292);
#endif
-
+
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
watch_ext->result_timer_id = Hal_Timer_Start(MMI_BP_WAIT_RESULT_TIMEOUT, mmi_hengai_bp_measure_result_timeout, NULL, false);
+
+ mmi_hengai_bp_raw_data_fill();
+ mmi_hengai_bp_measure_action_time_string_set(0);
+ mmi_hsensor_close();
+ mmi_hengai_bp_measuring_flag_set(false);
+
+ lv_task_t * data_send_task = lv_task_create(mmi_hengai_bp_measure_data_send_task_cb, 2000, LV_TASK_PRIO_HIGH, NULL);
+ lv_task_once(data_send_task);
}
void mmi_hengai_bp_measure_cycle_timeout(void * para)
if(MMI_BP_MEASURE_TOTAL_COUNT < s_hengai_bp_measure_count) // stop action when 60s
{
- mmi_hengai_bp_raw_data_fill();
- mmi_hengai_bp_measure_raw_data_send();
mmi_hengai_bp_measure_finish_screen();
}
else
if(LV_EVENT_CLICKED != e)
return;
- printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
lv_heng_ai_bp_measure_ext_t * watch_ext = (lv_heng_ai_bp_measure_ext_t *)mmi_heng_ai_bp_measure_screen_ext_get();
if(NULL == watch_ext)
return;
if(false == mmi_health_measure_wear_state_get())
{
- printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
lv_obj_t * img = lv_img_create(cont, NULL);
lv_img_set_src(img, ICON_HENGAI_BP_ALERT);
lv_obj_align(img, NULL, LV_ALIGN_IN_TOP_MID, 0, 90);
}
else
{
- printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
mmi_hsensor_bp_open();
mmi_hengai_bp_measure_action_time_string_set(1);
+ mmi_hengai_bp_measuring_flag_set(true);
s_hengai_bp_measure_count = 0;
+ lv_obj_t * label_title = lv_label_create(watch_ext->cont, NULL);
+ lv_obj_add_style(label_title, LV_LABEL_PART_MAIN, &lv_watch_font32);
+ lv_label_set_align(label_title, LV_LABEL_ALIGN_CENTER);
+ lv_label_set_text_id(label_title, WATCH_TEXT_ID_IN_MEASURING);
+ lv_obj_align(label_title, NULL, LV_ALIGN_IN_TOP_MID, 0, 48);
+ lv_obj_set_click(label_title, false);
+
gif_info_t * gif_info = gif_open(cont, ANIM_HENGAI_BP_MEASURE, 0);
if(NULL == gif_info)
return;
if(LV_EVENT_CLICKED != e)
return;
- printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
lv_heng_ai_bp_measure_ext_t * watch_ext = (lv_heng_ai_bp_measure_ext_t *)mmi_heng_ai_bp_measure_screen_ext_get();
if(NULL == watch_ext)
lv_label_set_text_id(label_prompt, WATCH_TEXT_ID_CALIBRATE_PROMPT_0);
lv_obj_align(label_prompt, NULL, LV_ALIGN_IN_TOP_MID, 0, 292);
- lv_obj_t * imgbtn = mmi_bp_screen_common_right_button_create(cont, 0, 0, mmi_hengai_bp_measure_prompt_switch_event_cb);
+ lv_obj_t * imgbtn = mmi_bp_screen_common_right_button_create(cont, 0, -5, mmi_hengai_bp_measure_prompt_switch_event_cb);
lv_watch_set_free_num(imgbtn, 0);
mmi_bp_screen_common_bottom_button_create(cont, WATCH_TEXT_ID_START_MEASURE, mmi_hengai_bp_measure_start_btn_event_cb);
lv_label_set_text_id(label_prompt, WATCH_TEXT_ID_CALIBRATE_PROMPT_1);
lv_obj_align(label_prompt, NULL, LV_ALIGN_IN_TOP_MID, 0, 292);
- lv_obj_t * imgbtn = mmi_bp_screen_common_left_button_create(cont, 0, 0, mmi_hengai_bp_measure_prompt_switch_event_cb);
+ lv_obj_t * imgbtn = mmi_bp_screen_common_left_button_create(cont, 0, -5, mmi_hengai_bp_measure_prompt_switch_event_cb);
lv_watch_set_free_num(imgbtn, 1);
mmi_bp_screen_common_bottom_button_create(cont, WATCH_TEXT_ID_START_MEASURE, mmi_hengai_bp_measure_start_btn_event_cb);
watch_set_suspend_enable(true, ACT_ID_HENG_AI_BP_CALIBRATE, 0);
lv_watch_png_cache_all_free();
+ if(mmi_hengai_bp_measuring_flag_get())
+ {
+ mmi_hsensor_close();
+ mmi_hengai_bp_measuring_flag_set(false);
+ }
+
lv_heng_ai_bp_calibrate_ext_t * watch_ext = (lv_heng_ai_bp_calibrate_ext_t *)mmi_heng_ai_bp_calibrate_screen_ext_get();
if(NULL == watch_ext)
return;
lv_obj_t * activity_obj = lv_watch_get_activity_obj(ACT_ID_HENG_AI_BP_CALIBRATE);
if(NULL != activity_obj)
{
- printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
mmi_heng_ai_bp_calibrate_screen_prepare_destory(NULL);
lv_obj_del(activity_obj);
}
mmi_hengai_bp_calibrate_result_screen(false);
}
-void mmi_hengai_bp_calibrate_update_result(bool is_success)
+void mmi_ui_msg_update_hengai_bp_calibrate_result(bool is_success)
{
lv_heng_ai_bp_calibrate_ext_t * watch_ext = (lv_heng_ai_bp_calibrate_ext_t *)mmi_heng_ai_bp_calibrate_screen_ext_get();
if(NULL == watch_ext)
if(true != watch_ext->is_watting_result)
return;
+ if(NULL != watch_ext->result_timer_id)
+ {
+ Hal_Timer_Stop(watch_ext->result_timer_id);
+ watch_ext->result_timer_id = NULL;
+ }
+
mmi_hengai_bp_calibrated_flag_set(is_success ? 1 : 0);
mmi_hengai_bp_calibrate_result_screen(is_success);
}
lv_obj_align(label_prompt, NULL, LV_ALIGN_IN_TOP_MID, 0, 292);
#endif
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
watch_ext->result_timer_id = Hal_Timer_Start(MMI_BP_WAIT_RESULT_TIMEOUT, mmi_hengai_bp_calibrate_result_timeout, NULL, false);
+
+ mmi_hengai_bp_calibrate_raw_data_send(s_hengai_bp_calibrate_times, s_bp_value_high, s_bp_value_low);
}
void mmi_hengai_bp_calibrate_end_input_event_cb(lv_obj_t * obj, lv_event_t e)
if(LV_EVENT_CLICKED != e)
return;
- // send vaule
- mmi_hengai_bp_calibrate_raw_data_send(s_hengai_bp_calibrate_times, s_bp_value_high, s_bp_value_low);
-
if(1 == s_hengai_bp_calibrate_times)
{
+ mmi_hengai_bp_calibrate_raw_data_send(s_hengai_bp_calibrate_times, s_bp_value_high, s_bp_value_low);
// once again
mmi_heng_ai_bp_calibrate_start_screen();
}
}
void mmi_hengai_bp_calibrate_end_screen(void)
-{
- mmi_hsensor_close();
- mmi_hengai_bp_measure_action_time_string_set(0);
-
+{
lv_heng_ai_bp_calibrate_ext_t * watch_ext = (lv_heng_ai_bp_calibrate_ext_t *)mmi_heng_ai_bp_calibrate_screen_ext_get();
if(NULL == watch_ext)
return;
lv_obj_align(label_title, NULL, LV_ALIGN_IN_TOP_MID, 0, 48);
lv_obj_set_click(label_title, false);
+ lv_obj_t * img = lv_img_create(watch_ext->cont, NULL);
+ lv_img_set_src(img, ICON_HENGAI_BP_PROMPT_2);
+ lv_obj_align(img, NULL, LV_ALIGN_IN_TOP_MID, 0, 104);
+
lv_obj_t * label_prompt = lv_label_create(watch_ext->cont, NULL);
lv_obj_add_style(label_prompt, LV_LABEL_PART_MAIN, &lv_watch_font28);
lv_label_set_align(label_prompt, LV_LABEL_ALIGN_CENTER);
lv_label_set_long_mode(label_prompt, LV_LABEL_LONG_BREAK);
- lv_obj_set_width(label_prompt, 360); // 400);
+ lv_obj_set_width(label_prompt, 320); // 400);
lv_label_set_text_id(label_prompt, WATCH_TEXT_ID_CALIBRATE_PROMPT_3);
- lv_obj_align(label_prompt, NULL, LV_ALIGN_IN_TOP_MID, 0, 200); // 104);
+ lv_obj_align(label_prompt, NULL, LV_ALIGN_IN_TOP_MID, 0, 292); // 104);
- mmi_bp_screen_common_bottom_button_create(watch_ext->cont, WATCH_TEXT_ID_OK, mmi_hengai_bp_calibrate_end_btn_event_cb);
+ //
+ s_hengai_bp_calibrate_times++;
+ mmi_hengai_bp_raw_data_fill();
+ mmi_hengai_bp_measure_action_time_string_set(0);
+ mmi_hsensor_close();
+ mmi_hengai_bp_measuring_flag_set(false);
+
+ mmi_bp_screen_common_bottom_button_create(watch_ext->cont, WATCH_TEXT_ID_IN_CALIBRATE_PROMPT_BTN, mmi_hengai_bp_calibrate_end_btn_event_cb);
}
void mmi_hengai_bp_calibrate_cycle_timeout(void * para)
if(MMI_BP_MEASURE_TOTAL_COUNT < s_hengai_bp_measure_count) // stop action when 60s
{
- s_hengai_bp_calibrate_times++;
- mmi_hengai_bp_raw_data_fill();
mmi_hengai_bp_calibrate_end_screen();
}
}
}
else
{
- printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
mmi_hsensor_bp_open();
mmi_hengai_bp_measure_action_time_string_set(1);
+ mmi_hengai_bp_measuring_flag_set(true);
s_hengai_bp_measure_count = 0;
lv_obj_t * label_title = lv_label_create(watch_ext->cont, NULL);
if(LV_EVENT_CLICKED != e)
return;
- printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
lv_heng_ai_bp_calibrate_ext_t * watch_ext = (lv_heng_ai_bp_calibrate_ext_t *)mmi_heng_ai_bp_calibrate_screen_ext_get();
if(NULL == watch_ext)
lv_label_set_text_id(label_prompt, WATCH_TEXT_ID_CALIBRATE_PROMPT_0);
lv_obj_align(label_prompt, NULL, LV_ALIGN_IN_TOP_MID, 0, 292);
- lv_obj_t * imgbtn = mmi_bp_screen_common_right_button_create(cont, 0, 0, mmi_hengai_bp_calibrate_prompt_switch_event_cb);
+ lv_obj_t * imgbtn = mmi_bp_screen_common_right_button_create(cont, 0, -5, mmi_hengai_bp_calibrate_prompt_switch_event_cb);
lv_watch_set_free_num(imgbtn, 0);
mmi_bp_screen_common_bottom_button_create(cont, WATCH_TEXT_ID_START_CALIBRATE, mmi_hengai_bp_calibrate_start_btn_event_cb);
lv_obj_align(label_prompt, NULL, LV_ALIGN_IN_TOP_MID, 0, 292);
lv_obj_t * imgbtn = NULL;
- imgbtn = mmi_bp_screen_common_left_button_create(cont, 0, 0, mmi_hengai_bp_calibrate_prompt_switch_event_cb);
+ imgbtn = mmi_bp_screen_common_left_button_create(cont, 0, -5, mmi_hengai_bp_calibrate_prompt_switch_event_cb);
lv_watch_set_free_num(imgbtn, 1);
- imgbtn = mmi_bp_screen_common_right_button_create(cont, 0, 0, mmi_hengai_bp_calibrate_prompt_switch_event_cb);
+ imgbtn = mmi_bp_screen_common_right_button_create(cont, 0, -5, mmi_hengai_bp_calibrate_prompt_switch_event_cb);
lv_watch_set_free_num(imgbtn, 2);
mmi_bp_screen_common_bottom_button_create(cont, WATCH_TEXT_ID_START_CALIBRATE, mmi_hengai_bp_calibrate_start_btn_event_cb);
lv_obj_add_style(label_prompt, LV_LABEL_PART_MAIN, &lv_watch_font28);
lv_label_set_align(label_prompt, LV_LABEL_ALIGN_CENTER);
lv_label_set_long_mode(label_prompt, LV_LABEL_LONG_BREAK);
- lv_obj_set_width(label_prompt, 400);
+ lv_obj_set_width(label_prompt, 320);
lv_label_set_text_id(label_prompt, WATCH_TEXT_ID_CALIBRATE_PROMPT_2);
- lv_obj_align(label_prompt, NULL, LV_ALIGN_IN_TOP_MID, 0, 104);
+ lv_obj_align(label_prompt, NULL, LV_ALIGN_IN_TOP_MID, 0, 130); // 104);
- lv_obj_t * imgbtn = mmi_bp_screen_common_left_button_create(cont, 0, 0, mmi_hengai_bp_calibrate_prompt_switch_event_cb);
+ lv_obj_t * imgbtn = mmi_bp_screen_common_left_button_create(cont, 0, -5, mmi_hengai_bp_calibrate_prompt_switch_event_cb);
lv_watch_set_free_num(imgbtn, 3);
mmi_bp_screen_common_bottom_button_create(cont, WATCH_TEXT_ID_START_CALIBRATE, mmi_hengai_bp_calibrate_start_btn_event_cb);
void mmi_heng_ai_bp_tileview_led(lv_obj_t * tileview)
{
-#if 0
lv_heng_ai_bp_ext_t * ext = mmi_heng_ai_bp_ext_get();
if(NULL == ext)
return NULL;
}
lv_led_off(ext->led[i]);
- lv_obj_set_size(ext->led[i], 6, 6);
+ lv_obj_set_size(ext->led[i], 8, 8);
}
lv_coord_t x = -1, y = -1;
lv_tileview_get_tile_act(tileview, &x, &y);
lv_led_on(ext->led[x]);
- lv_obj_set_size(ext->led[x], 10, 10);
+ lv_obj_set_size(ext->led[x], 12, 12);
PHONEBOOK_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: x=%d\n", __FUNCTION__, __LINE__, x);
lv_obj_set_pos(ext->led_cont, LV_HOR_RES * x + (LV_HOR_RES - lv_obj_get_width(ext->led_cont)) / 2,
LV_VER_RES - lv_obj_get_width(ext->led_cont) - 10);
-#endif
}
void mmi_heng_ai_bp_tileview_event_cb(lv_obj_t * tileview, lv_event_t e)
if(LV_EVENT_VALUE_CHANGED != e)
return;
- //mmi_heng_ai_bp_tileview_led(tileview);
+ mmi_heng_ai_bp_tileview_led(tileview);
}
lv_obj_t * mmi_heng_ai_bp_screen_create(lv_obj_t * activity_obj)
return NULL;
#if 0
+#if 1
if(false == watch_modem_sim_present_check_req())
{
lv_watch_obj_set_anim_mode(watch_obj, LV_WATCH_ANIM_HOR_RIGHT_HIDE);
lv_obj_align(label_1, NULL, LV_ALIGN_IN_TOP_MID, 0, 278);
lv_obj_set_click(label_1, false);
}
+#endif
+#if 1
else if(true != mmi_watch_tcp_connect_state_get()
|| true != mmi_protocol_watch_bind_state_get()
)
lv_obj_align(label_1, NULL, LV_ALIGN_IN_TOP_MID, 0, 278);
lv_obj_set_click(label_1, false);
}
+#endif
+#if 1
else if(false == mmi_health_measure_wear_state_get())
{
lv_watch_obj_set_anim_mode(watch_obj, LV_WATCH_ANIM_HOR_RIGHT_HIDE);
lv_obj_set_click(label_1, false);
}
else
+#endif
#endif
{
lv_watch_obj_set_anim_mode(watch_obj, LV_WATCH_ANIM_NO);
lv_watch_obj_add_element(tileview);
lv_watch_obj_add_element(lv_page_get_scrl(tileview));
- //lv_obj_set_event_cb(tileview, mmi_heng_ai_bp_tileview_event_cb);
+ lv_obj_set_event_cb(tileview, mmi_heng_ai_bp_tileview_event_cb);
- //mmi_heng_ai_bp_tileview_led(tileview);
+ mmi_heng_ai_bp_tileview_led(tileview);
}
return watch_obj;
{
char temp_buff[128] = {0};
- //»ñÈ¡48×Ö½ÚaslccÂëµÄÊ®Áù½øÖÆÑªÑ¹Êý¾Ýµ½blood_buf£¬×¢Òâ:blood_buf³¤¶ÈÒª´óÓÚµÈÓÚ48*2×Ö½Ú
+ //��ȡ48�ֽ�aslcc���ʮ������Ѫѹ���ݵ�blood_buf��ע��:blood_buf����Ҫ���ڵ���48*2�ֽ�
//void fr8012haq_blood_data_get(char *blood_buf)
fr8012haq_blood_data_get(temp_buff);
- printf("[@CHENG_DEBUG][%s][%d]: %s\n", __FUNCTION__, __LINE__, temp_buff);
- printf("[@CHENG_DEBUG][%d]: %s\n", __LINE__, temp_buff + 31);
- printf("[@CHENG_DEBUG][%d]: %s\n", __LINE__, temp_buff + 63);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %s\n", __FUNCTION__, __LINE__, temp_buff);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%d]: %s\n", __LINE__, temp_buff + 31);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%d]: %s\n", __LINE__, temp_buff + 63);
__debug_timer_start();
}
{
char * temp;
- printf("[@CHENG_DEBUG][%s][%d]: data_len=%d\n", __FUNCTION__, __LINE__, len);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: data_len=%d\n", __FUNCTION__, __LINE__, len);
temp = (void*)malloc(response_len + len);
if (!temp) {
- printf("Malloc failed...\n");
+ HENGAI_HEALTH_DEBUG_PRINTF("Malloc failed...\n");
return;
}
memset(temp, 0, response_len + len);
response_data = temp;
response_len += len;
- printf("[@CHENG_DEBUG][%s][%d]: response_len=%d\n", __FUNCTION__, __LINE__, response_len);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: response_len=%d\n", __FUNCTION__, __LINE__, response_len);
}
void mmi_hengai_http_post_resource_free(void)
sprintf(temp_str, "token: %s\r\n", token);
s_hengai_http_client_list_header = http_client_list_append(s_hengai_http_client_list_header, temp_str);
}
- // "dc5aed59e2fce3060cd1118b41b19552"
s_hengai_http_client_list_header = http_client_list_append(s_hengai_http_client_list_header, "Content-Type: application/json\r\n");
s_hengai_http_client_list_header = http_client_list_append(s_hengai_http_client_list_header, "Accept: */*\r\n");
http_client_setopt(s_hengai_http_client, HTTPCLIENT_OPT_HTTPHEADER, s_hengai_http_client_list_header);
http_client_getinfo(s_hengai_http_client, HTTPCLIENT_GETINFO_TCP_STATE, &response_code);
if(response_code != HTTP_TCP_ESTABLISHED)
{
- printf("http tcp not connecting\n");
+ HENGAI_HEALTH_DEBUG_PRINTF("http tcp not connecting\n");
ret = -1;
goto EXIT;
}
response_code = http_client_perform(s_hengai_http_client); /*execute http send and recv*/
if(response_code != HTTP_CLIENT_OK)
{
- printf("http perform have some wrong=%d\n", response_code);
+ HENGAI_HEALTH_DEBUG_PRINTF("http perform have some wrong=%d\n", response_code);
ret = -3;
goto EXIT;
}
http_client_getinfo(s_hengai_http_client, HTTPCLIENT_GETINFO_RESPONSE_CODE, &response_code);
if (response_code != 200 && response_code != 204)
{
- printf("response is not 'HTTP OK'=%d\n", response_code);
+ HENGAI_HEALTH_DEBUG_PRINTF("response is not 'HTTP OK'=%d\n", response_code);
}
if(NULL != s_hengai_http_revceive_buf)
s_hengai_http_revceive_buf = lv_mem_alloc(response_len + 1);
_lv_memset_00(s_hengai_http_revceive_buf, response_len + 1);
_lv_memcpy(s_hengai_http_revceive_buf, response_data, response_len);
- printf("[@CHENG_DEBUG][%s][%d]: data_len=%d\n", __FUNCTION__, __LINE__, response_len);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: data_len=%d\n", __FUNCTION__, __LINE__, response_len);
EXIT:
mmi_hengai_http_post_resource_free();
s_hengai_http_post_try_count++;
int ret = mmi_hengai_http_post_json_data(url, post_data, token);
- printf("[@CHENG_DEBUG][%s][%d]: ret=%d\n", __FUNCTION__, __LINE__, ret);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: ret=%d\n", __FUNCTION__, __LINE__, ret);
if(0 == ret)
{
- printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
ret_value = 0;
break;
}
{
if(HENGAI_HTTP_POST_TRY_COUNT_MAX <= s_hengai_http_post_try_count)
{
- printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
mmi_hengai_http_post_resource_free();
ret_value = -1;
break;
// measure data
void mmi_hengai_bp_measure_raw_data_send(void)
{
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+
char imei[16 + 1] = {0};
app_adp_get_imei_req(imei);
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 // def HENGAI_HTTP_TEST
char * token = "dc5aed59e2fce3060cd1118b41b19552";
+#else
+ char * token = mmi_hengai_health_token_get();
+#endif
//int test_number_array[] = {1012744,864594,698914,532908,402542,317532,235462,168856,142664,109818,42654};
cJSON * json_send = cJSON_CreateObject();
int ret = mmi_hengai_http_post_data(url, post_data, token);
if(0 == ret)
{
- printf("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, strlen(s_hengai_http_revceive_buf));
- printf("[@CHENG_DEBUG][%d]: %s\n", __LINE__, s_hengai_http_revceive_buf);
- printf("[@CHENG_DEBUG][%d]: %s\n", __LINE__, s_hengai_http_revceive_buf + 63);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, strlen(s_hengai_http_revceive_buf));
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG]: %s\n", s_hengai_http_revceive_buf);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG]: %s\n", s_hengai_http_revceive_buf + 100);
cJSON * json_recv = cJSON_Parse(s_hengai_http_revceive_buf);
if(NULL != json_recv)
{
- if(cJSON_GetIntValue(cJSON_GetObjectItem(json_recv, "status")))
+ if(cJSON_IsTrue(cJSON_GetObjectItem(json_recv, "status")))
{
- // true
- printf("[@CHENG_DEBUG][%s][%d]: true\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: true\n", __FUNCTION__, __LINE__);
cJSON * json_data = cJSON_GetObjectItem(json_recv, "data");
uint16_t bp_value_high = cJSON_GetIntValue(cJSON_GetObjectItem(json_data, "sbp"));
char * description = cJSON_GetStringValue(cJSON_GetObjectItem(json_data, "description"));
// update
- mmi_hengai_bp_measure_update_result(true, bp_value_high, bp_value_low, description);
+ mmi_ui_msg_action_hengai_bp_measure_result(true, bp_value_high, bp_value_low);
}
else
{
- // false
- printf("[@CHENG_DEBUG][%s][%d]: false\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: false\n", __FUNCTION__, __LINE__);
// update
- mmi_hengai_bp_measure_update_result(false, 0, 0, NULL);
+ mmi_ui_msg_action_hengai_bp_measure_result(false, 0, 0);
}
}
else
{
- printf("[@CHENG_DEBUG][%s][%d]: not json file\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: not json file\n", __FUNCTION__, __LINE__);
}
if(NULL != json_recv)
{
- printf("[@CHENG_DEBUG][%s][%d]: free json root\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: free json root\n", __FUNCTION__, __LINE__);
cJSON_Delete(json_recv);
json_recv = NULL;
}
// calibrate mode
void mmi_hengai_bp_calibrate_model_send(void)
{
+#if 0 // def HENGAI_HTTP_TEST
char * token = "dc5aed59e2fce3060cd1118b41b19552";
+#else
+ char * token = mmi_hengai_health_token_get();
+#endif
char imei[16 + 1] = {0};
app_adp_get_imei_req(imei);
int ret = mmi_hengai_http_post_data(url, post_data, token);
if(0 == ret)
{
- printf("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, strlen(s_hengai_http_revceive_buf));
- printf("[@CHENG_DEBUG][%d]: %s\n", __LINE__, s_hengai_http_revceive_buf);
- printf("[@CHENG_DEBUG][%d]: %s\n", __LINE__, s_hengai_http_revceive_buf + 63);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, strlen(s_hengai_http_revceive_buf));
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG]: %s\n", s_hengai_http_revceive_buf);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG]: %s\n", s_hengai_http_revceive_buf + 100);
cJSON * json_recv = cJSON_Parse(s_hengai_http_revceive_buf);
if(NULL != json_recv)
{
- printf("[@CHENG_DEBUG][%s][%d]: json file\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: json file\n", __FUNCTION__, __LINE__);
- bool status_value = cJSON_GetIntValue(cJSON_GetObjectItem(json_recv, "status"));
- mmi_hengai_bp_calibrate_update_result(status_value);
+ bool status_value = cJSON_IsTrue(cJSON_GetObjectItem(json_recv, "status"));
+ mmi_ui_msg_action_hengai_bp_calibrate_result(status_value);
}
else
{
- printf("[@CHENG_DEBUG][%s][%d]: not json file\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: not json file\n", __FUNCTION__, __LINE__);
}
if(NULL != json_recv)
{
- printf("[@CHENG_DEBUG][%s][%d]: free json root\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: free json root\n", __FUNCTION__, __LINE__);
cJSON_Delete(json_recv);
json_recv = NULL;
}
void mmi_hengai_bp_calibrate_raw_data_send(uint8_t calibrate_times, uint16_t bp_value_high, uint16_t bp_value_low)
{
+#if 0 // def HENGAI_HTTP_TEST
char * token = "dc5aed59e2fce3060cd1118b41b19552";
+#else
+ char * token = mmi_hengai_health_token_get();
+#endif
char imei[16 + 1] = {0};
app_adp_get_imei_req(imei);
int ret = mmi_hengai_http_post_data(url, post_data, token);
if(0 == ret)
{
- printf("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, strlen(s_hengai_http_revceive_buf));
- printf("[@CHENG_DEBUG][%d]: %s\n", __LINE__, s_hengai_http_revceive_buf);
- printf("[@CHENG_DEBUG][%d]: %s\n", __LINE__, s_hengai_http_revceive_buf + 63);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, strlen(s_hengai_http_revceive_buf));
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG]: %s\n", s_hengai_http_revceive_buf);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG]: %s\n", s_hengai_http_revceive_buf + 100);
cJSON * json_recv = cJSON_Parse(s_hengai_http_revceive_buf);
if(NULL != json_recv)
{
- if(cJSON_GetIntValue(cJSON_GetObjectItem(json_recv, "status")))
+ if(cJSON_IsTrue(cJSON_GetObjectItem(json_recv, "status")))
{
- printf("[@CHENG_DEBUG][%s][%d]: true\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: true\n", __FUNCTION__, __LINE__);
if(2 <= calibrate_times)
{
mmi_hengai_bp_calibrate_model_send();
}
else
{
- printf("[@CHENG_DEBUG][%s][%d]: false\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: false\n", __FUNCTION__, __LINE__);
+ if(2 <= calibrate_times)
+ {
+ mmi_ui_msg_action_hengai_bp_calibrate_result(false);
+ }
}
}
else
{
- printf("[@CHENG_DEBUG][%s][%d]: not json file\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: not json file\n", __FUNCTION__, __LINE__);
}
if(NULL != json_recv)
{
- printf("[@CHENG_DEBUG][%s][%d]: free json root\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: free json root\n", __FUNCTION__, __LINE__);
cJSON_Delete(json_recv);
json_recv = NULL;
}
json_recv = cJSON_Parse(s_hengai_http_revceive_buf);
if(NULL != json_recv)
{
- printf("[@CHENG_DEBUG][%s][%d]: json file\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: json file\n", __FUNCTION__, __LINE__);
- if(cJSON_GetIntValue(cJSON_GetObjectItem(json_recv, "status")))
+ if(cJSON_IsTrue(cJSON_GetObjectItem(json_recv, "status")))
{
// true
mmi_hengai_health_activated_flag_set(1);
}
else
{
- printf("[@CHENG_DEBUG][%s][%d]: not json file\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: not json file\n", __FUNCTION__, __LINE__);
}
if(NULL != json_recv)
{
- printf("[@CHENG_DEBUG][%s][%d]: free json root\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: free json root\n", __FUNCTION__, __LINE__);
cJSON_Delete(json_recv);
json_recv = NULL;
}
void mmi_hengai_bp_activation_check_action(void)
{
- printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
if(0 == mmi_hengai_bp_is_activated())
{
json_recv = cJSON_Parse(s_hengai_http_revceive_buf);
if(NULL != json_recv)
{
- printf("[@CHENG_DEBUG][%s][%d]: json file\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: json file\n", __FUNCTION__, __LINE__);
// true
- if(cJSON_GetIntValue(cJSON_GetObjectItem(json_recv, "status")))
+ if(cJSON_IsTrue(cJSON_GetObjectItem(json_recv, "status")))
{
cJSON * json_data = cJSON_GetObjectItem(json_recv, "data");
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
{
- printf("[@CHENG_DEBUG][%s][%d]: not json file\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: not json file\n", __FUNCTION__, __LINE__);
}
if(NULL != json_recv)
{
- printf("[@CHENG_DEBUG][%s][%d]: free json root\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: free json root\n", __FUNCTION__, __LINE__);
cJSON_Delete(json_recv);
json_recv = NULL;
}
void mmi_hengai_algorithm_interface_login_action(void)
{
- printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ 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())
{
cJSON * json_send = json_send = cJSON_CreateObject();
cJSON_AddItemToObject(json_send, "app_key", cJSON_CreateString(HENGAI_HTTP_POST_APP_KEY));
cJSON_AddItemToObject(json_send, "account_type", cJSON_CreateNumber(0));
- cJSON_AddItemToObject(json_send, "account", cJSON_CreateString("18912345678"));
- cJSON_AddItemToObject(json_send, "name", cJSON_CreateString("18912345678"));
+ cJSON_AddItemToObject(json_send, "account", cJSON_CreateString("18912345670"));
+ cJSON_AddItemToObject(json_send, "name", cJSON_CreateString("18912345670"));
cJSON_AddItemToObject(json_send, "password", cJSON_CreateString("123456"));
cJSON_AddItemToObject(json_send, "gender", cJSON_CreateNumber(3));
cJSON_AddItemToObject(json_send, "birthday", cJSON_CreateString("2000-10-01"));
int ret = mmi_hengai_http_post_data(url, post_data, NULL);
if(0 == ret)
{
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, strlen(s_hengai_http_revceive_buf));
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG]: %s\n", s_hengai_http_revceive_buf);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG]: %s\n", s_hengai_http_revceive_buf + 100);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG]: %s\n", s_hengai_http_revceive_buf + 200);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG]: %s\n", s_hengai_http_revceive_buf + 300);
+
cJSON * json_recv = cJSON_Parse(s_hengai_http_revceive_buf);
if(NULL != json_recv)
{
- if(cJSON_GetIntValue(cJSON_GetObjectItem(json_recv, "status")))
+ if(cJSON_IsTrue(cJSON_GetObjectItem(json_recv, "status")))
{
- printf("[@CHENG_DEBUG][%s][%d]: true\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: true\n", __FUNCTION__, __LINE__);
cJSON * json_data = cJSON_GetObjectItem(json_recv, "data");
char * token = cJSON_GetStringValue(cJSON_GetObjectItem(json_data, "token"));
- // save token
-
+
+ mmi_hengai_health_token_set(token);
}
else
{
- printf("[@CHENG_DEBUG][%s][%d]: false\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: false\n", __FUNCTION__, __LINE__);
}
}
else
{
- printf("[@CHENG_DEBUG][%s][%d]: not json file\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: not json file\n", __FUNCTION__, __LINE__);
}
if(NULL != json_recv)
{
- printf("[@CHENG_DEBUG][%s][%d]: free json root\n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: free json root\n", __FUNCTION__, __LINE__);
cJSON_Delete(json_recv);
json_recv = NULL;
}
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__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: nv write fail\n", __FUNCTION__, __LINE__);
}
}
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__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: nv read fail\n", __FUNCTION__, __LINE__);
_lv_memset_00(&s_hengai_health_data, sizeof(nv_watch_hengai_health_data_t));
}
}
void mmi_hengai_health_req_code_set(char * req_code)
{
+ if(NULL == req_code)
+ return;
+
+ if(NV_HENGAI_HEALTH_REQ_CODE_LEN < strlen(req_code))
+ return;
+
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG]: %s\n", req_code);
_lv_memcpy(s_hengai_health_data.req_code, req_code, strlen(req_code));
mmi_hengai_health_data_nv_write();
}
void mmi_hengai_health_act_code_set(char * act_code)
{
+ if(NULL == act_code)
+ return;
+
+ if(NV_HENGAI_HEALTH_ACT_CODE_LEN < strlen(act_code))
+ return;
+
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ 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();
}
void mmi_hengai_health_token_set(char * token)
{
+ if(NULL == token)
+ return;
+
+ if(NV_HENGAI_HEALTH_TOKEN_LEN < strlen(token))
+ return;
+
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG]: %s\n", token);
_lv_memcpy(s_hengai_health_data.token, token, strlen(token));
mmi_hengai_health_data_nv_write();
}