1 /*
2  * Copyright (c) 2023-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "brightness_param_helper.h"
17 
18 #include "sysparam.h"
19 
20 namespace OHOS {
21 namespace DisplayPowerMgr {
22 using namespace OHOS::PowerMgr;
GetDefaultBrightness()23 uint32_t BrightnessParamHelper::GetDefaultBrightness()
24 {
25     int32_t value = SysParam::GetIntValue(KEY_DEFAULT_BRIGHTNESS, BRIGHTNESS_DEFAULT);
26     return static_cast<uint32_t>(value);
27 }
28 
GetMaxBrightness()29 uint32_t BrightnessParamHelper::GetMaxBrightness()
30 {
31     int32_t value = SysParam::GetIntValue(KEY_MAX_BRIGHTNESS, BRIGHTNESS_MAX);
32     return static_cast<uint32_t>(value);
33 }
34 
GetMinBrightness()35 uint32_t BrightnessParamHelper::GetMinBrightness()
36 {
37     int32_t value = SysParam::GetIntValue(KEY_MIN_BRIGHTNESS, BRIGHTNESS_MIN);
38     return static_cast<uint32_t>(value);
39 }
40 
GetSleepBrightness()41 uint32_t BrightnessParamHelper::GetSleepBrightness()
42 {
43     int32_t value = SysParam::GetIntValue(KEY_SLEEP_BRIGHTNESS, BRIGHTNESS_SLEEP);
44     return static_cast<uint32_t>(value);
45 }
46 
GetSleepMinumumReductionBrightness()47 uint32_t BrightnessParamHelper::GetSleepMinumumReductionBrightness()
48 {
49     int32_t value = SysParam::GetIntValue(KEY_SLEEP_MINUMUM_REDUCTION_BRIGHTNESS, BRIGHTNESS_SLEEP_MINUMUM_REDUCTION);
50     return static_cast<uint32_t>(value);
51 }
52 
GetSleepDarkenTime()53 uint32_t BrightnessParamHelper::GetSleepDarkenTime()
54 {
55     int32_t value = SysParam::GetIntValue(KEY_SLEEP_DARKEN_TIME, BRIGHTNESS_SLEEP_DARKEN_TIME);
56     return static_cast<uint32_t>(value);
57 }
58 
RegisterBootCompletedCallback(BootCompletedCallback & callback)59 void BrightnessParamHelper::RegisterBootCompletedCallback(BootCompletedCallback& callback)
60 {
61     SysParam::RegisterBootCompletedCallback(callback);
62 }
63 } // namespace DisplayPowerMgr
64 } // namespace OHOS