Class Led

Definition

Namespace:
Tizen.System
Assembly:
Tizen.System.dll
API Level:
3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/led

The LED class provides the properties and methods to control the attached LED device.

C#
Copy
public static class Led
Inheritance
System.Object
Led
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
Copy
Console.WriteLine("Led MaxBrightness is: {0}", Tizen.System.Led.MaxBrightness); Console.WriteLine("Led current Brightness is: {0}", Tizen.System.Led.Brightness);

Properties

View Source

Brightness

Gets the brightness value of the LED that is located next to the camera.

Declaration
C#
Copy
public static int Brightness { get; set; }
Property Value
Type Description
Int32
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
Copy
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.

UnauthorizedAccessException

If the privilege is not set.

System.NotSupportedException

In case the device does not support this behavior.

API Level: 3
View Source

MaxBrightness

Gets the maximum brightness value of the LED that is located next to the camera.

Declaration
C#
Copy
public static int MaxBrightness { get; }
Property Value
Type Description
Int32
Exceptions
Type Condition
System.ArgumentException

When an invalid parameter value is set.

UnauthorizedAccessException

If the privilege is not set.

System.NotSupportedException

In case the device does not support this behavior.

API Level: 3

Methods

View Source

Play(Int32, Int32, Color)

Plays the LED that is located at the front of the device.

Declaration
C#
Copy
public static void Play(int on, int off, Color color)
Parameters
Type Name Description
Int32 on

Turn on time in milliseconds.

Int32 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.

Examples
Copy
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.

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.

API Level: 3
View Source

Stop()

Stops the LED that is located at the front of the device.

Declaration
C#
Copy
public static void Stop()
Examples
Copy
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
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.

API Level: 3

Events

View Source

BrightnessChanged

StateChanged is raised when the LED state is changed.

Declaration
C#
Copy
public static event EventHandler<LedBrightnessChangedEventArgs> BrightnessChanged
Event Type
Type Description
System.EventHandler<LedBrightnessChangedEventArgs>
API Level: 3