Tizen Native API
Led

The Led API provides functions to control the attached led device.

Required Header

#include <device/led.h>

Overview

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 to the front of a device.

Related Features

This API is related with the following features:

It is recommended to design 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.

To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.

More details on featuring your application can be found from Feature Element.

Functions

int device_flash_get_max_brightness (int *max_brightness)
 Gets the max brightness value of a LED that is located next to the camera.
int device_flash_get_brightness (int *brightness)
 Gets the brightness value of a LED that is located next to the camera.
int device_flash_set_brightness (int brightness)
 Sets the brightness value of a LED that is located next to the camera.
int device_led_play_custom (int on, int off, unsigned int color, unsigned int flags)
 Plays the custom effect of the service LED that is located to the front of a device.
int device_led_stop_custom (void)
 Stops the custom effect of the service LED that is located to the front of a device.

Enumeration Type Documentation

Enumeration for custom LED flags.

Since :
2.3
Enumerator:
LED_CUSTOM_DUTY_ON 

blink LED

LED_CUSTOM_DEFAULT 

Default flag


Function Documentation

int device_flash_get_brightness ( int *  brightness)

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

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/led
Remarks:
This API is related to the following feature: http://tizen.org/feature/camera.back.flash
Parameters:
[out]brightnessThe brightness value of LED (0 ~ MAX)
Returns:
0 on success, otherwise a negative error value
Return values:
DEVICE_ERROR_NONESuccessful
DEVICE_ERROR_INVALID_PARAMETERInvalid parameter
DEVICE_ERROR_PERMISSION_DENIEDPermission denied
DEVICE_ERROR_OPERATION_FAILEDOperation failed
DEVICE_ERROR_NOT_SUPPORTEDNot supported device
int device_flash_get_max_brightness ( int *  max_brightness)

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

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/led
Remarks:
This API is related to the following feature: http://tizen.org/feature/camera.back.flash
Parameters:
[out]max_brightnessThe max brightness value of the LED
Returns:
0 on success, otherwise a negative error value
Return values:
DEVICE_ERROR_NONESuccessful
DEVICE_ERROR_INVALID_PARAMETERInvalid parameter
DEVICE_ERROR_PERMISSION_DENIEDPermission denied
DEVICE_ERROR_OPERATION_FAILEDOperation failed
DEVICE_ERROR_NOT_SUPPORTEDNot supported device
int device_flash_set_brightness ( int  brightness)

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

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/led
Remarks:
Since , this API check camera flash status whether camera API preempted flash or not, so it could be failed if flash was preempted by camera API. In this case, API will return DEVICE_ERROR_RESOURCE_BUSY error. This API is related to the following feature: http://tizen.org/feature/camera.back.flash
Parameters:
[in]brightnessThe brightness value of LED (0 ~ MAX)
Returns:
0 on success, otherwise a negative error value
Return values:
DEVICE_ERROR_NONESuccessful
DEVICE_ERROR_INVALID_PARAMETERInvalid parameter
DEVICE_ERROR_PERMISSION_DENIEDPermission denied
DEVICE_ERROR_OPERATION_FAILEDOperation failed
DEVICE_ERROR_NOT_SUPPORTEDNot supported device
DEVICE_ERROR_RESOURCE_BUSYDevice or resource busy
int device_led_play_custom ( int  on,
int  off,
unsigned int  color,
unsigned int  flags 
)

Plays the custom effect of the service LED that is located to the front of a device.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/led
Remarks:
This API is related to the following feature: http://tizen.org/feature/led
Parameters:
[in]onTurn on time in milliseconds
[in]offTurn off time in milliseconds
[in]colorThe Color value
The first byte means opaque and the other 3 bytes are RGB values
[in]flagsThe combination of enum led_custom_flags
Returns:
0 on success, otherwise a negative error value
Return values:
DEVICE_ERROR_NONESuccessful
DEVICE_ERROR_INVALID_PARAMETERInvalid parameter
DEVICE_ERROR_PERMISSION_DENIEDPermission denied
DEVICE_ERROR_OPERATION_FAILEDOperation failed
DEVICE_ERROR_NOT_SUPPORTEDNot supported device
int device_led_stop_custom ( void  )

Stops the custom effect of the service LED that is located to the front of a device.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/led
Remarks:
This API is related to the following feature: http://tizen.org/feature/led
Returns:
0 on success, otherwise a negative error value
Return values:
DEVICE_ERROR_NONESuccessful
DEVICE_ERROR_INVALID_PARAMETERInvalid parameter
DEVICE_ERROR_PERMISSION_DENIEDPermission denied
DEVICE_ERROR_OPERATION_FAILEDOperation failed
DEVICE_ERROR_NOT_SUPPORTEDNot supported device