Coding rule: fix coding rule violation
[platform/core/api/device.git] / include / device.h
1 /*
2  * Copyright (c) 2011 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
19
20 #ifndef __TIZEN_SYSTEM_DEVICE_H__
21 #define __TIZEN_SYSTEM_DEVICE_H__
22
23 #include <stdbool.h>
24 #include "device-error.h"
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30
31 /**
32  * @addtogroup CAPI_SYSTEM_DEVICE_MODULE
33  * @{
34  */
35
36 /**
37  * @brief Gets the number of display devices.
38  *
39  * @return The number of display devices that the device provides.
40  * @retval #DEVICE_ERROR_NONE                           Successful
41  * @retval #DEVICE_ERROR_INVALID_PARAMETER      Invalid parameter
42  *
43  * @see device_get_brightness()
44  * @see device_set_brightness()
45  * @see device_get_max_brightness()
46  * @see device_set_brightness_from_settings()
47  * @see device_set_brightness_to_settings()
48  */
49 int device_get_display_numbers(int* device_number);
50
51 /**
52  * @brief Gets the display brightness value.
53  *
54  * @param[in] display_index     The index of the display, it be greater than or equal to 0 and less than \n
55  *                          the number of displays returned by device_get_display_numbers().\n
56  *                          The index zero is always assigned to the main display.
57  * @param[out] brightness       The current brightness value of the display
58  *
59  * @return 0 on success, otherwise a negative error value.
60  * @retval #DEVICE_ERROR_NONE                           Successful
61  * @retval #DEVICE_ERROR_INVALID_PARAMETER      Invalid parameter
62  * @retval #DEVICE_ERROR_OPERATION_FAILED       Operation failed
63  *
64  * @see device_get_display_numbers()
65  * @see device_set_brightness()
66  * @see device_get_max_brightness()
67  * @see device_set_brightness_from_settings()
68  * @see device_set_brightness_to_settings()
69  */
70 int device_get_brightness(int display_index, int *brightness);
71
72 /**
73  * @brief Sets the display brightness value.
74  *
75  * @param[in] display_index     The index of the display, it be greater than or equal to 0 and less than \n
76  *                          the number of displays returned by device_get_display_numbers().\n
77  *                          The index zero is always assigned to the main display.
78  * @param[in] brightness        The new brightness value to set \n
79  *                                                      The maximum value can be represented by device_get_max_brightness()
80  *
81  * @return 0 on success, otherwise a negative error value.
82  * @retval #DEVICE_ERROR_NONE                           Successful
83  * @retval #DEVICE_ERROR_INVALID_PARAMETER  Invalid parameter
84  * @retval #DEVICE_ERROR_OPERATION_FAILED   Operation failed
85  *
86  * @see device_get_display_numbers()
87  * @see device_get_max_brightness()
88  * @see device_get_brightness()
89  * @see device_set_brightness_from_settings()
90  * @see device_set_brightness_to_settings()
91  */
92 int device_set_brightness(int display_index, int brightness);
93
94 /**
95  * @brief Gets the maximum brightness value that can be set.
96  *
97  * @param[in] display_index     The index of the display, it be greater than or equal to 0 and less than \n
98  *                          the number of displays returned by device_get_display_numbers().\n
99  *                          The index zero is always assigned to the main display.
100  * @param[out] max_brightness   The maximum brightness value of the display
101  *
102  * @return 0 on success, otherwise a negative error value.
103  * @retval #DEVICE_ERROR_NONE                           Successful
104  * @retval #DEVICE_ERROR_INVALID_PARAMETER      Invalid parameter
105  * @retval #DEVICE_ERROR_OPERATION_FAILED       Operation failed
106  *
107  * @see device_get_display_numbers()
108  * @see device_set_brightness()
109  * @see device_get_brightness()
110  * @see device_set_brightness_from_settings()
111  * @see device_set_brightness_to_settings()
112  */
113 int device_get_max_brightness(int display_index, int *max_brightness);
114
115 /**
116  * @brief Sets the display brightness value from registered in settings.
117  *
118  * @details
119  * This function set display brightness to condition in the settings.
120  * if auto brightness option is enabled in setting, display's brightness will be changed automatically.
121  *
122  * @param[in] display_index     The index of the display, it be greater than or equal to 0 and less than \n
123  *                          the number of displays returned by device_get_display_numbers().\n
124  *                          The index zero is always assigned to the main display.
125  *
126  * @return 0 on success, otherwise a negative error value.
127  * @retval #DEVICE_ERROR_NONE                           Successful
128  * @retval #DEVICE_ERROR_INVALID_PARAMETER      Invalid parameter
129  * @retval #DEVICE_ERROR_OPERATION_FAILED       Operation failed
130  *
131  * @see device_get_display_numbers()
132  * @see device_get_max_brightness()
133  * @see device_set_brightness()
134  * @see device_get_brightness()
135  * @see device_set_brightness_to_settings()
136  */
137 int device_set_brightness_from_settings(int display_index);
138
139 /**
140  * @brief Sets the display brightness value to specific display and set to variable in settings.
141  *
142  * @details
143  * This function set given brightness value to given index of display.
144  * And also brightness variable in settings will be changed to given brightness value too.
145  *
146  * @param[in] display_index     The index of the display, it be greater than or equal to 0 and less than \n
147  *                          the number of displays returned by device_get_display_numbers().\n
148  *                          The index zero is always assigned to the main display.
149  * @param[in] brightness        The new brightness value to set \n
150  *                                                      The maximum value can be represented by device_get_max_brightness()
151  *
152  * @return 0 on success, otherwise a negative error value.
153  * @retval #DEVICE_ERROR_NONE                           Successful
154  * @retval #DEVICE_ERROR_INVALID_PARAMETER      Invalid parameter
155  * @retval #DEVICE_ERROR_OPERATION_FAILED       Operation failed
156  *
157  * @see device_get_display_numbers()
158  * @see device_get_max_brightness()
159  * @see device_set_brightness()
160  * @see device_get_brightness()
161  * @see device_set_brightness_from_settings()
162  */
163 int device_set_brightness_to_settings(int display_index, int brightness);
164
165 /**
166  * @brief Get brightness value of LED that placed to camera flash.
167  *
168  * @remarks This API is related to the following feature: %http://tizen.org/feature/camera.back.flash
169  *
170  * @param[out] brightness brightness value of LED (0 ~ MAX)
171  *
172  * @return 0 on success, otherwise a negative error value.
173  * @retval #DEVICE_ERROR_NONE                           Successful
174  * @retval #DEVICE_ERROR_INVALID_PARAMETER      Invalid parameter
175  * @retval #DEVICE_ERROR_OPERATION_FAILED       Operation failed
176  * @retval #DEVICE_ERROR_NOT_SUPPORTED          Not supported device
177  */
178 int device_flash_get_brightness(int *brightness);
179
180 /**
181  * @brief Set brightness value of LED that placed to camera flash.
182  *
183  * @remarks This API is related to the following feature: %http://tizen.org/feature/camera.back.flash
184  *
185  * @param[in] brightness brightness value of LED (0 ~ MAX)
186  *
187  * @return 0 on success, otherwise a negative error value.
188  * @retval #DEVICE_ERROR_NONE                           Successful
189  * @retval #DEVICE_ERROR_INVALID_PARAMETER      Invalid parameter
190  * @retval #DEVICE_ERROR_OPERATION_FAILED       Operation failed
191  * @retval #DEVICE_ERROR_NOT_SUPPORTED          Not supported device
192  */
193 int device_flash_set_brightness(int brightness);
194
195 /**
196  * @brief Get max brightness value of LED that placed to camera flash.
197  *
198  * @remarks
199  * Brightness control does not support yet. so this function always return 1. \n
200  * Set function can only use to switch on/off the flash. \n
201  * Get function can only use to retrieve on/off state of flash.
202  * This API is related to the following feature: %http://tizen.org/feature/camera.back.flash
203  *
204  * @param[out] max_brightness max brightness value of LED
205  *
206  * @return 0 on success, otherwise a negative error value.
207  * @retval #DEVICE_ERROR_NONE                           Successful
208  * @retval #DEVICE_ERROR_INVALID_PARAMETER      Invalid parameter
209  * @retval #DEVICE_ERROR_OPERATION_FAILED       Operation failed
210  * @retval #DEVICE_ERROR_NOT_SUPPORTED          Not supported device
211  */
212 int device_flash_get_max_brightness(int *max_brightness);
213
214 /**
215  * @brief Get total amount of physical RAM, in kilobytes
216  *
217  * @remarks
218  *
219  * @param[out] total_mem total amount of physical RAM
220  *
221  * @return 0 on success, otherwise a negative error value.
222  * @retval #DEVICE_ERROR_NONE                           Successful
223  * @retval #DEVICE_ERROR_INVALID_PARAMETER      Invalid parameter
224  * @retval #DEVICE_ERROR_OPERATION_FAILED       Operation failed
225  */
226 int device_memory_get_total(unsigned int *total_mem);
227
228 /**
229  * @brief Get available amount of physical RAM, in kilobytes
230  *
231  * @remarks
232  * Available amount is defined by following formula currently.
233  * available mem = MemFree+Buffers+Cached+SwapCached-Shmem
234  *
235  * @param[out] avail_mem available amount of physical RAM
236  *
237  * @return 0 on success, otherwise a negative error value.
238  * @retval #DEVICE_ERROR_NONE                           Successful
239  * @retval #DEVICE_ERROR_INVALID_PARAMETER      Invalid parameter
240  * @retval #DEVICE_ERROR_OPERATION_FAILED       Operation failed
241  */
242 int device_memory_get_available(unsigned int *avail_mem);
243
244 /**
245  * @}
246  */
247
248 #ifdef __cplusplus
249 }
250 #endif
251
252 #endif  // __TIZEN_SYSTEM_DEVICE_H__