From 4d41fc129b3478fc8915634f4b77f24cdd799912 Mon Sep 17 00:00:00 2001 From: zhouyanxu Date: Tue, 6 Sep 2022 16:02:17 +0800 Subject: [PATCH] add light HDI interface Signed-off-by: zhouyanxu --- light/v1_0/ILightInterface.idl | 14 ++++++++ light/v1_0/LightTypes.idl | 65 ++++++++++++++++++++++++++++++---- 2 files changed, 73 insertions(+), 6 deletions(-) diff --git a/light/v1_0/ILightInterface.idl b/light/v1_0/ILightInterface.idl index 23b6602c..5ca523fe 100644 --- a/light/v1_0/ILightInterface.idl +++ b/light/v1_0/ILightInterface.idl @@ -73,6 +73,20 @@ interface ILightInterface { */ TurnOnLight([in] int lightId, [in] struct HdfLightEffect effect); + /** + * @brief Turn on multiple sub-lights contained in the corresponding light according to the specified light ID. + * + * @param lightId Indicates the light id. For details, see {@link HdfLightId}. + * + * @param colors Color and brightness corresponding to multiple lights, see {@link LightColor}. + * + * @return Returns 0 if the operation is successful. + * @return Returns negative value if the get failed. + * + * @since 3.1 + */ + TurnOnMultiLights([in] int lightId, [in] struct HdfLightColor[] colors); + /** * @brief Turns off available lights in the list based on the specified light id. * diff --git a/light/v1_0/LightTypes.idl b/light/v1_0/LightTypes.idl index e3aebc6f..ecb069bc 100644 --- a/light/v1_0/LightTypes.idl +++ b/light/v1_0/LightTypes.idl @@ -55,7 +55,9 @@ enum HdfLightId { * @since 3.1 */ struct HdfLightInfo { + String lightName; /** Logic light name. */ int lightId; /** Light id. For details, see {@link HdfLightId}. */ + int lightNumber; /** Number of physical lights in the logic controller. */ int reserved; /** Custom extended information. */ }; @@ -65,9 +67,10 @@ struct HdfLightInfo { * @since 3.1 */ enum HdfLightFlashMode { - HDF_LIGHT_FLASH_NONE = 0, - HDF_LIGHT_FLASH_TIMED = 1, - HDF_LIGHT_FLASH_BUTT = 2, + HDF_LIGHT_FLASH_NONE = 0, /** No flicker mode. */ + HDF_LIGHT_FLASH_BLINK = 1, /** Timed flashing mode. */ + HDF_LIGHT_FLASH_GRADIENT = 2, /** Gradient mode. */ + HDF_LIGHT_FLASH_BUTT = 3, /** Invalid mode. */ }; /** @@ -83,6 +86,58 @@ struct HdfLightFlashEffect { int offTime; /** Duration (in ms) for which the light is off in a blinking period. */ }; +/** + * @brief Defines the color and brightness of the light. + * + * The parameters include the These parameters include red, green, blue values and brightness values. + * + * @since 3.1 + */ +struct RGBColor { + int brightness; /** Brightness value 0-255. */ + int r; /** Red value range 0-255. */ + int g; /** Green value range 0-255. */ + int b; /** Blue value range 0-255. */ +}; + +/** + * @brief Defines the color of the light. + * + * The parameters include the These parameters include red, green, blue and white values. + * + * @since 3.1 + */ +struct WRGBColor { + int w; /** White value range 0-255. */ + int r; /** Red value range 0-255. */ + int g; /** Green value range 0-255. */ + int b; /** Blue value range 0-255. */ +}; + +/** + * @brief Defines two modes for setting the light. + * + * The parameters include RGB mode and WRGB mode. + * + * @since 3.1 + */ +union ColorValue +{ + struct WRGBColor wrgbColor; /** WRGB mode, see {@link WRGBColor}. */ + struct RGBColor rgbColor; /** RGB mode, see {@link RGBColor}. */ +}; + +/** + * @brief Defines the color and brightness corresponding to light. + * + * The parameters include the brightness and WRGB color. + * + * @since 3.1 + */ +struct HdfLightColor { + union ColorValue colorValue; /** The modes for setting the light, see {@link union ColorValue}. */ +}; + /** * @brief Defines the lighting effect parameters. * @@ -91,8 +146,6 @@ struct HdfLightFlashEffect { * @since 3.1 */ struct HdfLightEffect { - int lightBrightness; /** Brightness value. Bits 24–31 for extended bit, Bits 16–23 for red, - bits 8–15 for green, and bits 0–7 for blue. if the byte segment is not equal to 0, - indicates turn on light of the corresponding color. */ + struct HdfLightColor lightColor; /** Color and brightness corresponding to light, see {@link HdfLightColor}. */ struct HdfLightFlashEffect flashEffect; /** Blinking mode. For details, see {@link LightFlashEffect}. */ }; -- Gitee