下拉充电状态代码合并
authorluozheng <1732036298@qq.com>
Sat, 24 May 2025 03:39:05 +0000 (11:39 +0800)
committerluozheng <1732036298@qq.com>
Sat, 24 May 2025 03:39:05 +0000 (11:39 +0800)
13 files changed:
code/sdk/application/wearable/fd230/nativeapp/nativeui/main/include/PullUpDownView.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/MainPresenterSample.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/PullUpDownView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/watchQRcode/src/WatchQRCodeView.cpp
code/sdk/application/wearable/fd230/service/broadcast/include/broadcast_feature.h
code/sdk/application/wearable/fd230/service/broadcast/src/broadcast_implement.c
code/sdk/application/wearable/fd230/service/msg_center/CMakeLists.txt
code/sdk/application/wearable/fd230/service/msg_center/include/notify/charge_notification.h [new file with mode: 0644]
code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp
code/sdk/application/wearable/fd230/service/msg_center/src/notify/charge_notification.cpp [new file with mode: 0644]
code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c
code/sdk/build/config/target_config/brandy/config.py
code/sdk/zhihui/services/battery/service/battery_service.cpp

index 569891c..a956666 100644 (file)
 #include "components/ui_box_progress.h"
 #include "components/ui_image_animator.h"
 #include "components/ui_swipe_view.h"
-// #include "battery_hal.h"
 #include "main/include/ConnectedStatusView.h"
 #include "main/include/dropdown/DropDownCardPage1.h"
 #include "main/include/dropdown/DropDownCardPage2.h"
 
-// extern uint8_t battery_get_voltage(float *voltage);
 
 namespace OHOS
 {
index 9289ede..2fab9cb 100644 (file)
 #ifdef SUPPORT_POWER_MANAGER
 #include "power_display_service.h"
 #endif
+
+extern "C"
+{
+#ifdef SUPPORT_BATTERY_SERVICE
+#include "battery_hal.h"
+extern uint8_t battery_get_voltage(float *voltage);
+#endif
+}
+
 namespace OHOS
 {
 REGIST_SLICE(VIEW_MAIN, MainViewSample, MainPresenterSample);
@@ -626,6 +635,8 @@ if (ConfigModel::GetInstance()->GetisFirstTimeStart() == true) {
         return ERRCODE_SUCC; // 假设成功获取星期信息
     }
 
+    
+
     void MainPresenterSample::UpdataBaseData()
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::UpdataBaseData");
@@ -660,8 +671,9 @@ if (ConfigModel::GetInstance()->GetisFirstTimeStart() == true) {
         // 获取电池电量信息
         float voltage = 0.0F;
         uint8_t value = 0;
-        // value = battery_get_voltage(&voltage);
-        value = 0;
+        #ifdef SUPPORT_BATTERY_SERVICE
+        value = battery_get_voltage(&voltage);
+        #endif
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "battery_get_voltage = %d", value);
         std::string dateAndweek = std::string(dateStr) + " " + std::string(weekStr);
         if (PullUpDownView::GetInstance() != nullptr)
index f764cc6..6df5a4b 100644 (file)
 #include "phoneservice/include/PhoneService.h"
 
 #include "ConfigModel.h"
+
+extern "C"
+{
+#ifdef SUPPORT_BATTERY_SERVICE
+#include "battery_hal.h"
+extern uint8_t get_charge_stat(void);
+#endif
+}
 namespace OHOS
 {
 
@@ -119,10 +127,12 @@ namespace OHOS
         // if (ret == 1)
         //     return true;
         // else
-        return false;
+        // return false;
 
-#ifdef FD230_650
+#ifdef FD230
         return SettingModel::GetInstance().GetPhoneConnectStatus();
+#else
+        return false;
 #endif
     }
     // 获取蓝牙耳机连接状态
@@ -134,9 +144,11 @@ namespace OHOS
         // if (ret == 1)
         //     return true;
         // else
-        return false;
-#ifdef FD230_650
+        // return false;
+#ifdef FD230
         return SettingModel::GetInstance().GetEarPhoneConnectStatus();
+#else
+        return false;
 #endif
     }
     // 获取蓝牙连接状态
@@ -148,10 +160,12 @@ namespace OHOS
         // if (ret != 0)
         //     return true;
         // else
-        return false;
+        // return false;
 
-#ifdef FD230_650
+#ifdef FD230
         return SettingModel::GetInstance().GetBlueToothConnectStatus();
+#else
+        return false;
 #endif
     }
 
@@ -523,7 +537,7 @@ namespace OHOS
         /* -------------------------------------------------------------------------- */
         UpdateSignalStrengthStatusAndBatteryPosition();
 /* -------------------------------------------------------------------------- */
-#ifdef FD230_650
+#ifdef FD230
         MainPresenterSample::GetInstance()->UpdataBaseData();
 #endif
         /* -------------------------------------------------------------------------- */
@@ -875,7 +889,7 @@ namespace OHOS
         updateSignalDisplay(); // 函数用于更新信号显示的UI
         UpdateXPosition();
 
-#ifdef FD230_650
+#ifdef FD230
         /*更新蓝牙连接状态*/
         int a2dp = uapi_a2dp_snk_get_device_connect_state();
         int hfp = uapi_hfp_connect_state();
@@ -892,8 +906,10 @@ namespace OHOS
             return;
         }
 
-        // bool isCharging = get_charge_stat(); // 获取充电状态
-           bool isCharging = false; 
+        bool isCharging = false;
+        #ifdef SUPPORT_BATTERY_SERVICE
+        isCharging = get_charge_stat(); // 获取充电状态
+        #endif
 
         if (isCharging)
         {
index 638700e..fd5bfe3 100644 (file)
@@ -63,16 +63,12 @@ namespace OHOS
 
     extern "C"
     {
-        #ifdef SUPPORT_BLE_SERVICE
+        #ifdef SUPPORT_BATTERY_SERVICE
 #include "build_version.h"
 #include "battery_hal.h"
         extern uint8_t battery_get_voltage(float *voltage);
         const char *get_version_string(void);
-#else
-        extern uint8_t battery_get_voltage(float *voltage){ return 0;}
-        const char *get_version_string(void);
-#endif
-
+        #endif
     }
 
     bool WatchQRCodeView::WatchQRCodeInitViewGroup(void)
@@ -191,12 +187,16 @@ namespace OHOS
         // 电量:
         float voltage = 0.0F;
         uint8_t value = 0;
-        // value = battery_get_voltage(&voltage);
-        // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "battery_get_voltage = %d", value);
-        value = 0;
+        #ifdef SUPPORT_BATTERY_SERVICE
+        value = battery_get_voltage(&voltage);
+        #endif
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "battery_get_voltage = %d", value);
 
         // 版本号:
-        std::string temp = get_version_string();
+        std::string temp;
+        #ifdef SUPPORT_BATTERY_SERVICE
+        temp = get_version_string();
+        #endif
         std::string version_string = "V" + temp;
         std::string str = "bat:" + std::to_string(value) + "%" + " " + version_string;
         return str;
