#define __Default_system_alarm__
-//#define __MMI_CUSTOM_BEI_KE_RUI_SHENG__
+#define __MMI_FZD_PROTOCOL_WITHOUT_PING_COMMAND_SUPPORT__
+
#define __HEALTH_MEASURE_FAKE_temperature_DATA__
//#define __MMI_CUSTOM_HENG_AI__
static lv_signal_cb_t ancient_scrl_signal;
-static uint8_t s_wechat_msg_init_flag = 0;
-static nv_watch_wechat_msg_info_t * s_wechat_msg_info = NULL;
+//static uint8_t s_wechat_msg_init_flag = 0;
+static nv_watch_wechat_msg_info_t s_wechat_msg_info_t = {0};
+static nv_watch_wechat_msg_info_t * s_wechat_msg_info = &s_wechat_msg_info_t;
static nv_watch_wechat_msg_item_info_t s_wechat_msg_item_info = {0};
static uint8_t s_wechat_play_anim_count = 0;
static char s_wechat_selected_item_index = -1;
void mmi_wechat_msg_info_init(void)
{
+#if 1
+ uint32_t nv_data_length = sizeof(nv_watch_wechat_msg_info_t);
+
+ if(nv_data_length != UI_NV_Read_Req(NV_SECTION_UI_WEHAT_MSG, 0, nv_data_length, (uint8_t *)s_wechat_msg_info))
+ {
+ WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: NV_SECTION_UI_WEHAT_MSG read fail\n", __FUNCTION__, __LINE__);
+ _lv_memset_00(s_wechat_msg_info, nv_data_length);
+ }
+
+#else
if(0 == s_wechat_msg_init_flag)
{
uint32_t nv_data_length = sizeof(nv_watch_wechat_msg_info_t);
s_wechat_msg_init_flag = 1;
}
+#endif
}
uint8_t wechat_msg_info_count_get(void)
}
}
s_wechat_msg_info->msg_count--;
+
+ wechat_msg_info_nv_write();
}
void wechat_msg_info_all_item_delete(void)
_lv_memset_00(&(s_wechat_msg_info->msg_item[i]), msg_item_info_size);
}
s_wechat_msg_info->msg_count = 0;
+
+ wechat_msg_info_nv_write();
}
void wechat_msg_info_new_item_add(nv_watch_wechat_msg_item_info_t * msg_item)
s_wechat_msg_info->msg_count++;
_lv_memcpy(&(s_wechat_msg_info->msg_item[s_wechat_msg_info->msg_count - 1]), msg_item, msg_item_info_size);
+
+ wechat_msg_info_nv_write();
}
void * wechat_actId_ext_get(lv_watch_Activity_Id_t actId)
if(WECHAT_CREATED_FROM_ALBUM == ext->from)
{
+ #if USE_LV_WATCH_ALBUM
album_photo_share_flag_reset();
+ #endif
}
else if(WECHAT_CREATED_FROM_IMGVIEWER == ext->from)
{
lv_obj_set_hidden(ext->img_record, false);
uint8_t msg_count = wechat_msg_info_count_get();
+ if(0 != msg_count)
+ {
+ uint8_t i = 0;
+ nv_watch_wechat_msg_item_info_t * msg_item = NULL;
+
+ for(i = 0; i < msg_count; i++)
+ {
+ wechat_msg_info_index_item_get(i, &msg_item);
+
+ if(1970 > msg_item->msg_time.tm_year
+ || 2070 < msg_item->msg_time.tm_year
+ || 12 < msg_item->msg_time.tm_mon
+ || 31 < msg_item->msg_time.tm_mday
+ )
+ {
+ WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: time content is wrong\n", __FUNCTION__, __LINE__);
+ wechat_msg_info_all_item_delete();
+ msg_count = 0;
+ break;
+ }
+ }
+ }
+
if(0 == msg_count)
{
lv_obj_set_hidden(ext->img_record, false);
uint8_t msg_count = wechat_msg_info_count_get();
+ if(0 != msg_count)
+ {
+ uint8_t i = 0;
+ nv_watch_wechat_msg_item_info_t * msg_item = NULL;
+
+ for(i = 0; i < msg_count; i++)
+ {
+ wechat_msg_info_index_item_get(i, &msg_item);
+
+ if(1970 > msg_item->msg_time.tm_year
+ || 2070 < msg_item->msg_time.tm_year
+ || 12 < msg_item->msg_time.tm_mon
+ || 31 < msg_item->msg_time.tm_mday
+ )
+ {
+ WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: time content is wrong\n", __FUNCTION__, __LINE__);
+ wechat_msg_info_all_item_delete();
+ msg_count = 0;
+ break;
+ }
+ }
+ }
+
if(0 == msg_count)
{
lv_obj_set_hidden(ext->label_no_msg, false);
-//#ifdef __MMI_WECHAT_SUPPORT__
+#ifdef __MMI_WECHAT_SUPPORT__
static lv_signal_cb_t ancient_scrl_signal;
-static uint8_t s_wechat_msg_init_flag = 0;
-static nv_watch_wechat_msg_info_t * s_wechat_msg_info = NULL;
+//static uint8_t s_wechat_msg_init_flag = 0;
+static nv_watch_wechat_msg_info_t s_wechat_msg_info_t = {0};
+static nv_watch_wechat_msg_info_t * s_wechat_msg_info = &s_wechat_msg_info_t;
static nv_watch_wechat_msg_item_info_t s_wechat_msg_item_info = {0};
static uint8_t s_wechat_play_anim_count = 0;
static char s_wechat_selected_item_index = -1;
void mmi_wechat_msg_info_init(void)
{
+#if 1
+ uint32_t nv_data_length = sizeof(nv_watch_wechat_msg_info_t);
+
+ if(nv_data_length != UI_NV_Read_Req(NV_SECTION_UI_WEHAT_MSG, 0, nv_data_length, (uint8_t *)s_wechat_msg_info))
+ {
+ WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: NV_SECTION_UI_WEHAT_MSG read fail\n", __FUNCTION__, __LINE__);
+ _lv_memset_00(s_wechat_msg_info, nv_data_length);
+ }
+
+#else
if(0 == s_wechat_msg_init_flag)
{
uint32_t nv_data_length = sizeof(nv_watch_wechat_msg_info_t);
s_wechat_msg_init_flag = 1;
}
+#endif
}
-void mmi_wechat_msg_info_reset(void)
-{
- if(s_wechat_msg_info!=NULL)
- {
- lv_mem_free(s_wechat_msg_info);
- s_wechat_msg_info = NULL;
-
- }
- uint32_t nv_data_length = sizeof(nv_watch_wechat_msg_info_t);
- s_wechat_msg_info = (nv_watch_wechat_msg_info_t *)lv_mem_alloc(nv_data_length);
- if(NULL == s_wechat_msg_info)
- {
- WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: memory alloc fail\n", __FUNCTION__, __LINE__);
- return;
- }
- _lv_memset_00(s_wechat_msg_info, nv_data_length);
-}
-
-
-
uint8_t wechat_msg_info_count_get(void)
{
uint8_t msg_count = s_wechat_msg_info->msg_count;
}
}
s_wechat_msg_info->msg_count--;
+
+ wechat_msg_info_nv_write();
}
void wechat_msg_info_all_item_delete(void)
_lv_memset_00(&(s_wechat_msg_info->msg_item[i]), msg_item_info_size);
}
s_wechat_msg_info->msg_count = 0;
+
+ wechat_msg_info_nv_write();
}
void wechat_msg_info_new_item_add(nv_watch_wechat_msg_item_info_t * msg_item)
s_wechat_msg_info->msg_count++;
_lv_memcpy(&(s_wechat_msg_info->msg_item[s_wechat_msg_info->msg_count - 1]), msg_item, msg_item_info_size);
+
+ wechat_msg_info_nv_write();
}
void * wechat_actId_ext_get(lv_watch_Activity_Id_t actId)
if(WECHAT_CREATED_FROM_ALBUM == ext->from)
{
+ #if USE_LV_WATCH_ALBUM
album_photo_share_flag_reset();
+ #endif
}
else if(WECHAT_CREATED_FROM_IMGVIEWER == ext->from)
{
void wechat_msg_receive_update_ui(void)
{
WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
-
- if(true != mmi_protocol_watch_bind_state_get())
- {
- mmi_protocol_fzd_action_bind();
- }
if(AUDIO_CTRL_PRIORITY_5 == Hal_Audio_Manage_Start_Req(AUDIO_CTRL_PRIORITY_5, wechat_receive_audio_play_audio_ctrl_callback))
{
lv_obj_align(sending_ext->sending_img, NULL, LV_ALIGN_CENTER, 0, 0);
lv_label_set_text_id(sending_ext->sending_label, ((true == result) ? WATCH_TEXT_ID_COMMON_SEND_SUCCESS : WATCH_TEXT_ID_COMMON_SEND_FAILED));
- lv_obj_align(sending_ext->sending_label, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, -100);
+ lv_obj_align(sending_ext->sending_label, NULL, LV_ALIGN_CENTER, 0, -10);
}
sending_ext->result_timer_id = Hal_Timer_Start(1500, wechat_msg_sending_result_screen_timeout, sending_ext, FALSE);
//lv_obj_set_width(label, lv_obj_get_width(obj) * 2 / 3);
lv_label_set_text_id(label, WATCH_TEXT_ID_COMMON_SENDING);
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
- lv_obj_align(label, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, -100);
+ lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, -10);
sending_ext->sending_label = label;
/*
void wechat_chat_list_msg_item_time(char * time_str, hal_rtc_t * cur_time, hal_rtc_t * msg_time, hal_rtc_t * last_msg_time)
{
WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
- if(msg_time->tm_year<1980 || msg_time->tm_year>2044 || msg_time->tm_mon>12 || msg_time->tm_mday>31 )
- {
- mmi_wechat_msg_info_reset();
- return;
- }
+
if(0 == last_msg_time->tm_year)
{
sprintf(time_str, "%d/%d/%d %02d:%02d", msg_time->tm_year, msg_time->tm_mon, msg_time->tm_mday,
lv_obj_set_hidden(ext->img_record, false);
uint8_t msg_count = wechat_msg_info_count_get();
+ if(0 != msg_count)
+ {
+ uint8_t i = 0;
+ nv_watch_wechat_msg_item_info_t * msg_item = NULL;
+
+ for(i = 0; i < msg_count; i++)
+ {
+ wechat_msg_info_index_item_get(i, &msg_item);
+
+ if(1970 > msg_item->msg_time.tm_year
+ || 2070 < msg_item->msg_time.tm_year
+ || 12 < msg_item->msg_time.tm_mon
+ || 31 < msg_item->msg_time.tm_mday
+ )
+ {
+ WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: time content is wrong\n", __FUNCTION__, __LINE__);
+ wechat_msg_info_all_item_delete();
+ msg_count = 0;
+ break;
+ }
+ }
+ }
+
if(0 == msg_count)
{
lv_obj_set_hidden(ext->label_no_msg, true);
lv_obj_set_hidden(ext->img_record, true);
}
- else if(//true != mmi_watch_tcp_connect_state_get()
- //||
- true != mmi_protocol_watch_bind_state_get()
+ else if(true != mmi_watch_tcp_connect_state_get()
+ || true != mmi_protocol_watch_bind_state_get()
)
{
lv_obj_set_hidden(ext->label_no_network, true);
lv_obj_set_hidden(ext->img_record, false);
uint8_t msg_count = wechat_msg_info_count_get();
+ if(0 != msg_count)
+ {
+ uint8_t i = 0;
+ nv_watch_wechat_msg_item_info_t * msg_item = NULL;
+
+ for(i = 0; i < msg_count; i++)
+ {
+ wechat_msg_info_index_item_get(i, &msg_item);
+
+ if(1970 > msg_item->msg_time.tm_year
+ || 2070 < msg_item->msg_time.tm_year
+ || 12 < msg_item->msg_time.tm_mon
+ || 31 < msg_item->msg_time.tm_mday
+ )
+ {
+ WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: time content is wrong\n", __FUNCTION__, __LINE__);
+ wechat_msg_info_all_item_delete();
+ msg_count = 0;
+ break;
+ }
+ }
+ }
+
if(0 == msg_count)
{
lv_obj_set_hidden(ext->label_no_msg, false);
}
}
-//#endif
+#endif
#ifdef __MMI_NEW_SMS_SILENT_SUPPORT__
{ ICON_SETTING_NEW_SMS_SILENT, WATCH_TEXT_ID_NEW_SMS_SILENT, setting_new_sms_silent_create_event_cb },
#endif
-#ifdef __MMI_APP_QRCODE_MENU_SUPPORT__
- { ICON_SETTING_APP_QRCODE, WATCH_TEXT_ID_APP_QRCODE, app_qrcode_create_event_cb },
-#endif
#ifdef __MMI_BLOOD_PRESSURE_SUPPORT__
{ BlOOD_PRESSURE_LIST_PNG, WATCH_TEXT_ID_Blood_pressure_calibration, setting_Blood_pressure_create_event_cb },
#endif
+#ifdef __MMI_APP_QRCODE_MENU_SUPPORT__
+ { ICON_SETTING_APP_QRCODE, WATCH_TEXT_ID_APP_QRCODE, app_qrcode_create_event_cb },
+#endif
#if USE_LV_WATCH_QRCODE != 0
{ ICON_SETTING_QRCODE, WATCH_TEXT_ID_DEVICE_QRCODE, qrcode_create_event_cb },
#endif
bool mmi_protocol_watch_bind_state_get(void)
{
+#ifdef __MMI_FZD_PROTOCOL_WITHOUT_PING_COMMAND_SUPPORT__
+ return true;
+#else
return s_watch_bind_state;
+#endif
}
void mmi_protocol_watch_bind_state_set(bool state)
}
/////////////////////////
+#ifdef __MMI_FZD_PROTOCOL_WITHOUT_PING_COMMAND_SUPPORT__
+static bool s_first_lk_command_received = false;
+
+bool mmi_protocol_first_lk_command_received_action(void);
+#endif
+
bool mmi_protocol_fzd_action_LINK(void)
{
bool mmi_protocol_fzd_parse_LINK(unsigned char * next_buff, unsigned int next_buff_len)
{
+#ifdef __MMI_FZD_PROTOCOL_WITHOUT_PING_COMMAND_SUPPORT__
+ if(false == s_first_lk_command_received)
+ {
+ s_first_lk_command_received = true;
+ mmi_protocol_first_lk_command_received_action();
+ }
+#else
if(true != mmi_protocol_watch_bind_state_get())
{
mmi_protocol_fzd_action_bind();
}
- //mmi_protocol_watch_heartbeat_action();
+#endif
return true;
}
_lv_memset_00(content_buff, 128);
Hal_Rtc_Gettime(&cur_time);
-
-
+
sprintf(content_buff, ",%02d%02d%02d,%u,%u,%u", cur_time.tm_year%2000, cur_time.tm_mon, cur_time.tm_mday, step_num, roll_num, battery_percent);
content_lenth = strlen(content_buff);
bool mmi_protocol_fzd_parse_HEARTBEAT(unsigned char * next_buff, unsigned int next_buff_len)
{
- //if(true != mmi_protocol_watch_bind_state_get())
- //{
- // mmi_protocol_fzd_action_bind();
- //}
if(0 == s_fzd_time_data_flag)
{
mmi_protocol_fzd_action_get_time();
bool mmi_protocol_fzd_action_bind(void)
{
+#ifdef __MMI_FZD_PROTOCOL_WITHOUT_PING_COMMAND_SUPPORT__
+ return false;
+#else
return mmi_protocol_fzd_send_without_data(MMI_FZD_ACTION_BIND);
+#endif
}
bool mmi_protocol_fzd_parse_ACTION_BIND(unsigned char * next_buff, unsigned int next_buff_len)
}
value = atoi(next_buff);
+
+#ifdef __MMI_FZD_PROTOCOL_WITHOUT_PING_COMMAND_SUPPORT__
+ if(0 == value)
+ {
+ mmi_watch_factory_aciton();
+ }
+#else
if(true == mmi_protocol_watch_bind_state_get())
{
if(0 == value)
}
}
+#endif
return true;
}
+#ifdef __MMI_FZD_PROTOCOL_WITHOUT_PING_COMMAND_SUPPORT__
+bool mmi_protocol_first_lk_command_received_action(void)
+{
+ // sim unbind check
+#ifdef __MMI_ZHSX_SUPPORT_CHECK_SIM_UNBIND__
+ mmi_watch_sim_unbind_check();
+#endif
+
+ // socket heartbeat
+ mmi_protocol_watch_heartbeat_action();
+
+ // timing mission
+ mmi_protocol_watch_timed_mission_action();
+
+ //video call
+#ifdef __MMI_ZHSX_SUPPORT_VIDEO_CALL__
+ mmi_protocol_fzd_action_get_vc_config();
+#endif
+
+ // hengai
+#ifdef __MMI_CUSTOM_HENG_AI__
+ mmi_hengai_sleep_activation_check_action();
+#endif
+
+
+}
+#endif
+
bool mmi_protocol_fzd_action_get_time(void)
{
return mmi_protocol_fzd_send_without_data(MMI_FZD_ACTION_GET_TIME);
return result;
}
+bool mmi_protocol_fzd_parse_SERVER_SET_REBOOT(unsigned char * next_buff, unsigned int next_buff_len)
+{
+ bool result = false;
+ MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_SERVER_SET_REBOOT;
+
+ result = true;
+ mmi_protocol_fzd_send_without_data(action);
+
+ //mmi_watch_reboot_aciton();
+
+ return result;
+}
+
bool mmi_protocol_fzd_parse_SERVER_FIND_WATCH(unsigned char * next_buff, unsigned int next_buff_len)
{
bool result = false;
case MMI_FZD_WARNING_TYPE_TAKE_OFF:
s_fzd_warning_info.take_off = value;
+ if(true == value)
+ {
+ s_fzd_warning_info.take_on = false;
+ }
break;
case MMI_FZD_WARNING_TYPE_TAKE_ON:
s_fzd_warning_info.take_on = value;
+ if(true == value)
+ {
+ s_fzd_warning_info.take_off = false;
+ }
break;
case MMI_FZD_WARNING_TYPE_FALL_DOWN:
MMI_FZD_SERVER_SET_CENTER_NUMBER,
MMI_FZD_SERVER_SET_MONITOR,
MMI_FZD_ACTION_UNBIND,
+ MMI_FZD_SERVER_SET_REBOOT,
#ifdef __MMI_ZHSX_SUPPORT_VIDEO_CALL__
#if defined(__MMI_ZHSX_SUPPORT_VIDEO_CALL_WULIAN__) || defined(__MMI_ZHSX_SUPPORT_VIDEO_CALL_FZD__) || defined(__MMI_ZHSX_SUPPORT_VIDEO_CALL_TONGXIN__)
bool mmi_protocol_fzd_parse_SERVER_SET_FACTORY(unsigned char * next_buff, unsigned int next_buff_len);
bool mmi_protocol_fzd_parse_SERVER_SET_POWEROFF(unsigned char * next_buff, unsigned int next_buff_len);
+bool mmi_protocol_fzd_parse_SERVER_SET_REBOOT(unsigned char * next_buff, unsigned int next_buff_len);
bool mmi_protocol_fzd_parse_SERVER_FIND_WATCH(unsigned char * next_buff, unsigned int next_buff_len);
{MMI_FZD_SERVER_SET_CENTER_NUMBER, "CENTER"},
{MMI_FZD_SERVER_SET_MONITOR, "MONITOR"},
{MMI_FZD_ACTION_UNBIND, "DLT"},
+ {MMI_FZD_SERVER_SET_REBOOT, "REBOOT"},
#ifdef __MMI_ZHSX_SUPPORT_VIDEO_CALL__
#ifdef __MMI_ZHSX_SUPPORT_VIDEO_CALL_WULIAN__
case MMI_FZD_ACTION_UNBIND:
break;
+ case MMI_FZD_SERVER_SET_REBOOT:
+ mmi_protocol_fzd_parse_SERVER_SET_REBOOT(next_buff, next_buff_len);
+ break;
+
#ifdef __MMI_ZHSX_SUPPORT_VIDEO_CALL__
#if defined(__MMI_ZHSX_SUPPORT_VIDEO_CALL_WULIAN__) || defined(__MMI_ZHSX_SUPPORT_VIDEO_CALL_FZD__) || defined(__MMI_ZHSX_SUPPORT_VIDEO_CALL_TONGXIN__)
case MMI_FZD_WATCH_GET_VC_CONFIG:
VOID Hal_Power_Off(HAL_POWER_OFF_TYPE type)
{
#ifdef __MMI_ZHSX_SUPPORT__
-#ifdef __MMI_WECHAT_SUPPORT__
- wechat_msg_info_nv_write();
-#endif
+//#ifdef __MMI_WECHAT_SUPPORT__
+// wechat_msg_info_nv_write();
+//#endif
asl_pedometer_steps_save(true);
#endif