* @Author: luozheng 1732036298@qq.com
* @Date: 2024-07-18 14:55:27
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-08-22 20:02:18
+ * @LastEditTime: 2024-08-24 14:48:41
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp
*/
extern "C" uint8_t uapi_dev_runtime_get_lock_status(void);
namespace OHOS
{
+ static uint16_t intercept_slice_ids[] = {
+ VIEW_INVALID,
+ VIEW_SAVEBAT, // 省电模式界面
+ VIEW_BLOOD_CHECK, // 血氧检测界面
+ VIEW_HEART_CHECK, // 心率检测界面
+ VIEW_TRAININGCRAD, // 训练控制卡片
+ VIEW_TEST, // 产测测试界面
+ };
+
RebootAndShutdownModel::RebootAndShutdownModel() {}
RebootAndShutdownModel::~RebootAndShutdownModel() {}
GraphicService::GetInstance()->PostGraphicEvent(std::bind(PowerKeyLongPressCallBack));
}
- static void SOSKeyLongPress(void)
- {
- start_SOS_phone_dail();
- }
-
-
/*注册电源键的长按事件*/
bool RebootAndShutdownModel::RegisterPowerKeyLongPressEvent(void)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Register PowerKey LongPress Event error, ret = %d", ret);
return false;
}
- ret = uapi_button_register_event_cb(SOSKeyLongPress, BUTTON1_LONGPRESS_8S);
- if (ret != ERRCODE_SUCC)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Register PowerKey LongPress Event error, ret = %d", ret);
- return false;
- }
return true;
}
}
}
+ static void SOSKeyLongPress(void)
+ {
+ start_SOS_phone_dail();
+ }
+
static void HandFuncKeyOnLongPress(void)
{
- GraphicService::GetInstance()->PostGraphicEvent(std::bind(FuncKeyOnLongPressCallBack));
+ GraphicService::GetInstance()->PostGraphicEvent(std::bind(SOSKeyLongPress));
}
- /*注册功能键的长按(2s)事件*/
+ /*注册功能键的长按(8s)事件*/
bool RebootAndShutdownModel::RegisterFuncKeyLongPressEvent(void)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::RegisterFuncKeyLongPressEvent");
- int32_t ret = uapi_button_register_event_cb(HandFuncKeyOnLongPress, BUTTON1_LONGPRESS_2S);
+ int32_t ret = uapi_button_register_event_cb(SOSKeyLongPress, BUTTON1_LONGPRESS_8S);
if (ret != ERRCODE_SUCC)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Register FuncKey LongPress Event error, ret = %d", ret);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Register PowerKey LongPress Event error, ret = %d", ret);
return false;
}
return true;
return;
}
+ uint16_t current_slice_id = OHOS::NativeAbility::GetInstance().GetCurSliceId();
+ for (uint16_t i = 0; i < sizeof(intercept_slice_ids) / sizeof(intercept_slice_ids); i++)
+ {
+ if (intercept_slice_ids[i] == current_slice_id)
+ {
+ return;
+ }
+ }
const power_display_svr_api_t *display_api = power_display_svr_get_api();
if (!display_api)
{
RegisterPowerKeyDoubleClickEvent();
RegisterPowerKeyLongPressEvent();
RegisterFuncKeyPressEvent();
- // RegisterFuncKeyLongPressEvent();
+ RegisterFuncKeyLongPressEvent();
// RegisterFuncKeyClickEvent();
RegisterFuncKeyDoubleClickEvent();
}