index 95b0129..242cde1 100644 (file)
@@ -58,11 +58,9 @@ typedef enum {
     TOPIC_EVENT_BLE_TRANSMIT,\r
     TOPIC_EVENT_GOAL_SHOW_VIEW,\r
 // #endif\r
-#ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION\r
     TOPIC_EVENT_CHARGE_PLUG,\r
     TOPIC_EVENT_CHARGE_UNPLUG,\r
     TOPIC_EVENT_LOWPOWER_ALARM,\r
-#endif\r
 #ifdef SUPPORT_SPO2_NOTIFICATION\r
     TOPIC_EVENT_SPO2_UPDATE,\r
     TOPIC_EVENT_START_HRS_MONITORING,\r
index 62a936e..11a994e 100644 (file)
@@ -34,6 +34,9 @@ static const TopicToCore topicToCoreArray[] = {
     {TOPIC_EVENT_HFP_WATCH_TO_PHONE, A_CORE_MASK, 1},
     {TOPIC_EVENT_DEVICE_BIND, A_CORE_MASK, 1},
     {TOPIC_EVENT_BLE_TRANSMIT, A_CORE_MASK, 1},
+    {TOPIC_EVENT_CHARGE_PLUG, A_CORE_MASK, 1},
+    {TOPIC_EVENT_CHARGE_UNPLUG, A_CORE_MASK, 1},
+    {TOPIC_EVENT_LOWPOWER_ALARM, A_CORE_MASK, 1},
 };
 
 /* 所有的topic,其对应的位图 */
index 59ce45d..65e1c34 100644 (file)
@@ -134,6 +134,8 @@ set(PRIVATE_HEADER
     ${ROOT_DIR}/application/wearable/nativeapp/nativeui/player/include
     ${ROOT_DIR}/application/wearable/nativeapp/nativeui/applist/include
     ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/player/interfaces/kits
+
+    ${ROOT_DIR}/application/wearable/fd230/nativeapp/nativeui/
 )
 
 if("JS_ENABLE" IN_LIST DEFINES)
@@ -147,6 +149,7 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/ketinput/src/NotifyOnKeyListener.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/pairing_notification.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/transmitting.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/charge_notification.cpp
 )
 else()
 set(SOURCES
@@ -158,6 +161,7 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/ketinput/src/NotifyOnKeyListener.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/pairing_notification.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/transmitting.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/charge_notification.cpp
     
 )
 endif()
diff --git a/code/sdk/application/wearable/fd230/service/msg_center/include/notify/charge_notification.h b/code/sdk/application/wearable/fd230/service/msg_center/include/notify/charge_notification.h
new file mode 100644 (file)
index 0000000..b37d65b
--- /dev/null
@@ -0,0 +1,80 @@
+#ifndef CHARGE_NOTIFICATION_H
+#define CHARGE_NOTIFICATION_H
+#include "components/ui_image_animator.h" 
+
+namespace OHOS
+{
+    // UIViewGroup *ChargingStatuShow(void);
+    // UIView *view_ = nullptr;
+    void FreeChargePower(void);
+    bool is_UIViewGroup_charge(void);
+    UIViewGroup * ShowChargeingView(void);
+
+    UIViewGroup* lowPowerShow(void);
+    
+    void set_lowpower_falg(uint8_t falg);
+    void FreelowPower(void);
+    void low_power_play();
+     
+    class lowppowrAnimatorStopListener :public OHOS::UIImageAnimatorView::AnimatorStopListener
+    {
+        public:
+        lowppowrAnimatorStopListener()
+        {
+        }
+        virtual ~lowppowrAnimatorStopListener(){
+
+        }
+           static lowppowrAnimatorStopListener *GetInstance(void)
+        {
+            static lowppowrAnimatorStopListener lowppowrAnimatorStopListener_T;
+            return &lowppowrAnimatorStopListener_T;
+        }
+
+        virtual void OnAnimatorStop(UIView &view) override;
+
+
+        
+    };
+
+
+   
+    class lowppowrViewEventListener : public OHOS::UIView::OnClickListener,
+                              public OHOS::UIView::OnLongPressListener,
+                              public OHOS::UIView::OnTouchListener,
+                              public OHOS::UIView::OnDragListener 
+    {
+public:
+    lowppowrViewEventListener();
+       virtual ~lowppowrViewEventListener();
+       static lowppowrViewEventListener *GetInstance(void);
+
+    bool OnClick(OHOS::UIView& view, const OHOS::ClickEvent& event) override;
+    bool OnDrag(UIView& view, const DragEvent& event) override
+    {
+        return true;
+    }
+    bool OnDragEnd(OHOS::UIView& view, const OHOS::DragEvent& event) override
+    {
+        return true;
+    }
+    virtual bool OnPress(OHOS::UIView& view, const OHOS::PressEvent& event) override
+    {
+        return true;
+    }
+    virtual bool OnLongPress(OHOS::UIView& view, const OHOS::LongPressEvent& event) override
+    {
+        return true;
+    }
+    virtual bool OnRelease(OHOS::UIView& view, const OHOS::ReleaseEvent& event) override
+    {
+        return true;
+    }
+
+    virtual bool OnDragStart(OHOS::UIView& view, const OHOS::DragEvent& event) override
+    {
+        return true;
+    }
+};
+};
+#endif /* CHARGE_NOTIFICATION_H */
\ No newline at end of file
index 1ea0589..40d3277 100644 (file)
 #include "bleInstruct.h"
 #endif
 
+#ifdef FD230
+#include "main/include/PullUpDownView.h"
+#include "custom_save_runtime.h"
 #include "transmitting.h"
+#include "charge_notification.h"
+
+#ifdef SUPPORT_POWER_MANAGER
+#include "power_display_service.h"
+#endif
+#endif
 
 namespace OHOS {
 
@@ -57,7 +66,10 @@ const PriorityMapper PRI_MAPPER[] = {
     {TOPIC_EVENT_HFP_WATCH_TO_PHONE, PRIORITY_ONE},
     {TOPIC_EVENT_HFP_PHONE_TO_WATCH, PRIORITY_ONE},
     {TOPIC_EVENT_DEVICE_BIND, PRIORITY_ONE},
-    {TOPIC_EVENT_BLE_TRANSMIT,PRIORITY_ONE}
+    {TOPIC_EVENT_BLE_TRANSMIT,PRIORITY_ONE},
+    {TOPIC_EVENT_CHARGE_PLUG, PRIORITY_TWO},
+    {TOPIC_EVENT_CHARGE_UNPLUG, PRIORITY_TWO},
+    {TOPIC_EVENT_LOWPOWER_ALARM,PRIORITY_TWO},
     // {TOPIC_EVENT_DEVICE_UNBIND, PRIORITY_TWO},
     // {TOPIC_EVENT_DEVICE_UNBINDING_REQUEST, PRIORITY_TWO},
 
@@ -95,6 +107,9 @@ void MsgCenterSubscribe()
     MsgCenterSubscribeTopic(TOPIC_EVENT_HFP_WATCH_TO_PHONE);
     MsgCenterSubscribeTopic(TOPIC_EVENT_DEVICE_BIND);
     MsgCenterSubscribeTopic(TOPIC_EVENT_BLE_TRANSMIT);
+    MsgCenterSubscribeTopic(TOPIC_EVENT_CHARGE_PLUG);
+    MsgCenterSubscribeTopic(TOPIC_EVENT_CHARGE_UNPLUG);
+    MsgCenterSubscribeTopic(TOPIC_EVENT_LOWPOWER_ALARM);
     
 }
 
@@ -140,6 +155,17 @@ static OHOS::UIViewGroup* showtransmitNotify(void)
 {
     return OHOS::transmittingShow();
 }
+//充电弹窗
+static OHOS::UIViewGroup* ShowChargeingNotify(void)
+{
+    return OHOS::ShowChargeingView();
+}
+
+/*显示低电量通知*/
+static OHOS::UIViewGroup* showlowpowerNotify(void)
+{
+    return OHOS::lowPowerShow();
+}
 
 void MsgCenterNotifyAlarmProc(const Topic topic, Request* req)
 {
@@ -215,7 +241,7 @@ void MsgCenterNotifyHfpWatchProc(const Topic topic, Request* req)
         NotificationManager::GetInstance()->SetWatchCallStatus(true);
     }
 }
