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_SETTING_HELPER_H 17595d5899Sopenharmony_ci#define BRIGHTNESS_SETTING_HELPER_H 18595d5899Sopenharmony_ci 19595d5899Sopenharmony_ci#include <cstdint> 20595d5899Sopenharmony_ci#include <string> 21595d5899Sopenharmony_ci 22595d5899Sopenharmony_ci#include "setting_observer.h" 23595d5899Sopenharmony_ci 24595d5899Sopenharmony_cinamespace OHOS { 25595d5899Sopenharmony_cinamespace DisplayPowerMgr { 26595d5899Sopenharmony_ci 27595d5899Sopenharmony_ciusing namespace OHOS::PowerMgr; 28595d5899Sopenharmony_ci 29595d5899Sopenharmony_ciclass BrightnessSettingHelper { 30595d5899Sopenharmony_cipublic: 31595d5899Sopenharmony_ci static void RegisterSettingBrightnessObserver(SettingObserver::UpdateFunc func); 32595d5899Sopenharmony_ci static void UnregisterSettingBrightnessObserver(); 33595d5899Sopenharmony_ci static void SetSettingBrightness(uint32_t value); 34595d5899Sopenharmony_ci static ErrCode GetSettingBrightness(uint32_t& brightness, const std::string& key = SETTING_BRIGHTNESS_KEY); 35595d5899Sopenharmony_ci 36595d5899Sopenharmony_ci static void RegisterSettingAutoBrightnessObserver(SettingObserver::UpdateFunc func); 37595d5899Sopenharmony_ci static void UnregisterSettingAutoBrightnessObserver(); 38595d5899Sopenharmony_ci static void SetSettingAutoBrightness(bool enable); 39595d5899Sopenharmony_ci static bool GetSettingAutoBrightness(const std::string& key = SETTING_AUTO_ADJUST_BRIGHTNESS_KEY); 40595d5899Sopenharmony_ciprivate: 41595d5899Sopenharmony_ci static const constexpr char* SETTING_BRIGHTNESS_KEY {"settings.display.screen_brightness_status"}; 42595d5899Sopenharmony_ci static const constexpr char* SETTING_AUTO_ADJUST_BRIGHTNESS_KEY {"settings.display.auto_screen_brightness"}; 43595d5899Sopenharmony_ci 44595d5899Sopenharmony_ci static sptr<SettingObserver> mAutoBrightnessObserver; 45595d5899Sopenharmony_ci static sptr<SettingObserver> mBrightnessObserver; 46595d5899Sopenharmony_ci}; 47595d5899Sopenharmony_ci} // namespace PowerMgr 48595d5899Sopenharmony_ci} // namespace OHOS 49595d5899Sopenharmony_ci 50595d5899Sopenharmony_ci#endif // BRIGHTNESS_SETTING_HELPER_H