1595d5899Sopenharmony_ci/* 2595d5899Sopenharmony_ci * Copyright (c) 2023-2023 Huawei Device Co., Ltd. 3595d5899Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4595d5899Sopenharmony_ci * you may not use this file except in compliance with the License. 5595d5899Sopenharmony_ci * You may obtain a copy of the License at 6595d5899Sopenharmony_ci * 7595d5899Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8595d5899Sopenharmony_ci * 9595d5899Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10595d5899Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11595d5899Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12595d5899Sopenharmony_ci * See the License for the specific language governing permissions and 13595d5899Sopenharmony_ci * limitations under the License. 14595d5899Sopenharmony_ci */ 15595d5899Sopenharmony_ci 16595d5899Sopenharmony_ci#ifndef BRIGHTNESS_ACTION_H 17595d5899Sopenharmony_ci#define BRIGHTNESS_ACTION_H 18595d5899Sopenharmony_ci 19595d5899Sopenharmony_ci#include <cstdint> 20595d5899Sopenharmony_ci#include <functional> 21595d5899Sopenharmony_ci#include <memory> 22595d5899Sopenharmony_ci#include <mutex> 23595d5899Sopenharmony_ci#include <vector> 24595d5899Sopenharmony_ci 25595d5899Sopenharmony_ci#include "brightness_base.h" 26595d5899Sopenharmony_ci#include "display_power_info.h" 27595d5899Sopenharmony_ci 28595d5899Sopenharmony_cinamespace OHOS { 29595d5899Sopenharmony_cinamespace DisplayPowerMgr { 30595d5899Sopenharmony_ciclass BrightnessAction { 31595d5899Sopenharmony_cipublic: 32595d5899Sopenharmony_ci explicit BrightnessAction(uint32_t displayId); 33595d5899Sopenharmony_ci ~BrightnessAction() = default; 34595d5899Sopenharmony_ci BrightnessAction(const BrightnessAction&) = delete; 35595d5899Sopenharmony_ci BrightnessAction& operator=(const BrightnessAction&) = delete; 36595d5899Sopenharmony_ci BrightnessAction(BrightnessAction&&) = delete; 37595d5899Sopenharmony_ci BrightnessAction& operator=(BrightnessAction&&) = delete; 38595d5899Sopenharmony_ci 39595d5899Sopenharmony_ci static uint32_t GetDefaultDisplayId(); 40595d5899Sopenharmony_ci static std::vector<uint32_t> GetAllDisplayId(); 41595d5899Sopenharmony_ci 42595d5899Sopenharmony_ci uint32_t GetDisplayId(); 43595d5899Sopenharmony_ci void SetDisplayId(uint32_t displayId); 44595d5899Sopenharmony_ci DisplayState GetDisplayState(); 45595d5899Sopenharmony_ci bool SetDisplayState(DisplayState state, const std::function<void(DisplayState)>& callback); 46595d5899Sopenharmony_ci bool SetDisplayPower(DisplayState state, uint32_t reason); 47595d5899Sopenharmony_ci uint32_t GetBrightness(); 48595d5899Sopenharmony_ci bool SetBrightness(uint32_t value); 49595d5899Sopenharmony_ci bool SetBrightness(uint32_t displayId, uint32_t value); 50595d5899Sopenharmony_ci 51595d5899Sopenharmony_ciprivate: 52595d5899Sopenharmony_ci std::mutex mMutexBrightness; 53595d5899Sopenharmony_ci uint32_t mBrightness {102}; 54595d5899Sopenharmony_ci uint32_t mDisplayId {DEFAULT_DISPLAY_ID}; 55595d5899Sopenharmony_ci}; 56595d5899Sopenharmony_ci} // namespace DisplayPowerMgr 57595d5899Sopenharmony_ci} // namespace OHOS 58595d5899Sopenharmony_ci#endif // BRIGHTNESS_ACTION_H 59