public class LightEffect extends Object
The blinking effects of a light include its brightness, lighting-on time, and lighting-off time.
SystemCapability.Sensors#MISC_DEVICE| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static String |
LIGHT_ID_BELT |
Describes the belt light on the device.
|
static String |
LIGHT_ID_BUTTONS |
Describes the button light on the device.
|
static String |
LIGHT_ID_KEYBOARD |
Describes the keyboard light on the device.
|
static String |
LIGHT_ID_LED |
Describes the LED light on the device.
|
| 构造器 | 说明 |
|---|---|
LightEffect(LightBrightness lightBrightness,
int onDuration,
int offDuration) |
A constructor used to create a
LightEffect instance. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
LightBrightness |
getLightBrightness() |
Obtains the brightness value of a light.
|
int |
getOffDuration() |
Obtains the lighting-off time of a light during its one-shot blink.
|
int |
getOnDuration() |
Obtains the lighting-on time of a light during its one-shot blink.
|
void |
setLightBrightness(LightBrightness lightBrightness) |
Sets the brightness value of a light.
|
void |
setOffDuration(int offDuration) |
Sets the lighting-off time of a light during its one-shot blink.
|
void |
setOnDuration(int onDuration) |
Sets the lighting-on time of a light during its one-shot blink.
|
public static final String LIGHT_ID_BELT
public static final String LIGHT_ID_BUTTONS
public static final String LIGHT_ID_KEYBOARD
public LightEffect(LightBrightness lightBrightness, int onDuration, int offDuration)
LightEffect instance.
The instance can be used to pass a value to the LightEffect parameter in the
LightAgent.turnOn(int, LightEffect) method to customize the
blinking effect of the light.
lightBrightness - Indicates the customized brightness value of the light.
LightBrightness specifies the available brightness values of three color channels.onDuration - Indicates the lighting-on time of a light during its one-shot blink, in
milliseconds. The value range is 0-600000 ms, indicating that the lighting-on time of the
light during its one-shot blink cannot exceed 10 minutes. When the parameter value is
0, the light is steady off. This parameter is invalid when it is set to a too
large value or a negative value. Note that the actual lighting-on time is determined by
the light itself.offDuration - Indicates the lighting-off time of the light, in milliseconds. The
value range is 0-600000 ms, indicating that the lighting-off time of the light during its
one-shot blink cannot exceed 10 minutes. When the parameter value is 0, the light
is steady on. This parameter is invalid when it is set to a too large value or a negative
value.public LightBrightness getLightBrightness()
The brightness value varies depending on the light.
public void setLightBrightness(LightBrightness lightBrightness)
lightBrightness - Indicates the brightness of the light.LightBrightnesspublic int getOnDuration()
public void setOnDuration(int onDuration)
onDuration - onDuration Indicates the lighting-on time of the light, in milliseconds.
The value range is 0-600000 ms, indicating that the lighting-on time of the light during
its one-shot blink cannot exceed 10 minutes. Note that the actual lighting-on time is
determined by the light itself.public int getOffDuration()
public void setOffDuration(int offDuration)
offDuration - Indicates the lighting-off time of the light, in milliseconds. The
value range is 0-600000 ms, indicating that the lighting-off time of the light during its
one-shot blink cannot exceed 10 minutes.