Class Led
Definition
- Assembly:
- Tizen.System.dll
The LED class provides the properties and methods to control the attached LED device.
public static class Led
- Inheritance
-
objectLed
Remarks
The LED API provides the way to control the attached LED device, such as the camera flash and service LED. It supports to turn on the camera flash and set the pattern to the service LED which is located at the front of the device. Related features: http://tizen.org/feature/led http://tizen.org/feature/camera.back.flash It is recommended to design the feature related codes in your application for reliability. You can check if a device supports the related features for this API by using system information, thereby controlling the procedure of your application.
Examples
Console.WriteLine("Led MaxBrightness is: {0}", Tizen.System.Led.MaxBrightness);
Console.WriteLine("Led current Brightness is: {0}", Tizen.System.Led.Brightness);
Properties
View SourceBrightness
Gets the brightness value of the LED that is located next to the camera.
Declaration
public static int Brightness { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
The brightness value range of the LED is 0 to Tizen.System.Led.MaxBrightness value. Changing the brightness value will invoke the registered EventHandler for the LED BrightnessChanged (if any).
Examples
Console.WriteLine("Led current Brightness is: {0}", Tizen.System.Led.Brightness);
Tizen.System.Led.Brightness = 50;
Console.WriteLine("Led current Brightness is: {0}", Tizen.System.Led.Brightness);
Exceptions
Type | Condition |
---|---|
System.ArgumentException | When an invalid parameter value is set. |
System.UnauthorizedAccessException | If the privilege is not set. |
System.NotSupportedException | In case the device does not support this behavior. |
MaxBrightness
Gets the maximum brightness value of the LED that is located next to the camera.
Declaration
public static int MaxBrightness { get; }
Property Value
Type | Description |
---|---|
int |
Remarks
Retrieves the maximum brightness level of the back camera flash.
Examples
using Tizen.System;
...
Console.WriteLine("Led MaxBrightness is: {0}", Led.MaxBrightness);
Exceptions
Type | Condition |
---|---|
System.ArgumentException | When an invalid parameter value is set. |
System.UnauthorizedAccessException | If the privilege is not set. |
System.NotSupportedException | In case the device does not support this behavior. |
Methods
View SourcePlay(int, int, Color)
Plays the custom effect of the service LED that is located to the front of a device.
Declaration
public static void Play(int on, int off, Color color)
Parameters
Type | Name | Description |
---|---|---|
int | on | Turn on time in milliseconds. |
int | off | Turn off time in milliseconds. |
Color | color | The Color value The first byte means opaque and the other 3 bytes are the RGB values. |
Remarks
The LED API provides the way to control the attached LED device, such as the camera flash and service LED. It supports to turn on the camera flash and set the pattern to the service LED which is located at the front of the device. Related features: http://tizen.org/feature/led http://tizen.org/feature/camera.back.flash It is recommended to design the feature related codes in your application for reliability. You can check if a device supports the related features for this API by using system information, thereby controlling the procedure of your application.
Examples
try
{
Led.Play(500, 200, Color.FromRgba(255, 255, 255, 1));
}
Catch(Exception e)
{
}
Exceptions
Type | Condition |
---|---|
System.ArgumentException | When an invalid parameter value is set. |
System.UnauthorizedAccessException | If the privilege is not set. |
System.InvalidOperationException | In case of any system error. |
System.NotSupportedException | In case the device does not support this behavior. |
See Also
View SourceStop()
Stops the custom effect of the service LED that is located to the front of a device.
Declaration
public static void Stop()
Remarks
The custom effect was started by Led.Play(int,int,Color).
Examples
try
{
Led.Play(500, 200, Color.FromRgba(255, 255, 255, 1));
//wait for a while and stop...
Led.Stop();
}
Catch(Exception e)
{
}
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | If the privilege is not set. |
System.InvalidOperationException | In case of any system error. |
System.NotSupportedException | In case the device does not support this behavior. |
See Also
Events
View SourceBrightnessChanged
StateChanged is raised when the LED state is changed.
Declaration
public static event EventHandler<LedBrightnessChangedEventArgs> BrightnessChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><LedBrightnessChangedEventArgs> |
Remarks
The LED API provides the way to control the attached LED device, such as the camera flash and service LED. It supports to turn on the camera flash and set the pattern to the service LED which is located at the front of the device. Related features: http://tizen.org/feature/led http://tizen.org/feature/camera.back.flash It is recommended to design the feature related codes in your application for reliability. You can check if a device supports the related features for this API by using system information, thereby controlling the procedure of your application.
Examples
public static async Task LedEventHandler()
{
EventHandler<LedBrightnessChangedEventArgs> handler = null;
handler = (object sender, LedBrightnessChangedEventArgs args) =>
{
Console.WriteLine("battery Level is: {0}", args.Brightness);
}
Led.BrightnessChanged += handler;
await Task.Delay(20000);
}