/* * 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 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, if the lightbrightness field is 0, * light brightness according to the defaultBrightness configured by HCS. For details, see {@link LightEffect}. * * @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); /** * @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.2 */ TurnOnMultiLights([in] int lightId, [in] struct HdfLightColor[] colors); /** * @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); }