From: luozheng <1732036298@qq.com> Date: Thu, 3 Oct 2024 12:18:55 +0000 (+0800) Subject: 注册functionKey的8次点击事件,该事件会进入开发调试窗口 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=fc60b81371cccb7c9af49e637e20b196a9bd182a;p=mirrors%2FFD230.git 注册functionKey的8次点击事件,该事件会进入开发调试窗口 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/RebootAndShutdownModel.h b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/RebootAndShutdownModel.h index c830bc074..acd86ab07 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/RebootAndShutdownModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/RebootAndShutdownModel.h @@ -8,7 +8,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-07-18 14:55:21 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-22 10:28:51 + * @LastEditTime: 2024-10-03 19:59:14 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/RebootAndShutdownModel.h */ @@ -39,6 +39,7 @@ namespace OHOS bool RegisterFuncKeyClickEvent(void); bool RegisterFuncKeyDoubleClickEvent(void); bool RegisterPowerAndFuncKeyPressEvent(void); + bool RegisterFuncKeyOtherOnClickEvent(void); bool powerKeyPressed{false}; bool funcKeyPressed{false}; }; diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp index 958358535..ea676e07e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-07-18 14:55:27 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-09-29 15:35:47 + * @LastEditTime: 2024-10-03 20:04:53 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp */ @@ -20,8 +20,9 @@ #include "bleService.h" #include "ui_service.h" #include "dial_sos_c.h" - +#include "broadcast_feature.h" #define SAVEMODE 0 +#define DEBUGOUTPUT 1 extern "C" uint8_t uapi_dev_runtime_get_lock_status(void); namespace OHOS @@ -530,6 +531,30 @@ namespace OHOS return true; } + + static void FuncKeyOtherOnClickEventCallBack(void) + { + CustomEventPublish(TOPIC_EVENT_DEBUGOUTPUT, NULL, 0); + return; + } + static void HandFuncKeyOtherOnClickEvent(void) + { + GraphicService::GetInstance()->PostGraphicEvent(std::bind(FuncKeyOtherOnClickEventCallBack)); + } + + bool RebootAndShutdownModel::RegisterFuncKeyOtherOnClickEvent(void) + { + // 注册按键按下8次事件 + int32_t powerret = uapi_button_register_event_cb(HandFuncKeyOtherOnClickEvent, BUTTON1_CLICKUP_OTHER); + if (powerret != ERRCODE_SUCC) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Failed to register Power Button Press Event, ret = %d", powerret); + return false; + } + + return true; + } + /*注册所有按键事件*/ void RebootAndShutdownModel::RegisterAllKeyEvents(void) { @@ -539,6 +564,9 @@ namespace OHOS RegisterFuncKeyLongPressEvent(); // RegisterFuncKeyClickEvent(); RegisterFuncKeyDoubleClickEvent(); +#if DEBUGOUTPUT + RegisterFuncKeyOtherOnClickEvent(); +#endif #if SAVEMODE RegisterPowerAndFuncKeyPressEvent(); #endif