mcu_hi3321_watch/tjd/ui/common/TjdUiSettingCenter.h
2025-05-26 20:15:20 +08:00

85 lines
2.0 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*----------------------------------------------------------------------------
* Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved.
*
* Description: common UI setting center, such as low power mode, screen brightness, etc.
*
* Author: luziquan@ss-tjd.com
*
* Create: 2024-10-16
*--------------------------------------------------------------------------*/
#ifndef TJD_UI_SETTING_CENTER_H
#define TJD_UI_SETTING_CENTER_H
#include <list>
namespace TJD {
typedef void(*BleConnectStateCallback)(bool isConnect);
class TjdUiSettingCenter
{
public:
void Init();
static TjdUiSettingCenter &GetInstance();
void SetLowPowerMode(bool enable);
bool IsConnectApp();
/**
* @brief 清空exc文件释放空间
*
*/
void ClearExcFile();
/**
* @brief 通知震动事件
*/
void NotifShakeEvent();
/**
* @brief 电话震动事件
*/
void PhoneShakeEvent();
/**
* @brief 手动结束震动
*/
void ShakeEndEvent();
/**
* @brief 开启持续亮屏,并且最高亮度
*/
void KeepScreenMaxOn();
/**
* @brief 关闭持续亮屏,恢复原亮度
*/
void KeepScreenMaxOff();
/**
* @brief 获取低电量模式亮度
* @return uint8_t 亮度值
*/
uint8_t GetLowPowerBrightness() { return lowPowerBrightness_; }
void ResetSystem();
void ShutdownSystem();
void RecoverySystem();
/**
* @brief 注册蓝牙连接状态回调
* @param callback
*/
void RegisterBleConnectStateCallback(BleConnectStateCallback callback) { bleConnectStateCallbackList_.push_back(callback); }
void UnregisterBleConnectStateCallback(BleConnectStateCallback callback) { bleConnectStateCallbackList_.remove(callback); }
void BleConnectStateEvent(int val);
private:
std::list<BleConnectStateCallback> bleConnectStateCallbackList_;
void BatterySaverProcess();
uint8_t lowPowerBrightness_{25};
TjdUiSettingCenter() {};
~TjdUiSettingCenter() {};
};
} // namespace TJD
#endif