unfinished feature
authorCCC <2393524978@qq.com>
Mon, 7 Aug 2023 02:05:04 +0000 (10:05 +0800)
committerCCC <2393524978@qq.com>
Mon, 7 Aug 2023 02:05:04 +0000 (10:05 +0800)
2.sdk/sdk/gui/lv_watch/lv_watch.c
2.sdk/sdk/gui/lv_watch/lv_watch_res.h
2.sdk/sdk/gui/lv_watch/mmi_sundry/mmi_sundry.c
2.sdk/sdk/gui/lv_watch/mmi_sundry/mmi_sundry.h

index 635a198..5c5b7a6 100644 (file)
@@ -505,6 +505,9 @@ static lv_obj_t * watch_create(bool silentReset)
     app_adaptor_get_pedometer_info_req(&record);
 
     app_adaptor_timing_control_init();
+#ifdef __MMI_ZHSX_SUPPORT_NO_SIM_POWER_OFF__
+       mmi_watch_no_sim_power_off_check_mission();     
+#endif
 
     return obj;
 }
@@ -811,13 +814,21 @@ bool watch_get_lcd_status(void)
 
 static void watch_normal_charging_status_change(VOID * para)
 {
-    (void)para;
+    //(void)para;
 
     printf("%s\n", __FUNCTION__);
     watch_wakeup_time_reset();
 #if USE_LV_WATCH_SD_AUTO_MOUNT != 0
     watch_start_sd_mount_task();
 #endif
+
+#ifdef __MMI_ZHSX_SUPPORT__
+    uint32_t chg_status = (uint32_t)para;
+
+       printf("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, chg_status);
+       //mmi_watch_charging_prompt_screen(NULL, chg_status);
+       mmi_ui_msg_action_charging_prompt(chg_status);
+#endif
 }
 
 void watch_set_pintype(MMI_MODEM_PIN_STATUS_TYPE pinreqtype)
@@ -879,4 +890,59 @@ static void watch_start_sd_mount_task(void)
 #endif
 
 
+uint8_t voip_get_call_volume(void)
+{
+#ifdef __MMI_ZHSX_SUPPORT_VIDEO_CALL__
+#ifdef __MMI_ZHSX_SUPPORT_VIDEO_CALL_WULIAN__
+    return (mmi_vc_get_call_volume());
+#endif
+#ifdef __MMI_ZHSX_SUPPORT_VIDEO_CALL_FZD__
+       return (mmi_vc_get_call_volume_fzd());
+#endif
+#endif
+
+    return 0;
+}
+
+bool watch_voip_suspend_check(void)
+{
+#ifdef __MMI_ZHSX_SUPPORT_VIDEO_CALL__
+#ifdef __MMI_ZHSX_SUPPORT_VIDEO_CALL_WULIAN__
+       return (mmi_vc_watch_suspend_check());
+#endif
+#ifdef __MMI_ZHSX_SUPPORT_VIDEO_CALL_FZD__
+       return (mmi_vc_watch_suspend_check_fzd());
+#endif
+#endif
+
+    return true;
+}
+
+bool voip_connect_check_req(void)
+{
+#ifdef __MMI_ZHSX_SUPPORT_VIDEO_CALL__
+#ifdef __MMI_ZHSX_SUPPORT_VIDEO_CALL_WULIAN__
+       return (mmi_vc_connect_check_req());
+#endif
+#ifdef __MMI_ZHSX_SUPPORT_VIDEO_CALL_FZD__
+       return (mmi_vc_connect_check_req_fzd());
+#endif
+#endif
+
+       return false;
+}
+
+void voip_activity_destroy_req(void)
+{
+#ifdef __MMI_ZHSX_SUPPORT_VIDEO_CALL__
+#ifdef __MMI_ZHSX_SUPPORT_VIDEO_CALL_WULIAN__
+       (mmi_vc_activity_destroy_req());
+#endif
+#ifdef __MMI_ZHSX_SUPPORT_VIDEO_CALL_FZD__
+       (mmi_vc_activity_destroy_req_fzd());
+#endif
+#endif
+}
+
+
 #endif/* USE_LV_WATCH */
index 98ac5af..5fb88f8 100644 (file)
@@ -745,6 +745,9 @@ LV_IMG_DECLARE(img_poweron_logo);
 #define ICON_APP_QRCODE           "R:/png/setting/ICON_APP_QRCODE.png"
 #endif
 
+#define ICON_CHARGE_CONNECTED          "R:/png/charge/ICON_CHARGE_CONNECTED.png"
+#define ICON_CHARGE_REMOVED           "R:/png/charge/ICON_CHARGE_REMOVED.png"
+
 
 
 #endif
index 62c3bdf..1030ff8 100644 (file)
@@ -327,6 +327,285 @@ void mmi_center_number_dialing_action(void)
 }
 
 
