• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 OHOS_CJ_DISPLAY_IMPL
17 #define OHOS_CJ_DISPLAY_IMPL
18 
19 #include "display_manager.h"
20 #include "display_utils.h"
21 #include "ffi_remote_data.h"
22 
23 namespace OHOS {
24 namespace Rosen {
25 class DisplayImpl final : public OHOS::FFI::FFIData {
26 public:
27     explicit DisplayImpl(const sptr<Display>& display);
28     ~DisplayImpl() override;
29     static sptr<DisplayImpl> CreateDisplayImpl(sptr<Display>& display);
30     static sptr<DisplayImpl> FindDisplayObject(uint64_t displayId);
31     uint32_t GetInfoId();
32     char* GetName();
33     bool GetAlive();
34     uint32_t GetState();
35     uint32_t GetRefreshRate();
36     uint32_t GetRotation();
37     uint32_t GetOrientation();
38     int32_t GetWidth();
39     int32_t GetHeight();
40     float GetDensityDPI();
41     float GetVirtualPixelRatio();
42     float GetXDPI();
43     float GetYDPI();
44     RetStruct GetColorSpaces();
45     RetStruct GetHdrFormats();
46     uint32_t GetAvailableWidth();
47     uint32_t GetAvailableHeight();
48     RetStruct GetCutoutInfo();
49     RetStruct GetAvailableArea();
50     int32_t OnUnRegisterAllDisplayManagerCallback(const std::string& type);
51     DMError UnRegisterAllDisplayListenerWithType(const std::string& type);
52     int32_t OnRegisterDisplayManagerCallback(const std::string& type, int64_t funcId);
53     DMError RegisterDisplayListenerWithType(const std::string& type, int64_t funcId);
54     int32_t OnUnRegisterDisplayManagerCallback(const std::string& type, int64_t funcId);
55     DMError UnRegisterDisplayListenerWithType(const std::string& type, int64_t funcId);
GetRuntimeType()56     OHOS::FFI::RuntimeType* GetRuntimeType() override
57     {
58         return GetClassType();
59     }
60 
61 private:
62     sptr<Display> display_ = nullptr;
63     friend class OHOS::FFI::RuntimeType;
64     friend class OHOS::FFI::TypeBase;
GetClassType()65     static OHOS::FFI::RuntimeType* GetClassType()
66     {
67         static OHOS::FFI::RuntimeType runtimeType = OHOS::FFI::RuntimeType::Create<OHOS::FFI::FFIData>("DisplayImpl");
68         return &runtimeType;
69     }
70 };
71 
72 enum class DisplayStateMode : uint32_t {
73     STATE_UNKNOWN = 0,
74     STATE_OFF,
75     STATE_ON,
76     STATE_DOZE,
77     STATE_DOZE_SUSPEND,
78     STATE_VR,
79     STATE_ON_SUSPEND
80 };
81 } // namespace Rosen
82 } // namespace OHOS
83 
84 #endif // DISPLAY_DISPLAY_IMPL
85