• 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 OH_NATIVE_DISPLAY_INFO_H
17 #define OH_NATIVE_DISPLAY_INFO_H
18 
19 /**
20  * @addtogroup OH_DisplayInfo
21  * @{
22  *
23  * @brief Defines the data structures for the C APIs of the display module.
24  *
25  * @syscap SystemCapability.WindowManager.WindowManager.Core
26  * @since 12
27  * @version 1.0
28  */
29 
30 /**
31  * @file oh_display_info.h
32  *
33  * @brief Defines the data structures for the C APIs of the display module.
34  *
35  * @kit ArkUI
36  * @library libnative_display_manager.so
37  * @syscap SystemCapability.WindowManager.WindowManager.Core
38  * @since 12
39  * @version 1.0
40  */
41 
42 #include "stdint.h"
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 /**
49  * @brief display name length
50  * @since 14
51  */
52 #define OH_DISPLAY_NAME_LENGTH 32
53 
54 /**
55  * @brief Enumerates rotations.
56  *
57  * @since 12
58  * @version 1.0
59  */
60 typedef enum {
61     /** device rotation 0 degree */
62     DISPLAY_MANAGER_ROTATION_0,
63 
64     /** device rotation 90 degrees */
65     DISPLAY_MANAGER_ROTATION_90,
66 
67     /** device rotation 180 degrees */
68     DISPLAY_MANAGER_ROTATION_180,
69 
70     /** device rotation 270 degree */
71     DISPLAY_MANAGER_ROTATION_270,
72 } NativeDisplayManager_Rotation;
73 
74 /**
75  * @brief Enumerates orientations.
76  *
77  * @since 12
78  * @version 1.0
79  */
80 typedef enum {
81     /** device portrait show */
82     DISPLAY_MANAGER_PORTRAIT = 0,
83 
84     /** device landscape show */
85     DISPLAY_MANAGER_LANDSCAPE = 1,
86 
87     /** device portrait inverted show */
88     DISPLAY_MANAGER_PORTRAIT_INVERTED = 2,
89 
90     /** device landscape inverted show */
91     DISPLAY_MANAGER_LANDSCAPE_INVERTED = 3,
92 
93     /** device unknow show */
94     DISPLAY_MANAGER_UNKNOWN,
95 } NativeDisplayManager_Orientation;
96 
97 /**
98  * @brief Enumerates the result types of the display manager interface.
99  *
100  * @since 12
101  * @version 1.0
102  */
103 typedef enum {
104     /** @error Operation is successful */
105     DISPLAY_MANAGER_OK = 0,
106 
107     /** @error Operation no permission */
108     DISPLAY_MANAGER_ERROR_NO_PERMISSION = 201,
109 
110     /** @error Operation not system app */
111     DISPLAY_MANAGER_ERROR_NOT_SYSTEM_APP = 202,
112 
113     /** @error Operation invalid param */
114     DISPLAY_MANAGER_ERROR_INVALID_PARAM = 401,
115 
116     /** @error Operation device not supported */
117     DISPLAY_MANAGER_ERROR_DEVICE_NOT_SUPPORTED = 801,
118 
119     /** @error Operation screen invalid */
120     DISPLAY_MANAGER_ERROR_INVALID_SCREEN = 1400001,
121 
122     /** @error Operation invalid call */
123     DISPLAY_MANAGER_ERROR_INVALID_CALL = 1400002,
124 
125     /** @error Operation system abnormal */
126     DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL = 1400003,
127 
128     /** @error Operation illegal param */
129     DISPLAY_MANAGER_ERROR_ILLEGAL_PARAM = 1400004,
130 } NativeDisplayManager_ErrorCode;
131 
132 /**
133  * @brief Enumerates the fold display mode.
134  *
135  * @since 12
136  * @version 1.0
137  */
138 typedef enum {
139     /** display mode unknown */
140     DISPLAY_MANAGER_FOLD_DISPLAY_MODE_UNKNOWN = 0,
141 
142     /** display mode full */
143     DISPLAY_MANAGER_FOLD_DISPLAY_MODE_FULL = 1,
144 
145     /** display mode main */
146     DISPLAY_MANAGER_FOLD_DISPLAY_MODE_MAIN = 2,
147 
148     /** display mode sub */
149     DISPLAY_MANAGER_FOLD_DISPLAY_MODE_SUB = 3,
150 
151     /** display mode coordination */
152     DISPLAY_MANAGER_FOLD_DISPLAY_MODE_COORDINATION = 4,
153 } NativeDisplayManager_FoldDisplayMode;
154 
155 /**
156  * @brief Defines the display rect data structure.
157  *
158  * @since 12
159  * @version 1.0
160  */
161 typedef struct {
162     /** rect left */
163     int32_t left;
164 
165     /** rect top */
166     int32_t top;
167 
168     /** rect width */
169     uint32_t width;
170 
171     /** rect height */
172     uint32_t height;
173 } NativeDisplayManager_Rect;
174 
175 /**
176  * @brief Defines the display waterfallDisplayAreaRects data structure.
177  *
178  * @since 12
179  * @version 1.0
180  */
181 typedef struct {
182     /** waterfall left rect */
183     NativeDisplayManager_Rect left;
184 
185     /** waterfall top rect */
186     NativeDisplayManager_Rect top;
187 
188     /** waterfall right rect */
189     NativeDisplayManager_Rect right;
190 
191     /** waterfall bottom rect */
192     NativeDisplayManager_Rect bottom;
193 } NativeDisplayManager_WaterfallDisplayAreaRects;
194 
195 /**
196  * @brief Defines the display cutout info data structure.
197  *
198  * @since 12
199  * @version 1.0
200  */
201 typedef struct {
202     /** boundingRects length */
203     int32_t boundingRectsLength;
204 
205     /** boundingRects info pointer */
206     NativeDisplayManager_Rect *boundingRects;
207 
208     /** waterfallDisplayAreaRects info */
209     NativeDisplayManager_WaterfallDisplayAreaRects waterfallDisplayAreaRects;
210 } NativeDisplayManager_CutoutInfo;
211 
212 /**
213  * @brief Enumerates of the display state.
214  *
215  * @since 14
216  * @version 1.0
217  */
218 typedef enum {
219     /** display state unknown */
220     DISPLAY_MANAGER_DISPLAY_STATE_UNKNOWN = 0,
221 
222     /** display state off */
223     DISPLAY_MANAGER_DISPLAY_STATE_OFF = 1,
224 
225     /** display state on */
226     DISPLAY_MANAGER_DISPLAY_STATE_ON = 2,
227 
228     /** display state doze */
229     DISPLAY_MANAGER_DISPLAY_STATE_DOZE = 3,
230 
231     /** display state doze suspend */
232     DISPLAY_MANAGER_DISPLAY_STATE_DOZE_SUSPEND = 4,
233 
234     /** display state vr */
235     DISPLAY_MANAGER_DISPLAY_STATE_VR = 5,
236 
237     /** display state on suspend */
238     DISPLAY_MANAGER_DISPLAY_STATE_ON_SUSPEND = 6,
239 } NativeDisplayManager_DisplayState;
240 
241 /**
242  * @brief Defines the display hdr structure.
243  *
244  * @since 14
245  * @version 1.0
246  */
247 typedef struct {
248     /** hdrFormat length */
249     uint32_t hdrFormatLength;
250 
251     /** hdrFormat pointer */
252     uint32_t *hdrFormats;
253 } NativeDisplayManager_DisplayHdrFormat;
254 
255 /**
256  * @brief Defines the display color space structure.
257  *
258  * @since 14
259  * @version 1.0
260  */
261 typedef struct {
262     /** color space length */
263     uint32_t colorSpaceLength;
264 
265     /** color space pointer */
266     uint32_t *colorSpaces;
267 } NativeDisplayManager_DisplayColorSpace;
268 
269 /**
270  * @brief Defines the display structure.
271  *
272  * @since 14
273  * @version 1.0
274  */
275 typedef struct {
276     /** display id */
277     uint32_t id;
278 
279     /** display name */
280     char name[OH_DISPLAY_NAME_LENGTH + 1];
281 
282     /** display is alive */
283     bool isAlive;
284 
285     /** display width */
286     int32_t width;
287 
288     /** display height */
289     int32_t height;
290 
291     /** display physical width */
292     int32_t physicalWidth;
293 
294     /** display physical height */
295     int32_t physicalHeight;
296 
297     /** display refresh rate */
298     uint32_t refreshRate;
299 
300     /** display available width */
301     uint32_t availableWidth;
302 
303     /** display available height */
304     uint32_t availableHeight;
305 
306     /** display density dpi */
307     float densityDPI;
308 
309     /** display density pixels */
310     float densityPixels;
311 
312     /** display scale density */
313     float scaledDensity;
314 
315     /** display xdpi*/
316     float xDPI;
317 
318     /** display ydpi */
319     float yDPI;
320 
321     /** display rotation */
322     NativeDisplayManager_Rotation rotation;
323 
324     /** display state */
325     NativeDisplayManager_DisplayState state;
326 
327     /** display orientation */
328     NativeDisplayManager_Orientation orientation;
329 
330     /** display hdr format */
331     NativeDisplayManager_DisplayHdrFormat *hdrFormat;
332 
333     /** display color space */
334     NativeDisplayManager_DisplayColorSpace *colorSpace;
335 } NativeDisplayManager_DisplayInfo;
336 
337 /**
338  * @brief Defines the displays structure.
339  *
340  * @since 14
341  * @version 1.0
342  */
343 typedef struct {
344     /** displays length */
345     uint32_t displaysLength;
346 
347     /** displays pointer */
348     NativeDisplayManager_DisplayInfo *displaysInfo;
349 } NativeDisplayManager_DisplaysInfo;
350 
351 /**
352  * @brief Enumerates of the displays source mode.
353  *
354  * @since 20
355  * @version 1.0
356  */
357 typedef enum {
358     /** display is not in use */
359     DISPLAY_SOURCE_MODE_NONE = 0,
360 
361     /** display is in main mode */
362     DISPLAY_SOURCE_MODE_MAIN = 1,
363 
364     /** display is in mirror mode */
365     DISPLAY_SOURCE_MODE_MIRROR = 2,
366 
367     /** display is in extend mode */
368     DISPLAY_SOURCE_MODE_EXTEND = 3,
369 
370     /** display stands alone */
371     DISPLAY_SOURCE_MODE_ALONE = 4,
372 } NativeDisplayManager_SourceMode;
373 
374 #ifdef __cplusplus
375 }
376 #endif
377 /** @} */
378 #endif // OH_NATIVE_DISPLAY_INFO_H