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 } NativeDisplayManager_ErrorCode; 130 131 /** 132 * @brief Enumerates the fold display mode. 133 * 134 * @since 12 135 * @version 1.0 136 */ 137 typedef enum { 138 /** display mode unknown */ 139 DISPLAY_MANAGER_FOLD_DISPLAY_MODE_UNKNOWN = 0, 140 141 /** display mode full */ 142 DISPLAY_MANAGER_FOLD_DISPLAY_MODE_FULL = 1, 143 144 /** display mode main */ 145 DISPLAY_MANAGER_FOLD_DISPLAY_MODE_MAIN = 2, 146 147 /** display mode sub */ 148 DISPLAY_MANAGER_FOLD_DISPLAY_MODE_SUB = 3, 149 150 /** display mode coordination */ 151 DISPLAY_MANAGER_FOLD_DISPLAY_MODE_COORDINATION = 4, 152 } NativeDisplayManager_FoldDisplayMode; 153 154 /** 155 * @brief Defines the display rect data structure. 156 * 157 * @since 12 158 * @version 1.0 159 */ 160 typedef struct { 161 /* rect left */ 162 int32_t left; 163 /* rect top */ 164 int32_t top; 165 /* rect width */ 166 uint32_t width; 167 /* rect height */ 168 uint32_t height; 169 } NativeDisplayManager_Rect; 170 171 /** 172 * @brief Defines the display waterfallDisplayAreaRects data structure. 173 * 174 * @since 12 175 * @version 1.0 176 */ 177 typedef struct { 178 /* waterfall left rect */ 179 NativeDisplayManager_Rect left; 180 181 /* waterfall top rect */ 182 NativeDisplayManager_Rect top; 183 184 /* waterfall right rect */ 185 NativeDisplayManager_Rect right; 186 187 /* waterfall bottom rect */ 188 NativeDisplayManager_Rect bottom; 189 } NativeDisplayManager_WaterfallDisplayAreaRects; 190 191 /** 192 * @brief Defines the display cutout info data structure. 193 * 194 * @since 12 195 * @version 1.0 196 */ 197 typedef struct { 198 /* boundingRects length */ 199 int32_t boundingRectsLength; 200 201 /* boundingRects info pointer */ 202 NativeDisplayManager_Rect *boundingRects; 203 204 /* waterfallDisplayAreaRects info */ 205 NativeDisplayManager_WaterfallDisplayAreaRects waterfallDisplayAreaRects; 206 } NativeDisplayManager_CutoutInfo; 207 208 /** 209 * @brief Enumerates of the display state. 210 * 211 * @since 14 212 * @version 1.0 213 */ 214 typedef enum { 215 /** display state unknown */ 216 DISPLAY_MANAGER_DISPLAY_STATE_UNKNOWN = 0, 217 218 /** display state off */ 219 DISPLAY_MANAGER_DISPLAY_STATE_OFF = 1, 220 221 /** display state on */ 222 DISPLAY_MANAGER_DISPLAY_STATE_ON = 2, 223 224 /** display state doze */ 225 DISPLAY_MANAGER_DISPLAY_STATE_DOZE = 3, 226 227 /** display state doze suspend */ 228 DISPLAY_MANAGER_DISPLAY_STATE_DOZE_SUSPEND = 4, 229 230 /** display state vr */ 231 DISPLAY_MANAGER_DISPLAY_STATE_VR = 5, 232 233 /** display state on suspend */ 234 DISPLAY_MANAGER_DISPLAY_STATE_ON_SUSPEND = 6, 235 } NativeDisplayManager_DisplayState; 236 237 /** 238 * @brief Defines the display hdr structure. 239 * 240 * @since 14 241 * @version 1.0 242 */ 243 typedef struct { 244 /** hdrFormat length */ 245 uint32_t hdrFormatLength; 246 247 /** hdrFormat pointer */ 248 uint32_t *hdrFormats; 249 } NativeDisplayManager_DisplayHdrFormat; 250 251 /** 252 * @brief Defines the display color space structure. 253 * 254 * @since 14 255 * @version 1.0 256 */ 257 typedef struct { 258 /** color space length */ 259 uint32_t colorSpaceLength; 260 261 /** color space pointer */ 262 uint32_t *colorSpaces; 263 } NativeDisplayManager_DisplayColorSpace; 264 265 /** 266 * @brief Defines the display structure. 267 * 268 * @since 14 269 * @version 1.0 270 */ 271 typedef struct { 272 /** display id */ 273 uint32_t id; 274 275 /** display name */ 276 char name[OH_DISPLAY_NAME_LENGTH + 1]; 277 278 /** display is alive */ 279 bool isAlive; 280 281 /** display width */ 282 int32_t width; 283 284 /** display height */ 285 int32_t height; 286 287 /** display physical width */ 288 int32_t physicalWidth; 289 290 /** display physical height */ 291 int32_t physicalHeight; 292 293 /** display refresh rate */ 294 uint32_t refreshRate; 295 296 /** display available width */ 297 uint32_t availableWidth; 298 299 /** display available height */ 300 uint32_t availableHeight; 301 302 /** display density dpi */ 303 float densityDPI; 304 305 /** display density pixels */ 306 float densityPixels; 307 308 /** display scale density */ 309 float scaledDensity; 310 311 /** display xdpi*/ 312 float xDPI; 313 314 /** display ydpi */ 315 float yDPI; 316 317 /** display rotation */ 318 NativeDisplayManager_Rotation rotation; 319 320 /** display state */ 321 NativeDisplayManager_DisplayState state; 322 323 /** display orientation */ 324 NativeDisplayManager_Orientation orientation; 325 326 /** display hdr format */ 327 NativeDisplayManager_DisplayHdrFormat *hdrFormat; 328 329 /** display color space */ 330 NativeDisplayManager_DisplayColorSpace *colorSpace; 331 } NativeDisplayManager_DisplayInfo; 332 333 /** 334 * @brief Defines the displays structure. 335 * 336 * @since 14 337 * @version 1.0 338 */ 339 typedef struct { 340 /** displays length */ 341 uint32_t displaysLength; 342 343 /** displays pointer */ 344 NativeDisplayManager_DisplayInfo *displaysInfo; 345 } NativeDisplayManager_DisplaysInfo; 346 347 #ifdef __cplusplus 348 } 349 #endif 350 /** @} */ 351 #endif // OH_NATIVE_DISPLAY_INFO_H