Tizen Native API
3.0
|
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:
- http://tizen.org/feature/led
- http://tizen.org/feature/camera.back.flash
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
enum led_custom_flags |
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.1
- 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] brightness The brightness value of LED ( 0
~ MAX)
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DEVICE_ERROR_NONE Successful DEVICE_ERROR_INVALID_PARAMETER Invalid parameter DEVICE_ERROR_PERMISSION_DENIED Permission denied DEVICE_ERROR_OPERATION_FAILED Operation failed DEVICE_ERROR_NOT_SUPPORTED Not 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.1
- 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_brightness The max brightness value of the LED
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DEVICE_ERROR_NONE Successful DEVICE_ERROR_INVALID_PARAMETER Invalid parameter DEVICE_ERROR_PERMISSION_DENIED Permission denied DEVICE_ERROR_OPERATION_FAILED Operation failed DEVICE_ERROR_NOT_SUPPORTED Not 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.1
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/led
- Remarks:
- Since 3.0, 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] brightness The brightness value of LED ( 0
~ MAX)
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DEVICE_ERROR_NONE Successful DEVICE_ERROR_INVALID_PARAMETER Invalid parameter DEVICE_ERROR_PERMISSION_DENIED Permission denied DEVICE_ERROR_OPERATION_FAILED Operation failed DEVICE_ERROR_NOT_SUPPORTED Not supported device DEVICE_ERROR_RESOURCE_BUSY Device 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.1
- 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] on Turn on time in milliseconds [in] off Turn off time in milliseconds [in] color The Color value
The first byte means opaque and the other 3 bytes are RGB values[in] flags The combination of enum led_custom_flags
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DEVICE_ERROR_NONE Successful DEVICE_ERROR_INVALID_PARAMETER Invalid parameter DEVICE_ERROR_PERMISSION_DENIED Permission denied DEVICE_ERROR_OPERATION_FAILED Operation failed DEVICE_ERROR_NOT_SUPPORTED Not 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.1
- 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_NONE Successful DEVICE_ERROR_INVALID_PARAMETER Invalid parameter DEVICE_ERROR_PERMISSION_DENIED Permission denied DEVICE_ERROR_OPERATION_FAILED Operation failed DEVICE_ERROR_NOT_SUPPORTED Not supported device