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