#endif
return 0;
}
+
+errcode_t Play_shutdown_animation_notify(uint8_t plugged)
+{
+ ChargerEventPublish(TOPIC_EVENT_LOWPOWER_ALARM,3);
+ // return 0;
+
+ return 0;
+}
+
+
+errcode_t low_power_play_toUI(uint8_t plugged)
+{
+
+ /**通过UI事件发送Notify*/
+ GraphicService::GetInstance()->PostGraphicEvent(std::bind(Play_shutdown_animation_notify, plugged));
+
+ return ERRCODE_SUCC;
+}
+
+
errcode_t charger_plug_event_ui_sendmsg_toUI(uint8_t plugged)
{
void uapi_battery_deinit(void);
void battery_service_resume(void);
void battery_service_suspend(void);
-
+errcode_t low_power_play_toUI(uint8_t);
void enable_02c(void);
void disable_02c(void);
void enable_charge(void);
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testmakephone.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testcat1.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testhrsenson.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testgsenson.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testgsenson.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testold.cpp
#${CMAKE_CURRENT_SOURCE_DIR} /service/acc_service.c
)
if("SUPPORT_ALIPAY_SEC" IN_LIST DEFINES)
--- /dev/null
+#ifndef TEST_OLD_VIEW_H
+#define TEST_OLD_VIEW_H
+
+#include "BaseView.h"
+#include "View.h"
+#include "components/ui_scroll_view.h"
+#include "components/ui_label.h"
+#include "components/ui_image_view.h"
+#include "components/ui_label_button_ext.h"
+//#include "cmsis_os.h"
+#include <iostream>
+
+namespace OHOS
+{
+ class testoldView
+ {
+
+ public:
+
+ struct LabelConfig
+ {
+ int16_t left;
+ int16_t top;
+ int16_t width;
+ int16_t height;
+ int16_t fontSize; // 字体大小
+ int16_t lineHeigh; // 行高
+ char *text; // 文本
+ uint8_t lineBreakMode; // 断行模式。
+ };
+
+ testoldView();
+ virtual ~testoldView();
+ static testoldView *GetInstance(void);
+
+ UIScrollView *testoldInitIView(void);
+ void ClearAll(void);
+ void set_data();
+ UILabel *x{nullptr};
+ void setlightvalue(int ,int ,int);
+ private:
+ bool testoldScrollViewcrollViewinit(void);
+ UILabel *InitLabel(LabelConfig &labelConfig);
+ UIScrollView *testoldScrollView{nullptr};
+ bool initViewStatus{false};
+ UILabel *title{nullptr};
+ // UILabel *x{nullptr};
+ UILabel *y{nullptr};
+ UILabel *z{nullptr};
+
+ UILabelButtonExt* labelButton_next = nullptr;
+ };
+}
+#endif
\ No newline at end of file
{MAKEPHONE,"makephonebutton", "hrsensonbutton_next",true},\r
{HRSENSON,"hrsensonbutton", "gsensonbutton_next",true},\r
{GSENSON,"gsensonbutton","xxxx" ,true},\r
+ {OLDTEST,"oldtestbutton","xxxxxxxxx",true},\r
};\r
// {FACTORYRESETVIEW,"FactoryResetButton",true},\r
// {SYSTEMLUPGRADE,"systemupgread",true},\r
// 根据控件id查找是哪个控件触发了点击回调\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnClick");\r
\r
+ if(strcmp(view.GetViewId(),"xxxx") == 0)\r
+ { \r
+ //testSPEAKView::GetInstance()->Changspeak(true);\r
+ testView::GetInstance()->ChangeView(GSENSON,TESTVIEW);\r
+ return true;\r
+ }\r
+\r
for(int i=0;i<len;i++)\r
{\r
if(strcmp(view.GetViewId(),ViewMapper_t[i].viewid_str) == 0)\r
#include "producttest/include/testView.h"\r
#include "producttest/include/testPresenter.h"\r
-\r
+#include "power_display_service.h"\r
#include "wearable_log.h"\r
namespace OHOS\r
{\r
{MAKEPHONE,"makephonebutton","makephone" ,&testView::ChangeMPTESTView},\r
{HRSENSON,"hrsensonbutton","hrsenson" ,&testView::ChangeHRTESTView},\r
{GSENSON,"gsensonbutton","gsenson" ,&testView::ChangeGTESTView},\r
+ {OLDTEST,"oldtestbutton","oldtest" ,&testView::ChangeoldTESTView},\r
// {FACTORYRESETVIEW,"FactoryResetButton","恢复出厂", &testView::ChangeSystemAboutView},\r
// {SYSTEMLUPGRADE,"systemupgread","系统升级",&testView::ChangeSystemAboutView},\r
// {TEST,"testButton","测试模式", &testView::ChangeSystemAboutView},\r
SystemLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
SystemLabel->SetRollSpeed(6);\r
SystemLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+\r
+ \r
return true;\r
}\r
\r
return true;\r
}\r
\r
+ bool testView::ChangeoldTESTView(int16_t thisView)\r
+ {\r
+ if (SystemScrollView[thisView] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView");\r
+ test_old_view = new testoldView();\r
+ if (test_old_view == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+ return false;\r
+ }\r
+ SystemScrollView[thisView] = test_old_view->testoldInitIView();\r
+ RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
+ }\r
+ return true;\r
+ }\r
+\r
UIScrollView *testView::GetSystemScrollView(int ViewId)\r
{\r
if (SystemScrollView[ViewId] == nullptr)\r
View<testPresenter>::OnStart();\r
//InitIView();\r
initView_ext(43,120,380,100,120,"/user/res/SETTING_NEXT.bin");\r
+ const power_display_svr_api_t *display_api = power_display_svr_get_api();\r
+ if (display_api->get_screen_state() != SCREEN_ON)\r
+ { \r
+ display_api->turn_on_screen(); \r
+ } \r
+ display_api->set_screen_set_keepon_timeout(-1);\r
}\r
\r
void testView::OnSetUpView()\r
gsenson_t t;
get_gsonsen_xyz(&t);
char buf[124]={0};
- float x_t=t.x/1024.0;
- float y_t=t.y/1024.0;
- float z_t=t.z/1024.0;
- sprintf(buf,"X:%3f\nY:%3f\nZ:%3f",x_t,y_t,z_t);
+ uint16 x_t=t.x;
+ uint16 y_t=t.y;
+ uint16 z_t=t.z;
+ sprintf(buf,"X:%d\nY:%d\nZ:%d",x_t,y_t,z_t);
x->SetText(buf);
RootView::GetInstance()->Invalidate();
testGsonsonScrollView->Add(x);
/* -------------------------------------------------------------------------- */
- labelButton_next= testAboutView::GetInstance()->init_button_next(167,378,"luminanceButton_next");
+ labelButton_next= testAboutView::GetInstance()->init_button_next(167,378,"xxxx");
testGsonsonScrollView->Add(labelButton_next);
#include "cat1_ctl.h"
#include "cat1_server_hal.h"
#include "ppg_service.h"
+
namespace OHOS
{
+ labelButton_next= testAboutView::GetInstance()->init_button_next(167,378,"gsensonbutton_next");
+ testhrsensonScrollView->Add(labelButton_next);
testhrsensonScrollView->SetTouchable(true);
--- /dev/null
+#include "wearable_log.h"
+#include "custom_utils.h"
+#include "producttest/include/testPresenter.h"
+#include "producttest/include/testold.h"
+#include "mag_service.h"
+#include "cmsis_os2.h"
+#include "cywee_hal.h"
+#include "tcxo.h"
+#include "ppg_service.h"
+#include "CompassModel.h"
+#include "linux/delay.h"
+#include "power_display_service.h"
+//#include "acc_service.h"
+namespace OHOS
+{
+ static void AGING_task(void *arg)
+ {
+ while (1)
+ {
+ msleep(1000);
+ // uapi_tcxo_delay_ms(3000);
+ for(int i=0;i<1;i++)
+ {
+ int8_t md = PPG_SERVICE_CMD_TYPE_DO_LEAKLIGHT_TEST;
+ send_ppg_cmd_msg(md);
+ msleep(3000);
+
+ }
+ for(int i=0;i<3;i++)
+ {
+ uint16_t angle_value= (int16_t)mag_service_get_fAzimuth();
+ char buf[16]={0};
+ sprintf(buf,"angle:%d",angle_value);
+ testoldView::GetInstance()->x->SetText(buf);
+ RootView::GetInstance()->Invalidate();
+ msleep(1000);
+ }
+ for(int i=0;i<3;i++)
+ {
+ gsenson_t t;
+ get_gsonsen_xyz(&t);
+ char buf[64]={0};
+ uint16 x_t=t.x;
+ uint16 y_t=t.y;
+ uint16 z_t=t.z;
+ sprintf(buf,"gsensor:\nX:%d\nY:%d\nZ:%d",x_t,y_t,z_t);
+ testoldView::GetInstance()->x->SetText(buf);
+ RootView::GetInstance()->Invalidate();
+
+ msleep(1000);
+ }
+ // uapi_tcxo_delay_ms(3000);
+ }
+
+ }
+
+ errcode_t old_test_init(void)
+ {
+
+ PRINT("uapi_ppg_service_init !\r\n");
+ app_task_definition_t taskcfg={0};
+ taskcfg.create_queue_handle = NULL;
+ taskcfg.attr.name="old_test_service";
+ taskcfg.attr.priority = TASK_PRIORITY_APP;
+ taskcfg.attr.stack_size = 1024*8;
+ taskcfg.func = AGING_task;
+ taskcfg.use_mem = USE_EXTEND_MEM;
+
+ errcode_t ret=uapi_create_osThread_custom(&taskcfg);
+ if(ret != ERRCODE_SUCC)
+ {
+ PRINT("create ppg_service failed %d!\r\n",ret);
+ return ERRCODE_FAIL;
+ }
+
+ return ERRCODE_SUCC;
+ }
+
+ static testoldView *g_pSystemAboutTheWatchView{nullptr};
+
+ void testoldView:: setlightvalue(int g,int r,int ir)
+ {
+
+ if(x!=nullptr)
+ {
+ char buf[124]={0};
+ sprintf(buf,"leaklight:\ngreen:%d\nred:%d\nir:%d",g,r,ir);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",buf);
+ x->SetText(buf);
+ RootView::GetInstance()->Invalidate();
+ int8_t md = PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST;
+ send_ppg_cmd_msg(md);
+ }
+
+ }
+
+ testoldView::testoldView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView");
+ g_pSystemAboutTheWatchView = this;
+ }
+
+ testoldView::~testoldView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView");
+ ClearAll();
+ g_pSystemAboutTheWatchView = nullptr;
+ }
+
+ testoldView *testoldView::GetInstance()
+ {
+
+ return g_pSystemAboutTheWatchView;
+ }
+ static osTimerId_t Gsenson_TEST_timer=NULL;
+ void testoldView::ClearAll()
+ {
+ if(testoldScrollView)
+ {
+ testoldScrollView->RemoveAll();
+
+ if (Gsenson_TEST_timer != NULL) {
+ osTimerDelete(Gsenson_TEST_timer);
+ Gsenson_TEST_timer = NULL;
+ return ;
+ }
+
+ if(title!=NULL)
+ {
+ delete title;
+ title=nullptr;
+ }
+ if(x!=NULL)
+ {
+ delete x;
+ x=nullptr;
+ }
+ if(labelButton_next)
+ {
+ delete labelButton_next;
+ labelButton_next=nullptr;
+ }
+ delete testoldScrollView;
+ testoldScrollView=nullptr;
+ }
+ }
+
+
+ UILabel *testoldView::InitLabel(LabelConfig &labelConfig)
+ {
+ UILabel *label = new UILabel();
+ if (label == nullptr)
+ {
+ return nullptr;
+ }
+ label->SetPosition(labelConfig.left, labelConfig.top, labelConfig.width, labelConfig.height); // 位置大小
+ label->SetStyle(STYLE_TEXT_FONT, labelConfig.fontSize); // 字体大小
+ label->SetStyle(STYLE_LINE_HEIGHT, labelConfig.lineHeigh); // 字体行高
+ label->SetText(labelConfig.text); // 内容
+ label->SetLineBreakMode(labelConfig.lineBreakMode); // 断行模式。
+ label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_TOP);
+ label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelConfig.fontSize);
+ return label;
+ }
+
+
+
+ bool testoldView::testoldScrollViewcrollViewinit(void)
+ {
+
+
+ CompassModel::GetInstance()->OpenCompassSensor();
+
+ testoldScrollView = new UIScrollView();
+ if (testoldScrollView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::testoldScrollView new fail!");
+ return false;
+ }
+ testoldScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+ testoldScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ testoldScrollView->SetStyle(STYLE_BORDER_RADIUS, 1294);
+
+
+ testoldScrollView->SetScrollBlankSize(0);
+ testoldScrollView->SetReboundSize(0);
+ testoldScrollView->SetDirection(1);
+ //UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(SystemPresenter::GetInstance());
+ // if (draglistener == nullptr)
+ // {
+ // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!");
+ // return false;
+ // }
+ // testoldScrollView->SetOnDragListener(draglistener);
+
+ LabelConfig Config = {
+ .left = 203,
+ .top = 52,
+ .width = 60,
+ .height = 35,
+ .fontSize = 30,
+ .lineHeigh = 35,
+ .text = "old_test",
+ .lineBreakMode = UILabel::LINE_BREAK_ADAPT,
+ };
+ title = InitLabel(Config);
+ if (title == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemAboutTheWatchTitle new fail!");
+ return false;
+ }
+ testoldScrollView->Add(title);
+ /* -------------------------------------------------------------------------- */
+ // uint16_t angle_value= (int16_t)mag_service_get_fAzimuth();
+ gsenson_t t;
+ //get_gsonsen_xyz(&t);
+ char buf[124]={0};
+ //sprintf(buf,"X:%f\nY:%f\nZ:%f",t.x,t.y,t.z);
+ Config = {
+ .left = 173,
+ .top = 160,
+ .width = 120,
+ .height = 35,
+ .fontSize = 40,
+ .lineHeigh = 35,
+ .text = buf,
+ .lineBreakMode = UILabel::LINE_BREAK_ADAPT,
+ };
+
+ x = InitLabel(Config);
+ if (x == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::WatchNameTitle new fail!");
+ return false;
+ }
+ testoldScrollView->Add(x);
+
+ /* -------------------------------------------------------------------------- */
+
+ labelButton_next= testAboutView::GetInstance()->init_button_next(167,378,"xxxx");
+ testoldScrollView->Add(labelButton_next);
+
+
+ testoldScrollView->SetTouchable(true);
+ testoldScrollView->SetDraggable(false);
+
+ 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();
+ }
+ display_api->set_screen_set_keepon_timeout(-1);
+
+
+
+ old_test_init();
+ return true;
+ }
+
+ UIScrollView *testoldView::testoldInitIView()
+ {
+ if (!testoldScrollViewcrollViewinit())
+ {
+ return nullptr;
+ }
+ return testoldScrollView;
+ }
+}
\ No newline at end of file
#include "lwip/apps/http_client.h"
#include "tcxo.h"
#include "cat1_server.h"
+ #include "linux/delay.h"
namespace OHOS
{
static void upgrade_task(void *arg)
{
- uapi_tcxo_delay_ms(3000);
+ msleep(3000);
+ //uapi_tcxo_delay_ms(3000);
char buf[1024]={0};
FILE * fp = fopen(Path,"rb");
if(fp==NULL)
static void upgrade_task_fwpkg(void *arg)
{
- uapi_tcxo_delay_ms(3000);
+ msleep(3000);
FILE * fp = fopen(Path_ota_package,"rb");
if(fp!=NULL)
{
${CMAKE_CURRENT_SOURCE_DIR}/src/msg_center_customer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/msg_center_cmd.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/notify/alarm_notification.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/charge_notification.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/notify/makephone_notification.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/notify/notification_manager_customer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/vendor_app/baidu/baidu_app.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/msg_center_customer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/msg_center_cmd.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/notify/alarm_notification.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/charge_notification.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/notify/makephone_notification.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/notify/notification_manager_customer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/notify/pairing_notification.cpp
#ifndef CHARGE_NOTIFICATION_H
#define CHARGE_NOTIFICATION_H
+#include "components/ui_image_animator.h"
namespace OHOS
{
- UIViewGroup *ChargingStatuShow(void);
- UIView *view_ = nullptr;
+ // UIViewGroup *ChargingStatuShow(void);
+ // UIView *view_ = nullptr;
+
+ UIViewGroup* lowPowerShow(void);
+ void set_lowpower_falg(bool falg);
+ void FreelowPower(void);
+ void low_power_paly(void);
+
+ 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
#include "components/ui_view_group.h"
#include "alarm_notification.h"
#include "makephone_notification.h"
+#include "charge_notification.h"
#include "pairing_notification.h"
#include "findwatch_notification.h"
#include "cat1_server.h"
#include "testchanging.h"
#include "testcat1.h"
+#include "testold.h"
#include "testhrsenson.h"
#include "ConfigModel.h"
#include "power_display_service.h"
return OHOS::CreateDeviceUnbindingRequestGroupView();
}
-/*显示查找手表通知*/
+/*显示低电量通知*/
+static OHOS::UIViewGroup* showlowpowerNotify(void)
+{
+ return OHOS::lowPowerShow();
+}
+
static OHOS::UIViewGroup* showFindWatchNotify(void)
{
return OHOS::CreateFindWatchView();
void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req)
{
- unused(req);
+ //unused(req);
unused(topic);
WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: LowPower Alarm !");
+ //if(req->data);
+ uint8 *x= (uint8 *)(req->data);
+ if(*x==3)
+ {
+ low_power_paly();
+ }
+ else if(*x==0)
+ {
+ set_lowpower_falg(false);
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(showlowpowerNotify, (uint16_t)topic, true);
+ }
+ else
+ {
+ set_lowpower_falg(true);
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(showlowpowerNotify, (uint16_t)topic, true);
+
+ }
+
+
+
//TODO: 亮屏弹窗倒计时5秒关机(不需要取消,强制关机)
// DialModelCharge::GetInstance()->UpdateChargeStuaut(0);
// SaveEleModel::GetInstance()->SetChargeStuaut(0);
{
t->setlightvalue(green,red,ir);
}
+
+ testoldView * t_1= testoldView::GetInstance();
+ if(t_1!=NULL)
+ {
+ t_1->setlightvalue(green,red,ir);
+ }
}
//穿戴状态
#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"
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/"; //关机图片路径
+ static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 36; // 图片帧数
+ static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_TIME = 150; // 图片更新间隔
+ ImageAnimatorInfo ShutDownImageInfo[SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; // 关机图像的信息
+ 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 char **ShutDownPathsArray{nullptr}; // 关机图片路径数组
- // 展示充电图标
- UIViewGroup *ChargingStatuShow()
+ #define LOW_POWER_BUTTON "LOW_POWER_BUTTON"
+ // UIViewGroup *ChargingStatuShow()
+ // {
+ // // Add ImageView to App
+ // if (imageCharge == nullptr)
+ // {
+ // imageCharge = new UIImageView();
+ // }
+ // imageCharge->SetPosition(186, 55); // widget's left position and top position
+ // imageCharge->Resize(100, 100); // widget's width and height
+ // imageCharge->SetViewId("image1"); // Set style
+
+ // // Set additional property
+ // char *image1imagesPath = "/user/res/Battery/Charge_Icon.bin";
+ // imageCharge->SetSrc(image1imagesPath);
+
+ // // Add to rootView
+ // RootView::GetInstance()->Add(imageCharge);
+
+ // if (view_->GetHorCurrentPage() == WATCH_FACE)
+ // {
+ // imageCharge->SetVisible(true);
+ // }
+ // }
+ static const char ** CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages)
{
- // Add ImageView to App
- if (imageCharge == nullptr)
+ const char **imagePaths = new const char *[numImages];
+ char buffer[256];
+ for (int i = 0; i < numImages; i++)
+ {
+ snprintf(buffer, sizeof(buffer), "%s%d.%s", basePath, i + 1, fileExtension);
+ imagePaths[i] = strdup(buffer);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " imagePaths[%d] = %s", i, imagePaths[i]);
+ }
+ return imagePaths;
+ }
+
+ UIViewGroup * ShowUpShutDownAnimatorView()
+ {
+ group = new UIViewGroup();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group new fail");
+ return nullptr;
+ }
+ group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShutDownAnimatorView::ShowUpShutDownAnimatorView");
+ ShutDownPathsArray = CreateImagePathsArray(ShutDownPaths, "bin", 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 NULL;
+ }
+ for (uint8_t i = 0; i < SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++)
+ {
+ ShutDownImageInfo[i].imagePath = (ShutDownPathsArray[i]);
+ ShutDownImageInfo[i].imageType = IMG_SRC_FILE_PATH;
+ 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, 100);
+ ShutDownImageAnimatorView->SetRepeat(false);
+ ShutDownImageAnimatorView->SetRepeatTimes(1);
+
+ }
+ ShutDownImageAnimatorView->SetVisible(true);
+ //ShutDownImageAnimatorView->Start();
+ group->SetVisible(false);
+ group->Add(ShutDownImageAnimatorView);
+ return group;
+ }
+
+ static bool battery_falg=false;
+ void set_lowpower_falg(bool 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)
{
- imageCharge = new UIImageView();
+ delete alarm_labelbutton;
+ alarm_labelbutton = nullptr;
}
- imageCharge->SetPosition(186, 55); // widget's left position and top position
- imageCharge->Resize(100, 100); // widget's width and height
- imageCharge->SetViewId("image1"); // Set style
+ if(group)
+ {
+ group->RemoveAll();
+ if(ShutDownImageAnimatorView)
+ {
+ delete ShutDownImageAnimatorView;
+ ShutDownImageAnimatorView = nullptr;
+ }
+ delete group;
+ group = nullptr;
+
+ }
+
+ RootView::GetInstance()->Remove(UIViewGroup_lowpower);
+ delete UIViewGroup_lowpower;
+ UIViewGroup_lowpower = nullptr;
+ }
+ }
+
+ void low_power_TimerCallBack(int data)
+ {
+ //uapi_poweroff_device(); // 关机
+ low_power_play_toUI(0);
+ }
+ void low_power_paly(void)
+ {
+ //uapi_poweroff_device(); // 关机
+ 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();
+
+ }
+
+ 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(183, 62); // 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
- char *image1imagesPath = "/user/res/Battery/Charge_Icon.bin";
- imageCharge->SetSrc(image1imagesPath);
+ const char *imageimagesPath = "/user/res/FastTrainingAttentionVector.bin";
+ alarm_img->SetSrc(imageimagesPath);
// Add to rootView
- RootView::GetInstance()->Add(imageCharge);
+ 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, 33);
- if (view_->GetHorCurrentPage() == WATCH_FACE)
+ // Set additional property
+ if(battery_falg==false)
{
- imageCharge->SetVisible(true);
+ alarm_UILabel->SetText("请及时连接充电器");
+ alarm_UILabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+ alarm_UILabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ alarm_UILabel->SetRollSpeed(0);
+ alarm_UILabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 33);
}
+ // Set additional property
+ if(battery_falg==true)
+ {
+ alarm_UILabel->SetPosition(84, 215);
+ alarm_UILabel->SetText("电量过低将自动关机");
+ alarm_UILabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+ alarm_UILabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ alarm_UILabel->SetRollSpeed(0);
+ alarm_UILabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 33);
+ osStatus_t retTimer;
+ low_power_timer = osTimerNew((osTimerFunc_t)low_power_TimerCallBack, osTimerOnce, NULL, NULL);
+ retTimer = osTimerStart(low_power_timer, 1000*5);
+ 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;
+ }
+ }
+
+ // 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->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 44);
+ 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();
+ UIViewGroup_lowpower->Add(group);
+
+ 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_paly();
+
+ }
+ else
+ {
+ NotificationManager::GetInstance()->StopNotify();
+ }
+
+ }
+ return true;
+ UNUSED(event);
+ }
+
+ void lowppowrAnimatorStopListener::OnAnimatorStop(UIView &view)
+ {
+ //UNUSED(view);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "xxxxxxxxxxxxxxxxxxxxOnAnimatorStop");
+
+ uapi_poweroff_device(); // 关机
+
+ //NotificationManager::GetInstance()->StopNotify();
+ //
+ // if(strcmp(view.GetViewId(),LOW_POWER_BUTTON)!=0)
+ // {
+
+ // }
+
+ }
+
+
+
}
// The watch rejects the call
if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1)
{
- //#ifdef SUPPORT_CAT1_SERVICE
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MakephoneNotify 11111111 ");
cat1_call_hungup();
addcalllog();
- // uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();
- // NativeAbility::GetInstance().ChangeSlice(preSlice);
NotificationManager::GetInstance()->StopNotify();
//#endif
}
else if (strcmp(view.GetViewId(), "callingHandUp") == 0)
{
-
- // The watch rejects the call
+
if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1)
{
- //#ifdef SUPPORT_CAT1_SERVICE
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MakephoneNotify 11111111 ");
- cat1_call_hungup();
- // uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();
- // NativeAbility::GetInstance().ChangeSlice(preSlice);
- NotificationManager::GetInstance()->StopNotify();
- //#endif
+ cat1_call_hungup();
+ NotificationManager::GetInstance()->StopNotify();
+
}
}
return true;
FreeCallingView();
FreeCalldialView();
FreeFindWatchView();
+ FreelowPower();
#ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION
//Do Free notification view
#endif