/* * Copyright (c) 2022 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 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; /** * @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 Enumerates the light types. * * @since 3.2 */ enum HdfLightType { HDF_LIGHT_TYPE_SINGLE_COLOR = 1, HDF_LIGHT_TYPE_RGB_COLOR = 2, HDF_LIGHT_TYPE_WRGB_COLOR = 3, }; /** * @brief Defines the basic light information. * * Basic light information includes the light id, light name, light number and light type. * * @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 lightType; /** Light type. For details, see {@link HdfLightType}. */ }; /** * @brief Enumerates the lighting modes. * * @since 3.1 */ enum HdfLightFlashMode { 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. */ }; /** * @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; /** 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 color and extended information of the light. * * The parameters include four parameters include red, green, blue values and extended information. * * @since 3.2 */ struct RGBColor { unsigned char r; /** Red value range 0-255. */ unsigned char g; /** Green value range 0-255. */ unsigned char b; /** Blue value range 0-255. */ unsigned char reserved; /** Custom extended information. */ }; /** * @brief Defines the color of the light. * * The parameters include the These parameters include red, green, blue and white values. * * @since 3.2 */ struct WRGBColor { unsigned char w; /** White value range 0-255. */ unsigned char r; /** Red value range 0-255. */ unsigned char g; /** Green value range 0-255. */ unsigned char b; /** Blue value range 0-255. */ }; /** * @brief Defines three modes for setting the light. * * The parameters include single color mode, RGB mode and WRGB mode. * * @since 3.2 */ union ColorValue { int singleColor; /** Single color mode. */ 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.2 */ struct HdfLightColor { union ColorValue colorValue; /** The modes for setting the light, see {@link union ColorValue}. */ }; /** * @brief Defines the lighting effect parameters. * * The parameters include the brightness and blinking mode. * * @since 3.1 */ struct HdfLightEffect { struct HdfLightColor lightColor; /** Color and brightness corresponding to light, see {@link HdfLightColor}. */ struct HdfLightFlashEffect flashEffect; /** Blinking mode. For details, see {@link LightFlashEffect}. */ };