+#ifdef __MMI_ZHSX_SUPPORT_NO_SIM_POWER_OFF__
+
+static void * s_no_sim_power_off_timer = NULL;
+static uint8_t s_no_sim_power_off_seconds = NO_SIM_POWER_OFF_PROMPT_INTERVAL;
+
+void mmi_watch_no_sim_power_off_timer_stop(void)
+{
+       if(NULL != s_no_sim_power_off_timer)
+       {
+               uos_timer_stop(s_no_sim_power_off_timer);
+               uos_timer_delete(s_no_sim_power_off_timer);
+               s_no_sim_power_off_timer = NULL;
+       }
+}
+
+static void mmi_watch_no_sim_power_off_prompt_prepare_destory(lv_obj_t * activity_obj)
+{
+    lv_watch_png_cache_all_free();
+    lv_obj_t * act_obj = lv_watch_get_activity_obj(ACT_ID_NO_SIM_POWER_OFF_PROMPT);
+    if(act_obj)
+       {
+        lv_obj_del(act_obj);
+    }
+
+       mmi_watch_no_sim_power_off_check_action();
+
+       watch_set_suspend_enable(true, ACT_ID_NO_SIM_POWER_OFF_PROMPT, 0);
+}
+
+static void mmi_watch_no_sim_power_off_ok_btn_event_cb(lv_obj_t * btn, lv_event_t e)
+{
+    if(LV_EVENT_CLICKED == e)
+    {
+               mmi_watch_power_off_aciton();
+    }
+}
+
+static void mmi_watch_no_sim_power_off_cancel_btn_event_cb(lv_obj_t * btn, lv_event_t e)
+{
+    if(LV_EVENT_CLICKED == e)
+    {
+               mmi_watch_no_sim_power_off_prompt_prepare_destory(NULL);
+    }
+}
+
+static void mmi_watch_no_sim_power_off_prompt_status_update(lv_anim_t * anim)
+{
+       char t_text[64] = {0};
+       
+       s_no_sim_power_off_seconds--;
+       if(0 == s_no_sim_power_off_seconds)
+       {
+               mmi_watch_power_off_aciton();
+       }
+       else
+       {
+               sprintf(t_text, "%d%s", s_no_sim_power_off_seconds, lv_lang_get_text(WATCH_TEXT_ID_NO_SIM_POWER_OFF_PROMPT));
+               lv_label_set_text(anim->var, t_text);
+       }
+}
+
+static lv_obj_t * mmi_watch_no_sim_power_off_prompt_create(lv_obj_t * activity_obj)
+{
+    if(activity_obj == NULL) 
+       {
+        lv_watch_activity_ext_t activity_ext;
+        memset(&activity_ext, 0, sizeof(lv_watch_activity_ext_t));
+        activity_ext.actId = ACT_ID_NO_SIM_POWER_OFF_PROMPT;
+        activity_ext.create = NULL;
+        activity_ext.prepare_destory = mmi_watch_no_sim_power_off_prompt_prepare_destory;
+        activity_obj = lv_watch_creat_activity_obj(&activity_ext);
+        LV_ASSERT_MEM(activity_obj);
+        if(activity_obj == NULL) 
+                       return NULL;
+    }
+
+    lv_obj_t * obj = lv_watch_obj_create(activity_obj);
+    LV_ASSERT_MEM(obj);
+    if(obj == NULL) return NULL;
+    lv_watch_obj_set_anim_mode(obj, LV_WATCH_ANIM_HOR_RIGHT_HIDE);
+
+       lv_obj_t * cont = lv_cont_create(obj, NULL);
+       lv_obj_set_size(cont, LV_HOR_RES, LV_VER_RES);
+       lv_obj_set_style_local_bg_color(cont, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
+       lv_obj_set_base_dir(cont, LV_BIDI_DIR_LTR);
+
+       char t_text[64] = {0};
+       lv_obj_t * label = lv_label_create(cont, NULL);
+       s_no_sim_power_off_seconds = NO_SIM_POWER_OFF_PROMPT_INTERVAL;
+       sprintf(t_text, "%d%s", s_no_sim_power_off_seconds, lv_lang_get_text(WATCH_TEXT_ID_NO_SIM_POWER_OFF_PROMPT));
+       lv_label_set_text(label, t_text);
+       lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
+       lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font26); // &lv_watch_font26_black);
+       lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 70);
+
+       lv_obj_t * btn_cancel = lv_btn_create(cont, NULL);
+       lv_obj_set_size(btn_cancel, 100, 56);
+       lv_obj_set_style_local_bg_color(btn_cancel, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x47, 0xA6, 0xFF));
+       lv_obj_set_style_local_radius(btn_cancel, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 30);
+       lv_obj_set_style_local_bg_color(btn_cancel, LV_BTN_PART_MAIN, LV_STATE_PRESSED, LV_COLOR_MAKE(0x47, 0xA6, 0xFF));
+       lv_obj_set_style_local_radius(btn_cancel, LV_BTN_PART_MAIN, LV_STATE_PRESSED, 30);
+       lv_obj_align(btn_cancel, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 10, -20);
+       lv_obj_set_event_cb(btn_cancel, mmi_watch_no_sim_power_off_cancel_btn_event_cb);
+       lv_obj_t * label_cancel = lv_label_create(btn_cancel, NULL);
+       lv_label_set_text_id(label_cancel, WATCH_TEXT_ID_CANCEL);
+       lv_obj_add_style(label_cancel, LV_LABEL_PART_MAIN, &lv_watch_font26_black);
+
+       lv_obj_t * btn_ok = lv_btn_create(cont, btn_cancel);
+       lv_obj_set_style_local_bg_color(btn_ok, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xFF, 0x6F, 0x91));
+       lv_obj_set_style_local_radius(btn_ok, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 30);
+       lv_obj_set_style_local_bg_color(btn_ok, LV_BTN_PART_MAIN, LV_STATE_PRESSED, LV_COLOR_MAKE(0xFF, 0x6F, 0x91));
+       lv_obj_set_style_local_radius(btn_ok, LV_BTN_PART_MAIN, LV_STATE_PRESSED, 30);
+       lv_obj_align(btn_ok, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, -10, -20);
+       lv_obj_set_event_cb(btn_ok, mmi_watch_no_sim_power_off_ok_btn_event_cb);
+       lv_obj_t * label_ok = lv_label_create(btn_ok, label_cancel);
+       lv_label_set_text_id(label_ok, WATCH_TEXT_ID_OK);
+
+       //
+       lv_anim_path_t path;
+       lv_anim_path_init(&path);
+       lv_anim_path_set_cb(&path, lv_anim_path_step);
+
+       lv_anim_t a;
+       lv_anim_init(&a);
+       lv_anim_set_var(&a, label);
+       lv_anim_set_start_cb(&a, (lv_anim_ready_cb_t)mmi_watch_no_sim_power_off_prompt_status_update);
+       lv_anim_set_time(&a, 1);
+       lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
+       lv_anim_set_delay(&a,1000);
+       lv_anim_set_repeat_delay(&a, 1000);
+       lv_anim_start(&a);
+
+       watch_set_suspend_enable(false, ACT_ID_NO_SIM_POWER_OFF_PROMPT, 0);
+}
+
+void mmi_ui_msg_update_no_sim_power_off(void)
+{
+       mmi_watch_no_sim_power_off_prompt_create(NULL);
+}
+
+static void mmi_watch_no_sim_power_off_callback(uint32_t para)
+{
+       mmi_watch_no_sim_power_off_timer_stop();
+       
+       if((false == watch_modem_sim_present_check_req())
+               && (NULL == lv_watch_get_activity_obj(ACT_ID_FACTORY_MODE_MAIN))
+               )
+       {
+               // power off prompt
+               SUNDRY_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+               
+               mmi_watch_wake_up();
+               mmi_ui_msg_action_no_sim_power_off();
+       }
+       else
+       {
+               // skip this time
+               SUNDRY_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+               
+               mmi_watch_no_sim_power_off_check_action();
+       }
+}
+
+void mmi_watch_no_sim_power_off_check_action(void)
+{
+       SUNDRY_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+       
+       mmi_watch_no_sim_power_off_timer_stop();
+       uos_timer_create(&s_no_sim_power_off_timer);
+       uos_timer_start(s_no_sim_power_off_timer, MS_TO_TICKS(NO_SIM_POWER_OFF_INTERVAL), 0, mmi_watch_no_sim_power_off_callback, NULL);
+}
+
+void mmi_watch_no_sim_power_off_check_mission(void)
+{
+    if((false == watch_modem_sim_present_check_req())
+               && (NULL == lv_watch_get_activity_obj(ACT_ID_FACTORY_MODE_MAIN))
+               )
+       {
+               SUNDRY_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+
+               mmi_watch_no_sim_power_off_check_action();
+    }
+}
+#endif
+
+
+// charging
+static void * s_watch_charge_prompt_timer = NULL;
+
+static void mmi_watch_charging_prompt_timer_stop(void)
+{
+       if(NULL != s_watch_charge_prompt_timer)
+       {
+               Hal_Timer_Stop(s_watch_charge_prompt_timer);
+               s_watch_charge_prompt_timer = NULL;
+       }
+}
+
+static void mmi_watch_charging_prompt_screen_prepare_destory(lv_obj_t * activity_obj)
+{
+       mmi_watch_charging_prompt_timer_stop();
+       
+    lv_watch_png_cache_all_free();
+    lv_obj_t * act_obj = lv_watch_get_activity_obj(ACT_ID_CHARGING_PROMPT);
+    if(act_obj)
+       {
+        lv_obj_del(act_obj);
+    }
+}
+
+static void mmi_watch_charging_prompt_cb(void *para)
+{
+       SUNDRY_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+       
+       mmi_watch_charging_prompt_screen_prepare_destory(NULL);
+}
+
+static lv_obj_t * mmi_watch_charging_prompt_screen(lv_obj_t * activity_obj, uint32_t chg_status)
+{
+       if(activity_obj == NULL) 
+       {
+               lv_watch_activity_ext_t activity_ext;
+               memset(&activity_ext, 0, sizeof(lv_watch_activity_ext_t));
+               activity_ext.actId = ACT_ID_CHARGING_PROMPT;
+               activity_ext.create = NULL;
+               activity_ext.prepare_destory = mmi_watch_charging_prompt_screen_prepare_destory;
+               activity_obj = lv_watch_creat_activity_obj(&activity_ext);
+               LV_ASSERT_MEM(activity_obj);
+               if(activity_obj == NULL) 
+               {
+                       return(NULL);
+               }
+       }
+
+       lv_obj_t * obj = lv_watch_obj_create(activity_obj);
+       LV_ASSERT_MEM(obj);
+       if(obj == NULL) 
+               return NULL;
+       
+    lv_watch_obj_set_anim_mode(obj, LV_WATCH_ANIM_HOR_RIGHT_HIDE);
+
+       lv_obj_t * cont = lv_cont_create(obj, NULL);
+       lv_obj_set_size(cont, 180, 180); // (cont, LV_HOR_RES, LV_VER_RES);
+       //lv_obj_set_style_local_bg_color(cont, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
+       //lv_obj_set_style_local_radius(cont, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 30);
+       lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0);
+       lv_obj_set_click(cont, false);
+       //lv_watch_obj_add_element(cont);
+
+       lv_obj_t * img = lv_img_create(cont, NULL);
+       lv_img_set_src(img, ((HAL_CHG_CONNECTED == (HAL_CHG_STATUS)chg_status) ? ICON_CHARGE_CONNECTED : ICON_CHARGE_REMOVED));
+       lv_obj_align(img, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
+       lv_obj_set_click(img, false);
+       
+       lv_obj_t * label = lv_label_create(cont, NULL);
+       lv_label_set_text_id(label, ((HAL_CHG_CONNECTED == (HAL_CHG_STATUS)chg_status) ? WATCH_TEXT_ID_CHARGE_CONNECTED : WATCH_TEXT_ID_CHARGE_REMOVED));
+       lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font26);
+       lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
+       lv_obj_align(label, img, LV_ALIGN_OUT_BOTTOM_MID, 0, 20);
+
+       mmi_watch_charging_prompt_timer_stop();
+       s_watch_charge_prompt_timer = Hal_Timer_Start(2 * 1000, mmi_watch_charging_prompt_cb, NULL, false);
+
+       return obj;
+}
+
+void mmi_ui_msg_update_charging_prompt(uint32_t chg_status)
+{
+#if 0
+       SUNDRY_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, chg_status);
+       
+       if(HAL_CHG_CONNECTED == (HAL_CHG_STATUS)chg_status || HAL_CHG_DISCONNECTED == (HAL_CHG_STATUS)chg_status)
+       {
+               mmi_watch_charging_prompt_screen(NULL, chg_status);
+       }
+#endif
+}
+
+
 
 
 
index e2d3df5..64cee93 100644 (file)
@@ -55,6 +55,17 @@ 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 __MMI_ZHSX_SUPPORT_NO_SIM_POWER_OFF__
+#define NO_SIM_POWER_OFF_INTERVAL      (15 * 60 * 1000) // ms
+#define NO_SIM_POWER_OFF_PROMPT_INTERVAL       (15) // s
+
+void mmi_ui_msg_update_no_sim_power_off(void);
+void mmi_watch_no_sim_power_off_check_action(void);
+void mmi_watch_no_sim_power_off_check_mission(void);
+#endif
+
+void mmi_ui_msg_update_charging_prompt(uint32_t chg_status);
+
 
 
 #ifdef __cplusplus