From a15146ffa07c2476ca7ceac3f6c7b09b04a64401 Mon Sep 17 00:00:00 2001 From: longer_jokies Date: Mon, 23 Jun 2025 16:30:06 +0800 Subject: [PATCH] =?UTF-8?q?ResourceManager=5FConfiguration=E7=94=A8?= =?UTF-8?q?=E4=BA=8E=E8=BF=94=E5=9B=9E=E5=BD=93=E5=89=8D=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=EF=BC=8C=E7=8E=B0=E6=9C=89=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E4=BD=93=E4=B8=AD=E7=9A=84ScreenDensity=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=80=BC=E5=8F=96=E5=80=BC=E8=8C=83=E5=9B=B4=E5=92=8C=E5=AE=9E?= =?UTF-8?q?=E9=99=85=E8=BF=94=E5=9B=9E=E5=80=BC=E8=8C=83=E5=9B=B4=E4=B8=8D?= =?UTF-8?q?=E7=AC=A6=EF=BC=9B=E5=A2=9E=E5=8A=A0=E6=9B=BF=E4=BB=A3=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1ScreenDensityDpi=EF=BC=8C=E7=94=A8=E4=BA=8E=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E6=AD=A3=E7=A1=AE=E7=9A=84=E5=80=BC=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: longer_jokies --- .../include/resourcemanager/resmgr_common.h | 353 +++++++++--------- 1 file changed, 182 insertions(+), 171 deletions(-) diff --git a/global/resource_management/include/resourcemanager/resmgr_common.h b/global/resource_management/include/resourcemanager/resmgr_common.h index 13b49689c..68fe60702 100644 --- a/global/resource_management/include/resourcemanager/resmgr_common.h +++ b/global/resource_management/include/resourcemanager/resmgr_common.h @@ -1,171 +1,182 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup resourcemanager - * @{ - * - * @brief Provides the c interface to obtain resources, and relies on librawfile.z.so when used. - * - * @since 12 - */ - -/** - * @file resmgr_common.h - * - * @brief Provides the structure required by the interface. - * @syscap SystemCapability.Global.ResourceManager - * @library libohresmgr.so - * @kit LocalizationKit - * @since 12 - */ -#ifndef GLOBAL_RESMGR_COMMON_H -#define GLOBAL_RESMGR_COMMON_H - -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief The error code of resource manager. - * - * @since 12 - */ -typedef enum ResourceManager_ErrorCode { - /** @error Success */ - SUCCESS = 0, - /** @error Invalid input parameter */ - ERROR_CODE_INVALID_INPUT_PARAMETER = 401, - /** @error Invalid resource ID */ - ERROR_CODE_RES_ID_NOT_FOUND = 9001001, - /** @error Invalid resource name */ - ERROR_CODE_RES_NOT_FOUND_BY_ID = 9001002, - /** @error No matching resource is found based on the resource ID */ - ERROR_CODE_RES_NAME_NOT_FOUND = 9001003, - /** @error No matching resource is found based on the resource name */ - ERROR_CODE_RES_NOT_FOUND_BY_NAME = 9001004, - /** @error Invalid relative path */ - ERROR_CODE_RES_PATH_INVALID = 9001005, - /** @error The resource is referenced cyclically */ - ERROR_CODE_RES_REF_TOO_MUCH = 9001006, - /** @error Failed to format the resource obtained based on the resource ID */ - ERROR_CODE_RES_ID_FORMAT_ERROR = 9001007, - /** @error Failed to format the resource obtained based on the resource Name */ - ERROR_CODE_RES_NAME_FORMAT_ERROR = 9001008, - /** @error Failed to access the system resource */ - ERROR_CODE_SYSTEM_RES_MANAGER_GET_FAILED = 9001009, - /** @error Invalid overlay path */ - ERROR_CODE_OVERLAY_RES_PATH_INVALID = 9001010, - /** @error Out of memory */ - ERROR_CODE_OUT_OF_MEMORY = 9001100, -} ResourceManager_ErrorCode; - -/** - * @brief Enumerates screen directions. - * - * @since 12 - */ -typedef enum ResourceManager_Direction { - /** Indicates the vertical direction. */ - DIRECTION_VERTICAL = 0, - /** Indicates the horizontal direction. */ - DIRECTION_HORIZONTAL = 1, -} ResourceManager_Direction; - -/** - * @brief Enumerates color mode types. - * - * @since 12 - */ -typedef enum ResourceManager_ColorMode { - /** Indicates dark mode. */ - COLOR_MODE_DARK = 0, - /** Indicates light mode. */ - COLOR_MODE_LIGHT = 1, -} ResourceManager_ColorMode; - -/** - * @brief Enumerates device types. - * - * @since 12 - */ -typedef enum ResourceManager_DeviceType { - /** Indicates a phone. */ - DEVICE_TYPE_PHONE = 0X00, - /** Indicates a tablet. */ - DEVICE_TYPE_TABLET = 0x01, - /** Indicates a car. */ - DEVICE_TYPE_CAR = 0x02, - /** Indicates a PC. */ - DEVICE_TYPE_PC = 0x03, - /** Indicates a smart TV. */ - DEVICE_TYPE_TV = 0x04, - /** Indicates a wearable device. */ - DEVICE_TYPE_WEARABLE = 0x06, - /** Indicates a 2in1 device. */ - DEVICE_TYPE_2IN1 = 0x07, -} ResourceManager_DeviceType; - -/** - * @brief Enumerates screen density types. - * - * @since 12 - */ -typedef enum ScreenDensity { - /** Indicates small screen density. */ - SCREEN_SDPI = 120, - /** Indicates medium screen density. */ - SCREEN_MDPI = 160, - /** Indicates large screen density. */ - SCREEN_LDPI = 240, - /** Indicates extra-large screen density. */ - SCREEN_XLDPI = 320, - /** Indicates extra-extra-large screen density. */ - SCREEN_XXLDPI = 480, - /** Indicates extra-extra-extra-large screen density. */ - SCREEN_XXXLDPI = 640, -} ScreenDensity; - -/** - * @brief Enumerates device configuration. - * - * @since 12 - */ -typedef struct ResourceManager_Configuration { - /** Indicates the screen direction of the current device. */ - ResourceManager_Direction direction; - /** Indicates the current system language, for example, zh-Hans-CN. */ - char* locale; - /** Indicates the device type. */ - ResourceManager_DeviceType deviceType; - /** Indicates the screen density. */ - ScreenDensity screenDensity; - /** Indicates the color mode. */ - ResourceManager_ColorMode colorMode; - /** Indicates the mcc. */ - uint32_t mcc; - /** Indicates the mnc. */ - uint32_t mnc; - /** Reserved attributes. */ - uint32_t reserved[20]; -} ResourceManager_Configuration; -#ifdef __cplusplus -}; -#endif - -/** @} */ -#endif // GLOBAL_RESMGR_COMMON_H +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup resourcemanager + * @{ + * + * @brief Provides the c interface to obtain resources, and relies on librawfile.z.so when used. + * + * @since 12 + */ + +/** + * @file resmgr_common.h + * + * @brief Provides the structure required by the interface. + * @syscap SystemCapability.Global.ResourceManager + * @library libohresmgr.so + * @kit LocalizationKit + * @since 12 + */ +#ifndef GLOBAL_RESMGR_COMMON_H +#define GLOBAL_RESMGR_COMMON_H + +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief The error code of resource manager. + * + * @since 12 + */ +typedef enum ResourceManager_ErrorCode { + /** @error Success */ + SUCCESS = 0, + /** @error Invalid input parameter */ + ERROR_CODE_INVALID_INPUT_PARAMETER = 401, + /** @error Invalid resource ID */ + ERROR_CODE_RES_ID_NOT_FOUND = 9001001, + /** @error Invalid resource name */ + ERROR_CODE_RES_NOT_FOUND_BY_ID = 9001002, + /** @error No matching resource is found based on the resource ID */ + ERROR_CODE_RES_NAME_NOT_FOUND = 9001003, + /** @error No matching resource is found based on the resource name */ + ERROR_CODE_RES_NOT_FOUND_BY_NAME = 9001004, + /** @error Invalid relative path */ + ERROR_CODE_RES_PATH_INVALID = 9001005, + /** @error The resource is referenced cyclically */ + ERROR_CODE_RES_REF_TOO_MUCH = 9001006, + /** @error Failed to format the resource obtained based on the resource ID */ + ERROR_CODE_RES_ID_FORMAT_ERROR = 9001007, + /** @error Failed to format the resource obtained based on the resource Name */ + ERROR_CODE_RES_NAME_FORMAT_ERROR = 9001008, + /** @error Failed to access the system resource */ + ERROR_CODE_SYSTEM_RES_MANAGER_GET_FAILED = 9001009, + /** @error Invalid overlay path */ + ERROR_CODE_OVERLAY_RES_PATH_INVALID = 9001010, + /** @error Out of memory */ + ERROR_CODE_OUT_OF_MEMORY = 9001100, +} ResourceManager_ErrorCode; + +/** + * @brief Enumerates screen directions. + * + * @since 12 + */ +typedef enum ResourceManager_Direction { + /** Indicates the vertical direction. */ + DIRECTION_VERTICAL = 0, + /** Indicates the horizontal direction. */ + DIRECTION_HORIZONTAL = 1, +} ResourceManager_Direction; + +/** + * @brief Enumerates color mode types. + * + * @since 12 + */ +typedef enum ResourceManager_ColorMode { + /** Indicates dark mode. */ + COLOR_MODE_DARK = 0, + /** Indicates light mode. */ + COLOR_MODE_LIGHT = 1, +} ResourceManager_ColorMode; + +/** + * @brief Enumerates device types. + * + * @since 12 + */ +typedef enum ResourceManager_DeviceType { + /** Indicates a phone. */ + DEVICE_TYPE_PHONE = 0X00, + /** Indicates a tablet. */ + DEVICE_TYPE_TABLET = 0x01, + /** Indicates a car. */ + DEVICE_TYPE_CAR = 0x02, + /** Indicates a PC. */ + DEVICE_TYPE_PC = 0x03, + /** Indicates a smart TV. */ + DEVICE_TYPE_TV = 0x04, + /** Indicates a wearable device. */ + DEVICE_TYPE_WEARABLE = 0x06, + /** Indicates a 2in1 device. */ + DEVICE_TYPE_2IN1 = 0x07, +} ResourceManager_DeviceType; + +/** + * @brief Enumerates screen density types. + * + * @since 12 + */ +typedef enum ScreenDensity { + /** Indicates small screen density. */ + SCREEN_SDPI = 120, + /** Indicates medium screen density. */ + SCREEN_MDPI = 160, + /** Indicates large screen density. */ + SCREEN_LDPI = 240, + /** Indicates extra-large screen density. */ + SCREEN_XLDPI = 320, + /** Indicates extra-extra-large screen density. */ + SCREEN_XXLDPI = 480, + /** Indicates extra-extra-extra-large screen density. */ + SCREEN_XXXLDPI = 640, +} ScreenDensity; + +/** + * @brief Enumerates device configuration. + * + * @since 12 + */ +typedef struct ResourceManager_Configuration { + /** Indicates the screen direction of the current device. */ + ResourceManager_Direction direction; + /** Indicates the current system language, for example, zh-Hans-CN. */ + char* locale; + /** Indicates the device type. */ + ResourceManager_DeviceType deviceType; + /** + * Indicates the screen density. + * + * @deprecated since 20 + * @useinstead screenDensityDpi + */ + ScreenDensity screenDensity; + /** Indicates the color mode. */ + ResourceManager_ColorMode colorMode; + /** Indicates the mcc. */ + uint32_t mcc; + /** Indicates the mnc. */ + uint32_t mnc; + /** Reserved attributes. */ + uint32_t reserved[20]; + /** + * Indicates the screen density dpi. + * + * @since 20 + */ + ScreenDensity screenDensityDpi; +} ResourceManager_Configuration; +#ifdef __cplusplus +}; +#endif + +/** @} */ +#endif // GLOBAL_RESMGR_COMMON_H \ No newline at end of file -- Gitee