#define MMI_CUSTOMER_SLEEP_SETTING_TIME_SWITCH (MMI_WATCH_SWITCH_ON) // 0-close; 1-open
#define MMI_CUSTOMER_SLEEP_SETTING_TIME_BHOUR (20) // 0-23
#define MMI_CUSTOMER_SLEEP_SETTING_TIME_BMIN (0) // 0-59
-#define MMI_CUSTOMER_SLEEP_SETTING_TIME_EHOUR (9) // 0-23
+#define MMI_CUSTOMER_SLEEP_SETTING_TIME_EHOUR (10) // 0-23
#define MMI_CUSTOMER_SLEEP_SETTING_TIME_EMIN (0) // 0-59
void mmi_gui_timing_task_create(void)
{
+ if(NULL != s_gui_timing_task_id)
+ {
+ return;
+ }
+
s_gui_timing_task_id = uos_create_task(mmi_gui_timing_task_entry,
NULL,
MMI_GUI_TIMING_MSG_QUEUE_SIZE,
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, mmi_gui_timing_timer_callback, NULL);
-
s_timing_control_timer_counter++; // 3s per time
mmi_gui_timing_task_msg_send(MMI_GUI_TIMING_MSG_3_SECOND, NULL); // 3 seconds
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, mmi_gui_timing_timer_callback, NULL);
+ uos_timer_start(s_timing_control_timer,
+ MS_TO_TICKS(MMI_GUI_TIMING_TIMER_INTERVAL),
+ MS_TO_TICKS(MMI_GUI_TIMING_TIMER_INTERVAL),
+ mmi_gui_timing_timer_callback,
+ NULL);
}
#else
#ifdef __MMI_CUSTOM_HENGAI_SLEEP_K18__
#define NV_MAX_SLEEP_STATE 50
-typedef enum
-{
- NV_LS_STATE = 11, // light sleep
- NV_DS_STATE = 12, // deep sleep
- NV_REM_STATE = 2, // rapid eye movement
-} NV_SLEEP_STATE_E;
+//typedef enum
+//{
+// NV_LS_STATE = 11, // light sleep
+// NV_DS_STATE = 12, // deep sleep
+// NV_REM_STATE = 2, // rapid eye movement
+//} NV_SLEEP_STATE_E;
typedef struct
{
uint8_t minute;
} nv_sleep_time_t;
-typedef struct
-{
- uint32_t duration; // the duration of corresponding state
- NV_SLEEP_STATE_E state; // state
-} nv_sleep_detail_data_t;
+//typedef struct
+//{
+// uint32_t duration; // the duration of corresponding state
+// NV_SLEEP_STATE_E state; // state
+//} nv_sleep_detail_data_t;
typedef struct
{
uint32_t total_sleep_time; // minutes
nv_sleep_time_t begin_sleep_time; // sleep_time_t
nv_sleep_time_t end_sleep_time;
- uint16_t state_count; // number of some sleep state
- nv_sleep_detail_data_t data[NV_MAX_SLEEP_STATE];
+// uint16_t state_count; // number of some sleep state
+// nv_sleep_detail_data_t data[NV_MAX_SLEEP_STATE];
} __packed nv_watch_hengai_sleep_data_t;
#endif
{
uos_timer_stop(s_delay_timer_id);
uos_timer_delete(s_delay_timer_id);
+ s_delay_timer_id = NULL;
}
mmi_hengai_tcp_algorithm_interface_login_action();
{
uos_timer_stop(s_hengai_sleep_gsensor_timer_id);
uos_timer_delete(s_hengai_sleep_gsensor_timer_id);
+ s_hengai_sleep_gsensor_timer_id = NULL;
}
s_hengai_sleep_gsensor_counter = 0;
static sleep_data_t s_hengai_sdata = {0};
static bool s_sleep_data_in_same_cycle = false;
-static void mmi_hengai_sleep_data_get(void);
-static void mmi_hengai_gsensor_data_get(uint32_t para);
+static TASK_HANDLE * s_hengai_k18_sleep_task_id = NULL;
+
+void mmi_hengai_k18_sleep_task_msg_send(MMI_WATCH_SLEEP_MSG_ID_E msg_id) //, void * msg_param)
+{
+ if(NULL == s_hengai_k18_sleep_task_id)
+ {
+ printf("[@CHENG_DEBUG][%s][%d]: task not exist\n", __FUNCTION__, __LINE__);
+ return;
+ }
+
+ if((MMI_WATCH_SLEEP_MSG_QUEUE_SIZE - 1) < Hal_Get_Message_Count(s_hengai_k18_sleep_task_id))
+ {
+ printf("[@CHENG_DEBUG][%s][%d]: msg queue full\n", __FUNCTION__, __LINE__);
+ return;
+ }
+
+ printf("[@CHENG_DEBUG][%s][%d]: msg_id=%d\n", __FUNCTION__, __LINE__, msg_id);
+ mmi_watch_sleep_task_msg_t * msg = Hal_Mem_Alloc(sizeof(mmi_watch_sleep_task_msg_t));
+ if(NULL == msg)
+ {
+ printf("[@CHENG_DEBUG][%s][%d]: memory alloc fail\n", __FUNCTION__, __LINE__);
+ return;
+ }
+ msg->msg_id = msg_id;
+ //msg->msg_param = msg_param;
+
+ Hal_Send_Message((TASK_ID)s_hengai_k18_sleep_task_id, (void *)msg);
+}
+
+static void mmi_hengai_k18_sleep_task_handle(void * param)
+{
+ mmi_watch_sleep_task_msg_t * msg = (mmi_watch_sleep_task_msg_t *)param;
+ MMI_WATCH_SLEEP_MSG_ID_E msg_id = msg->msg_id;
+ //void * msg_param = msg->msg_param;
+
+ printf("[@CHENG_DEBUG][%s][%d]: msg_id=%d\n", __FUNCTION__, __LINE__, msg_id);
+ switch(msg_id)
+ {
+ case MMI_WATCH_SLEEP_MSG_600MS:
+ mmi_hengai_k18_gsensor_data_get();
+ break;
+
+ default:
+ break;
+ }
+}
+
+static void mmi_hengai_k18_sleep_task_entry(void * para)
+{
+ while(NULL == s_hengai_k18_sleep_task_id)
+ {
+ uos_sleep(10);
+ }
+
+ while(1)
+ {
+ mmi_watch_sleep_task_msg_t * msg = (mmi_watch_sleep_task_msg_t *)Hal_Receive_Message((TASK_ID)s_hengai_k18_sleep_task_id, TRUE);
+
+ mmi_hengai_k18_sleep_task_handle(msg);
+
+ //Hal_Mem_Free(msg->msg_param);
+ Hal_Mem_Free(msg);
+ }
+}
+
+void mmi_hengai_k18_sleep_task_create(void)
+{
+ if(NULL != s_hengai_k18_sleep_task_id)
+ {
+ return;
+ }
+
+ s_hengai_k18_sleep_task_id = uos_create_task(mmi_hengai_k18_sleep_task_entry,
+ NULL,
+ MMI_WATCH_SLEEP_MSG_QUEUE_SIZE,
+ MMI_WATCH_SLEEP_TASK_STACK_SIZE,
+ MMI_WATCH_SLEEP_TASK_PRIORITY,
+ "mmi_hengai_k18_sleep_task");
+
+ printf("[@CHENG_DEBUG][%s][%d]: task_id=0x%x\n", __FUNCTION__, __LINE__, s_hengai_k18_sleep_task_id);
+}
#endif
-static bool mmi_hengai_sleep_data_send(void)
+static bool mmi_hengai_k18_sleep_data_send(void)
{
char * temp_buff = NULL;
uint32_t buff_size = sizeof(sleep_data_t);
char * temp_ptr = NULL;
+ uint32_t temp_len = 0;
uint32_t temp_count = 0;
uint8_t i = 0;
temp_count = strlen(temp_ptr);
}
- mmi_protocol_fzd_action_sleep_data(temp_buff, strlen(temp_buff));
+ temp_len = strlen(temp_buff);
+ UART_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: buff_size=%d,temp_len=%d\n", __FUNCTION__, __LINE__, buff_size, temp_len);
+ mmi_protocol_fzd_action_sleep_data(temp_buff, temp_len);
if(NULL != temp_buff)
{
}
}
-static void mmi_hengai_sleep_data_get(void)
+static void mmi_hengai_k18_sleep_data_get(void)
{
//if(0 != mmi_hsensor_measure_get_wear_status())
{
UART_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: result=%d\n", __FUNCTION__, __LINE__, result);
if(1 == result)
{
- mmi_hengai_sleep_data_send();
+ mmi_hengai_k18_sleep_data_send();
mmi_hengai_sleep_data_set(&s_hengai_sdata);
}
else if(-1 == result)
{
mmi_hengai_health_sleep_lib_active();
}
- #ifdef __hengai_sleep_test__
- mmi_hengai_k18_sleep_data_test_send();
- mmi_hengai_sleep_result_save(&curtime, result);
- #endif
}
_lv_memset_00(s_hengai_sleep_gsensor_data, sizeof(s_hengai_sleep_gsensor_data));
- mmi_hengai_gsensor_data_get(0);
}
-static void mmi_hengai_gsensor_data_get(uint32_t para)
+void mmi_hengai_k18_gsensor_data_get(void)
{
-#ifdef __hengai_sleep_test_server_gsensor_data__
- return;
-#endif
-
int16_t t_mems_data[32 * 3] = {0};
uint8_t i = 0;
for(i = 0; i < 30; i++) // 30 sets data per 600ms
{
uint16_t index = s_hengai_sleep_gsensor_counter * 30 + i;
+
+ if(HENGAI_SLEEP_GSENSOR_DATA_MAX <= index)
+ {
+ break;
+ }
s_hengai_sleep_gsensor_data[index].x = *(t_mems_data + i*3);
s_hengai_sleep_gsensor_data[index].y = *(t_mems_data + i*3 + 1);
s_hengai_sleep_gsensor_counter++;
if(100 <= s_hengai_sleep_gsensor_counter) // 1 minute:600ms*100
{
- uos_timer_stop(s_hengai_sleep_gsensor_timer_id);
s_hengai_sleep_gsensor_counter = 0;
- #ifdef __hengai_sleep_test__
- mmi_hengai_k18_gsensor_upload_action();
- #endif
- mmi_hengai_sleep_data_get();
- }
- else
- {
- uos_timer_stop(s_hengai_sleep_gsensor_timer_id);
- uos_timer_start(s_hengai_sleep_gsensor_timer_id, MS_TO_TICKS(600), 0, mmi_hengai_gsensor_data_get, NULL);
+ mmi_hengai_k18_sleep_data_get();
}
}
-void mmi_hengai_get_sleep_data_start(void)
+void mmi_hengai_k18_get_sleep_data_cb(uint32_t para)
{
-#ifdef __hengai_sleep_test_server_gsensor_data__
- return;
-#endif
+ mmi_hengai_k18_sleep_task_msg_send(MMI_WATCH_SLEEP_MSG_600MS); //, void * msg_param)
+}
+void mmi_hengai_get_sleep_data_start(void)
+{
printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
UART_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+
+ mmi_hengai_k18_sleep_task_create();
if(NULL != s_hengai_sleep_gsensor_timer_id)
uos_timer_stop(s_hengai_sleep_gsensor_timer_id);
//³õʼ»¯sdata
init_sleep_data(&s_hengai_sdata);
- uos_timer_start(s_hengai_sleep_gsensor_timer_id, MS_TO_TICKS(600), 0, mmi_hengai_gsensor_data_get, NULL);
+ uos_timer_start(s_hengai_sleep_gsensor_timer_id,
+ MS_TO_TICKS(600),
+ MS_TO_TICKS(600),
+ mmi_hengai_k18_get_sleep_data_cb,
+ NULL);
}
void mmi_hengai_get_sleep_data_stop(void)
{
-#ifdef __hengai_sleep_test_server_gsensor_data__
- return;
-#endif
-
printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
if(NULL != s_hengai_sleep_gsensor_timer_id)
{
uos_timer_stop(s_hengai_sleep_gsensor_timer_id);
uos_timer_delete(s_hengai_sleep_gsensor_timer_id);
+ s_hengai_sleep_gsensor_timer_id = NULL;
}
s_sleep_data_in_same_cycle = false;
if(nv_data_length != UI_NV_Write_Req(NV_SECTION_UI_HENGAI_SLEEP_DATA, 0, nv_data_length, (uint8_t *)&s_hengai_sleep_data))
{
- SUNDRY_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: nv write fail\n", __FUNCTION__, __LINE__);
+ printf("[@CHENG_DEBUG][%s][%d]: nv write fail\n", __FUNCTION__, __LINE__);
}
}
if(nv_data_length != UI_NV_Read_Req(NV_SECTION_UI_HENGAI_SLEEP_DATA, 0, nv_data_length, (uint8_t *)&s_hengai_sleep_data))
{
- SUNDRY_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: nv read fail\n", __FUNCTION__, __LINE__);
+ printf("[@CHENG_DEBUG][%s][%d]: nv read fail\n", __FUNCTION__, __LINE__);
_lv_memset_00(&s_hengai_sleep_data, sizeof(nv_watch_hengai_sleep_data_t));
}
}
-void mmi_hengai_sleep_data_set(nv_watch_hengai_sleep_data_t * data)
+void mmi_hengai_sleep_data_set(sleep_data_t * data) // (nv_watch_hengai_sleep_data_t * data)
{
if(NULL == data)
return;
if(false == s_sleep_data_in_same_cycle)
{
+ UART_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+
s_sleep_data_in_same_cycle = true;
- _lv_memcpy(&s_hengai_sleep_data, data, sizeof(nv_watch_hengai_sleep_data_t));
+
+ s_hengai_sleep_data.total_sleep_time = data->total_sleep_time;
+ _lv_memcpy(&(s_hengai_sleep_data.begin_sleep_time), &(data->begin_sleep_time), sizeof(nv_sleep_time_t));
+ _lv_memcpy(&(s_hengai_sleep_data.end_sleep_time), &(data->end_sleep_time), sizeof(nv_sleep_time_t));
}
else
{
+ UART_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+
s_hengai_sleep_data.total_sleep_time += data->total_sleep_time;
_lv_memcpy(&(s_hengai_sleep_data.end_sleep_time), &(data->end_sleep_time), sizeof(nv_sleep_time_t));
-
- if(NV_MAX_SLEEP_STATE > s_hengai_sleep_data.state_count)
- {
- uint8_t count = s_hengai_sleep_data.state_count;
- s_hengai_sleep_data.state_count += data->state_count;
- if(NV_MAX_SLEEP_STATE < s_hengai_sleep_data.state_count)
- s_hengai_sleep_data.state_count = NV_MAX_SLEEP_STATE;
-
- _lv_memcpy(s_hengai_sleep_data.data + count, data->data, sizeof(nv_sleep_detail_data_t) * (s_hengai_sleep_data.state_count - count));
- }
}
mmi_hengai_sleep_data_nv_write();
}
// update time
if(0 != s_hengai_sleep_data.total_sleep_time
- && 0 != s_hengai_sleep_data.end_sleep_time.hour
- && 0 != s_hengai_sleep_data.end_sleep_time.minute
+ && (0 != s_hengai_sleep_data.end_sleep_time.hour
+ || 0 != s_hengai_sleep_data.end_sleep_time.minute
+ )
)
{
lv_obj_t * label_prompt = lv_label_create(cont, NULL);
}
#endif
+
+
+// [e9c46fe559102558fe099e794cd571a2oxLwDqcwJCtiPSRu*876226002021881*0067*SLEEP_DATA,2024-10-24 11:11,2024-10-24 13:48,157,10,11,0,2,109,12,2,11,3,12,2,11,1,12,24,2,10,12,2,11,4]
+// [34dd6188c1d1f31c95948171aad75c1boxLwDqcwJCtiPSRu*876226002021881*0063*SLEEP_DATA,2024-10-18 13:54,2024-10-18 15:39,107,10,11,0,2,24,12,9,2,5,12,7,2,5,12,7,2,46,12,2,11,2]
+// [26535ab1fed638806c9c532665c7bdd6oxLwDqcwJCtiPSRu*876226002021881*0054*SLEEP_DATA,2024-10-25 10:51,2024-10-25 12:06,75,7,11,1,12,3,2,16,12,7,2,38,12,7,11,3]
+// [3116327bf6a1a60db350f638f7b0bb69oxLwDqcwJCtiPSRu*876226002021881*0088*SLEEP_DATA,2024-10-25 12:10,2024-10-25 16:00,230,17,11,3,12,1,2,8,12,7,2,37,12,7,2,11,12,7,2,11,12,11,2,39,12,7,2,31,12,7,2,40,12,2,11,1]
+
+
+
#endif
#ifdef __MMI_CUSTOM_HENGAI_SLEEP_K18__
+#define MMI_WATCH_SLEEP_TASK_PRIORITY 221
+#define MMI_WATCH_SLEEP_TASK_STACK_SIZE (1 * 1024)
+#define MMI_WATCH_SLEEP_MSG_QUEUE_SIZE (32) // (16)
+
+
+typedef enum
+{
+ MMI_WATCH_SLEEP_MSG_ID_START,
+
+ MMI_WATCH_SLEEP_MSG_600MS,
+
+ MMI_WATCH_SLEEP_MSG_ID_END
+}MMI_WATCH_SLEEP_MSG_ID_E;
+
+typedef struct
+{
+ uint16_t msg_id;
+ //void * msg_param;
+}mmi_watch_sleep_task_msg_t;
+
void mmi_hengai_get_sleep_data_start(void);
void mmi_hengai_get_sleep_data_stop(void);
}
mmi_watch_authenticate_flag_set(1);
- mmi_launcher_tcp_first_connect(0);
+ mmi_launcher_tcp_first_connect_check_start();
}
else
{
#define PROTOCOL_LOCATION_MOVE_CHECK_TIMER_INTERVAL (2 * 1000) // ms
-static void mmi_protocol_timing_timer_callback(uint32_t param);
+static void mmi_protocol_timing_timer_cb_action(void);
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)
{
PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: msg_id=%d\n",__FUNCTION__,__LINE__, msg_id);
switch(msg_id)
{
+ case MMI_PROTOCOL_TIMING_MSG_TIMER_CB:
+ mmi_protocol_timing_timer_cb_action();
+ break;
+
case MMI_PROTOCOL_TIMING_MSG_HEARTBEAT:
mmi_protocol_fzd_action_HEARTBEAT();
break;
PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: task_id=0x%x\n",__FUNCTION__,__LINE__, s_protocol_timing_task_id);
}
-static void mmi_protocol_timing_timer_callback(uint32_t param)
+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__);
+
+ 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),
+ MS_TO_TICKS(PROTOCOL_LOCATION_MOVE_CHECK_TIMER_INTERVAL),
+ mmi_protocol_location_move_state_check_cb,
+ NULL);
+}
+
+static void mmi_protocol_timing_timer_cb_action(void)
{
uint32_t cur_time_stamp = 0;
Hal_Rtc_Gettime_Count_Utc(&cur_time_stamp);
PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: cur_time_stamp=%d\n", __FUNCTION__, __LINE__, cur_time_stamp);
- uos_timer_stop(s_protocol_timing_timer);
- uos_timer_start(s_protocol_timing_timer, MS_TO_TICKS(PROTOCOL_TIMING_TIMER_INTERVAL), 0, mmi_protocol_timing_timer_callback, NULL);
-
// heartbeat
if(mmi_protocol_watch_heartbeat_action_interval_get() <= (cur_time_stamp - s_protocol_heartbeat_time_stamp))
{
}
-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)
+static void mmi_protocol_timing_timer_callback(uint32_t param)
{
- 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);
+ mmi_protocol_timing_task_msg_send(MMI_PROTOCOL_TIMING_MSG_TIMER_CB, NULL);
}
void mmi_protocol_timing_mission_action(void)
else
uos_timer_stop(s_protocol_timing_timer);
- uos_timer_start(s_protocol_timing_timer, MS_TO_TICKS(PROTOCOL_TIMING_TIMER_INTERVAL), 0, mmi_protocol_timing_timer_callback, NULL);
+ uos_timer_start(s_protocol_timing_timer,
+ MS_TO_TICKS(PROTOCOL_TIMING_TIMER_INTERVAL),
+ MS_TO_TICKS(PROTOCOL_TIMING_TIMER_INTERVAL),
+ mmi_protocol_timing_timer_callback,
+ NULL);
}
void mmi_protocol_timing_mission_stop(void)
{
MMI_PROTOCOL_TIMING_MSG_ID_START,
+ MMI_PROTOCOL_TIMING_MSG_TIMER_CB,
MMI_PROTOCOL_TIMING_MSG_HEARTBEAT,
MMI_PROTOCOL_TIMING_MSG_LOCATION_UPDATE,
MMI_PROTOCOL_TIMING_MSG_WEATHER_UPDATE,
static void * s_tcp_first_connect_timer_id = NULL;
static uint32_t s_tcp_first_connect_time = 0;
-void mmi_launcher_tcp_first_connect(uint32_t para)
+static void mmi_launcher_tcp_first_connect_check_cb(uint32_t para)
{
if((FALSE == watch_modem_sim_present_check_req())
&& (MMI_TCP_FIRST_CONNECT_TIMEOUT <= s_tcp_first_connect_time)
{
printf("[@CHENG_DEBUG][%s][%d]: \n",__FUNCTION__,__LINE__);
- if(NULL == s_tcp_first_connect_timer_id)
- {
- uos_timer_create(&s_tcp_first_connect_timer_id);
- }
- uos_timer_stop(s_tcp_first_connect_timer_id);
- uos_timer_start(s_tcp_first_connect_timer_id,
- MS_TO_TICKS(MMI_TCP_FIRST_CONNECT_TIME_INTERVAL),
- MS_TO_TICKS(MMI_TCP_FIRST_CONNECT_TIME_INTERVAL),
- mmi_launcher_tcp_first_connect,
- NULL);
if(true == mmi_poweron_logo_is_finish())
{
s_tcp_first_connect_time += MMI_TCP_FIRST_CONNECT_TIME_INTERVAL;
}
}
+void mmi_launcher_tcp_first_connect_check_start(void)
+{
+ printf("[@CHENG_DEBUG][%s][%d]: \n",__FUNCTION__,__LINE__);
+
+ s_tcp_first_connect_time = 0;
+
+ if(NULL == s_tcp_first_connect_timer_id)
+ uos_timer_create(&s_tcp_first_connect_timer_id);
+ else
+ uos_timer_stop(s_tcp_first_connect_timer_id);
+
+ uos_timer_start(s_tcp_first_connect_timer_id,
+ MS_TO_TICKS(MMI_TCP_FIRST_CONNECT_TIME_INTERVAL),
+ MS_TO_TICKS(MMI_TCP_FIRST_CONNECT_TIME_INTERVAL),
+ mmi_launcher_tcp_first_connect_check_cb,
+ NULL);
+}
+
#ifdef __MMI_ZHSX_SUPPORT_AUTHENTICATE__
#define MMI_AUTHENTICATE_CONNECT_TIME_INTERVAL (1000 * 5) // ms
#define MMI_AUTHENTICATE_CONNECT_TIMEOUT (1000 * 60 * 3) // ms
send_task_msg_authenticate_action();
}
-void mmi_watch_authenticate_pre(uint32_t para)
+static void mmi_watch_authenticate_check_cb(uint32_t para)
{
if((FALSE == watch_modem_sim_present_check_req())
&& (MMI_AUTHENTICATE_CONNECT_TIMEOUT <= s_authenticate_connect_time)
{
printf("[@CHENG_DEBUG][%s][%d]: \n",__FUNCTION__,__LINE__);
- if(NULL == s_authenticate_connect_timer_id)
- {
- uos_timer_create(&s_authenticate_connect_timer_id);
- }
- uos_timer_stop(s_authenticate_connect_timer_id);
- uos_timer_start(s_authenticate_connect_timer_id,
- MS_TO_TICKS(MMI_AUTHENTICATE_CONNECT_TIME_INTERVAL),
- MS_TO_TICKS(MMI_AUTHENTICATE_CONNECT_TIME_INTERVAL),
- mmi_watch_authenticate_pre,
- NULL);
if(true == mmi_poweron_logo_is_finish())
{
s_authenticate_connect_time += MMI_AUTHENTICATE_CONNECT_TIME_INTERVAL;
}
}
}
+
+static void mmi_watch_authenticate_check_start(void)
+{
+ printf("[@CHENG_DEBUG][%s][%d]: \n",__FUNCTION__,__LINE__);
+
+ s_authenticate_connect_time = 0;
+
+ if(NULL == s_authenticate_connect_timer_id)
+ uos_timer_create(&s_authenticate_connect_timer_id);
+ else
+ uos_timer_stop(s_authenticate_connect_timer_id);
+
+ uos_timer_start(s_authenticate_connect_timer_id,
+ MS_TO_TICKS(MMI_AUTHENTICATE_CONNECT_TIME_INTERVAL),
+ MS_TO_TICKS(MMI_AUTHENTICATE_CONNECT_TIME_INTERVAL),
+ mmi_watch_authenticate_check_cb,
+ NULL);
+}
#endif
#endif
#ifdef __MMI_ZHSX_SUPPORT_AUTHENTICATE__
if(0 == mmi_watch_authenticate_flag_get())
{
- mmi_watch_authenticate_pre(0);
+ mmi_watch_authenticate_check_start();
}
else
{
- mmi_launcher_tcp_first_connect(0);
+ mmi_launcher_tcp_first_connect_check_start();
}
#else
- mmi_launcher_tcp_first_connect(0);
+ mmi_launcher_tcp_first_connect_check_start();
#endif
#else
void send_tcp_cmdmsg(int cmd_type,void* cmd_param);
#ifdef __MMI_ZHSX_SUPPORT__
-void mmi_launcher_tcp_first_connect(uint32_t para);
+void mmi_launcher_tcp_first_connect_check_start(void);
#endif
#ifdef __cplusplus