gengxin
authorCCC <2393524978@qq.com>
Tue, 25 Jul 2023 06:31:04 +0000 (14:31 +0800)
committerCCC <2393524978@qq.com>
Tue, 25 Jul 2023 06:31:04 +0000 (14:31 +0800)
2.sdk/sdk/gui/lv_watch/lv_apps/mmi_wechat/wechat.h
2.sdk/sdk/gui/lv_watch/lv_apps/mmi_wechat/wechat_ui.c
2.sdk/sdk/gui/lv_watch/lv_watch_res.h
2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.c
2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.h
2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_sms.c
2.sdk/sdk/gui/lv_watch/mmi_sundry/mmi_sundry.c
2.sdk/sdk/gui/lv_watch/mmi_sundry/mmi_sundry.h

index f9f0f56..742d354 100644 (file)
@@ -104,6 +104,11 @@ typedef struct
 void wechat_chat_list_set_slide_enable(lv_watch_obj_ext_t * ext, bool enable);
 void mmi_wechat_msg_info_init(void);
 void wechat_msg_info_nv_write(void);
+
+bool wechat_msg_voice_is_playing(void);
+bool wechat_msg_voice_is_recording(void);
+bool wechat_msg_item_is_sending(void);
+
 void wechat_msg_receive_update_ui(void);
 bool wechat_msg_receive_from_server(char * data_buff, int data_buff_len, nv_wechat_msg_type_e type);
 void wechat_msg_voice_item_playing_stop(lv_wechat_ext_t * ext);
index c62ef9a..1263063 100644 (file)
@@ -266,17 +266,17 @@ void wechat_msg_receive_update_ui(void)
        if(AUDIO_CTRL_PRIORITY_5 == Hal_Audio_Manage_Start_Req(AUDIO_CTRL_PRIORITY_5, wechat_receive_audio_play_audio_ctrl_callback))
        {
                Hal_NFFS_File_Play_Onetime(AUDIO_WECHAT_RECEIVE, (HAL_SPEAKER_GAIN)query_current_volume(), wechat_receive_audio_play_over_cb, NULL);
-       }
 
-       Hal_Vibrator_Play_Onetime(NULL, 1000);
+               Hal_Vibrator_Play_Onetime(NULL, 1000);
        
-       if(lv_watch_get_activity_obj(ACT_ID_WECHAT_MAIN)) 
-       {
-               wechat_main_screen_refresh();
-       }
-       else
-       {
-               wechat_create_event_cb(NULL, LV_EVENT_CLICKED);
+               if(lv_watch_get_activity_obj(ACT_ID_WECHAT_MAIN)) 
+               {
+                       wechat_main_screen_refresh();
+               }
+               else
+               {
+                       wechat_create_event_cb(NULL, LV_EVENT_CLICKED);
+               }
        }
 }
 
@@ -350,7 +350,7 @@ bool wechat_msg_receive_from_server(char * data_buff, int data_buff_len, nv_wech
                WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
                
                mmi_watch_wake_up();
-               mmi_msg_ui_action_wechat_incoming();
+               mmi_ui_msg_action_wechat_incoming();
        }
 
        return true;
index 6c4cc2e..98ac5af 100644 (file)
@@ -204,7 +204,7 @@ LV_IMG_DECLARE(img_poweron_logo);
 
 //dial
 #define ICON_DIAL_SETTING                   "R:/png/dial/icon_setting.png"
-#define ICON_DIAL_NONE                      "R:/png/dial/icon_none.png"
+//#define ICON_DIAL_NONE                      "R:/png/dial/icon_none.png"
 
 //power of charging
 #define ICON_POWER_OFF_CHARGING_OK          "R:/png/power_off_charging/icon_power_off_charging_ok.png"
