#define __MMI_PEDOMETER_STEP_AND_GOAL_STYLE__
+#define __MMI_SOS_NUMBER_NAME_SUPPORT__
#endif
TASK_HANDLE * s_gui_timing_task_id = NULL;
+static void mmi_gui_timing_timer_callback(uint32_t param);
static void mmi_gui_timing_task_3_second_mission(void * time_param);
static void mmi_gui_timing_task_15_second_mission(void * time_param);
static void mmi_gui_timing_task_1_minute_mission(void * time_param);
}
-static void timing_timer_callback(uint32_t param)
+static void mmi_gui_timing_timer_callback(uint32_t param)
{
hal_rtc_t cur_time = {0};
Hal_Rtc_Gettime(&cur_time);
TIMING_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %02d:%02d:%02d\n", __FUNCTION__, __LINE__, cur_time.tm_hour, cur_time.tm_min, cur_time.tm_sec);
uos_timer_stop(s_timing_control_timer);
- uos_timer_start(s_timing_control_timer, MS_TO_TICKS(MMI_GUI_TIMING_TIMER_INTERVAL), 0, timing_timer_callback, NULL);
+ uos_timer_start(s_timing_control_timer, MS_TO_TICKS(MMI_GUI_TIMING_TIMER_INTERVAL), 0, mmi_gui_timing_timer_callback, NULL);
s_timing_control_timer_counter++;
mmi_gui_timing_task_create();
uos_timer_create(&s_timing_control_timer);
- uos_timer_start(s_timing_control_timer, MS_TO_TICKS(MMI_GUI_TIMING_TIMER_INTERVAL), 0, timing_timer_callback, NULL);
+ uos_timer_start(s_timing_control_timer, MS_TO_TICKS(MMI_GUI_TIMING_TIMER_INTERVAL), 0, mmi_gui_timing_timer_callback, NULL);
}
#else
typedef struct
{
char number[NV_WATCH_SOS_NUMBER_MAX][NV_CONTACTS_MAX_NUMBER_LEN];
+#ifdef __MMI_SOS_NUMBER_NAME_SUPPORT__
+ char name[NV_WATCH_SOS_NUMBER_MAX][NV_CONTACTS_MAX_NAME_LEN];
+#endif
} __packed nv_watch_sos_number_t;
Hal_Mem_Free(contact_info);
}
-#ifndef __MMI_ZHSX_SUPPORT__
+#ifdef __MMI_ZHSX_SUPPORT__
+ else
+ {
+ #ifdef __MMI_SOS_NUMBER_NAME_SUPPORT__
+ mmi_sos_get_name_by_number(number, call_params.name);
+
+ #else
+
+ #endif
+ }
+#else
else
{
call_params.img_src = ICON_FAMILY;
return true;
}
+#ifdef __MMI_SOS_NUMBER_NAME_SUPPORT__
+bool mmi_sos_get_name_by_number(char * number, char * name)
+{
+ uint8_t i = 0;
+
+ for(i = 0; i < NV_WATCH_SOS_NUMBER_MAX; i++)
+ {
+ if(0 == strcmp(number, s_sos_number.number[i]))
+ {
+ Hal_Mem_Copy(name, s_sos_number.name[i], NV_CONTACTS_MAX_NAME_LEN);
+ return true;
+ }
+ }
+
+ return false;
+}
+#endif
+
uint8_t get_sos_status(void)
{
return s_sos_state;
#ifdef __MMI_ZHSX_SUPPORT__
void mmi_sos_number_nv_read(void);
void mmi_sos_number_set(nv_watch_sos_number_t * sos_number);
+#ifdef __MMI_SOS_NUMBER_NAME_SUPPORT__
+bool mmi_sos_get_name_by_number(char * number, char * name);
+#endif
+
lv_res_t mmi_key_back_sos_btn_action(void);
void sos_create_event_cb(lv_obj_t * btn, lv_event_t e);
static void * s_protocol_timing_timer = NULL;
TASK_HANDLE * s_protocol_timing_task_id = NULL;
static uint32_t s_protocol_heartbeat_time_stamp = 0, s_protocol_timed_location_time_stamp = 0, s_protocol_timed_weather_time_stamp = 0;
+static void * s_protocol_location_move_check_timer = NULL;
+static uint8_t s_protocol_location_move_flag = 0;
+static int16_t s_gsensor_chip_x = 0, s_gsensor_chip_y = 0, s_gsensor_chip_z = 0;
+
+#define PROTOCOL_LOCATION_MOVE_CHECK_TIMER_INTERVAL (2 * 1000) // ms
static void mmi_protocol_timing_timer_callback(uint32_t param);
+static uint8_t mmi_protocol_location_move_state_get(void);
+static void mmi_protocol_location_move_state_set(uint8_t flag);
+static void mmi_protocol_location_move_state_check_cb(uint32_t param);
static void mmi_protocol_timing_task_msg_send(MMI_PROTOCOL_TIMING_MSG_ID_E msg_id, void * msg_param)
{
//location
if(mmi_protocol_watch_location_upload_interval_get() <= (cur_time_stamp - s_protocol_timed_location_time_stamp))
{
- //if(current_steps != s_watch_timed_location_last_steps)
+ if(0 != mmi_protocol_location_move_state_get())
{
mmi_protocol_timing_task_msg_send(MMI_PROTOCOL_TIMING_MSG_LOCATION_UPDATE, NULL);
}
s_protocol_timed_location_time_stamp = cur_time_stamp;
+ mmi_protocol_location_move_state_set(0);
}
//weather
}
+static uint8_t mmi_protocol_location_move_state_get(void)
+{
+ return s_protocol_location_move_flag;
+}
+
+static void mmi_protocol_location_move_state_set(uint8_t flag)
+{
+ s_protocol_location_move_flag = flag;
+}
+
+static void mmi_protocol_location_move_state_check_cb(uint32_t param)
+{
+ PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+
+ uos_timer_stop(s_protocol_location_move_check_timer);
+ uos_timer_start(s_protocol_location_move_check_timer, MS_TO_TICKS(PROTOCOL_LOCATION_MOVE_CHECK_TIMER_INTERVAL), 0, mmi_protocol_location_move_state_check_cb, NULL);
+
+ if(0 == mmi_protocol_location_move_state_get())
+ {
+ int16_t chip_x = 0, chip_y = 0, chip_z = 0;
+
+ xMotion_Chip_Read_XYZ(&chip_x, &chip_y, &chip_z);
+ PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d,%d,%d/%d,%d,%d\n", __FUNCTION__, __LINE__,
+ chip_x, chip_y, chip_z, s_gsensor_chip_x, s_gsensor_chip_y, s_gsensor_chip_z);
+ if((100 < abs(s_gsensor_chip_x - chip_x)) || (100 < abs(s_gsensor_chip_y - chip_y)) || (100 < abs(s_gsensor_chip_z - chip_z)))
+ {
+ PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ mmi_protocol_location_move_state_set(1);
+ }
+ s_gsensor_chip_x = chip_x;
+ s_gsensor_chip_y = chip_y;
+ s_gsensor_chip_z = chip_z;
+ }
+}
+
+void mmi_protocol_location_move_state_check(void)
+{
+ if(NULL == s_protocol_location_move_check_timer)
+ uos_timer_create(&s_protocol_location_move_check_timer);
+ else
+ uos_timer_stop(s_protocol_location_move_check_timer);
+
+ mmi_protocol_location_move_state_set(0);
+ xMotion_Chip_Read_XYZ(&s_gsensor_chip_x, &s_gsensor_chip_y, &s_gsensor_chip_z);
+ uos_timer_start(s_protocol_location_move_check_timer, MS_TO_TICKS(PROTOCOL_LOCATION_MOVE_CHECK_TIMER_INTERVAL), 0, mmi_protocol_location_move_state_check_cb, NULL);
+}
+
void mmi_protocol_timing_mission_action(void)
{
mmi_protocol_timing_task_create();
mmi_protocol_action_location();
s_protocol_timed_location_time_stamp = cur_time_stamp;
+ mmi_protocol_location_move_state_check();
mmi_protocol_action_get_weather();
s_protocol_timed_weather_time_stamp = cur_time_stamp;
uos_timer_delete(s_protocol_timing_timer);
s_protocol_timing_timer = NULL;
}
+
+ if(NULL != s_protocol_location_move_check_timer)
+ {
+ uos_timer_stop(s_protocol_location_move_check_timer);
+ uos_timer_delete(s_protocol_location_move_check_timer);
+ s_protocol_location_move_check_timer = NULL;
+ }
}
return result;
}
+#ifdef __MMI_SOS_NUMBER_NAME_SUPPORT__
+bool mmi_protocol_fzd_parse_SERVER_SET_SOS_NUMBER_NAME(unsigned char * next_buff, unsigned int next_buff_len)
+{
+ bool result = false;
+ MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_SERVER_SET_SOS_NUMBER_NAME;
+
+ if(NULL == next_buff || 0 == next_buff_len)
+ {
+ PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ return false;
+ }
+
+ result = true;
+ mmi_protocol_fzd_send_without_data(action);
+
+ uint8_t i = 0;
+ unsigned char * temp_ptr = NULL;
+ nv_watch_sos_number_t sos_number = {0};
+
+ while (NULL != next_buff)
+ {
+ temp_ptr = km_strtok_r(NULL, ",", &next_buff);
+ PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %s,%s\n", __FUNCTION__, __LINE__, temp_ptr, next_buff);
+
+ if (NULL != temp_ptr)
+ {
+ strncpy(sos_number.number[i], temp_ptr, FZD_MIN(strlen(temp_ptr), (WATCH_CONTACTS_MAX_NUMBER_LEN - 1)));
+ }
+
+ temp_ptr = km_strtok_r(NULL, ",", &next_buff);
+ if (NULL != temp_ptr)
+ {
+ uint8_t t_len = 0;
+
+ mmi_unicode_hex_str_to_utf8_str(temp_ptr, strlen(temp_ptr), sos_number.name[i], &t_len);
+ }
+
+ i++;
+ if(NV_WATCH_SOS_NUMBER_MAX <= i)
+ {
+ break;
+ }
+ }
+
+ mmi_sos_number_set(&sos_number);
+
+ return result;
+}
+#else
bool mmi_protocol_fzd_parse_SERVER_SET_SOS_NUMBER(unsigned char * next_buff, unsigned int next_buff_len)
{
bool result = false;
return result;
}
+#endif
bool mmi_protocol_fzd_parse_SERVER_SET_CENTER_NUMBER(unsigned char * next_buff, unsigned int next_buff_len)
{
#endif
MMI_FZD_ACTION_GET_WEATHER,
+#ifdef __MMI_SOS_NUMBER_NAME_SUPPORT__
+ MMI_FZD_SERVER_SET_SOS_NUMBER_NAME,
+#else
MMI_FZD_SERVER_SET_SOS_NUMBER,
+#endif
MMI_FZD_SERVER_SET_CENTER_NUMBER,
MMI_FZD_SERVER_SET_MONITOR,
MMI_FZD_ACTION_UNBIND,
bool mmi_protocol_fzd_action_send_get_weather(MMI_WATCH_LOCATION_DATA_T * location_data);
bool mmi_protocol_fzd_parse_ACTION_GET_WEATHER(unsigned char * next_buff, unsigned int next_buff_len);
+#ifdef __MMI_SOS_NUMBER_NAME_SUPPORT__
+bool mmi_protocol_fzd_parse_SERVER_SET_SOS_NUMBER_NAME(unsigned char * next_buff, unsigned int next_buff_len);
+#else
bool mmi_protocol_fzd_parse_SERVER_SET_SOS_NUMBER(unsigned char * next_buff, unsigned int next_buff_len);
+#endif
bool mmi_protocol_fzd_parse_SERVER_SET_CENTER_NUMBER(unsigned char * next_buff, unsigned int next_buff_len);
{MMI_FZD_ACTION_SEND_PHOTO, "img"},
#endif
{MMI_FZD_ACTION_GET_WEATHER, "WT"},
+ #ifdef __MMI_SOS_NUMBER_NAME_SUPPORT__
+ {MMI_FZD_SERVER_SET_SOS_NUMBER_NAME, "SOS2"},
+ #else
{MMI_FZD_SERVER_SET_SOS_NUMBER, "SOS"},
+ #endif
{MMI_FZD_SERVER_SET_CENTER_NUMBER, "CENTER"},
{MMI_FZD_SERVER_SET_MONITOR, "MONITOR"},
{MMI_FZD_ACTION_UNBIND, "DLT"},
mmi_protocol_fzd_parse_ACTION_GET_WEATHER(next_buff, next_buff_len);
break;
+ #ifdef __MMI_SOS_NUMBER_NAME_SUPPORT__
+ case MMI_FZD_SERVER_SET_SOS_NUMBER_NAME:
+ mmi_protocol_fzd_parse_SERVER_SET_SOS_NUMBER_NAME(next_buff, next_buff_len);
+ break;
+ #else
case MMI_FZD_SERVER_SET_SOS_NUMBER:
mmi_protocol_fzd_parse_SERVER_SET_SOS_NUMBER(next_buff, next_buff_len);
break;
+ #endif
case MMI_FZD_SERVER_SET_CENTER_NUMBER:
mmi_protocol_fzd_parse_SERVER_SET_CENTER_NUMBER(next_buff, next_buff_len);