1 /*
2 * Copyright (c) 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
17 #include "brightness_impl.h"
18
19 #include "PreviewerEngineLog.h"
20 #include "SharedData.h"
21
22 using namespace OHOS::ACELite;
23
SetValueImpl(uint8_t value)24 int32_t BrightnessImpl::SetValueImpl(uint8_t value)
25 {
26 if (!SharedData<uint8_t>::SetData(SharedDataType::BRIGHTNESS_VALUE, value)) {
27 return EC_API_INVALID_PARAM;
28 }
29 ILOG("Set screen brightness value: %d", value);
30 return 0;
31 }
32
GetValueImpl(uint8_t & value)33 int32_t BrightnessImpl::GetValueImpl(uint8_t& value)
34 {
35 value = SharedData<uint8_t>::GetData(SharedDataType::BRIGHTNESS_VALUE);
36 ILOG("Get screen brightness value: %d", value);
37 return 0;
38 }
39
SetModeImpl(uint8_t mode)40 int32_t BrightnessImpl::SetModeImpl(uint8_t mode)
41 {
42 if (!SharedData<uint8_t>::SetData(SharedDataType::BRIGHTNESS_MODE, mode)) {
43 return EC_API_INVALID_PARAM;
44 }
45 ILOG("Set screen brightness mode: %d", mode);
46 return 0;
47 }
48
GetModeImpl(uint8_t & mode)49 int32_t BrightnessImpl::GetModeImpl(uint8_t& mode)
50 {
51 mode = SharedData<uint8_t>::GetData(SharedDataType::BRIGHTNESS_MODE);
52 ILOG("Get screen brightness mode: %d", mode);
53 return 0;
54 }
55
SetKeepScreenOnImpl(bool keepScreenOn)56 void BrightnessImpl::SetKeepScreenOnImpl(bool keepScreenOn)
57 {
58 SharedData<bool>::SetData(SharedDataType::KEEP_SCREEN_ON, keepScreenOn);
59 ILOG("Set screen keep on: %d", keepScreenOn);
60 }
61
SetAlwaysOnMode(bool alwaysOn)62 void BrightnessImpl::SetAlwaysOnMode(bool alwaysOn)
63 {
64 (void)alwaysOn;
65 }
66
GetSysMode(uint8_t & mode)67 int32_t BrightnessImpl::GetSysMode(uint8_t& mode)
68 {
69 (void)mode;
70 return 0;
71 }
72
SetSysMode(uint8_t mode)73 int32_t BrightnessImpl::SetSysMode(uint8_t mode)
74 {
75 (void)mode;
76 return 0;
77 }
78
GetSysAlwaysOnState()79 uint8_t BrightnessImpl::GetSysAlwaysOnState()
80 {
81 return 0;
82 }
83
SetSysAlwaysOnState(uint8_t alwaysOnState)84 void BrightnessImpl::SetSysAlwaysOnState(uint8_t alwaysOnState)
85 {
86 (void)alwaysOnState;
87 }
88
GetCurBrightLevel()89 uint8_t BrightnessImpl::GetCurBrightLevel()
90 {
91 return 0;
92 }
93
BrightnessImpl()94 BrightnessImpl::BrightnessImpl()
95 {
96 }
97
~BrightnessImpl()98 BrightnessImpl::~BrightnessImpl()
99 {
100 }
101