* @Author: luozheng 1732036298@qq.com
* @Date: 2024-07-18 14:55:27
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-27 18:27:16
+ * @LastEditTime: 2024-07-31 10:49:15
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp
*/
#include "rebootandshutdown/include/RebootAndShutdownModel.h"
+#include "rebootandshutdown/include/RebootAndShutdownPresenter.h"
#include "wearable_log.h"
#include "ConfigModel.h"
#include "NativeAbility.h"
static void HandlePowerKeyLongPress(void)
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HandlePowerKeyLongPress");
+
+ RebootAndShutdownPresenter *rebootAndShutdownPresenter = RebootAndShutdownPresenter::GetInstance();
+ if (rebootAndShutdownPresenter != nullptr && true == rebootAndShutdownPresenter->GetIsShutDownImageAnimator())
+ {
+ return;
+ }
+
const power_display_svr_api_t *display_api = power_display_svr_get_api();
if (!display_api)
{
static void HandlePowerKeyDoubleClick(void)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HandlePowerKeyDoubleClick");
- // Handle PowerKey DoubleClick logic here
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HandlePowerKeyDoubleClick");
+
+ RebootAndShutdownPresenter *rebootAndShutdownPresenter = RebootAndShutdownPresenter::GetInstance();
+ if (rebootAndShutdownPresenter != nullptr && true == rebootAndShutdownPresenter->GetIsShutDownImageAnimator())
+ {
+ return;
+ }
+
const power_display_svr_api_t *display_api = power_display_svr_get_api();
if (!display_api)
{
/*注册电源键的双击事件*/
bool RebootAndShutdownModel::RegisterPowerKeyDoubleClickEvent(void)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::RegisterPowerKeyDoubleClickEvent");
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::RegisterPowerKeyDoubleClickEvent");
// Register PowerKey DoubleClick event here
int32_t ret = uapi_button_register_event_cb(HandlePowerKeyDoubleClick, BUTTON_PWR_CLICKUP_2);
if (ret != ERRCODE_SUCC)
static void HandFuncKeyOnPress(void)
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::HandFuncKeyOnPress");
+
+ RebootAndShutdownPresenter *rebootAndShutdownPresenter = RebootAndShutdownPresenter::GetInstance();
+ if (rebootAndShutdownPresenter != nullptr && true == rebootAndShutdownPresenter->GetIsShutDownImageAnimator())
+ {
+ return;
+ }
+
const power_display_svr_api_t *display_api = power_display_svr_get_api();
if (!display_api)
{
return;
}
display_api->turn_on_screen();
- // if (display_api->get_screen_state() == SCREEN_OFF) /*处于灭屏状态才亮屏*/
- // {
-
- // }
- // else
- // {
- // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Screen is on not to turn_on_screen");
- // }
return;
}
/*注册功能键的按下事件*/
bool RebootAndShutdownModel::RegisterFuncKeyPressEvent(void)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::RegisterFuncKeyPressEvent");
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::RegisterFuncKeyPressEvent");
// Register FuncKey Press event here
int32_t ret = uapi_button_register_event_cb(HandFuncKeyOnPress, BUTTON1_PRESS);
if (ret != ERRCODE_SUCC)
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HandFuncKeyOnLongPress");
- if(true == ConfigModel::GetInstance()->GetisFirstTimeStart())
+ RebootAndShutdownPresenter *rebootAndShutdownPresenter = RebootAndShutdownPresenter::GetInstance();
+ if (rebootAndShutdownPresenter != nullptr && true == rebootAndShutdownPresenter->GetIsShutDownImageAnimator())
+ {
+ return;
+ }
+
+ if (true == ConfigModel::GetInstance()->GetisFirstTimeStart())
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HandFuncKeyOnLongPress: first time power on");
return;
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HandleFuncKeyOnClick");
- if(true == ConfigModel::GetInstance()->GetisFirstTimeStart())
+ RebootAndShutdownPresenter *rebootAndShutdownPresenter = RebootAndShutdownPresenter::GetInstance();
+ if (rebootAndShutdownPresenter != nullptr && true == rebootAndShutdownPresenter->GetIsShutDownImageAnimator())
+ {
+ return;
+ }
+
+ if (true == ConfigModel::GetInstance()->GetisFirstTimeStart())
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HandleFuncKeyOnClick: first time power on");
return;
/*注册功能键的单击事件*/
bool RebootAndShutdownModel::RegisterFuncKeyClickEvent(void)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::RegisterFuncKeyClickEvent");
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::RegisterFuncKeyClickEvent");
int32_t ret = uapi_button_register_event_cb(HandleFuncKeyOnClick, BUTTON1_CLICKUP);
if (ret != ERRCODE_SUCC)
{
static void HandleFuncKeyDoubleClick(void)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HandleFuncKeyDoubleClick");
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HandleFuncKeyDoubleClick");
+
+ RebootAndShutdownPresenter *rebootAndShutdownPresenter = RebootAndShutdownPresenter::GetInstance();
+ if (rebootAndShutdownPresenter != nullptr && true == rebootAndShutdownPresenter->GetIsShutDownImageAnimator())
+ {
+ return;
+ }
- if(true == ConfigModel::GetInstance()->GetisFirstTimeStart())
+ if (true == ConfigModel::GetInstance()->GetisFirstTimeStart())
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HandleFuncKeyDoubleClick: first time power on");
return;
/*注册功能键双击事件*/
bool RebootAndShutdownModel::RegisterFuncKeyDoubleClickEvent(void)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::RegisterFuncKeyDoubleClickEvent");
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::RegisterFuncKeyDoubleClickEvent");
int32_t ret = uapi_button_register_event_cb(HandleFuncKeyDoubleClick, BUTTON1_CLICKUP_2);
if (ret != ERRCODE_SUCC)
{