* @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
*/
bool RegisterFuncKeyClickEvent(void);
bool RegisterFuncKeyDoubleClickEvent(void);
bool RegisterPowerAndFuncKeyPressEvent(void);
+ bool RegisterFuncKeyOtherOnClickEvent(void);
bool powerKeyPressed{false};
bool funcKeyPressed{false};
};
* @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
*/
#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
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)
{
RegisterFuncKeyLongPressEvent();
// RegisterFuncKeyClickEvent();
RegisterFuncKeyDoubleClickEvent();
+#if DEBUGOUTPUT
+ RegisterFuncKeyOtherOnClickEvent();
+#endif
#if SAVEMODE
RegisterPowerAndFuncKeyPressEvent();
#endif