gengxin
author@CHENG <2393524978@qq.com>
Thu, 23 May 2024 07:21:51 +0000 (15:21 +0800)
committer@CHENG <2393524978@qq.com>
Thu, 23 May 2024 07:21:51 +0000 (15:21 +0800)
2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_measure.c
2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_measure.h
2.sdk/sdk/gui/lv_watch/lv_apps/sms_msg/sms_msg.c
2.sdk/sdk/gui/lv_watch/mmi_location/mmi_location.c
2.sdk/sdk/gui/lv_watch/mmi_location/mmi_location.h
2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.c
2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.h
2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.c
2.sdk/sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_msg_handler_impl.c

index b97c7b5..34a77b8 100644 (file)
@@ -181,7 +181,7 @@ void mmi_tsensor_body_value_get(float * body_value)
 
 bool mmi_health_measure_wear_state_get(void)
 {
-       bool is_wear = TRUE;
+       bool is_wear = true;
 
        if(0 == mmi_hsensor_measure_get_wear_status())
                is_wear = false;
@@ -323,9 +323,10 @@ void mmi_health_measure_timed_info_nv_read(void)
        if(nv_data_length != UI_NV_Read_Req(NV_SECTION_UI_HEALTH_MEASURE, 0, nv_data_length, (uint8_t *)&s_health_measure_timed_data))
        {
                HEALTH_MEASURE_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: nv read fail\n", __FUNCTION__, __LINE__);
+               _lv_memset_00(&s_health_measure_timed_data, nv_data_length);
        }
 
-       //_lv_ll_clear(&s_health_measure_timed_ll);
+       _lv_ll_clear(&s_health_measure_timed_ll);
        _lv_ll_init(&s_health_measure_timed_ll, sizeof(MMI_HEALTH_MEASURE_TYPE_E));
 }
 
@@ -345,6 +346,10 @@ void mmi_health_measure_timed_info_nv_default(nv_watch_health_measure_timed_t *
        data->blood_glucose_timed_interval = MMI_HEALTH_BLOOD_GLUCOSE_TIMED_INTERVAL;
 }
 