index 97e0ae8..9ff218f 100644 (file)
@@ -518,6 +518,7 @@ static unsigned char * mmi_protocol_fzd_action_string_get(MMI_PROTOCOL_FZD_ACTIO
                        {MMI_FZD_ACTION_GET_WEATHER, "WT"},                     //
                        {MMI_FZD_SERVER_SET_SOS_NUMBER, "SOS"},                 //
                        {MMI_FZD_SERVER_SET_CENTER_NUMBER, "CENTER"},           //
+                       {MMI_FZD_SERVER_SET_MONITOR, "MONITOR"},
                        {MMI_FZD_ACTION_UNBIND, "DLT"},
 
                #ifdef __MMI_ZHSX_SUPPORT_VIDEO_CALL__
@@ -689,6 +690,10 @@ static bool mmi_protocol_fzd_content_parse(unsigned char * content_ptr, unsigned
                        mmi_protocol_fzd_parse_SERVER_SET_CENTER_NUMBER(next_buff, next_buff_len);
                        break;
 
+               case MMI_FZD_SERVER_SET_MONITOR:
+                       mmi_protocol_fzd_parse_SERVER_SET_MONITOR(next_buff, next_buff_len);
+                       break;
+
                case MMI_FZD_ACTION_UNBIND:
                        break;
 
@@ -806,8 +811,8 @@ bool mmi_protocol_fzd_parse_ACTION_BIND(unsigned char * next_buff, unsigned int
                if(0 == value)
                {
                        mmi_protocol_watch_bind_state_set(false);
-                       uos_sleep(10);
-                       mmi_watch_reset(NULL);
+                       //uos_sleep(10);
+                       mmi_watch_factory_aciton();                     
                }
        }
        else
@@ -919,8 +924,9 @@ bool mmi_protocol_fzd_parse_SERVER_SET_FACTORY(unsigned char * next_buff, unsign
        
        result = true;
        mmi_protocol_fzd_send_without_data(action);
+
        //uos_sleep(10);
-       mmi_watch_reset(NULL);
+       mmi_watch_factory_aciton();
 
        return result;
 }
@@ -933,8 +939,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_POWEROFF(unsigned char * next_buff, unsig
        result = true;
        mmi_protocol_fzd_send_without_data(action);
 
-       uos_sleep(10);
-       mmi_watch_power_off();
+       mmi_watch_power_off_aciton();
 
        return result;
 }
@@ -1002,7 +1007,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_PHONEBOOK(unsigned char * next_buff, unsi
                temp_ptr = km_strtok_r(NULL, ",", &next_buff);
                if (NULL != temp_ptr)
                {
-                       strncpy(server_set_contact[i].contact_number, temp_ptr, FZD_MIN(strlen(temp_ptr), WATCH_CONTACTS_MAX_NUMBER_LEN - 1));
+                       strncpy(server_set_contact[i].contact_number, temp_ptr, FZD_MIN(strlen(temp_ptr), (WATCH_CONTACTS_MAX_NUMBER_LEN - 1)));
                }
                else
                {
@@ -1056,7 +1061,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_CALL(unsigned char * next_buff, unsigned
        }
        _lv_memset_00(number, next_buff_len + 1);
        _lv_memcpy(number, next_buff, next_buff_len + 1);
-    phone_voice_call_req(number);
+    //phone_voice_call_req(number);
 
        return result;
 }
@@ -1448,7 +1453,7 @@ bool mmi_protocol_fzd_ACTION_TALK(char * data_buff, int data_buff_len)
        }
 
        memory_size = data_buff_len;
-       memory_size += FZD_MAX(data_buff_len * ENCRYPT_EXT_COEF/100, FZD_MIN(ENCRYPT_EXT_MIN, data_buff_len));
+       memory_size += FZD_MAX((data_buff_len * ENCRYPT_EXT_COEF/100), FZD_MIN(ENCRYPT_EXT_MIN, data_buff_len));
        content_buff = (unsigned char *)lv_mem_alloc(memory_size);
        if(NULL == content_buff)
        {
@@ -1820,7 +1825,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_SOS_NUMBER(unsigned char * next_buff, uns
                
                if (NULL != temp_ptr)
                {
-                       strncpy(sos_number.number[i], temp_ptr, FZD_MIN(strlen(temp_ptr), WATCH_CONTACTS_MAX_NUMBER_LEN - 1));
+                       strncpy(sos_number.number[i], temp_ptr, FZD_MIN(strlen(temp_ptr), (WATCH_CONTACTS_MAX_NUMBER_LEN - 1)));
                }
 
                i++;
@@ -1849,13 +1854,28 @@ bool mmi_protocol_fzd_parse_SERVER_SET_CENTER_NUMBER(unsigned char * next_buff,
        result = true;
        mmi_protocol_fzd_send_without_data(action);
 
-    //////////
-    //////////
-    //////////
-    //function
-    //////////
-    //////////
-    //////////
+    nv_watch_center_number_t center_number = {0};
+       memcpy(center_number.number, next_buff, FZD_MIN(next_buff_len, (NV_CONTACTS_MAX_NUMBER_LEN - 1)));
+       mmi_center_number_set(&center_number);
+
+       return result;
+}
+
+bool mmi_protocol_fzd_parse_SERVER_SET_MONITOR(unsigned char * next_buff, unsigned int next_buff_len)
+{
+       bool result = false;
+       MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_SERVER_SET_MONITOR;
+
+       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);
+
+       mmi_center_number_dialing_action();
 
        return result;
 }
@@ -2045,7 +2065,7 @@ bool mmi_protocol_fzd_parse_WATCH_GET_VC_CONTACT(unsigned char * next_buff, unsi
                temp_ptr = km_strtok_r(NULL, ",", &next_buff);
                if (NULL != temp_ptr)
                {
-                       t_len_1 = FZD_MIN(strlen(temp_ptr), NV_WATCH_VC_CONTACT_NUMBER_LEN - 1);
+                       t_len_1 = FZD_MIN(strlen(temp_ptr), (NV_WATCH_VC_CONTACT_NUMBER_LEN - 1));
                        strncpy(t_vc_contact.number[i], temp_ptr, t_len_1);
                }
                else
@@ -2056,7 +2076,7 @@ bool mmi_protocol_fzd_parse_WATCH_GET_VC_CONTACT(unsigned char * next_buff, unsi
                temp_ptr = km_strtok_r(NULL, ",", &next_buff);
                if (NULL != temp_ptr)
                {
-                       t_len_1 = FZD_MIN(strlen(temp_ptr), (NV_WATCH_VC_CONTACT_NAME_LEN - 1) * 4);
+                       t_len_1 = FZD_MIN(strlen(temp_ptr), ((NV_WATCH_VC_CONTACT_NAME_LEN - 1) * 4));
                        mmi_unicode_hex_str_to_utf8_str(temp_ptr, t_len_1, t_vc_contact.name[i], &t_len_2);
 
                        //PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d,%d\n", __FUNCTION__, __LINE__, t_len_1, t_len_2);
index d9e3055..37fb43c 100644 (file)
@@ -130,6 +130,7 @@ typedef enum
 
        MMI_FZD_SERVER_SET_SOS_NUMBER, // 26
        MMI_FZD_SERVER_SET_CENTER_NUMBER,
+       MMI_FZD_SERVER_SET_MONITOR,     
        MMI_FZD_ACTION_UNBIND,
 
 #ifdef __MMI_ZHSX_SUPPORT_VIDEO_CALL__
index 4e43f95..44d5c55 100644 (file)
@@ -185,7 +185,7 @@ static void mmi_protocol_sms_power_off_cb(watch_app_adp_sms_send_result_type_t r
        
        if(APP_SMS_SEND_SUCCESS == result)
        {
-               mmi_watch_power_off();
+               mmi_watch_power_off_aciton();
        }
        else if(APP_SMS_SEND_FAIL == result)
        {
@@ -216,7 +216,7 @@ static void mmi_protocol_sms_set_factory_cb(watch_app_adp_sms_send_result_type_t
        
        if(APP_SMS_SEND_SUCCESS == result)
        {
-               mmi_watch_reset(NULL);
+               mmi_watch_factory_aciton();
        }
        else if(APP_SMS_SEND_FAIL == result)
        {
index 249edc9..62c3bdf 100644 (file)
@@ -60,6 +60,7 @@ void mmi_watch_wake_up(void)
        else 
        {
         watch_wakeup_lcd(false);
+               watch_wakeup_time_reset();
     }
 
 #else
@@ -80,6 +81,36 @@ void mmi_watch_wake_up(void)
 }
 
 
+void mmi_ui_msg_update_watch_factory(void)
+{
+       mmi_watch_reset(NULL);
+}
+
+void mmi_watch_factory_aciton(void)
+{
+       SUNDRY_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+
+       // ui
+    mmi_watch_wake_up();
+       mmi_ui_msg_action_watch_factory();
+}
+
+
+void mmi_ui_msg_update_watch_power_off(void)
+{
+       mmi_watch_power_off();
+}
+
+void mmi_watch_power_off_aciton(void)
+{
+       SUNDRY_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+
+       // ui
+    mmi_watch_wake_up();
+       mmi_ui_msg_action_watch_power_off();
+}
+
+
 static TIMER_ID s_watch_search_timer_id = NULL;
 
 void mmi_watch_search_timer_stop(void)
@@ -200,7 +231,7 @@ lv_obj_t * mmi_watch_server_search_screen_create(lv_obj_t * activity_obj)
        return obj;
 }
 
-void mmi_watch_server_search_update_ui(void)
+void mmi_ui_msg_update_watch_server_search(void)
 {
        mmi_watch_server_search_screen_create(NULL);    
 }
@@ -213,6 +244,10 @@ void mmi_watch_searching_aciton(void)
        {
                return ;
        }
+       if(true == wechat_msg_voice_is_recording() || true == wechat_msg_item_is_sending())
+       {
+               return;
+       }
 
        if(NULL != lv_watch_get_activity_obj(ACT_ID_WATCH_SEARCHING))
        {
@@ -221,9 +256,78 @@ void mmi_watch_searching_aciton(void)
 
        // ui
     mmi_watch_wake_up();
-       mmi_msg_ui_action_watch_searching();
+       mmi_ui_msg_action_watch_searching();
+}
+
+
+static nv_watch_center_number_t s_center_number = {0};
+
+void mmi_center_number_nv_write(void)
+{
+       uint32_t nv_data_length = sizeof(nv_watch_center_number_t);
+       
+       if(nv_data_length != UI_NV_Write_Req(NV_SECTION_UI_CENTER_NUMBER, 0, nv_data_length, (uint8_t *)&s_center_number))
+       {
+               printf("[@CHENG_DEBUG][%s][%d]: nv write fail\n", __FUNCTION__, __LINE__);
+       }
+}
+
+void mmi_center_number_nv_read(void)
+{
+       uint32_t nv_data_length = sizeof(nv_watch_center_number_t);
+       
+       if(nv_data_length != UI_NV_Read_Req(NV_SECTION_UI_CENTER_NUMBER, 0, nv_data_length, (uint8_t *)&s_center_number))
+       {
+               printf("[@CHENG_DEBUG][%s][%d]: nv read fail\n", __FUNCTION__, __LINE__);
+       }
+}
+
+bool mmi_center_number_is_empty(void)
+{
+       if(0 != strlen(s_center_number.number))
+               return false;
+
+       return true;
+}
+
+void mmi_center_number_set(nv_watch_center_number_t * center_number)
+{
+       _lv_memcpy(&s_center_number, center_number, sizeof(nv_watch_center_number_t));
+
+       mmi_center_number_nv_write();
+}
+
+void mmi_ui_msg_update_ceter_number_dialing(void)
+{
+       char * number = (char *)lv_mem_alloc(NV_CONTACTS_MAX_NUMBER_LEN);
+       if(NULL != number)
+       {
+               _lv_memcpy(number, s_center_number.number, NV_CONTACTS_MAX_NUMBER_LEN);
+               phone_voice_call_req(number);
+       }
 }
 
+void mmi_center_number_dialing_action(void)
+{
+       SUNDRY_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+       
+       if(true == mmi_active_screen_is_prohibit_interrupted())
+       {
+               return ;
+       }
+
+       if(true == mmi_center_number_is_empty())
+       {
+               return ;
+       }
+
+       // ui
+       mmi_watch_wake_up();
+       mmi_ui_msg_action_center_number_dialing();
+}
+
+
+
 
 
 
index a3c2f02..e2d3df5 100644 (file)
@@ -32,6 +32,12 @@ bool mmi_active_screen_is_prohibit_interrupted(void);
 void mmi_watch_wake_up(void);
 
 
+void mmi_ui_msg_update_watch_factory(void);
+void mmi_watch_factory_aciton(void);
+void mmi_ui_msg_update_watch_power_off(void);
+void mmi_watch_power_off_aciton(void);
+
+
 #define MMI_WATCH_SEARCH_DURATION      (1000 * 60) // ms
 
 typedef struct
@@ -41,9 +47,15 @@ typedef struct
 } lv_watch_search_ext_t;
 
 void mmi_watch_search_screen_destroy(void);
-void mmi_watch_server_search_update_ui(void);
+void mmi_ui_msg_update_watch_server_search(void);
 void mmi_watch_searching_aciton(void);
 
+void mmi_center_number_nv_read(void);
+void mmi_center_number_set(nv_watch_center_number_t * center_number);
+void mmi_ui_msg_update_ceter_number_dialing(void);
+void mmi_center_number_dialing_action(void);
+
+
 
 #ifdef __cplusplus
 } /* extern "C" */