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_MANAGER_H 17595d5899Sopenharmony_ci#define BRIGHTNESS_MANAGER_H 18595d5899Sopenharmony_ci 19595d5899Sopenharmony_ci#include "brightness_service.h" 20595d5899Sopenharmony_ci#include "brightness_manager_ext.h" 21595d5899Sopenharmony_ci 22595d5899Sopenharmony_cinamespace OHOS { 23595d5899Sopenharmony_cinamespace DisplayPowerMgr { 24595d5899Sopenharmony_ciclass BrightnessManager { 25595d5899Sopenharmony_cipublic: 26595d5899Sopenharmony_ci BrightnessManager(const BrightnessManager&) = delete; 27595d5899Sopenharmony_ci BrightnessManager& operator=(const BrightnessManager&) = delete; 28595d5899Sopenharmony_ci BrightnessManager(BrightnessManager&&) = delete; 29595d5899Sopenharmony_ci BrightnessManager& operator=(BrightnessManager&&) = delete; 30595d5899Sopenharmony_ci 31595d5899Sopenharmony_ci static BrightnessManager& Get(); 32595d5899Sopenharmony_ci 33595d5899Sopenharmony_ci void Init(uint32_t defaultMax, uint32_t defaultMin); 34595d5899Sopenharmony_ci void DeInit(); 35595d5899Sopenharmony_ci void SetDisplayState(uint32_t id, DisplayState state, uint32_t reason); 36595d5899Sopenharmony_ci DisplayState GetState(); 37595d5899Sopenharmony_ci bool AutoAdjustBrightness(bool enable); 38595d5899Sopenharmony_ci bool SetBrightness(uint32_t value, uint32_t gradualDuration = 0, bool continuous = false); 39595d5899Sopenharmony_ci bool DiscountBrightness(double discount); 40595d5899Sopenharmony_ci double GetDiscount() const; 41595d5899Sopenharmony_ci void SetScreenOnBrightness(); 42595d5899Sopenharmony_ci uint32_t GetScreenOnBrightness() const; 43595d5899Sopenharmony_ci bool OverrideBrightness(uint32_t value, uint32_t gradualDuration = 0); 44595d5899Sopenharmony_ci bool RestoreBrightness(uint32_t gradualDuration = 0); 45595d5899Sopenharmony_ci bool BoostBrightness(uint32_t timeoutMs, uint32_t gradualDuration = 0); 46595d5899Sopenharmony_ci bool CancelBoostBrightness(uint32_t gradualDuration = 0); 47595d5899Sopenharmony_ci bool IsBrightnessOverridden() const; 48595d5899Sopenharmony_ci bool IsBrightnessBoosted() const; 49595d5899Sopenharmony_ci uint32_t GetBrightness(); 50595d5899Sopenharmony_ci uint32_t GetDeviceBrightness(); 51595d5899Sopenharmony_ci void ClearOffset(); 52595d5899Sopenharmony_ci uint32_t SetLightBrightnessThreshold(std::vector<int32_t> threshold, sptr<IDisplayBrightnessCallback> callback); 53595d5899Sopenharmony_ci uint32_t GetCurrentDisplayId(uint32_t defaultId) const; 54595d5899Sopenharmony_ci void SetDisplayId(uint32_t id = 0); 55595d5899Sopenharmony_ci bool SetMaxBrightness(double value); 56595d5899Sopenharmony_ci bool SetMaxBrightnessNit(uint32_t nit); 57595d5899Sopenharmony_ci 58595d5899Sopenharmony_ciprivate: 59595d5899Sopenharmony_ci BrightnessManager() = default; 60595d5899Sopenharmony_ci virtual ~BrightnessManager() = default; 61595d5899Sopenharmony_ci 62595d5899Sopenharmony_ciprivate: 63595d5899Sopenharmony_ci BrightnessManagerExt mBrightnessManagerExt; 64595d5899Sopenharmony_ci}; 65595d5899Sopenharmony_ci} // namespace DisplayPowerMgr 66595d5899Sopenharmony_ci} // namespace OHOS 67595d5899Sopenharmony_ci#endif // BRIGHTNESS_MANAGER_H