1 /*
2  * Copyright (c) 2021-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 #ifndef DISPLAYMGR_IDISPLAY_MGR_H
17 #define DISPLAYMGR_IDISPLAY_MGR_H
18 
19 #include <iremote_broker.h>
20 #include <vector>
21 
22 #include "display_mgr_errors.h"
23 #include "display_power_info.h"
24 #include "idisplay_brightness_callback.h"
25 #include "idisplay_power_callback.h"
26 
27 namespace OHOS {
28 namespace DisplayPowerMgr {
29 class IDisplayPowerMgr : public IRemoteBroker {
30 public:
31     virtual bool SetDisplayState(uint32_t id, DisplayState state, uint32_t reason) = 0;
32     virtual DisplayState GetDisplayState(uint32_t id) = 0;
33     virtual std::vector<uint32_t> GetDisplayIds() = 0;
34     virtual uint32_t GetMainDisplayId() = 0;
35     virtual bool SetBrightness(uint32_t value, uint32_t displayId, bool continuous) = 0;
36     virtual bool SetMaxBrightness(double value, uint32_t enterTestMode) = 0;
37     virtual bool SetMaxBrightnessNit(uint32_t maxNit, uint32_t enterTestMode) = 0;
38     virtual bool DiscountBrightness(double discount, uint32_t displayId) = 0;
39     virtual bool OverrideBrightness(uint32_t value, uint32_t displayId, uint32_t duration = 500) = 0;
40     virtual bool OverrideDisplayOffDelay(uint32_t delayMs) = 0;
41     virtual bool RestoreBrightness(uint32_t displayId, uint32_t duration = 500) = 0;
42     virtual uint32_t GetBrightness(uint32_t displayId) = 0;
43     virtual uint32_t GetDefaultBrightness() = 0;
44     virtual uint32_t GetMaxBrightness() = 0;
45     virtual uint32_t GetMinBrightness() = 0;
46     virtual bool AdjustBrightness(uint32_t id, int32_t value, uint32_t duration) = 0;
47     virtual bool AutoAdjustBrightness(bool enable) = 0;
48     virtual bool IsAutoAdjustBrightness() = 0;
49     virtual bool RegisterCallback(sptr<IDisplayPowerCallback> callback) = 0;
50     virtual bool BoostBrightness(int32_t timeoutMs, uint32_t displayId) = 0;
51     virtual bool CancelBoostBrightness(uint32_t displayId) = 0;
52     virtual uint32_t GetDeviceBrightness(uint32_t displayId) = 0;
53     virtual bool SetCoordinated(bool coordinated, uint32_t displayId) = 0;
54     virtual uint32_t SetLightBrightnessThreshold(
55         std::vector<int32_t> threshold, sptr<IDisplayBrightnessCallback> callback) = 0;
56     virtual DisplayErrors GetError() = 0;
57 
58     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.displaypowermgr.IDisplayPowerMgr");
59 };
60 } // namespace DisplayPowerMgr
61 } // namespace OHOS
62 #endif // DISPLAYMGR_IDISPLAY_MGR_H
63