1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @addtogroup HdfLight 18 * @{ 19 * 20 * @brief Provides APIs for the light service. 21 * 22 * The light module provides a unified interface for the light service to access the light driver. 23 * After obtaining the driver object or proxy, the light service distinguishes light devices by id 24 * and call related APIs to obtain light information, turn on or off a light, or set the blinking mode. 25 * @since 3.1 26 */ 27 28/** 29 * @file ILightInterface.idl 30 * 31 * @brief Declares common APIs of the light module. These APIs can be used to obtain the light id, 32 * turn on or off a light, and set the light brightness and blinking mode. 33 * @since 3.1 34 */ 35 36/** 37 * @brief Defines the basic operations that can be performed on lights. 38 * 39 * The operations include obtaining light information, turning on or off a light, 40 * and setting the light brightness or blinking mode. 41 */ 42 43package ohos.hdi.light.v1_0; 44import ohos.hdi.light.v1_0.LightTypes; 45 46interface ILightInterface { 47 /** 48 * @brief Obtains information about all the lights in the system. 49 * 50 * @param info Indicates the vector of the light information. For details, see {@link HdfLightInfo}. 51 * 52 * @return Returns <b>0</b> if the operation is successful. 53 * @return Returns a negative value if the operation fails. 54 * 55 * @since 3.1 56 */ 57 GetLightInfo([out] struct HdfLightInfo[] info); 58 59 /** 60 * @brief Turns on available lights in the list based on the specified light id. 61 * 62 * @param lightId Indicates the light id. For details, see {@link HdfLightId}. 63 * 64 * @param effect Indicates the pointer to the lighting effect, if the lightbrightness field is 0, 65 * light brightness according to the defaultBrightness configured by HCS. For details, see {@link LightEffect}. 66 * 67 * @return Returns <b>0</b> if the operation is successful. 68 * @return Returns <b>-1</b> if the light id is not supported. 69 * @return Returns <b>-2</b> if the blinking setting is not supported. 70 * @return Returns <b>-3</b> if the brightness setting is not supported. 71 * 72 * @since 3.1 73 */ 74 TurnOnLight([in] int lightId, [in] struct HdfLightEffect effect); 75 76 /** 77 * @brief Turn on multiple sub-lights contained in the corresponding light according to the specified light ID. 78 * 79 * @param lightId Indicates the light id. For details, see {@link HdfLightId}. 80 * 81 * @param colors Color and brightness corresponding to multiple lights, see {@link LightColor}. 82 * 83 * @return Returns <b>0</b> if the operation is successful. 84 * @return Returns negative value if the get failed. 85 * 86 * @since 3.2 87 */ 88 TurnOnMultiLights([in] int lightId, [in] struct HdfLightColor[] colors); 89 90 /** 91 * @brief Turns off available lights in the list based on the specified light id. 92 * 93 * @param lightId Indicates the light id. For details, see {@link HdfLightId}. 94 * 95 * @return Returns <b>0</b> if the operation is successful. 96 * @return Returns a negative value if the operation fails. 97 * 98 * @since 3.1 99 */ 100 TurnOffLight([in] int lightId); 101} 102