diff --git a/light/v1_0/ILightInterface.idl b/light/v1_0/ILightInterface.idl index fe124dd5ac04c90966bb36efdb6fe1d35344c639..cd6cd891b00fdc3932d80d9d7aaec0470755c4cd 100755 --- a/light/v1_0/ILightInterface.idl +++ b/light/v1_0/ILightInterface.idl @@ -13,11 +13,74 @@ * limitations under the License. */ +/** + * @addtogroup HdfLight + * @{ + * + * @brief Provides APIs for the light service. + * + * The light module provides a unified interface for the light service to access the light driver. + * After obtaining the driver object or proxy, the light service distinguishes light devices by id + * and call related APIs to obtain light information, turn on or off a light, or set the blinking mode. + * @since 3.1 + */ + +/** + * @file ILightInterface.idl + * + * @brief Declares common APIs of the light module. These APIs can be used to obtain the light id, + * turn on or off a light, and set the light brightness and blinking mode. + * @since 3.1 + */ + +/** + * @brief Defines the basic operations that can be performed on lights. + * + * The operations include obtaining light information, turning on or off a light, + * and setting the light brightness or blinking mode. + */ + package ohos.hdi.light.v1_0; import ohos.hdi.light.v1_0.LightTypes; interface ILightInterface { + /** + * @brief Obtains information about all the lights in the system. + * + * @param info Indicates the vector of the light information. For details, see {@link HdfLightInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.1 + */ GetLightInfo([out] struct HdfLightInfo[] info); + + /** + * @brief Turns on available lights in the list based on the specified light id. + * + * @param lightId Indicates the light id. For details, see {@link HdfLightId}. + * + * @param effect Indicates the pointer to the lighting effect. For details, see {@link HdfLightEffect}. + * + * @return Returns 0 if the operation is successful. + * @return Returns -1 if the light id is not supported. + * @return Returns -2 if the blinking setting is not supported. + * @return Returns -3 if the brightness setting is not supported. + * + * @since 3.1 + */ TurnOnLight([in] int lightId, [in] struct HdfLightEffect effect); - TurnOffLight([in] int LightId); + + /** + * @brief Turns off available lights in the list based on the specified light id. + * + * @param lightId Indicates the light id. For details, see {@link HdfLightId}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.1 + */ + TurnOffLight([in] int lightId); } \ No newline at end of file diff --git a/light/v1_0/LightTypes.idl b/light/v1_0/LightTypes.idl index 8ff6b5221f0778a9721fba9448a58fb89afa57cc..743705250bfef8e9febb107015ce76aed1c1c3d4 100755 --- a/light/v1_0/LightTypes.idl +++ b/light/v1_0/LightTypes.idl @@ -13,33 +13,85 @@ * limitations under the License. */ +/** + * @addtogroup HdfLight + * @{ + * + * @brief Provides APIs for the light service. + * + * The light module provides a unified interface for the light service to access the light driver. + * After obtaining the light driver object or proxy, the service can call related APIs to obtain light information, + * turn on or off a light, and set the light blinking mode based on the light id. + * @since 3.1 + */ + +/** + * @file LightTypes.idl + * + * @brief Defines the light data structure, including the light id, lighting mode, + * blinking mode and duration, return values, and lighting effect. + * @since 3.1 + */ + package ohos.hdi.light.v1_0; -enum HdfLighType { - HDF_LIGHT_TYPE_BATTERY = 1, - HDF_LIGHT_TYPE_NOTIFICATIONS = 2, - HDF_LIGHT_TYPE_ATTENTION = 3, +/** + * @brief Enumerates the light ids. + * + * @since 3.1 + */ +enum HdfLightId { + HDF_LIGHT_ID_BATTERY = 1, + HDF_LIGHT_ID_NOTIFICATIONS = 2, + HDF_LIGHT_ID_ATTENTION = 3, HDF_LIGHT_ID_BUTT = 4, }; +/** + * @brief Defines the basic light information. + * + * Basic light information includes the light id and custom extended information. + * + * @since 3.1 + */ struct HdfLightInfo { - int lightId; - int reserved; + int lightId; /** Light id. For details, see {@link HdfLightId}. */ + int reserved; /** Custom extended information. */ }; +/** + * @brief Enumerates the lighting modes. + * + * @since 3.1 + */ enum HdfLightFlashMode { HDF_LIGHT_FLASH_NONE = 0, HDF_LIGHT_FLASH_TIMED = 1, HDF_LIGHT_FLASH_BUTT = 2, }; +/** + * @brief Defines the blinking parameters. + * + * The parameters include the blinking mode and the on and off time for the light in a blinking period. + * + * @since 3.1 + */ struct HdfLightFlashEffect { - int flashMode; - int onTime; - int offTime; + int flashMode; /** Blinking mode. For details, see {@link HdfLightFlashMode}. */ + int onTime; /** Duration (in ms) for which the light is on in a blinking period. */ + int offTime; /** Duration (in ms) for which the light is off in a blinking period. */ }; +/** + * @brief Defines the lighting effect parameters. + * + * The parameters include the brightness and blinking mode. + * + * @since 3.1 + */ struct HdfLightEffect { - int lightBrightness; - struct HdfLightFlashEffect flashEffect; + int lightBrightness; /** Brightness value. The value 1 of the most significant bit indicates a color. + Bits 16¨C31 for red, bits 8¨C15 for green, and bits 0¨C7 for blue. */ + struct HdfLightFlashEffect flashEffect; /** Blinking mode. For details, see {@link LightFlashEffect}. */ }; \ No newline at end of file