-
+#ifdef FD230
 void MsgCenterNotifyDeviceBindProc(const Topic topic, Request* req)
 {
     #ifdef SUPPORT_BLE_SERVICE
@@ -327,6 +353,153 @@ void MsgCenterNotifybleTransmit(const Topic topic, Request* req)
     // unused(req);
     #endif
 }
+
+void MsgCenterNotifyChargePlugProc(const Topic topic, Request* req)
+{
+    unused(req);
+    WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger Plug !");
+
+    uapi_save_runtime_log(RUNTIME_LOG_CHARGE_START);//充电开始事件
+
+    const power_display_svr_api_t *display_api = power_display_svr_get_api();
+    if (display_api->get_screen_state() != SCREEN_ON)
+    {
+        display_api->turn_on_screen();
+    }
+
+    if(PullUpDownView::GetInstance())
+    {
+        GraphicService::GetInstance()->PostGraphicEvent(std::bind(&OHOS::PullUpDownView::UpdateBatteryProcess,  OHOS::PullUpDownView::GetInstance() ));
+    }
+
+    #if 0
+#if DIALDATASET
+    DialModelCharge::GetInstance()->UpdatechargeStatus(1);
+#endif
+    SaveEleModel::GetInstance()->SetChargeStatus(true);
+    if (uapi_dev_runtime_get_train_status()) 
+    {
+      WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger Plug ! but train status is true");
+      return ;
+    }
+
+    
+    testCHANINGView *t = testCHANINGView::GetInstance();
+    if(t != nullptr)
+    {
+        t->ChangeViewcolor(true);
+    }
+    else
+    {
+        if (CheckPriority(topic) && !uapi_dev_runtime_get_factory_test_status_flag()) //产测模式不弹充电弹窗
+        {
+            NotificationManager::GetInstance()->ShowNotify(ShowChargeingNotify, (uint16_t)topic, true);
+        }
+    }
+    #endif
+   
+}
+
+/*充电器已拔掉*/
+void MsgCenterNotifyChargeUnPlugProc(const Topic topic, Request* req)
+{
+    unused(req);
+    unused(topic);
+    WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger UnPlug !");
+    //充电停止事件
+    uapi_save_runtime_log(RUNTIME_LOG_CHARGE_STOP);//TOOD*
+
+    if(PullUpDownView::GetInstance())
+    {
+        GraphicService::GetInstance()->PostGraphicEvent(std::bind(&OHOS::PullUpDownView::UpdateBatteryProcess,  OHOS::PullUpDownView::GetInstance() ));
+    }
+
+    #if 0
+#if DIALDATASET
+    DialModelCharge::GetInstance()->UpdatechargeStatus(0);
+#endif
+    SaveEleModel::GetInstance()->SetChargeStatus(false);
+    
+    testCHANINGView *t = testCHANINGView::GetInstance();
+    if(t != nullptr)
+    {
+        t->ChangeViewcolor(false);
+    }
+    else
+    {
+        if(is_UIViewGroup_charge())
+        {
+            NotificationManager::GetInstance()->StopNotify();
+        }
+    }
+    #endif
+}
+
+/*低电量提醒*/
+void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req)
+{
+    WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: LowPower Alarm !");
+    #if 0
+    uint8 *x= (uint8 *)(req->data);
+    const power_display_svr_api_t *display_api = power_display_svr_get_api();
+ 
+    if(*x==3)
+    {
+        if (display_api->get_screen_state() != SCREEN_ON)
+        {   
+            display_api->turn_on_screen();  
+        }
+        display_api->set_screen_set_keepon_timeout(1000*5);
+        //倒计时结束后,直接执行关机动画
+        low_power_play();
+    }
+    else if(*x==0)
+    {
+        //提醒低电充电
+        if (display_api->get_screen_state() != SCREEN_ON)
+        {   
+            display_api->turn_on_screen();  
+        }
+        display_api->set_screen_set_keepon_timeout(1000*5);
+
+        set_lowpower_falg(0);
+        if (CheckPriority(topic))
+        {
+            NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+            NotificationManager::GetInstance()->ShowNotify(showlowpowerNotify, (uint16_t)topic, true);
+        }
+    }
+    else
+    {
+        //电量过低,直接提醒关机
+        if (display_api->get_screen_state() != SCREEN_ON)
+        {   
+            display_api->turn_on_screen();  
+        }
+        display_api->set_screen_set_keepon_timeout(1000*10);
+        
+        set_lowpower_falg(1);
+        if (NotificationManager::GetInstance()->HasNotifyShowing())
+        NotificationManager::GetInstance()->StopNotify();
+        if (CheckPriority(topic))
+        {
+            NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
+            NotificationManager::GetInstance()->ShowNotify(showlowpowerNotify, (uint16_t)topic, true);
+        }
+    }
+    //TODO: 亮屏弹窗倒计时5秒关机(不需要取消,强制关机)
+    // DialModelCharge::GetInstance()->UpdatechargeStatus(0);
+    // SaveEleModel::GetInstance()->SetChargeStatus(0);
+    
+    // testCHANINGView *t=testCHANINGView::GetInstance();
+    // if(t!=NULL)
+    // {
+        // t->ChangeViewcolor(false);
+    // }
+    #endif
+}
+#endif
+
 /* 订阅事件通知逻辑可定制 */
 static MsgCenterNotifyTable g_msgCenterNotifyTable[] = {
     {TOPIC_EVENT_ALARM_RING,         MsgCenterNotifyAlarmProc},
@@ -338,8 +511,10 @@ static MsgCenterNotifyTable g_msgCenterNotifyTable[] = {
     {TOPIC_EVENT_HFP_WATCH_ACTIVE,   MsgCenterNotifyHfpWatchProc},
     {TOPIC_EVENT_HFP_PHONE_TO_WATCH, MsgCenterNotifyHfpWatchProc},
     {TOPIC_EVENT_BLE_TRANSMIT,       MsgCenterNotifybleTransmit},
-
     {TOPIC_EVENT_DEVICE_BIND,     MsgCenterNotifyDeviceBindProc},
+    {TOPIC_EVENT_CHARGE_PLUG,       MsgCenterNotifyChargePlugProc},
+    {TOPIC_EVENT_CHARGE_UNPLUG,       MsgCenterNotifyChargeUnPlugProc},
+    {TOPIC_EVENT_LOWPOWER_ALARM,       MsgCenterNotifyLowPowerAlarmProc},
     // {TOPIC_EVENT_DEVICE_UNBIND,   MsgCenterNotifyDeviceUnBindProc},   
     // {TOPIC_EVENT_DEVICE_UNBINDING_REQUEST,   MsgCenterNotifyDeviceUnBindingRequestProc},   
 
diff --git a/code/sdk/application/wearable/fd230/service/msg_center/src/notify/charge_notification.cpp b/code/sdk/application/wearable/fd230/service/msg_center/src/notify/charge_notification.cpp
new file mode 100644 (file)
index 0000000..f808c4f
--- /dev/null
@@ -0,0 +1,656 @@
+#include "notification_manager.h"
+#include "wearable_log.h"
+#include "UiConfig.h"
+#include "AlarmPopUpPresenter.h"
+#include "components/ui_image_view.h"
+#include "components/ui_label.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_label_button_ext.h"  
+#include "battery_service.h"
+#include "NativeAbility.h"
+#include "custom_utils.h"
+#include "cmsis_os2.h"
+#include "linux/delay.h"
+#include "components/ui_circle_progress.h"
+#include "battery_hal.h"
+#include "uicomponents/UIComponents.h"
+#include "charge_notification.h"
+
+//#include "ui_resource_string.h"
+
+namespace OHOS
+{
+    UIImageView *imageCharge = nullptr;
+    UIViewGroup *UIViewGroup_lowpower=nullptr;
+    UIImageView *alarm_img=nullptr;
+    UILabelExt *alarm_UILabel=nullptr;
+    UILabelButtonExt *alarm_labelbutton=nullptr;
+    UIViewGroup *group=nullptr;
+    UIImageAnimatorView *ShutDownImageAnimatorView=nullptr;
+    static constexpr char *ShutDownPaths = "/user/res/RebootAndShutDown/ShutDown/"; //关机图片路径
+    #define SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES 30 // 图片帧数
+    static int16_t SHUTDOWN_IMAGE_ANIMATOR_TIME = 130;           // 图片更新间隔
+    
+    static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_X = 0;
+    static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_Y = 0;
+    static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_W = 466;
+    static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_H = 466;
+    const ImageInfo **ShutDownInfoArray{nullptr};                                     // 关机图片路径数组
+    ImageAnimatorInfo ShutDownImageInfo[SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; // 关机图像的信息
+    #define LOW_POWER_BUTTON "LOW_POWER_BUTTON"
+    #define CHARGE_GROUP "UIViewGroup_charge"
+
+   // GILROY_BOLD_FONT
+    //充电中 UI 
+    UIViewGroup *UIViewGroup_charge =nullptr;
+
+    UICircleProgress *batteryprogress = nullptr;
+
+    UIImageView *image_circle = nullptr;
+    UIImageView *image_lightning=nullptr;
+  
+    UILabelExt *UILabel_time=nullptr;
+    UILabelExt *UILabel_power=nullptr;
+    UILabelExt *UILabel_Chargeing=nullptr;
+
+    osTimerId_t Chargeing_timer= NULL;
+
+    // 刷新回调
+    void Chargeing_Timer_CallBack(int data) {
+      if (UIViewGroup_charge == nullptr || UILabel_Chargeing == nullptr ||
+          UILabel_power == nullptr || UILabel_time == nullptr ||
+          batteryprogress== nullptr) {
+        return;
+      }
+
+      float voltage = 0.0F;
+      uint8_t power = battery_get_voltage(&voltage);
+
+      // 使用 std::to_string 生成电池电量字符串
+      std::string powerstr = std::to_string(power) + "%";
+
+      // 获取当前时间
+      time_t seconds = time(nullptr);
+      struct tm pTM;
+      localtime_r(&seconds, &pTM); // 使用 localtime_r 以确保线程安全
+
+      // 解析时间并格式化为字符串
+      std::string stringtime =
+          (pTM.tm_hour < 10 ? "0" : "") + std::to_string(pTM.tm_hour) + ":" +
+          (pTM.tm_min < 10 ? "0" : "") + std::to_string(pTM.tm_min);
+
+      // 更新充电状态标签
+      if (UILabel_Chargeing) {
+        if (power == 100) {
+          UILabel_Chargeing->SetTextId(STR_CHARG_DOWN); // TODO: 增加多国语言
+        } else {
+          UILabel_Chargeing->SetTextId(STR_CHAEGING);
+          // UILabel_Chargeing->SetTextId(STR_CHARGE);
+        }
+        UILabel_Chargeing->Invalidate();
+      }
+
+      // 刷新时间标签
+      if (UILabel_time) {
+        UILabel_time->SetText(stringtime.c_str());
+        UILabel_time->Invalidate();
+      }
+
+      // 刷新电池百分比标签
+      if (UILabel_power) {
+        UILabel_power->SetText(powerstr.c_str());
+        UILabel_power->Invalidate();
+      }
+
+      // 刷新进度条
+      if (batteryprogress) {
+        batteryprogress->SetValue(power);
+        batteryprogress->Invalidate();
+      }
+    }
+
+    bool is_UIViewGroup_charge(void)
+    {
+        if(UIViewGroup_charge != nullptr) 
+        {
+            return true;
+        }
+        return false;
+    }
+
+    void FreeChargePower(void)
+    {
+       if (UIViewGroup_charge != nullptr) 
+       {
+
+        if(Chargeing_timer)
+        {
+            osTimerStop(Chargeing_timer);
+            osTimerDelete(Chargeing_timer);
+            Chargeing_timer = NULL;
+        }
+
+        UIViewGroup_charge->RemoveAll();
+
+        if (batteryprogress) {
+          delete batteryprogress;
+          batteryprogress = nullptr;
+        }
+        if(image_lightning)
+        {
+            delete image_lightning;
+            image_lightning = nullptr;
+        }
+
+        if(UILabel_time)
+        {
+            delete UILabel_time;
+            UILabel_time = nullptr;
+        }
+
+        if(UILabel_power)
+        {
+            delete UILabel_power;
+            UILabel_power = nullptr;
+
+        }
+         if(UILabel_Chargeing)
+        {
+            delete UILabel_Chargeing;
+            UILabel_Chargeing = nullptr;
+
+        }
+       
+      
+        RootView::GetInstance()->Remove(UIViewGroup_charge);
+        delete UIViewGroup_charge;
+        UIViewGroup_charge = nullptr;
+        }
+    }
+
+    UIViewGroup * ShowChargeingView(void)
+    {
+      
+        if (UIViewGroup_charge == nullptr) 
+        {
+            UIViewGroup_charge = new UIViewGroup();
+            UIViewGroup_charge->SetPosition(0, 0, 466, 466);
+            //UIViewGroup_charge->SetStyle(STYLE_BACKGROUND_OPA, 0);
+        }
+        UIViewGroup_charge->SetViewId(CHARGE_GROUP);
+        UIViewGroup_charge->SetTouchable(true);
+        UIView::OnClickListener *UIViewGroup_charge_Click = static_cast<UIView::OnClickListener *>(lowppowrViewEventListener::GetInstance());
+        UIViewGroup_charge->SetOnClickListener(UIViewGroup_charge_Click);
+
+        
+        float voltage = 0.0F;
+        uint8_t power = 0;
+        power = battery_get_voltage(&voltage);
+      
+        char buf[16]={0};
+        sprintf(buf,"%d%c",power,'%');
+        //printf("power:%s\r\n",buf);
+
+        time_t currtime;
+        struct tm *timeinfo;
+        time(&currtime);
+        timeinfo = localtime(&currtime);
+
+        char time_buf[16]={0};
+        sprintf_s(time_buf,16,"%02d:%02d",timeinfo->tm_hour,timeinfo->tm_min);
+
+        if (batteryprogress == nullptr) {
+          batteryprogress = new UICircleProgress();
+        }
+        batteryprogress->SetPosition(
+            123, 123); // widget's left position and top position
+        batteryprogress->Resize(224, 222); // widget's width and height
+        batteryprogress->SetViewId("circleProgress1"); // Set style
+        batteryprogress->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+
+        // Set additional property
+        // Set BackgroundStyle
+        batteryprogress->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
+        batteryprogress->SetBackgroundStyle(STYLE_BACKGROUND_OPA, 0x05);
+        batteryprogress->SetBackgroundStyle(STYLE_BORDER_OPA, 0x07);
+        batteryprogress->SetBackgroundStyle(STYLE_LINE_OPA, 0x07);
+        batteryprogress->SetBackgroundStyle(STYLE_LINE_WIDTH, 22);
+        // Set ForegroundStyle
+        batteryprogress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, 0xff2195F6);
+        batteryprogress->SetForegroundStyle(STYLE_BORDER_COLOR, 0xff000000);
+        batteryprogress->SetForegroundStyle(STYLE_LINE_COLOR, 0xff4FC34C);
+        batteryprogress->SetForegroundStyle(STYLE_LINE_WIDTH, 22);
+        batteryprogress->SetCenterPosition(111, 109);
+        batteryprogress->SetRadius(108);
+        batteryprogress->SetEndAngle(359);
+        batteryprogress->SetValue(power);
+        batteryprogress->SetVisible(true);
+        // batteryprogress->SetCapType(CAP_ROUND); 不使用圆形边缘
+
+        if (image_lightning == nullptr) {
+        image_lightning = new UIImageView();
+        }
+        image_lightning->SetPosition(207, 176);         // widget's left position and top position
+        image_lightning->Resize(70, 60);          // widget's width and height
+        image_lightning->SetViewId("image2");// Set style
+        image_lightning->SetStyle(STYLE_BORDER_COLOR, 0xff191919);
+        char* image2imagesPath = "/user/res/solar-energy_1.bin";
+        image_lightning->SetSrc(image2imagesPath);
+        image_lightning->SetVisible(true);
+
+
+        if (image_circle == nullptr) {
+            image_circle = new UIImageView();
+        }
+        image_circle->SetPosition(126, 125);         // widget's left position and top position
+        image_circle->Resize(194, 194);          // widget's width and height
+        image_circle->SetViewId("image1");// Set style
+        char* image1imagesPath = "/user/res/Ellipse_37.bin";
+        image_circle->SetSrc(image1imagesPath);
+        image_circle->SetVisible(true);
+
+        if (UILabel_power == nullptr) {
+            UILabel_power = new UILabelExt();
+        }
+        UILabel_power->SetPosition(133, 252);         // widget's left position and top position
+        UILabel_power->Resize(200, 60);          // widget's width and height
+        UILabel_power->SetViewId("label5");// Set style
+        UILabel_power->SetStyle(STYLE_TEXT_FONT, 40);
+
+        UILabel_power->SetText(buf);
+        UILabel_power->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+        UILabel_power->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+        UILabel_power->SetRollSpeed(0);
+        UILabel_power->SetFont(GILROY_BOLD_FONT, 40);
+        UILabel_power->SetVisible(true);
+        
+
+        if (UILabel_Chargeing == nullptr) {
+            UILabel_Chargeing = new UILabelExt();
+        }
+        UILabel_Chargeing->SetPosition(133, 356);         // widget's left position and top position
+        UILabel_Chargeing->Resize(200, 60);          // widget's width and height
+        UILabel_Chargeing->SetViewId("label4");// Set style
+        UILabel_Chargeing->SetStyle(STYLE_TEXT_FONT, 30);
+        // UILabel_Chargeing->SetText("正在充电");
+        // UILabel_Chargeing->SetTextId(STR_CHARGE);
+        UILabel_Chargeing->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+        UILabel_Chargeing->SetTextColor(Color::GetColorFromRGBA(0x4F, 0xC3, 0x4C, 0xff));
+        UILabel_Chargeing->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+        UILabel_Chargeing->SetRollSpeed(0);
+        UILabel_Chargeing->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, 30);
+        UILabel_Chargeing->SetVisible(true);
+
+
+        if (UILabel_time == nullptr) {
+            UILabel_time = new UILabelExt();
+        }
+        UILabel_time->SetPosition(173, 65);         // widget's left position and top position
+        UILabel_time->Resize(120, 48);          // widget's width and height
+        UILabel_time->SetViewId("label3");// Set style
+        UILabel_time->SetStyle(STYLE_TEXT_FONT, 40);
+        // Set additional property
+        UILabel_time->SetText(time_buf);
+        UILabel_time->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+        UILabel_time->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+        UILabel_time->SetRollSpeed(0);
+        UILabel_time->SetFont(GILROY_BOLD_FONT, 40);
+        UILabel_time->SetVisible(true);
+
+        osStatus_t retTimer;
+        Chargeing_timer = osTimerNew((osTimerFunc_t)Chargeing_Timer_CallBack, osTimerPeriodic, NULL, NULL);
+        retTimer = osTimerStart(Chargeing_timer, 1000*1);
+        if (retTimer != osOK && Chargeing_timer != NULL) {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+                "StartCallTimer osTimerStart failed,  ret = %lx!!", retTimer);
+            osTimerDelete(Chargeing_timer);
+            Chargeing_timer = NULL;
+        }
+        
+       
+
+        UIViewGroup_charge->Add(image_lightning);
+        UIViewGroup_charge->Add(image_circle);
+
+        UIViewGroup_charge->Add(batteryprogress);
+
+        UIViewGroup_charge->Add(UILabel_time);
+        UIViewGroup_charge->Add(UILabel_power);
+        UIViewGroup_charge->Add(UILabel_Chargeing);
+
+        NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeChargePower);
+        return UIViewGroup_charge;
+    }
+
+
+    void ShowUpShutDownAnimatorView()
+    {
+        group = new UIViewGroup();
+        if (group == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group new fail");
+            return ;
+        }
+        group->SetPosition(0, 0, 466, 466);
+
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShutDownAnimatorView::ShowUpShutDownAnimatorView");
+        ShutDownInfoArray = CreateImageInfoArray(ShutDownPaths, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+
+        if (ShutDownImageAnimatorView == nullptr)
+        {
+            ShutDownImageAnimatorView = new UIImageAnimatorView();
+            if (ShutDownImageAnimatorView == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BluetoothEarPhoneView new ShutDownImageAnimatorView fail");
+                return ;
+            }
+           
+            for (uint8_t i = 0; i < SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++)
+            {
+                ShutDownImageInfo[i].imageInfo = (ShutDownInfoArray[i]);
+                ShutDownImageInfo[i].imageType = IMG_SRC_IMAGE_INFO;
+                ShutDownImageInfo[i].pos.x = SHUTDOWN_IMAGE_ANIMATOR_VIEW_X;
+                ShutDownImageInfo[i].pos.y = SHUTDOWN_IMAGE_ANIMATOR_VIEW_Y;
+                ShutDownImageInfo[i].width = SHUTDOWN_IMAGE_ANIMATOR_VIEW_W;
+                ShutDownImageInfo[i].height = SHUTDOWN_IMAGE_ANIMATOR_VIEW_H;
+            }
+            ShutDownImageAnimatorView->SetPosition(SHUTDOWN_IMAGE_ANIMATOR_VIEW_X, SHUTDOWN_IMAGE_ANIMATOR_VIEW_Y, SHUTDOWN_IMAGE_ANIMATOR_VIEW_W, SHUTDOWN_IMAGE_ANIMATOR_VIEW_H);
+            ShutDownImageAnimatorView->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+            ShutDownImageAnimatorView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+            ShutDownImageAnimatorView->SetImageAnimatorSrc(ShutDownImageInfo, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES, SHUTDOWN_IMAGE_ANIMATOR_TIME);
+            ShutDownImageAnimatorView->SetRepeat(false);
+            ShutDownImageAnimatorView->SetRepeatTimes(1);
+           
+        }
+        UIImageAnimatorView::AnimatorStopListener *stoplistener =  static_cast<UIImageAnimatorView::AnimatorStopListener *>(lowppowrAnimatorStopListener::GetInstance());
+        ShutDownImageAnimatorView->SetAnimatorStopListener(stoplistener);
+        if (stoplistener == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Failed to Create stoplistener!!");
+            return;
+        }
+
+        ShutDownImageAnimatorView->SetVisible(true);
+        //ShutDownImageAnimatorView->Start();
+        group->SetVisible(false);
+        group->Add(ShutDownImageAnimatorView);
+        return ;
+    }
+
+    static uint8_t battery_falg=0;
+    void set_lowpower_falg(uint8_t falg)
+    {
+        battery_falg=falg;
+    }
+
+    osTimerId_t  low_power_timer= NULL;
+   void FreelowPower(void)
+    {
+       if (UIViewGroup_lowpower != nullptr) 
+       {
+        UIViewGroup_lowpower->RemoveAll();
+        if(alarm_img)
+        {
+            delete alarm_img;
+            alarm_img = nullptr;
+        }
+        if(alarm_UILabel)
+        {
+            delete alarm_UILabel;
+            alarm_UILabel = nullptr;
+        }
+         if(alarm_labelbutton)
+        {
+            delete alarm_labelbutton;
+            alarm_labelbutton = nullptr;
+        }
+        if(group)
+        {
+            group->RemoveAll();
+            ShutDownImageAnimatorView->Stop();
+            if(ShutDownImageAnimatorView)
+            {
+            delete ShutDownImageAnimatorView;
+            ShutDownImageAnimatorView = nullptr;
+            }
+            FreeImageInfoArray(ShutDownInfoArray,ShutDownPaths,SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+            delete group;
+            group = nullptr;
+
+        }
+        //FreeImagePathsArray(ShutDownPathsArray,SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+      
+        RootView::GetInstance()->Remove(UIViewGroup_lowpower);
+        delete UIViewGroup_lowpower;
+        UIViewGroup_lowpower = nullptr;
+        }
+    }
+    static uint8_t timer_falg_low_power=6;
+    void low_power_TimerCallBack(int data)
+    {
+        //uapi_poweroff_device(); // 关机
+        if(timer_falg_low_power)
+        {
+            timer_falg_low_power--;
+           // char buf[34]={0};
+            // sprintf(buf,"电量过低%ds后将自动关机",timer_falg_low_power);
+            // alarm_UILabel->GetText();
+            // printf("%s\r\n",alarm_UILabel);
+            UpdateLabel(alarm_UILabel, timer_falg_low_power, STR_LOW_POWER_NOTIF_2);
+            alarm_UILabel->Invalidate();
+            if(timer_falg_low_power==0)
+            {
+                alarm_UILabel->SetVisible(false);
+                low_power_play_toUI(3);
+            }
+           
+        }
+        
+    }
+
+    void low_power_play()
+    {
+        //uapi_poweroff_device(); // 关机
+       
+        //osTimerStop(low_power_timer);
+        group->SetVisible(true);
+        UIImageAnimatorView::AnimatorStopListener *stoplistener =  static_cast<UIImageAnimatorView::AnimatorStopListener *>(lowppowrAnimatorStopListener::GetInstance());
+        ShutDownImageAnimatorView->SetAnimatorStopListener(stoplistener);
+        if (stoplistener == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Failed to Create stoplistener!!");
+            return ;
+        }
+        ShutDownImageAnimatorView->Start();
+        set_lowpower_show(1,0);
+
+
+        
+    }
+
+    UIViewGroup *lowPowerShow()
+    {
+    
+        if (UIViewGroup_lowpower == nullptr) {
+            UIViewGroup_lowpower = new UIViewGroup();
+            UIViewGroup_lowpower->SetPosition(0, 0, 466, 466);
+            //UIViewGroup_lowpower->SetStyle(STYLE_BACKGROUND_OPA, 0);
+        }
+        // Add ImageView to App
+        if (alarm_img == nullptr) {
+            alarm_img = new UIImageView();
+        }
+        alarm_img->SetPosition(171, 155);         // widget's left position and top position
+        alarm_img->Resize(100, 100);          // widget's width and height
+        alarm_img->SetViewId("image1");// Set style
+
+        // Set additional property
+        const char *imageimagesPath = "/user/res/lowpower.bin";
+        alarm_img->SetSrc(imageimagesPath);
+
+        // Add to rootView
+        UIViewGroup_lowpower->Add(alarm_img);
+        alarm_img->SetVisible(true);
+
+        // Add Label to App
+        if (alarm_UILabel == nullptr) {
+            alarm_UILabel = new UILabelExt();
+        }
+        alarm_UILabel->SetPosition(101, 215);         // widget's left position and top position
+        alarm_UILabel->Resize(466, 212);          // widget's width and height
+        alarm_UILabel->SetViewId("label1");// Set style
+        alarm_UILabel->SetStyle(STYLE_TEXT_FONT, 30);
+
+        // Set additional property
+        if(battery_falg==0)
+        {
+            alarm_UILabel->SetPosition(110, 252);         // widget's left position and top position
+            alarm_UILabel->Resize(245, 70);          // widget's width and height
+
+            // alarm_UILabel->SetText("当前电量低于10%请及时充电");
+            alarm_UILabel->SetTextId(STR_LOW_POWER_NOTIF_1);
+            
+            alarm_UILabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+            alarm_UILabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            alarm_UILabel->SetRollSpeed(0);
+            alarm_UILabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            set_lowpower_show(0,0);
+        }
+        // Set additional property
+        if(battery_falg==1)
+        {
+            alarm_UILabel->SetPosition(110, 252);
+            alarm_UILabel->Resize(245, 70);          // widget's width and height
+            //alarm_UILabel->SetText("当前电量低于5%,将自动关机");
+            alarm_UILabel->SetTextId(STR_LOW_POWER_NOTIF_2);
+            UpdateLabel(alarm_UILabel, 5, STR_LOW_POWER_NOTIF_2);
+            alarm_UILabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+            alarm_UILabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            alarm_UILabel->SetRollSpeed(0);
+            alarm_UILabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            osStatus_t retTimer;
+            low_power_timer = osTimerNew((osTimerFunc_t)low_power_TimerCallBack, osTimerPeriodic, NULL, NULL);
+            retTimer = osTimerStart(low_power_timer, 1000*1);
+            if (retTimer != osOK && low_power_timer != NULL) {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+                    "StartCallTimer osTimerStart failed,  ret = %lx!!", retTimer);
+                osTimerDelete(low_power_timer);
+                low_power_timer = NULL;
+            }
+            timer_falg_low_power=5;
+            
+           
+        }
+       
+        // Add to rootView
+        UIViewGroup_lowpower->Add(alarm_UILabel);
+        alarm_UILabel->SetVisible(true);
+        
+        // Add LabelButtonExt to App
+        if (alarm_labelbutton == nullptr) {
+            alarm_labelbutton = new UILabelButtonExt();
+        }
+        // alarm_labelbutton->SetPosition(165, 378);         // widget's left position and top position
+        // alarm_labelbutton->Resize(135, 88);          // widget's width and height
+        alarm_labelbutton->SetViewId(LOW_POWER_BUTTON);// Set style
+        alarm_labelbutton->SetPosition(0, 366, 466, 100);
+        const char *ImgSrc = "/user/res/466x100button.bin";
+        alarm_labelbutton->SetImageSrc(ImgSrc, ImgSrc);
+        // Set additional property
+        // alarm_labelbutton->SetText("确认");
+        alarm_labelbutton->SetTextId(STR_KONW);
+        alarm_labelbutton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+        alarm_labelbutton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
+
+        UIView::OnClickListener *button1Click = static_cast<UIView::OnClickListener *>(lowppowrViewEventListener::GetInstance());
+        alarm_labelbutton->SetOnClickListener(button1Click);
+
+        // Add to rootView
+        UIViewGroup_lowpower->Add(alarm_labelbutton);
+        alarm_labelbutton->SetVisible(true);
+        UIViewGroup_lowpower->SetTouchable(true);
+        alarm_labelbutton->SetTouchable(true);
+
+        ShowUpShutDownAnimatorView();
+        if(group)
+        UIViewGroup_lowpower->Add(group);
+        if(battery_falg>=3)
+        {
+            group->SetVisible(true);
+            ShutDownImageAnimatorView->Start();
+            ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); // 关机动画已经开始了不能息屏
+
+        }
+
+        NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreelowPower);
+        return UIViewGroup_lowpower;
+    }
+
+    lowppowrViewEventListener::lowppowrViewEventListener()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallViewEventListener :%p", this);
+    }
+
+    lowppowrViewEventListener::~lowppowrViewEventListener()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "~CallViewEventListener");
+    }
+
+    lowppowrViewEventListener *lowppowrViewEventListener::GetInstance(void)
+    {
+        static lowppowrViewEventListener lowppowrViewEventListene_t;
+        return &lowppowrViewEventListene_t;
+    }
+
+    bool lowppowrViewEventListener::OnClick(UIView& view, const ClickEvent& event)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "OnClick.....");
+        if(strcmp(view.GetViewId(),LOW_POWER_BUTTON)==0)
+        {
+            if(battery_falg)
+            {
+                osTimerStop(low_power_timer);
+                low_power_play();
+
+            }
+            else
+            {
+                NotificationManager::GetInstance()->StopNotify();
+            }
+           
+        }
+        if(strcmp(view.GetViewId(),CHARGE_GROUP)==0)
+        {
+            NotificationManager::GetInstance()->StopNotify();
+        }
+        return true;
+        UNUSED(event);
+    }
+
+    void lowppowrAnimatorStopListener::OnAnimatorStop(UIView &view)
+    {
+        //UNUSED(view);
+        // NotificationManager::GetInstance()->StopNotify();//hcj改动
+        msleep(500);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "xxxxxxxxxxxxxxxxxxxxOnAnimatorStop");
+
+        if(battery_falg==4)
+        shutdown_reboot_prejobs(REBOOT_TYPE);
+        else
+        shutdown_reboot_prejobs(SHUTDOWN_TYPE);
+        // uapi_poweroff_device(); // 关机 
+
+       
+
+        //NotificationManager::GetInstance()->StopNotify();
+        //
+        // if(strcmp(view.GetViewId(),LOW_POWER_BUTTON)!=0)
+        // {
+            
+        // }
+       
+    }
+
+
+
+}
index 3141b0d..2560ff4 100644 (file)
@@ -20,73 +20,18 @@ static const TopicToCore topicToCoreArray[] = {
     {TOPIC_DEMO_ACORE_MSG, A_CORE_MASK, 1},
     {TOPIC_DEMO_ALL_MSG, A_CORE_MASK, 1},
     {TOPIC_EVENT_ALARM_RING, A_CORE_MASK, 1},
-    {TOPIC_EVENT_ON_TIME, A_CORE_MASK, 1},
     {TOPIC_EVENT_UTCTIME_UPDATE, A_CORE_MASK, 1},
     {TOPIC_EVENT_NEXTDAY_UPDATE, A_CORE_MASK, 1},
     {TOPIC_EVENT_WEARSTATE_UPDATE, A_CORE_MASK, 1},
     {TOPIC_EVENT_STEPDATA_UPDATE, A_CORE_MASK, 1},
     {TOPIC_EVENT_SHUTDOWN, A_CORE_MASK, 1},
     {TOPIC_EVENT_HEARTRATE_UPDATA, A_CORE_MASK, 1},
-    {TOPIC_EVENT_STATIC_HEARTRATE_UPDATA, A_CORE_MASK, 1},
-#ifdef SUPPORT_CYWEE_SERVICE    
-    {TOPIC_EVENT_ACTIVITY_UPDATE, A_CORE_MASK, 1},
-    {TOPIC_EVENT_ACTIVITY_EXTRA_INFO_UPDATE, A_CORE_MASK, 1},
-    {TOPIC_EVENT_AR_ALERT_TYPE_UPDATE, A_CORE_MASK, 1},
-    {TOPIC_EVENT_INACTIVITY_UPDATE, A_CORE_MASK, 1},
-    {TOPIC_EVENT_INACTIVITY_ACCUMULATE_TIME_UPDATE, A_CORE_MASK, 1},
-    {TOPIC_EVENT_BLE_TRAINING,A_CORE_MASK,1},
-    {TOPIC_EVENT_BLE_TRANSMIT,A_CORE_MASK,1},
-    {TOPIC_EVENT_GOAL_SHOW_VIEW,A_CORE_MASK,1},
-    
-#endif
-#ifdef SUPPORT_SPO2_NOTIFICATION
-    {TOPIC_EVENT_SPO2_UPDATE, A_CORE_MASK, 1},
-    {TOPIC_EVENT_START_HRS_MONITORING, A_CORE_MASK, 1},
-    {TOPIC_EVENT_STOP_HRS_MONITORING, A_CORE_MASK, 1},
-    {TOPIC_EVENT_START_SPO2_MONITORING, A_CORE_MASK, 1},
-    {TOPIC_EVENT_STOP_SPO2_MONITORING, A_CORE_MASK, 1},
-    {TOPIC_EVENT_GRAYCARD_UPDATA, A_CORE_MASK, 1},
-    {TOPIC_EVENT_LEAKLIGHT_UPDATA, A_CORE_MASK, 1},
-#endif
     {TOPIC_EVENT_HFP_INCOMMING, A_CORE_MASK, 1},
     {TOPIC_EVENT_HFP_PHONE_ACTIVE, A_CORE_MASK, 1},
     {TOPIC_EVENT_HFP_WATCH_ACTIVE, A_CORE_MASK, 1},
     {TOPIC_EVENT_HFP_FINISHED, A_CORE_MASK, 1},
     {TOPIC_EVENT_HFP_PHONE_TO_WATCH, A_CORE_MASK, 1},
     {TOPIC_EVENT_HFP_WATCH_TO_PHONE, A_CORE_MASK, 1},
-    {TOPIC_EVENT_HFP_HINT, A_CORE_MASK, 1},
-    
-#ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION
-    {TOPIC_EVENT_CHARGE_PLUG, A_CORE_MASK, 1},
-    {TOPIC_EVENT_CHARGE_UNPLUG, A_CORE_MASK, 1},
-    {TOPIC_EVENT_LOWPOWER_ALARM, A_CORE_MASK, 1},
-#endif
-#ifdef SUPPORT_DEVICE_PAIRING_NOTIFICATION
-    {TOPIC_EVENT_DEVICE_BIND,A_CORE_MASK, 1},
-    // {TOPIC_EVENT_DEVICE_UNBIND,A_CORE_MASK, 1},
-    // {TOPIC_EVENT_DEVICE_UNBINDING_REQUEST,A_CORE_MASK, 1},
-#endif
-    {TOPIC_EVENT_ENTER_CMAERA,A_CORE_MASK, 1},//遥控拍照
-    {TOPIC_EVENT_ASSISTANT_NOTE,A_CORE_MASK, 1},//语音助手
-    {TOPIC_EVENT_CANCEL_CMAERA,A_CORE_MASK, 1},
-    {TOPIC_EVENT_FIND_WATCH,A_CORE_MASK, 1},//查找手表
-    {TOPIC_EVENT_CANCEL_FIND_WATCH,A_CORE_MASK, 1},
-    {TOPIC_EVENT_DRINKREMINDER,A_CORE_MASK, 1},
-    {TOPIC_EVENT_MESSAGENOTE,A_CORE_MASK, 1},
-    {TOPIC_EVENT_MESSAGE_UPDATA,A_CORE_MASK, 1},
-    {TOPIC_EVENT_SLEEPNOTE,A_CORE_MASK, 1},
-    {TOPIC_EVENT_DEBUGOUTPUT,A_CORE_MASK, 1},
-    {TOPIC_EVENT_SHUTDOWN_ANIMATIOR,A_CORE_MASK, 1},
-#ifdef SUPPORT_CAT1_MODEM
-    {TOPIC_EVENT_CAT1_INCOMMING, A_CORE_MASK, 1},
-    {TOPIC_EVENT_CAT1_CALLCONNTED, A_CORE_MASK, 1},
-    {TOPIC_EVENT_CAT1_CALLENDED, A_CORE_MASK, 1},
-    {TOPIC_EVENT_CAT1_CALLDIAL, A_CORE_MASK, 1},
-    {TOPIC_EVENT_CAT1_SIGNAL_UPDATE, A_CORE_MASK, 1},
-    {TOPIC_EVENT_CAT1_POWER_ON, A_CORE_MASK, 1},
-    {TOPIC_EVENT_CAT1_POWER_OFF, A_CORE_MASK, 1},
-    {TOPIC_EVENT_CAT1_CALL_FAIL,A_CORE_MASK, 1},
-#endif
 };
 
 /* 所有的topic,其对应的位图 */
