if(cJSON_GetIntValue(cJSON_GetObjectItem(json_recv, "status")))
{
// true
- mmi_hengai_bp_activated_finish();
+ mmi_hengai_health_activated_flag_set(1);
}
else
{
{
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);
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()
-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();
+}
+
+
+
+