1 /* 2 * Copyright (c) 2021-2022 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_DISPLAY_MGR_PROXY_H 17 #define DISPLAYMGR_DISPLAY_MGR_PROXY_H 18 19 #include <cstdint> 20 #include <vector> 21 #include <functional> 22 #include <iremote_proxy.h> 23 #include "iremote_broker.h" 24 #include "iremote_object.h" 25 #include "refbase.h" 26 #include "display_power_info.h" 27 #include "idisplay_power_callback.h" 28 #include "idisplay_power_mgr.h" 29 30 namespace OHOS { 31 namespace DisplayPowerMgr { 32 class DisplayPowerMgrProxy : public IRemoteProxy<IDisplayPowerMgr> { 33 public: DisplayPowerMgrProxy(const sptr<IRemoteObject> & impl)34 explicit DisplayPowerMgrProxy(const sptr<IRemoteObject>& impl) 35 : IRemoteProxy<IDisplayPowerMgr>(impl) {} 36 ~DisplayPowerMgrProxy() override = default; 37 38 virtual bool SetDisplayState(uint32_t id, DisplayState state, uint32_t reason) override; 39 virtual DisplayState GetDisplayState(uint32_t id) override; 40 virtual std::vector<uint32_t> GetDisplayIds() override; 41 virtual uint32_t GetMainDisplayId() override; 42 43 virtual bool SetBrightness(uint32_t value, uint32_t displayId) override; 44 virtual bool DiscountBrightness(double value, uint32_t displayId) override; 45 virtual bool OverrideBrightness(uint32_t value, uint32_t displayId) override; 46 virtual bool OverrideDisplayOffDelay(uint32_t delayMs) override; 47 virtual bool RestoreBrightness(uint32_t displayId) override; 48 virtual uint32_t GetBrightness(uint32_t displayId) override; 49 virtual uint32_t GetDefaultBrightness() override; 50 virtual uint32_t GetMaxBrightness() override; 51 virtual uint32_t GetMinBrightness() override; 52 virtual bool AdjustBrightness(uint32_t id, int32_t value, uint32_t duration) override; 53 virtual bool AutoAdjustBrightness(bool enable) override; 54 virtual bool IsAutoAdjustBrightness() override; 55 virtual bool RegisterCallback(sptr<IDisplayPowerCallback> callback) override; 56 virtual bool BoostBrightness(int32_t timeoutMs, uint32_t displayId) override; 57 virtual bool CancelBoostBrightness(uint32_t displayId) override; 58 virtual uint32_t GetDeviceBrightness(uint32_t displayId) override; 59 virtual DisplayErrors GetError() override; 60 61 private: 62 static inline BrokerDelegator<DisplayPowerMgrProxy> delegator_; 63 DisplayErrors lastError_ {DisplayErrors::ERR_OK}; 64 }; 65 } // namespace DisplayPowerMgr 66 } // namespace OHOS 67 #endif // DISPLAYMGR_DISPLAY_MGR_PROXY_H 68