#include "lv_watch.h"
-#ifdef __MMI_CUSTOM_HENG_AI_BLOOD_PRESSURE__
-
-static nv_watch_heng_ai_blood_pressure_t s_hengai_blood_pressure_data = {0};
-
-void mmi_hengai_blood_pressure_nv_write(void)
-{
- uint32_t nv_data_length = sizeof(nv_watch_heng_ai_blood_pressure_t);
-
- if(nv_data_length != UI_NV_Write_Req(NV_SECTION_UI_HENG_AI_BLOOD_PRESSURE, 0, nv_data_length, (uint8_t *)&s_hengai_blood_pressure_data))
- {
- printf("[@CHENG_DEBUG][%s][%d]: nv write fail\n", __FUNCTION__, __LINE__);
- }
-}
-
-void mmi_hengai_blood_pressure_nv_read(void)
-{
- uint32_t nv_data_length = sizeof(nv_watch_heng_ai_blood_pressure_t);
-
- if(nv_data_length != UI_NV_Read_Req(NV_SECTION_UI_HENG_AI_BLOOD_PRESSURE, 0, nv_data_length, (uint8_t *)&s_hengai_blood_pressure_data))
- {
- printf("[@CHENG_DEBUG][%s][%d]: nv read fail\n", __FUNCTION__, __LINE__);
- _lv_memset_00(&s_hengai_blood_pressure_data, sizeof(nv_watch_heng_ai_blood_pressure_t));
- }
-}
-
-void mmi_hengai_blood_pressure_data_set(nv_watch_heng_ai_blood_pressure_t * data)
-{
- if(NULL != data)
- {
- _lv_memset_00(&s_hengai_blood_pressure_data, sizeof(nv_watch_heng_ai_blood_pressure_t));
- _lv_memcpy(&s_hengai_blood_pressure_data, data, sizeof(nv_watch_heng_ai_blood_pressure_t));
- mmi_hengai_blood_pressure_nv_write();
- }
-}
-
-uint8_t mmi_hengai_bp_is_calibrated(void)
-{
- return (s_hengai_blood_pressure_data.is_calibrated);
-}
-
-#if 0
-uint8_t mmi_hengai_bp_is_activated(void)
-{
- return (s_hengai_blood_pressure_data.is_activated);
-}
-
-char * mmi_hengai_bp_req_code_get(void)
-{
- return (s_hengai_blood_pressure_data.req_code);
-}
-
-void mmi_hengai_bp_req_code_set(char * req_code)
-{
- _lv_memcpy(s_hengai_blood_pressure_data.req_code, req_code, strlen(req_code));
-}
-
-char * mmi_hengai_bp_act_code_get(void)
-{
- return (s_hengai_blood_pressure_data.act_code);
-}
-
-void mmi_hengai_bp_act_code_set(char * act_code)
-{
- _lv_memcpy(s_hengai_blood_pressure_data.act_code, act_code, strlen(act_code));
-}
-
-void mmi_hengai_bp_activated_finish(void)
-{
- s_hengai_blood_pressure_data.is_activated = 1;
- mmi_hengai_blood_pressure_nv_write();
-}
-#endif
-
+#ifdef __MMI_CUSTOM_HENGAI_HEALTH__
#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__);
mmi_hsensor_bp_open();
mmi_hengai_bp_measure_action_time_string_set(1);
-
s_hengai_bp_measure_count = 0;
gif_info_t * gif_info = gif_open(cont, ANIM_HENGAI_BP_MEASURE, 0);
if(is_success)
{
- nv_watch_heng_ai_blood_pressure_t data = {0};
+ nv_watch_hengai_health_data_t data = {0};
data.is_calibrated = 1;
mmi_hengai_blood_pressure_data_set(&data);
}
}
+#if 0
void mmi_bp_roller_get_optstr_from_num(uint16_t sel_value, char * stropt, uint32_t user_num)
{
uint8_t opt_display[5];
mmi_bp_screen_common_bottom_button_create(watch_ext->cont, WATCH_TEXT_ID_OK, mmi_hengai_bp_calibrate_end_input_event_cb);
}
+#else
+
+void mmi_hengai_bp_calibrate_input_btn_event_cb(lv_obj_t * obj, lv_event_t e)
+{
+ if(LV_EVENT_CLICKED != e)
+ return;
+
+ 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 * label = NULL;
+ char temp_str[4] = {0};
+
+ uint32_t free_num = lv_watch_get_free_num(obj);
+ if(0 == free_num)
+ {
+ (MMI_HENGAI_BP_HIGH_VALUE_MAX > s_bp_value_high) ? s_bp_value_high++ : NULL;
+ sprintf(temp_str, "%d", s_bp_value_high);
+ label = watch_ext->label_input_high;
+ }
+ else if(1 == free_num)
+ {
+ (MMI_HENGAI_BP_HIGH_VALUE_MIN < s_bp_value_high) ? s_bp_value_high-- : NULL;
+ sprintf(temp_str, "%d", s_bp_value_high);
+ label = watch_ext->label_input_high;
+ }
+ else if(2 == free_num)
+ {
+ (MMI_HENGAI_BP_LOW_VALUE_MAX > s_bp_value_low) ? s_bp_value_low++ : NULL;
+ sprintf(temp_str, "%d", s_bp_value_low);
+ label = watch_ext->label_input_low;
+ }
+ else if(3 == free_num)
+ {
+ (MMI_HENGAI_BP_LOW_VALUE_MIN < s_bp_value_low) ? s_bp_value_low-- : NULL;
+ sprintf(temp_str, "%d", s_bp_value_low);
+ label = watch_ext->label_input_low;
+ }
+ lv_label_set_text(label, temp_str);
+}
+
+void mmi_hengai_bp_calibrate_input_screen(void)
+{
+ 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;
+
+ s_bp_value_high = 120;
+ s_bp_value_low = 80;
+ lv_obj_clean(watch_ext->cont);
+
+ 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_INPUT_CALIBRATE_VALUE);
+ lv_obj_align(label_title, NULL, LV_ALIGN_IN_TOP_MID, 0, 48);
+ lv_obj_set_click(label_title, false);
+
+ lv_obj_t * label = NULL;
+ lv_obj_t * imgbtn = NULL;
+ char temp_str[4] = {0};
+
+ label = lv_label_create(watch_ext->cont, NULL);
+ lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font24);
+ lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
+ lv_label_set_text_id(label, WATCH_TEXT_ID_SYSTOLIC_BP);
+ lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_LEFT, 103, 104);
+ lv_obj_set_click(label, false);
+
+ imgbtn = lv_imgbtn_create(watch_ext->cont, NULL);
+ lv_imgbtn_set_src(imgbtn, LV_BTN_STATE_RELEASED, ICON_HENGAI_BP_UP_ARROW);
+ lv_imgbtn_set_src(imgbtn, LV_BTN_STATE_PRESSED, ICON_HENGAI_BP_UP_ARROW);
+ lv_obj_align(imgbtn, label, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); // 20);
+ lv_obj_set_event_cb(imgbtn, mmi_hengai_bp_calibrate_input_btn_event_cb);
+ lv_watch_set_free_num(imgbtn, 0);
+
+ label = lv_label_create(watch_ext->cont, NULL);
+ lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font60);
+ lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
+ sprintf(temp_str, "%d", s_bp_value_high);
+ lv_label_set_text(label, temp_str);
+ lv_obj_align(label, imgbtn, LV_ALIGN_OUT_BOTTOM_MID, 0, 8); // 20);
+ lv_obj_set_click(label, false);
+ watch_ext->label_input_high = label;
+
+ imgbtn = lv_imgbtn_create(watch_ext->cont, NULL);
+ lv_imgbtn_set_src(imgbtn, LV_BTN_STATE_RELEASED, ICON_HENGAI_BP_DOWN_ARROW);
+ lv_imgbtn_set_src(imgbtn, LV_BTN_STATE_PRESSED, ICON_HENGAI_BP_DOWN_ARROW);
+ lv_obj_align(imgbtn, label, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); // 20);
+ lv_obj_set_event_cb(imgbtn, mmi_hengai_bp_calibrate_input_btn_event_cb);
+ lv_watch_set_free_num(imgbtn, 1);
+
+
+ label = lv_label_create(watch_ext->cont, NULL);
+ lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font24);
+ lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
+ lv_label_set_text_id(label, WATCH_TEXT_ID_DIASTOLIC_BP);
+ lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_LEFT, 280, 104);
+ lv_obj_set_click(label, false);
+
+ imgbtn = lv_imgbtn_create(watch_ext->cont, NULL);
+ lv_imgbtn_set_src(imgbtn, LV_BTN_STATE_RELEASED, ICON_HENGAI_BP_UP_ARROW);
+ lv_imgbtn_set_src(imgbtn, LV_BTN_STATE_PRESSED, ICON_HENGAI_BP_UP_ARROW);
+ lv_obj_align(imgbtn, label, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); // 20);
+ lv_obj_set_event_cb(imgbtn, mmi_hengai_bp_calibrate_input_btn_event_cb);
+ lv_watch_set_free_num(imgbtn, 2);
+
+ label = lv_label_create(watch_ext->cont, NULL);
+ lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font60);
+ lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
+ sprintf(temp_str, "%d", s_bp_value_low);
+ lv_label_set_text(label, temp_str);
+ lv_obj_align(label, imgbtn, LV_ALIGN_OUT_BOTTOM_MID, 0, 8); // 20);
+ lv_obj_set_click(label, false);
+ watch_ext->label_input_low = label;
+
+ imgbtn = lv_imgbtn_create(watch_ext->cont, NULL);
+ lv_imgbtn_set_src(imgbtn, LV_BTN_STATE_RELEASED, ICON_HENGAI_BP_DOWN_ARROW);
+ lv_imgbtn_set_src(imgbtn, LV_BTN_STATE_PRESSED, ICON_HENGAI_BP_DOWN_ARROW);
+ lv_obj_align(imgbtn, label, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); // 20);
+ lv_obj_set_event_cb(imgbtn, mmi_hengai_bp_calibrate_input_btn_event_cb);
+ lv_watch_set_free_num(imgbtn, 3);
+
+
+ mmi_bp_screen_common_bottom_button_create(watch_ext->cont, WATCH_TEXT_ID_OK, mmi_hengai_bp_calibrate_end_input_event_cb);
+}
+#endif
+
+
void mmi_hengai_bp_calibrate_end_btn_event_cb(lv_obj_t * obj, lv_event_t e)
{
if(LV_EVENT_CLICKED != e)
}
else
{
+ printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
mmi_hsensor_bp_open();
mmi_hengai_bp_measure_action_time_string_set(1);
+ 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_obj_set_click(label, false);
/* start timer (1 min) */
- s_hengai_bp_measure_count = 0;
watch_ext->measure_timer_id = Hal_Timer_Start(1000, mmi_hengai_bp_calibrate_cycle_timeout, NULL, true);
}
}
#include "lv_watch.h"
-#ifdef __MMI_CUSTOM_HENG_AI_BLOOD_PRESSURE__
+#ifdef __MMI_CUSTOM_HENGAI_HEALTH__
#include "hal/dm/cJSON.h"
else
{
// false
- printf("[@CHENG_DEBUG][%s][%d]: fail\n", __FUNCTION__, __LINE__);
+ printf("[@CHENG_DEBUG][%s][%d]: false\n", __FUNCTION__, __LINE__);
// update
mmi_hengai_bp_measure_update_result(false, 0, 0, NULL);
}
{
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);
cJSON * json_recv = cJSON_Parse(s_hengai_http_revceive_buf);
if(NULL != json_recv)
cJSON_AddItemToObject(json_send, "mac", cJSON_CreateString(imei));
cJSON_AddItemToObject(json_send, "begin_time", cJSON_CreateString(begin_time_str));
cJSON_AddItemToObject(json_send, "end_time", cJSON_CreateString(end_time_str));
- cJSON_AddItemToObject(json_send, "pulse_wave", cJSON_CreateString("HENGAI"));
+ cJSON_AddItemToObject(json_send, "pulse_wave", cJSON_CreateIntArray(mmi_hengai_bp_raw_data_ptr_get(), mmi_hengai_bp_raw_data_len_get()));
cJSON_AddItemToObject(json_send, "sample_rate", cJSON_CreateNumber(MMI_HENGAI_BP_RAW_DATA_SAMPLE_RATE));
cJSON_AddItemToObject(json_send, "sbp", cJSON_CreateNumber(bp_value_high));
cJSON_AddItemToObject(json_send, "dbp", cJSON_CreateNumber(bp_value_low));
{
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);
cJSON * json_recv = cJSON_Parse(s_hengai_http_revceive_buf);
if(NULL != json_recv)
{
- printf("[@CHENG_DEBUG][%s][%d]: json file\n", __FUNCTION__, __LINE__);
-
if(cJSON_GetIntValue(cJSON_GetObjectItem(json_recv, "status")))
{
- // true
+ printf("[@CHENG_DEBUG][%s][%d]: true\n", __FUNCTION__, __LINE__);
if(2 <= calibrate_times)
{
mmi_hengai_bp_calibrate_model_send();
}
else
{
- // false
- printf("[@CHENG_DEBUG][%s][%d]: fail\n", __FUNCTION__, __LINE__);
+ printf("[@CHENG_DEBUG][%s][%d]: false\n", __FUNCTION__, __LINE__);
}
}
else
}
+
+
+static nv_watch_hengai_health_data_t s_hengai_blood_pressure_data = {0};
+
+void mmi_hengai_blood_pressure_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))
+ {
+ printf("[@CHENG_DEBUG][%s][%d]: nv write fail\n", __FUNCTION__, __LINE__);
+ }
+}
+
+void mmi_hengai_blood_pressure_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))
+ {
+ 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));
+ }
+}
+
+void mmi_hengai_blood_pressure_data_set(nv_watch_hengai_health_data_t * data)
+{
+ 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();
+ }
+}
+
+uint8_t mmi_hengai_bp_is_calibrated(void)
+{
+ return (s_hengai_blood_pressure_data.is_calibrated);
+}
+
+uint8_t mmi_hengai_bp_is_activated(void)
+{
+ return (s_hengai_blood_pressure_data.is_activated);
+}
+
+char * mmi_hengai_bp_req_code_get(void)
+{
+ return (s_hengai_blood_pressure_data.req_code);
+}
+
+void mmi_hengai_bp_req_code_set(char * req_code)
+{
+ _lv_memcpy(s_hengai_blood_pressure_data.req_code, req_code, strlen(req_code));
+}
+
+char * mmi_hengai_bp_act_code_get(void)
+{
+ return (s_hengai_blood_pressure_data.act_code);
+}
+
+void mmi_hengai_bp_act_code_set(char * act_code)
+{
+ _lv_memcpy(s_hengai_blood_pressure_data.act_code, act_code, strlen(act_code));
+}
+
+void mmi_hengai_bp_activated_finish(void)
+{
+ s_hengai_blood_pressure_data.is_activated = 1;
+ mmi_hengai_blood_pressure_nv_write();
+}
+
+
+
+
#endif