index ebe3ed2..a500068 100644 (file)
@@ -357,6 +357,7 @@ target = {
             'SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION',
             # 'SUPPORT_AT_CUSTOMUTILS',
             'SUPPORT_BLE_SERVICE',
+            'SUPPORT_BATTERY_SERVICE',
             'FD230',
             # 'SUPPORT_AUTO_OTA_SERVER',
             # 'CONFIG_DFX_SUPPORT_DIAG_UP_MACHINE=1',
index eac110b..46731f3 100644 (file)
@@ -602,19 +602,19 @@ errcode_t charger_plug_event_notify(uint8_t plugged)
    #ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION
     if(plugged == 1){
 
-        // ChargerEventPublish(TOPIC_EVENT_CHARGE_PLUG,1);
+        ChargerEventPublish(TOPIC_EVENT_CHARGE_PLUG,1);
         //重置提醒flag
         low_power_flag_1=1;
         low_power_flag_2=1; 
 
     }else{
-        // ChargerEventPublish(TOPIC_EVENT_CHARGE_UNPLUG,0);
+        ChargerEventPublish(TOPIC_EVENT_CHARGE_UNPLUG,0);
     } 
    #else
     if(plugged == 1){
-        // ChargerEventPublish(TOPIC_EVENT_STEPDATA_UPDATE,1);
+        ChargerEventPublish(TOPIC_EVENT_STEPDATA_UPDATE,1);
     }else{
-        // ChargerEventPublish(TOPIC_EVENT_STEPDATA_UPDATE,0);
+        ChargerEventPublish(TOPIC_EVENT_STEPDATA_UPDATE,0);
     } 
    #endif
    return 0;
@@ -636,16 +636,16 @@ errcode_t Play_shutdown_animation_notify(uint8_t alarm_level)
     //PRINT("alarm_level[%d],low_power_flag_1[%d],low_power_flag_2[%d]\n",alarm_level,low_power_flag_1,low_power_flag_2);
     if(alarm_level==0 && low_power_flag_1)
     {   //low_power_flag_1=0;
-        // ChargerEventPublish(TOPIC_EVENT_LOWPOWER_ALARM,alarm_level);
+        ChargerEventPublish(TOPIC_EVENT_LOWPOWER_ALARM,alarm_level);
     }
     else if(alarm_level==1 && low_power_flag_2)
     {
         //low_power_flag_2=0;
-        // ChargerEventPublish(TOPIC_EVENT_LOWPOWER_ALARM,alarm_level);
+        ChargerEventPublish(TOPIC_EVENT_LOWPOWER_ALARM,alarm_level);
     }
     else if(alarm_level!=0 && alarm_level!=1)
     {
-        // ChargerEventPublish(TOPIC_EVENT_LOWPOWER_ALARM,alarm_level);
+        ChargerEventPublish(TOPIC_EVENT_LOWPOWER_ALARM,alarm_level);
     }
    
 
@@ -734,7 +734,7 @@ errcode_t uapi_battery_init(void)
     g_battery_timer = osTimerNew((osTimerFunc_t)battery_check_timer_callback, osTimerPeriodic, NULL, NULL);
 
     /**下面初始化电池基本数据,充电线基本状态*/
-    // uapi_register_charger_event_callback(battery_charger_plug_event_callback);
+    uapi_register_charger_event_callback(battery_charger_plug_event_callback);
    
     //开始timer
     battery_timer_start_check_released(CHARGE_CHECK_TIMER_CYCLE_MS);