+void mmi_health_measure_timed_list_clear(void)
+{
+       _lv_ll_clear(&s_health_measure_timed_ll);
+}
 
 void mmi_health_measure_timed_list_node_remove(MMI_HEALTH_MEASURE_TYPE_E measure_type)
 {
@@ -438,7 +443,16 @@ bool mmi_health_measure_heart_timed_action(bool direct_trigger, uint32_t cur_tim
                if(true == direct_trigger 
                        || s_health_measure_timed_data.heart_timed_interval <= (cur_time_stamp - s_health_measure_heart_timed_time_stamp))
                {
-                       HEALTH_MEASURE_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+                       if(true == direct_trigger)
+                       {
+                               s_health_measure_heart_timed_time_stamp = 0;
+                       }
+                       
+                       HEALTH_MEASURE_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: cur_stamp=%d,timed_stamp=%d\n", __FUNCTION__, __LINE__, cur_time_stamp, s_health_measure_heart_timed_time_stamp);
+                       
+                       //char info_buf[64] = {0};
+                       //sprintf(info_buf, "heart:%d-%d-%d", direct_trigger, cur_time_stamp, s_health_measure_heart_timed_time_stamp);
+                       //mmi_debug_info_write_to_file(info_buf);
                        
                        mmi_health_measure_timed_list_node_add(MMI_HEALTH_MEASURE_HEART);
                        if(true == mmi_health_measure_timed_list_trigger(MMI_HEALTH_MEASURE_HEART))
@@ -460,7 +474,12 @@ bool mmi_health_measure_temperature_timed_action(bool direct_trigger, uint32_t c
                if(true == direct_trigger 
                        || s_health_measure_timed_data.temperature_timed_interval <= (cur_time_stamp - s_health_measure_temperature_timed_time_stamp))
                {
-                       HEALTH_MEASURE_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+                       if(true == direct_trigger)
+                       {
+                               s_health_measure_temperature_timed_time_stamp = 0;
+                       }
+                       
+                       HEALTH_MEASURE_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: cur_stamp=%d,timed_stamp=%d\n", __FUNCTION__, __LINE__, cur_time_stamp, s_health_measure_temperature_timed_time_stamp);
                        
                        mmi_health_measure_timed_list_node_add(MMI_HEALTH_MEASURE_TEMPERATURE);
                        if(true == mmi_health_measure_timed_list_trigger(MMI_HEALTH_MEASURE_TEMPERATURE))
@@ -482,6 +501,11 @@ bool mmi_health_measure_blood_timed_action(bool direct_trigger, uint32_t cur_tim
                if(true == direct_trigger 
                        || s_health_measure_timed_data.blood_timed_interval <= (cur_time_stamp - s_health_measure_blood_timed_time_stamp))
                {
+                       if(true == direct_trigger)
+                       {
+                               s_health_measure_blood_timed_time_stamp = 0;
+                       }
+                       
                        mmi_health_measure_timed_list_node_add(MMI_HEALTH_MEASURE_BLOOD);
                        if(true == mmi_health_measure_timed_list_trigger(MMI_HEALTH_MEASURE_BLOOD))
                        {
@@ -503,6 +527,11 @@ bool mmi_health_measure_spo2_timed_action(bool direct_trigger, uint32_t cur_time
                        || s_health_measure_timed_data.spo2_timed_interval <= (cur_time_stamp - s_health_measure_spo2_timed_time_stamp)
                        )
                {
+                       if(true == direct_trigger)
+                       {
+                               s_health_measure_spo2_timed_time_stamp = 0;
+                       }
+                       
                        mmi_health_measure_timed_list_node_add(MMI_HEALTH_MEASURE_SPO2);
                        if(true == mmi_health_measure_timed_list_trigger(MMI_HEALTH_MEASURE_SPO2))
                        {
@@ -524,6 +553,11 @@ bool mmi_health_measure_blood_glucose_timed_action(bool direct_trigger, uint32_t
                        || s_health_measure_timed_data.blood_glucose_timed_interval <= (cur_time_stamp - s_health_measure_blood_glucose_timed_time_stamp)
                        )
                {
+                       if(true == direct_trigger)
+                       {
+                               s_health_measure_blood_glucose_timed_time_stamp = 0;
+                       }
+                       
                        mmi_health_measure_timed_list_node_add(MMI_HEALTH_MEASURE_BLOOD_GLUCOSE);
                        if(true == mmi_health_measure_timed_list_trigger(MMI_HEALTH_MEASURE_BLOOD_GLUCOSE))
                        {
@@ -537,12 +571,23 @@ bool mmi_health_measure_blood_glucose_timed_action(bool direct_trigger, uint32_t
        return false;
 }
 
+bool mmi_health_measure_timed_mission_action(uint32_t cur_time_stamp, bool is_first)
+{
+       mmi_health_measure_heart_timed_action(is_first, cur_time_stamp);
+       mmi_health_measure_temperature_timed_action(is_first, cur_time_stamp);
+       mmi_health_measure_blood_timed_action(is_first, cur_time_stamp);
+       mmi_health_measure_spo2_timed_action(is_first, cur_time_stamp);
+       mmi_health_measure_blood_glucose_timed_action(is_first, cur_time_stamp);
+       
+       return true;
+}
+
 void mmi_health_measure_server_set_save(MMI_HEALTH_MEASURE_TYPE_E measure_type, int value_interval)
 {
        uint8_t flag = (0 == value_interval) ? 0 : 1;
        uint32_t cur_time_stamp = 0;
        
-       Hal_Rtc_Gettime_Count(&cur_time_stamp);
+       Hal_Rtc_Gettime_Count_Utc(&cur_time_stamp); // Hal_Rtc_Gettime_Count(&cur_time_stamp);
        
        switch(measure_type)
        {
@@ -655,9 +700,9 @@ bool mmi_health_measure_spo2_data_ui_get(uint16_t * spo2_value)
        return true;
 }
 
-void mmi_health_measure_send_heart(void)
+void mmi_health_measure_send_heart(void * param)
 {
-       uint16_t heart_value = s_health_measure_run_data.heart_value;
+       uint16_t heart_value = ((mmi_health_measure_msg_param_t *)param)->heart_value;
 
        if(0 == heart_value)
        {
@@ -666,16 +711,16 @@ void mmi_health_measure_send_heart(void)
        }
        
        mmi_protocol_action_send_heart(heart_value);
-       
+
        nv_watch_health_info_t health_info = {0};
        mmi_health_info_get(&health_info);
        health_info.heart_value = heart_value;
        mmi_health_info_set(&health_info);
 }
 
-void mmi_health_measure_send_temperature(void)
+void mmi_health_measure_send_temperature(void * param)
 {
-       float body_value = s_health_measure_run_data.body_value;
+       float body_value = ((mmi_health_measure_msg_param_t *)param)->body_value;
 
        if(0.0 == body_value)
        {
@@ -691,10 +736,10 @@ void mmi_health_measure_send_temperature(void)
        mmi_health_info_set(&health_info);
 }
 
-void mmi_health_measure_send_blood(void)
+void mmi_health_measure_send_blood(void * param)
 {
-       uint16_t blood_high_value = s_health_measure_run_data.blood_high_value;
-       uint16_t blood_low_value = s_health_measure_run_data.blood_low_value;
+       uint16_t blood_high_value = ((mmi_health_measure_msg_param_t *)param)->blood_high_value;
+       uint16_t blood_low_value = ((mmi_health_measure_msg_param_t *)param)->blood_low_value;
 
        if(0 == blood_high_value || 0 == blood_low_value)
        {
@@ -711,9 +756,9 @@ void mmi_health_measure_send_blood(void)
        mmi_health_info_set(&health_info);
 }
 
-void mmi_health_measure_send_spo2(void)
+void mmi_health_measure_send_spo2(void * param)
 {
-       uint16_t spo2_value = s_health_measure_run_data.spo2_value;
+       uint16_t spo2_value = ((mmi_health_measure_msg_param_t *)param)->spo2_value;
 
        if(0 == spo2_value)
        {
@@ -729,9 +774,9 @@ void mmi_health_measure_send_spo2(void)
        mmi_health_info_set(&health_info);
 }
 
-void mmi_health_measure_send_blood_glucose(void)
+void mmi_health_measure_send_blood_glucose(void * param)
 {
-       float blood_glucose_value = s_health_measure_run_data.blood_glucose_value;
+       float blood_glucose_value = ((mmi_health_measure_msg_param_t *)param)->blood_glucose_value;
 
        if(0.0 == blood_glucose_value)
        {
@@ -768,31 +813,69 @@ void mmi_health_measure_process_finish(void)
        mmi_health_measure_process_timer_stop();
        mmi_health_measure_timed_list_node_remove(s_health_measure_run_data.measure_type);
 
+       mmi_health_measure_msg_param_t * param = NULL;
+       
        switch(s_health_measure_run_data.measure_type)
        {
                case MMI_HEALTH_MEASURE_HEART:
                        mmi_hsensor_close();
-                       mmi_health_measure_send_heart();
+                       param = Hal_Mem_Alloc(sizeof(mmi_health_measure_msg_param_t));
+                       if(NULL != param)
+                       {
+                               Hal_Mem_Set(param, 0x0, sizeof(mmi_health_measure_msg_param_t));
+                               param->heart_value = s_health_measure_run_data.heart_value;
+
+                               mmi_health_measure_task_msg_send(MMI_HEALTH_MEASURE_MSG_HEART_FINISHED, param);
+                       }
                        break;
        
                case MMI_HEALTH_MEASURE_TEMPERATURE:
                        mmi_tsensor_close();
-                       mmi_health_measure_send_temperature();
+                       param = Hal_Mem_Alloc(sizeof(mmi_health_measure_msg_param_t));
+                       if(NULL != param)
+                       {
+                               Hal_Mem_Set(param, 0x0, sizeof(mmi_health_measure_msg_param_t));
+                               param->body_value = s_health_measure_run_data.body_value;
+
+                               mmi_health_measure_task_msg_send(MMI_HEALTH_MEASURE_MSG_TEMPERATURE_FINISHED, param);
+                       }
                        break;
        
                case MMI_HEALTH_MEASURE_BLOOD:
                        mmi_hsensor_close();
-                       mmi_health_measure_send_blood();
+                       param = Hal_Mem_Alloc(sizeof(mmi_health_measure_msg_param_t));
+                       if(NULL != param)
+                       {
+                               Hal_Mem_Set(param, 0x0, sizeof(mmi_health_measure_msg_param_t));
+                               param->blood_high_value = s_health_measure_run_data.blood_high_value;
+                               param->blood_low_value = s_health_measure_run_data.blood_low_value;
+
+                               mmi_health_measure_task_msg_send(MMI_HEALTH_MEASURE_MSG_BLOOD_FINISHED, param);
+                       }
                        break;
                        
                case MMI_HEALTH_MEASURE_SPO2:
                        mmi_hsensor_close();
-                       mmi_health_measure_send_spo2();
+                       param = Hal_Mem_Alloc(sizeof(mmi_health_measure_msg_param_t));
+                       if(NULL != param)
+                       {
+                               Hal_Mem_Set(param, 0x0, sizeof(mmi_health_measure_msg_param_t));
+                               param->spo2_value = s_health_measure_run_data.spo2_value;
+
+                               mmi_health_measure_task_msg_send(MMI_HEALTH_MEASURE_MSG_SPO2_FINISHED, param);
+                       }
                        break;
 
                case MMI_HEALTH_MEASURE_BLOOD_GLUCOSE:
                        mmi_hsensor_close();
-                       mmi_health_measure_send_blood_glucose();
+                       param = Hal_Mem_Alloc(sizeof(mmi_health_measure_msg_param_t));
+                       if(NULL != param)
+                       {
+                               Hal_Mem_Set(param, 0x0, sizeof(mmi_health_measure_msg_param_t));
+                               param->blood_glucose_value = s_health_measure_run_data.blood_glucose_value;
+
+                               mmi_health_measure_task_msg_send(MMI_HEALTH_MEASURE_MSG_BLOOD_GLUCOSE_FINISHED, param);
+                       }
                        break;
        
                default:
@@ -1021,6 +1104,116 @@ void mmi_health_measure_factory_mode_clean(void)
        {
                mmi_health_measure_interrupt();
        }
+       _lv_memset_00(&s_health_measure_run_data, sizeof(s_health_measure_run_data));
+}
+
+
+
+#define MMI_HEALTH_MEASURE_TASK_PRIORITY 221
+#define MMI_HEALTH_MEASURE_TASK_STACK_SIZE (8 * 1024)
+#define MMI_HEALTH_MEASURE_MSG_QUEUE_SIZE (16)
+
+TASK_HANDLE * s_health_measure_task_id = NULL;
+
+
+void mmi_health_measure_task_msg_send(MMI_HEALTH_MEASURE_MSG_ID_E msg_id, void * param)
+{
+       if(NULL == s_health_measure_task_id)
+       {
+               HEALTH_MEASURE_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: task not exist\n",__FUNCTION__,__LINE__);
+               if(NULL != param)
+                       Hal_Mem_Free(param);
+               
+               return;
+       }
+       
+       if((MMI_HEALTH_MEASURE_MSG_QUEUE_SIZE - 1) < Hal_Get_Message_Count(s_health_measure_task_id))
+       {
+               HEALTH_MEASURE_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: msg queue full\n",__FUNCTION__,__LINE__);
+               if(NULL != param)
+                       Hal_Mem_Free(param);
+               
+               return;
+       }
+
+       HEALTH_MEASURE_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: msg_id=%d\n",__FUNCTION__,__LINE__, msg_id);
+    mmi_health_measure_task_msg_t * msg = Hal_Mem_Alloc(sizeof(mmi_health_measure_task_msg_t));
+       msg->msg_id = msg_id;
+       msg->msg_param = param;
+   
+    Hal_Send_Message((TASK_ID)s_health_measure_task_id, (void *)msg);
 }
+
+static void mmi_health_measure_task_handle(void * param)
+{
+       mmi_health_measure_task_msg_t * msg = (mmi_health_measure_task_msg_t *)param;
+       MMI_HEALTH_MEASURE_MSG_ID_E msg_id = msg->msg_id;
+       void * msg_param = msg->msg_param;
+
+       HEALTH_MEASURE_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: msg_id=%d\n",__FUNCTION__,__LINE__, msg_id);
+    switch(msg_id)
+       {
+        case MMI_HEALTH_MEASURE_MSG_HEART_FINISHED:
+                       mmi_health_measure_send_heart(msg_param);
+            break;
+
+        case MMI_HEALTH_MEASURE_MSG_TEMPERATURE_FINISHED:
+                       mmi_health_measure_send_temperature(msg_param);
+            break;
+
+        case MMI_HEALTH_MEASURE_MSG_BLOOD_FINISHED:
+                       mmi_health_measure_send_blood(msg_param);
+            break;
+
+        case MMI_HEALTH_MEASURE_MSG_SPO2_FINISHED:
+                       mmi_health_measure_send_spo2(msg_param);
+            break;
+                       
+               case MMI_HEALTH_MEASURE_MSG_BLOOD_GLUCOSE_FINISHED:
+                       mmi_health_measure_send_blood_glucose(msg_param);
+                       break;
+
+               default:
+                       break;
+    }
+}
+
+static void mmi_health_measure_task_entry(void * para)
+{
+    while(NULL == s_health_measure_task_id)
+       {
+        uos_sleep(10);
+    }
+
+    while(1)
+       {
+        mmi_health_measure_task_msg_t * msg = (mmi_health_measure_task_msg_t *)Hal_Receive_Message((TASK_ID)s_health_measure_task_id, TRUE);
+
+               mmi_health_measure_task_handle(msg);
+
+        Hal_Mem_Free(msg->msg_param);
+        Hal_Mem_Free(msg);
+    }
+}
+
+void mmi_health_measure_task_init(void)
+{
+       if(NULL != s_health_measure_task_id)
+       {
+               HEALTH_MEASURE_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: task_id=0x%x\n",__FUNCTION__,__LINE__, s_health_measure_task_id);
+               return;
+       }
+
+       s_health_measure_task_id = uos_create_task(mmi_health_measure_task_entry,
+                                                                                               NULL,
+                                                                                               MMI_HEALTH_MEASURE_MSG_QUEUE_SIZE,
+                                                                                               MMI_HEALTH_MEASURE_TASK_STACK_SIZE,
+                                                                                               MMI_HEALTH_MEASURE_TASK_PRIORITY,
+                                                                                               "mmi_health_measure_task");
+
+       HEALTH_MEASURE_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: task_id=0x%x\n",__FUNCTION__,__LINE__, s_health_measure_task_id);
+}
+
+
 #endif
 
index 67fa9dd..81e15d5 100644 (file)
@@ -103,6 +103,7 @@ void mmi_tsensor_body_value_get(float * body_value);
 bool mmi_health_measure_wear_state_get(void);
 //MMI_HEALTH_MEASURE_STATE_E mmi_health_measure_state_get(void);
 bool mmi_health_measure_state_is_ui_measure(void);
+bool mmi_health_measure_state_is_in_measure(void);
 
 bool mmi_health_measure_heart_data_ui_get(uint16_t * heart_value);
 bool mmi_health_measure_temperature_data_ui_get(float * body_value, float * wrist_value);
@@ -118,11 +119,45 @@ void mmi_health_measure_ui_measure_start(MMI_HEALTH_MEASURE_TYPE_E measure_type)
 
 void mmi_health_measure_timed_info_nv_read(void);
 void mmi_health_measure_timed_info_nv_default(nv_watch_health_measure_timed_t * data);
-bool mmi_health_measure_heart_timed_action(bool direct_trigger, uint32_t cur_time_stamp);
-bool mmi_health_measure_temperature_timed_action(bool direct_trigger, uint32_t cur_time_stamp);
-bool mmi_health_measure_blood_timed_action(bool direct_trigger, uint32_t cur_time_stamp);
-bool mmi_health_measure_spo2_timed_action(bool direct_trigger, uint32_t cur_time_stamp);
-bool mmi_health_measure_blood_glucose_timed_action(bool direct_trigger, uint32_t cur_time_stamp);
+void mmi_health_measure_timed_list_clear(void);
+bool mmi_health_measure_timed_mission_action(uint32_t cur_time_stamp, bool is_first);
+
+
+
+typedef enum
+{
+       MMI_HEALTH_MEASURE_MSG_ID_START,
+
+    MMI_HEALTH_MEASURE_MSG_HEART_FINISHED,
+    MMI_HEALTH_MEASURE_MSG_TEMPERATURE_FINISHED,
+    MMI_HEALTH_MEASURE_MSG_BLOOD_FINISHED,
+    MMI_HEALTH_MEASURE_MSG_SPO2_FINISHED,
+       MMI_HEALTH_MEASURE_MSG_BLOOD_GLUCOSE_FINISHED,
+
+    MMI_HEALTH_MEASURE_MSG_ID_END
+}MMI_HEALTH_MEASURE_MSG_ID_E;
+
+typedef struct
+{
+       uint16_t msg_id;
+       void * msg_param;
+}mmi_health_measure_task_msg_t;
+
+typedef struct
+{
+       uint16_t heart_value;
+       uint16_t blood_high_value;
+       uint16_t blood_low_value;
+       uint16_t spo2_value;
+       float wrist_value;
+       float body_value;
+       float blood_glucose_value;
+}mmi_health_measure_msg_param_t;
+
+
+void mmi_health_measure_task_msg_send(MMI_HEALTH_MEASURE_MSG_ID_E msg_id, void * param);
+void mmi_health_measure_task_init(void);
+
 
 #endif
 
index 9639616..710c938 100644 (file)
@@ -439,9 +439,15 @@ void sms_msg_app_new_sms_info_ind(app_adp_new_sms_info_ind_t *sms_info)
                sms_msg_write_nvm(nvm_sms_list);
                lv_mem_free(nvm_sms_list);
 
-       #ifdef __MMI_ZHSX_SUPPORT_DO_NOT_DISTURB__
-               if(false == mmi_watch_is_in_do_not_disturb_time())
-       #endif
+               if(true
+                       && (false == mmi_active_screen_is_prohibit_interrupted())
+                       #ifdef __MMI_ZHSX_SUPPORT_DO_NOT_DISTURB__
+                       && (false == mmi_watch_is_in_do_not_disturb_time())
+                       #endif
+                       #ifdef __MMI_ZHSX_SUPPORT_HEALTH_SENSOR__
+                       && (false == mmi_health_measure_state_is_ui_measure())
+                       #endif
+                       )
                {
                        uint8_t volume = 0;
                        
index cdd6225..01a531a 100644 (file)
@@ -425,9 +425,14 @@ static void mmi_watch_location_mission_timer_cb(uint32_t para)
 {
        LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: total=%d,count=%d\n", __FUNCTION__, __LINE__, MMI_WATCH_LOCATION_CHECK_TIMES_COUNT_MAX, s_watch_location_times_check_count);
 
-       //mmi_watch_location_gps_data_get();
-       
        s_watch_location_times_check_count++;
+       mmi_protocol_timing_task_msg_send(MMI_PROTOCOL_MSG_LOCATION_DATA_CHECK, NULL);
+}
+
+void mmi_watch_location_data_check(void)
+{
+       LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: total=%d,count=%d\n", __FUNCTION__, __LINE__, MMI_WATCH_LOCATION_CHECK_TIMES_COUNT_MAX, s_watch_location_times_check_count);
+
        if(MMI_WATCH_LOCATION_CHECK_TIMES_COUNT_MAX <= s_watch_location_times_check_count)
        {
                LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
index 4a9e526..ba04857 100644 (file)
@@ -113,6 +113,7 @@ typedef enum
 void mmi_watch_location_mission_list_init(void);
 void mmi_watch_location_mission_list_clear(void);
 
+void mmi_watch_location_data_check(void);
 void mmi_watch_location_mission_timed_location_action(void);
 void mmi_watch_location_mission_current_location_action(void);
 void mmi_watch_location_mission_get_weather_action(void);
index 51f4f99..454d817 100644 (file)
@@ -9,14 +9,6 @@
 static nv_watch_protocol_data_t s_watch_protocol_data = {0};
 static bool s_watch_bind_state = false;
 
-static void * s_watch_timed_mission_timer_id = NULL;
-static uint32_t s_watch_timed_location_time_stamp = 0, s_watch_timed_weather_time_stamp = 0;
-static void * s_watch_heartbeat_action_timer_id = NULL;
-static uint32_t s_watch_heartbeat_action_time_stamp = 0;
-static uint32_t s_watch_timed_location_last_steps = 0;
-
-static void mmi_protocol_watch_timed_mission_timer_cb(uint32_t para);
-static void mmi_protocol_watch_heartbeat_timer_cb(uint32_t para);
 bool mmi_protocol_action_location(void);
 
 
@@ -27,11 +19,7 @@ bool mmi_watch_tcp_connect_state_get(void)
 
 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)
@@ -476,134 +464,303 @@ void mmi_protocol_watch_weather_update_interval_set(uint32_t value)
        s_watch_protocol_data.weather_update_interval = value;
        mmi_watch_protocol_data_nv_write();
 }
-static int last_chip_x=0;
-static int last_chip_y=0;
-static int last_chip_z=0;
-static uint32_t move_num_falg=0;
-static void mmi_protocol_watch_timed_mission_timer_cb(uint32_t para)
+
+
+
+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_callback_action(void);
+static void mmi_protocol_location_move_state_check_cb(uint32_t param);
+
+void mmi_protocol_timing_task_msg_send(MMI_PROTOCOL_TIMING_MSG_ID_E msg_id, void * msg_param)
+{
+       if(NULL == s_protocol_timing_task_id)
+       {
+               PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: task not exist\n",__FUNCTION__,__LINE__);
+               if(NULL != msg_param)
+                       Hal_Mem_Free(msg_param);
+               
+               return;
+       }
+       
+       if((PROTOCOL_TIMING_MSG_QUEUE_SIZE - 1) < Hal_Get_Message_Count(s_protocol_timing_task_id))
+       {
+               PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: msg queue full\n",__FUNCTION__,__LINE__);
+               if(NULL != msg_param)
+                       Hal_Mem_Free(msg_param);
+               
+               return;
+       }
+
+       PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: msg_id=%d\n",__FUNCTION__,__LINE__, msg_id);
+    mmi_protocol_timing_task_msg_t * msg = Hal_Mem_Alloc(sizeof(mmi_protocol_timing_task_msg_t));
+       if(NULL == msg)
+       {
+               PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: memory alloc fail\n",__FUNCTION__,__LINE__);
+               if(NULL != msg_param)
+                       Hal_Mem_Free(msg_param);
+               
+               return;
+       }
+       msg->msg_id = msg_id;
+       msg->msg_param = msg_param;
+
+    Hal_Send_Message((TASK_ID)s_protocol_timing_task_id, (void *)msg);
+}
+
+static void mmi_protocol_timing_task_handle(void * param)
+{
+       mmi_protocol_timing_task_msg_t * msg = (mmi_protocol_timing_task_msg_t *)param;
+       MMI_PROTOCOL_TIMING_MSG_ID_E msg_id = msg->msg_id;
+       void * msg_param = msg->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_HEARTBEAT:
+                       mmi_protocol_fzd_action_HEARTBEAT();
+                       break;
+                       
+               case MMI_PROTOCOL_TIMING_MSG_LOCATION_UPDATE:
+                       mmi_protocol_action_location();
+            break;
+                       
+               case MMI_PROTOCOL_TIMING_MSG_WEATHER_UPDATE:
+                       mmi_protocol_action_get_weather();
+            break;
+                       
+               case MMI_PROTOCOL_TIMING_MSG_HEALTH_MEASURE:
+                       #ifdef __MMI_ZHSX_SUPPORT_HEALTH_SENSOR__
+                       uint32_t cur_time_stamp = *((uint32_t *) msg_param);
+                       PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: cur_stamp=%d\n", __FUNCTION__, __LINE__, cur_time_stamp);
+                       mmi_health_measure_timed_mission_action(cur_time_stamp, false);
+                       #endif
+            break;
+
+               case MMI_PROTOCOL_MSG_MOVE_STATE_CHECK:
+                       mmi_protocol_location_move_state_check_callback_action();
+                       break;
+                       
+               case MMI_PROTOCOL_MSG_LOCATION_DATA_CHECK:
+                       mmi_watch_location_data_check();
+                       break;
+
+               default:
+                       break;
+    }
+}
+
+static void mmi_protocol_timing_task_entry(void * para)
+{
+    while(NULL == s_protocol_timing_task_id)
+       {
+        uos_sleep(10);
+    }
+
+    while(1)
+       {
+        mmi_protocol_timing_task_msg_t * msg = (mmi_protocol_timing_task_msg_t *)Hal_Receive_Message((TASK_ID)s_protocol_timing_task_id, TRUE);
+
+               mmi_protocol_timing_task_handle(msg);
+
+        Hal_Mem_Free(msg->msg_param);
+        Hal_Mem_Free(msg);
+    }
+}
+
+static void mmi_protocol_timing_task_create(void)
+{
+       if(NULL != s_protocol_timing_task_id)
+       {
+               PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: task_id=0x%x\n",__FUNCTION__,__LINE__, s_protocol_timing_task_id);
+               return;
+       }
+       
+       s_protocol_timing_task_id = uos_create_task(mmi_protocol_timing_task_entry,
+                                                                                       NULL,
+                                                                                       PROTOCOL_TIMING_MSG_QUEUE_SIZE,
+                                                                                       PROTOCOL_TIMING_TASK_STACK_SIZE,
+                                                                                       PROTOCOL_TIMING_TASK_PRIORITY,
+                                                                                       "mmi_protocol_timing_task");
+
+       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)
 {
        uint32_t cur_time_stamp = 0;
 
-       Hal_Rtc_Gettime_Count(&cur_time_stamp);
+       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);
 
-       int chip_x,chip_y,chip_z;
-       xMotion_Chip_Read_XYZ(&chip_x, &chip_y, &chip_z);
-       if(last_chip_x-chip_x>=100 || last_chip_x-chip_x<-100
-        || last_chip_y-chip_y>=100 || last_chip_y-chip_y<-100
-        || last_chip_z-chip_z>=100 || last_chip_z-chip_z<-100 )
+       // heartbeat
+       if(mmi_protocol_watch_heartbeat_action_interval_get() <= (cur_time_stamp - s_protocol_heartbeat_time_stamp))
        {
-               if(move_num_falg<=5)
-               {
-                       move_num_falg++;
-               }
+               mmi_protocol_timing_task_msg_send(MMI_PROTOCOL_TIMING_MSG_HEARTBEAT, NULL);
+               s_protocol_heartbeat_time_stamp = cur_time_stamp;
        }
-       last_chip_x=chip_x;
-       last_chip_y=chip_y;
-       last_chip_z=chip_z;
+
        //location
-       if(mmi_protocol_watch_location_upload_interval_get() <= (cur_time_stamp - s_watch_timed_location_time_stamp))
+       if(mmi_protocol_watch_location_upload_interval_get() <= (cur_time_stamp - s_protocol_timed_location_time_stamp))
        {
-               
-               if(move_num_falg>=5)
+               if(0 != mmi_protocol_location_move_state_get())
                {
-                       mmi_protocol_action_location();
+                       mmi_protocol_timing_task_msg_send(MMI_PROTOCOL_TIMING_MSG_LOCATION_UPDATE, NULL);
                }
-               s_watch_timed_location_time_stamp = cur_time_stamp;
-               move_num_falg=0;
+               s_protocol_timed_location_time_stamp = cur_time_stamp;
+               mmi_protocol_location_move_state_set(0);
        }
 
        //weather
-       if(mmi_protocol_watch_weather_update_interval_get() <= (cur_time_stamp - s_watch_timed_weather_time_stamp))
+       if(mmi_protocol_watch_weather_update_interval_get() <= (cur_time_stamp - s_protocol_timed_weather_time_stamp))
        {
-               mmi_protocol_action_get_weather();
-               s_watch_timed_weather_time_stamp = cur_time_stamp;
+               mmi_protocol_timing_task_msg_send(MMI_PROTOCOL_TIMING_MSG_WEATHER_UPDATE, NULL);
+               s_protocol_timed_weather_time_stamp = cur_time_stamp;
        }
 
-#ifdef __MMI_ZHSX_SUPPORT_HEALTH_SENSOR__
        //health measure
-       mmi_health_measure_heart_timed_action(false, cur_time_stamp);
-       mmi_health_measure_temperature_timed_action(false, cur_time_stamp);
-       mmi_health_measure_blood_timed_action(false, cur_time_stamp);
-       mmi_health_measure_spo2_timed_action(false, cur_time_stamp);
-       mmi_health_measure_blood_glucose_timed_action(false, cur_time_stamp);
+#ifdef __MMI_ZHSX_SUPPORT_HEALTH_SENSOR__
+       uint32_t * time_stamp_p = Hal_Mem_Alloc(sizeof(uint32_t));
+       * time_stamp_p = cur_time_stamp;
+       mmi_protocol_timing_task_msg_send(MMI_PROTOCOL_TIMING_MSG_HEALTH_MEASURE, time_stamp_p);
 #endif
 
-       uos_timer_stop(s_watch_timed_mission_timer_id);
-       uos_timer_start(s_watch_timed_mission_timer_id, MS_TO_TICKS(1000 * 1), 0, mmi_protocol_watch_timed_mission_timer_cb, NULL);
 }
 
-void mmi_protocol_watch_timed_mission_action(void)
+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)
 {
-       if(NULL == s_watch_timed_mission_timer_id)
+       s_protocol_location_move_flag = flag;
+}
+
+static void mmi_protocol_location_move_state_check_callback_action(void)
+{
+       PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+
+       if(0 == mmi_protocol_location_move_state_get())
        {
-               uint32_t cur_time_stamp = 0;
+               int16_t chip_x = 0, chip_y = 0, chip_z = 0;
                
-               Hal_Rtc_Gettime_Count(&cur_time_stamp);
-               
-               mmi_watch_location_mission_list_init();
-               mmi_protocol_action_location();
-               s_watch_timed_location_time_stamp = cur_time_stamp;
-               s_watch_timed_location_last_steps = asl_pedometer_steps_get();
-
-               mmi_protocol_action_get_weather();
-               s_watch_timed_weather_time_stamp = cur_time_stamp;
-
-       #ifdef __MMI_ZHSX_SUPPORT_HEALTH_SENSOR__
-               mmi_health_measure_timed_info_nv_read();
-               mmi_health_measure_heart_timed_action(true, cur_time_stamp);
-               mmi_health_measure_temperature_timed_action(true, cur_time_stamp);
-               mmi_health_measure_blood_timed_action(true, cur_time_stamp);
-               mmi_health_measure_spo2_timed_action(true, cur_time_stamp);
-               mmi_health_measure_blood_glucose_timed_action(true, cur_time_stamp);
-       #endif
-               
-               uos_timer_create(&s_watch_timed_mission_timer_id);
-               uos_timer_start(s_watch_timed_mission_timer_id, MS_TO_TICKS(1000 * 20), 0, mmi_protocol_watch_timed_mission_timer_cb, NULL);
+               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_watch_heartbeat_stop(void)
+static void mmi_protocol_location_move_state_check_cb(uint32_t param)
 {
-       if(NULL != s_watch_heartbeat_action_timer_id)
+       PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+
+       if(0 == mmi_protocol_location_move_state_get())
        {
-               uos_timer_stop(s_watch_heartbeat_action_timer_id);
-               uos_timer_delete(s_watch_heartbeat_action_timer_id);
-               s_watch_heartbeat_action_timer_id = NULL;
+               mmi_protocol_timing_task_msg_send(MMI_PROTOCOL_MSG_MOVE_STATE_CHECK, NULL);
        }
+
+       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);
 }
 
-static void mmi_protocol_watch_heartbeat_timer_cb(uint32_t para)
+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_mission_stop();
+       
+       mmi_protocol_timing_task_create();
+
        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);
+       
+       mmi_protocol_fzd_action_HEARTBEAT();
+       s_protocol_heartbeat_time_stamp = cur_time_stamp;
 
-       Hal_Rtc_Gettime_Count(&cur_time_stamp);
-       if(mmi_protocol_watch_heartbeat_action_interval_get() <= (cur_time_stamp - s_watch_heartbeat_action_time_stamp))
-       {
-               PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: cur=%d, stamp=%d\n", __FUNCTION__, __LINE__, cur_time_stamp, s_watch_heartbeat_action_time_stamp);
-               
-               mmi_protocol_fzd_action_HEARTBEAT();
-               s_watch_heartbeat_action_time_stamp = cur_time_stamp;
-       }
+       mmi_watch_location_mission_list_init();
+       mmi_protocol_action_location();
+       s_protocol_timed_location_time_stamp = cur_time_stamp;
+       mmi_protocol_location_move_state_check();
 
-       uos_timer_stop(s_watch_heartbeat_action_timer_id);
-       uos_timer_start(s_watch_heartbeat_action_timer_id, MS_TO_TICKS(1000 * 20), 0, mmi_protocol_watch_heartbeat_timer_cb, NULL);
+       mmi_protocol_action_get_weather();
+       s_protocol_timed_weather_time_stamp = cur_time_stamp;
+
+#ifdef __MMI_ZHSX_SUPPORT_HEALTH_SENSOR__
+       mmi_health_measure_task_init();
+       mmi_health_measure_timed_info_nv_read();
+       mmi_health_measure_timed_mission_action(cur_time_stamp, true);
+#endif
+
+       if(NULL == s_protocol_timing_timer)
+           uos_timer_create(&s_protocol_timing_timer);
+       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);
 }
 
-void mmi_protocol_watch_heartbeat_action(void)
+void mmi_protocol_timing_mission_stop(void)
 {
-       if(NULL == s_watch_heartbeat_action_timer_id)
+       //char info_buf[64] = {0};
+       //sprintf(info_buf, "mmi_protocol_timing_mission_stop");
+       //mmi_debug_info_write_to_file(info_buf);
+       
+       if(NULL != s_protocol_timing_timer)
        {
-               PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
-               
-               mmi_protocol_fzd_action_HEARTBEAT();
-               
-               Hal_Rtc_Gettime_Count(&s_watch_heartbeat_action_time_stamp);
+               uos_timer_stop(s_protocol_timing_timer);
+               uos_timer_delete(s_protocol_timing_timer);
+               s_protocol_timing_timer = NULL;
+       }
 
-               uos_timer_create(&s_watch_heartbeat_action_timer_id);
-               uos_timer_start(s_watch_heartbeat_action_timer_id, MS_TO_TICKS(1000 * 20), 0, mmi_protocol_watch_heartbeat_timer_cb, 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;
        }
+
+       mmi_watch_location_mission_list_clear();
+       
+#ifdef __MMI_ZHSX_SUPPORT_HEALTH_SENSOR__
+       mmi_health_measure_timed_list_clear();
+#endif
 }
 
+
+
 extern void dm_send_msg_active(void);
 bool mmi_protocol_watch_link_action(void)
 {
index d0c415d..84740f8 100644 (file)
@@ -28,21 +28,46 @@ extern "C"
 #endif
 
 
+#define PROTOCOL_TIMING_TIMER_INTERVAL (20 * 1000) // ms
+
+#define PROTOCOL_TIMING_TASK_PRIORITY 220
+#define PROTOCOL_TIMING_TASK_STACK_SIZE (10 * 1024)
+#define PROTOCOL_TIMING_MSG_QUEUE_SIZE (64)
+
+
+typedef enum
+{
+       MMI_PROTOCOL_TIMING_MSG_ID_START,
+
+    MMI_PROTOCOL_TIMING_MSG_HEARTBEAT,
+       MMI_PROTOCOL_TIMING_MSG_LOCATION_UPDATE,
+    MMI_PROTOCOL_TIMING_MSG_WEATHER_UPDATE,
+       MMI_PROTOCOL_TIMING_MSG_HEALTH_MEASURE,
+       MMI_PROTOCOL_MSG_MOVE_STATE_CHECK,
+       MMI_PROTOCOL_MSG_LOCATION_DATA_CHECK,
+
+    MMI_PROTOCOL_TIMING_MSG_ID_END
+}MMI_PROTOCOL_TIMING_MSG_ID_E;
+
+
+typedef struct
+{
+       uint16_t msg_id;
+       void * msg_param;
+}mmi_protocol_timing_task_msg_t;
+
+
+
 
 bool mmi_watch_tcp_connect_state_get(void);
 
 bool mmi_protocol_watch_bind_state_get(void);
-
 void mmi_protocol_watch_bind_state_set(bool state);
 
 void mmi_protocol_receive_data_process(char * recv_str, int recv_len);
-
 void * mmi_protocol_send_space_ptr_get(int cmd);
-
 int mmi_protocol_send_space_size_get(int cmd);
-
 void mmi_protocol_send_space_free(int cmd);
-
 bool mmi_protocol_send_cmd_check(int cmd);
 
 void mmi_watch_protocol_data_nv_read(void);
@@ -64,10 +89,9 @@ uint8_t mmi_protocol_device_name_len_get(void);
 char * mmi_protocol_device_name_get(void);
 void mmi_protocol_device_name_set(char * device_name);
 
-void mmi_protocol_watch_timed_mission_action(void);
-
-void mmi_protocol_watch_heartbeat_stop(void);
-void mmi_protocol_watch_heartbeat_action(void);
+void mmi_protocol_timing_task_msg_send(MMI_PROTOCOL_TIMING_MSG_ID_E msg_id, void * msg_param);
+void mmi_protocol_timing_mission_action(void);
+void mmi_protocol_timing_mission_stop(void);
 
 bool mmi_protocol_watch_link_action(void);
 
index d79ca85..a4bdf1e 100644 (file)
@@ -553,12 +553,29 @@ static bool mmi_protocol_fzd_send_with_data(MMI_PROTOCOL_FZD_ACTION_ENUM action,
 }
 
 /////////////////////////
-#ifdef __MMI_FZD_PROTOCOL_WITHOUT_PING_COMMAND_SUPPORT__
-static bool s_first_lk_command_received = false;
+static void mmi_watch_action_after_bind(void)
+{
+       mmi_protocol_watch_bind_state_set(true);
 
-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
 
+       // timing mission
+       mmi_protocol_timing_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
+
+}
 
 bool mmi_protocol_fzd_action_LINK(void)
 {
@@ -568,11 +585,8 @@ 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();
-       }
+       mmi_watch_action_after_bind();
+
 #else
        if(true != mmi_protocol_watch_bind_state_get())
        {
@@ -670,30 +684,7 @@ bool mmi_protocol_fzd_parse_ACTION_BIND(unsigned char * next_buff, unsigned int
        {
                if(1 == value)
                {
-                       mmi_protocol_watch_bind_state_set(true);
-
-                       // 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
-               
-
+                       mmi_watch_action_after_bind();
                }
        }
 #endif
@@ -701,34 +692,6 @@ bool mmi_protocol_fzd_parse_ACTION_BIND(unsigned char * next_buff, unsigned int
        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);
index 505eaf5..4264e8e 100644 (file)
@@ -54,7 +54,7 @@ void cmdmsg_handler_disconnect_impl(void *param)
 
        mmi_protocol_watch_bind_state_set(false);
 
-       mmi_protocol_watch_heartbeat_stop();
+       mmi_protocol_timing_mission_stop();
 
 #else