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
22using namespace OHOS::ACELite;
23
24int32_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
33int32_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
40int32_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
49int32_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
56void BrightnessImpl::SetKeepScreenOnImpl(bool keepScreenOn)
57{
58    SharedData<bool>::SetData(SharedDataType::KEEP_SCREEN_ON, keepScreenOn);
59    ILOG("Set screen keep on: %d", keepScreenOn);
60}
61
62void BrightnessImpl::SetAlwaysOnMode(bool alwaysOn)
63{
64    (void)alwaysOn;
65}
66
67int32_t BrightnessImpl::GetSysMode(uint8_t& mode)
68{
69    (void)mode;
70    return 0;
71}
72
73int32_t BrightnessImpl::SetSysMode(uint8_t mode)
74{
75    (void)mode;
76    return 0;
77}
78
79uint8_t BrightnessImpl::GetSysAlwaysOnState()
80{
81    return 0;
82}
83
84void BrightnessImpl::SetSysAlwaysOnState(uint8_t alwaysOnState)
85{
86    (void)alwaysOnState;
87}
88
89uint8_t BrightnessImpl::GetCurBrightLevel()
90{
91    return 0;
92}
93
94BrightnessImpl::BrightnessImpl()
95{
96}
97
98BrightnessImpl::~BrightnessImpl()
99{
100}
101