device: Merge public api on Tizen 2.3 into tizen branch
[platform/core/api/device.git] / include / led.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 #ifndef __TIZEN_SYSTEM_LED_H__
19 #define __TIZEN_SYSTEM_LED_H__
20
21 #include "device-error.h"
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27
28 /**
29  * @addtogroup CAPI_SYSTEM_DEVICE_LED_MODULE
30  * @{
31  */
32
33 /**
34  * @brief Gets the max brightness value of a LED that is located next to the camera.
35  *
36  * @since_tizen 2.3
37  * @privlevel public
38  * @privilege %http://tizen.org/privilege/led
39  *
40  * @param[out] max_brightness The max brightness value of the LED
41  *
42  * @return @c 0 on success,
43  *         otherwise a negative error value
44  *
45  * @retval #DEVICE_ERROR_NONE               Successful
46  * @retval #DEVICE_ERROR_INVALID_PARAMETER  Invalid parameter
47  * @retval #DEVICE_ERROR_PERMISSION_DENIED  Permission denied
48  * @retval #DEVICE_ERROR_OPERATION_FAILED   Operation failed
49  * @retval #DEVICE_ERROR_NOT_SUPPORTED      Not supported device
50  */
51 int device_flash_get_max_brightness(int *max_brightness);
52
53 /**
54  * @brief Gets the brightness value of a LED that is located next to the camera.
55  *
56  * @since_tizen 2.3
57  * @privlevel public
58  * @privilege %http://tizen.org/privilege/led
59  *
60  * @param[out] brightness The brightness value of LED (@c 0 ~ MAX)
61  *
62  * @return @c 0 on success,
63  *         otherwise a negative error value
64  *
65  * @retval #DEVICE_ERROR_NONE               Successful
66  * @retval #DEVICE_ERROR_INVALID_PARAMETER  Invalid parameter
67  * @retval #DEVICE_ERROR_PERMISSION_DENIED  Permission denied
68  * @retval #DEVICE_ERROR_OPERATION_FAILED   Operation failed
69  * @retval #DEVICE_ERROR_NOT_SUPPORTED      Not supported device
70  */
71 int device_flash_get_brightness(int *brightness);
72
73 /**
74  * @brief Sets the brightness value of a LED that is located next to the camera.
75  *
76  * @since_tizen 2.3
77  * @privlevel public
78  * @privilege %http://tizen.org/privilege/led
79  *
80  * @param[in] brightness The brightness value of LED (@c 0 ~ MAX)
81  *
82  * @return @c 0 on success,
83  *         otherwise a negative error value
84  *
85  * @retval #DEVICE_ERROR_NONE               Successful
86  * @retval #DEVICE_ERROR_INVALID_PARAMETER  Invalid parameter
87  * @retval #DEVICE_ERROR_PERMISSION_DENIED  Permission denied
88  * @retval #DEVICE_ERROR_OPERATION_FAILED   Operation failed
89  * @retval #DEVICE_ERROR_NOT_SUPPORTED      Not supported device
90  */
91 int device_flash_set_brightness(int brightness);
92
93 /**
94  * @brief Enumeration for custom LED flags.
95  * @since_tizen 2.3
96  */
97 typedef enum {
98     LED_CUSTOM_DUTY_ON = 1 << 0,                /**< blink LED */
99     LED_CUSTOM_DEFAULT = (LED_CUSTOM_DUTY_ON),  /**< Default flag */
100 } led_custom_flags;
101
102 /**
103  * @brief Plays the custom effect of the service LED that is located to the front of a device.
104  *
105  * @since_tizen 2.3
106  * @privlevel public
107  * @privilege %http://tizen.org/privilege/led
108  *
109  * @param[in] on    Turn on time in milliseconds
110  * @param[in] off   Turn off time in milliseconds
111  * @param[in] color The Color value \n
112  *                  The first byte means opaque and the other 3 bytes are RGB values.
113  * @param[in] flags The combination of enum #led_custom_flags
114  *
115  * @return @c 0 on success,
116  *         otherwise a negative error value
117  *
118  * @retval #DEVICE_ERROR_NONE               Successful
119  * @retval #DEVICE_ERROR_INVALID_PARAMETER  Invalid parameter
120  * @retval #DEVICE_ERROR_PERMISSION_DENIED  Permission denied
121  * @retval #DEVICE_ERROR_OPERATION_FAILED   Operation failed
122  * @retval #DEVICE_ERROR_NOT_SUPPORTED      Not supported device
123  */
124 int device_led_play_custom(int on, int off, unsigned int color, unsigned int flags);
125
126 /**
127  * @brief Stops the custom effect of the service LED that is located to the front of a device.
128  *
129  * @since_tizen 2.3
130  * @privlevel public
131  * @privilege %http://tizen.org/privilege/led
132  *
133  * @return @c 0 on success,
134  *         otherwise a negative error value
135  *
136  * @retval #DEVICE_ERROR_NONE               Successful
137  * @retval #DEVICE_ERROR_INVALID_PARAMETER  Invalid parameter
138  * @retval #DEVICE_ERROR_PERMISSION_DENIED  Permission denied
139  * @retval #DEVICE_ERROR_OPERATION_FAILED   Operation failed
140  * @retval #DEVICE_ERROR_NOT_SUPPORTED      Not supported device
141  */
142 int device_led_stop_custom(void);
143
144 /**
145  * @}
146  */
147
148 #ifdef __cplusplus
149 }
150 #endif
151
152 #endif  // __TIZEN_SYSTEM_LED_H__