4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: DongGi Jang <dg0402.jang@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
27 #define DEPRECATED __attribute__((deprecated))
36 * @ingroup DEVICE_MANAGER
37 * @brief This file contains the API for the status of devices
44 * @defgroup DEVICE_MANAGER Device Manager
45 * @ingroup SYSTEM_FRAMEWORK
46 * @brief Device Manager library
48 * Device manager provides APIs to control devices or to get the status of devices.
49 * <br> Use devman.pc and include devman.h and devman_haptic.h files
51 * @addtogroup DEVICE_MANAGER
59 typedef enum devtype_list {
60 DEVTYPE_POWERSUPPLY, /**< battery, PMIC, etc about power */
61 DEVTYPE_DISPLAY0, /**< main screen */
62 DEVTYPE_DISPLAY1, /**< sub screen */
63 DEVTYPE_HAPTIC, /**< motor */
64 DEVTYPE_LED, /**< LED */
65 DEVTYPE_JACK, /**< jack - Micro USB, 3.5 pi jack etc */
66 DEVTYPE_TOUCHSCREEN, /**< main touch screen */
67 DEVTYPE_TOUCHKEY, /**< touchkey */
70 DEVTYPE_MMC, /**< MMC card(Micro SD) */
71 DEVTYPE_EFFECT_HAPTIC, /**< extended touchsense */
78 * DEVTYPE_POWERSUPPLY property for generic APIs
81 POWER_SUPPLY_PROP_CHARGE_FULL,
82 /**< Battery is full-charged.*/
83 POWER_SUPPLY_PROP_CHARGE_NOW,
84 /**< Battery is being charged now */
85 POWER_SUPPLY_PROP_CAPACITY, /**< Current remaining battery */
90 * DEVTYPE_DISPLAY0 and DEVTYPE_DISPLAY1 property for generic APIs
94 DISPLAY_PROP_BRIGHTNESS,
95 DISPLAY_PROP_MAX_BRIGHTNESS,
97 DISPLAY_PROP_DISPLAY_COUNT,
102 * DEVTYPE_LED property for generic APIs
106 LED_PROP_MAX_BRIGHTNESS,
111 * DEVTYPE_JACK property for generic APIs
114 JACK_PROP_EARJACK_ONLINE,
116 JACK_PROP_MIC_ONLINE, /**< Microphone */
117 JACK_PROP_TVOUT_ONLINE, /**< analog tvout */
118 JACK_PROP_USB_ONLINE, /**< USB connection */
119 JACK_PROP_TA_ONLINE, /**< Travel Adapter(Charger) */
120 JACK_PROP_HDMI_ONLINE, /**< Digital tvout */
121 JACK_PROP_USB_PATH, /**< */
122 JACK_PROP_EARKEY_PRESS, /**< */
123 JACK_PROP_CRADLE_ONLINE,/**< Cradle connection */
128 * DEVTYPE_TOUCHKEY property for generic APIs
141 * DEVTYPE_UART property for generic APIs
144 UART_PROP_SELECT_PATH,
149 * DEVTYPE_MMC property for generic APIs
156 * @fn int device_get_property(devtype_t devtype, int property, int *value)
158 * This generic API is used to get the property values of supported devices.\n
159 * If the caller process does not have permission, it returns failure.
160 * @param[in] devtype device type that you want to get the value
161 * @param[in] property value property that you want to get the value
162 * @param[out] *value current value of device property
163 * @return 0 on success, -1 if failed
164 * @see device_set_property()
168 * if( device_get_property(DEVTYPE_POWERSUPPLY, POWER_SUPPLY_PROP_CAPACITY, &val) < 0 )
169 * printf("Fail to get property\n");
171 * printf("Property is %d\n", val);
175 int device_get_property(devtype_t devtype, int property, int *value);
178 * @fn int device_set_property(devtype_t devtype, int property, int value)
180 * This generic API is used to set the property values of supported devices.\n
181 * If the caller process does not have permission, it returns failure.
182 * @param[in] devtype device type that you want to set the value
183 * @param[in] property value property that you want to set the value
184 * @param[in] value value that you want to set
185 * @return 0 on success, -1 if failed
186 * @see device_get_property()
190 * if( device_set_property(DEVTYPE_DISPLAY0, DISPLAY_PROP_BRIGHTNESS, val) < 0 )
191 * printf("Fail to set property\n");
193 * printf("Property is set %d\n", val);
197 int device_set_property(devtype_t devtype, int property, int value);
199 /* Application level interfaces */
203 * This API is used to get the remaining battery percentage.\n
204 * It gets the Battery percentage by calling device_get_property() function.\n
205 * It returns integer value(0~100) that indicate remaining batterty percentage on success.\n
206 * Or a negative value(-1) is returned on failure.
207 * @return On success, integer value(0~100) is returned.
208 * Or a negative value(-1) is returned on failure.
209 * @see device_is_battery_full()
214 * battery = device_get_battery_pct();
216 * printf("Fail to get the remaining battery percentage.\n");
218 * printf("remaining battery percentage : %d\n", battery);
222 int device_get_battery_pct(void);
226 * This API is used to get the fully charged status of battery.\n
227 * It gets the fully charged status of Battery by calling device_get_property() function.\n
228 * If the status of battery is full, it returns 1.\n
229 * Or a negative value(-1) is returned, if the status of battery is not full.
230 * @return 1 with battery full, or 0 on not full-charged, -1 if failed
231 * @see device_get_battery_pct()
235 * if ( device_is_battery_full() > 0 )
236 * printf("battery fully chared\n");
240 int device_is_battery_full(void);
247 DEV_DISPLAY_0, /**< */
248 DEV_DISPLAY_1, /**< */
249 DEV_MAIN_DISPLAY = DEV_DISPLAY_0, /**< */
254 * This API is used to get the current brightness of the display.\n
255 * It gets the current brightness of the display by calling device_get_property() function.\n
256 * It returns integer value which is the current brightness on success.\n
257 * Or a negative value(-1) is returned on failure.
258 * @param[in] num display number that you want to get the brightness value
259 * @return current brightness value on success, -1 if failed
260 * @see device_set_diplay_brt()
265 * cur_brt = device_get_display_brt(0);
267 * printf("Fail to get the current brightness of the display.\n");
269 * printf("Current brightness of the display is %d\n", cur_brt);
273 int device_get_display_brt(display_num_t num);
277 * This API is used to set the current brightness of the display.\n
278 * It sets the current brightness of the display by calling device_set_property() function.\n
279 * MUST use this API very carefully. \n
280 * you MUST set original brightness by device_release_brt_ctrl(),
281 * after you finish your job using this API.
282 * @param[in] num display number that you want to set the brightness value
283 * @param[in] val brightness value that you want to set
284 * @return 0 on success, -1 if failed
285 * @see device_get_diplay_brt(), device_release_brt_ctrl()
289 * if( device_set_display_brt(0,6) < 0 )
290 * printf("Fail to set the current brightness of the display0\n");
292 * printf("The current brightness of the display0 is set 6\n");
296 int device_set_display_brt(display_num_t num, int val);
300 * This API is used to release brightness control.\n
301 * It sets the current brightness of the display by calling device_set_property() function.\n
302 * MUST call this API after you finished the job which need to change the brightness.
303 * @param[in] num display number
304 * @return 0 on success, -1 if failed
305 * @see device_set_display_brt()
309 * org_val = device_get_display_brt(0);
310 * device_set_display_brt(0,1);
312 * ret = device_release_brt_ctrl(0);
314 * printf("Fail to release brightness control\n");
318 int device_release_brt_ctrl(display_num_t num);
322 * This API is used to get the max brightness of the display.\n
323 * It gets the current brightness of the display by calling device_get_property() function.\n
324 * It returns integer value which is the max brightness on success.\n
325 * Or a negative value(-1) is returned on failure
326 * @param[in] num display number
327 * @return max brightness value on success, -1 if failed
332 * max_brt = device_get_max_brt(0);
334 * printf("Fail to get the max brightness of the display.\n");
336 * printf("Max brightness of the display is %d\n", max_brt);
340 int device_get_max_brt(display_num_t num);
347 LCD_GAMMA_22 = 1, /**< 8500K , 2.2 GAMMA*/
348 LCD_GAMMA_19 = 2, /**< 8500K , 1.9 GAMMA*/
349 LCD_GAMMA_17 = 3, /**< 8500K , 1.7 GAMMA*/
350 LCD_GAMMA_NORMAL = LCD_GAMMA_22, /**< Normal screen */
351 LCD_GAMMA_PLAY_RECORD = LCD_GAMMA_19, /**< Playing or recording cam */
352 LCD_GAMMA_PREVIEW = LCD_GAMMA_17, /**< Preview */
353 LCD_GAMMA_MOVIE = LCD_GAMMA_19, /**< Movie */
354 LCD_GAMMA_CAMERA = 11, /**< Camera */
359 * This API is used to get the current gamma of the display.\n
360 * It gets the current gamma of the display by calling device_get_property() function.\n
361 * It returns enum value which is the current gamma on success.\n
362 * Or a negative value(-1) is returned on failure.
363 * @param[in] num display number that you want to get the gamma value
364 * @return current gamma enum value on success, -1 if failed
365 * @see device_set_diplay_gamma()
370 * cur_brt = device_get_display_gamma(0);
372 * printf("Fail to get the current gamma of the display.\n");
374 * printf("Current gamma of the display is %d\n", cer_brt);
378 int device_get_display_gamma(display_num_t num);
382 * This API is used to set the specific gamma value of the display .\n
383 * It sets the specific gamma value of the display by calling device_set_property() function.\n
384 * MUST use this API very carefully. \n
385 * you MUST set original gamma by device_release_gamma_ctrl(),
386 * after you finish your job using this API.
387 * @param[in] num display number that you want to set the gamma value
388 * @param[in] new_val lcd gamma enum value that you want to set
389 * @return 0 on success, -1 if failed
390 * @see device_get_diplay_gammat(), device_release_gamma_ctrl()
394 * if( device_set_display_gamma(0,1) < 0 )
395 * printf("Fail to set the specific gamma of the display0\n");
397 * printf("The gamma of the display0 is set 1(LCD_GAMMA_22)\n");
401 int device_set_display_gamma(display_num_t num,
402 display_gamma_t new_val);
406 * This API is used to release gamma control.\n
407 * It sets the gamma of the display by calling device_set_property() function.\n
408 * MUST call this API after you finished the job which need to change the gamma.
409 * @param[in] num display number
410 * @param[in] org_val original gamma enums value before you control the gamma
411 * @return 0 on success, -1 if failed
412 * @see device_set_display_gamma()
416 * org_val = device_get_display_gamma(0);
417 * device_set_display_gamma(0,2);
419 * ret = device_release_gamma_ctrl(0, org_val);
421 * printf("Fail to release gamma control\n");
425 int device_release_gamma_ctrl(display_num_t num,
426 display_gamma_t org_val);
430 * This API is used to get number of displays on the phone.\n
431 * It gets the current number of displays by calling device_get_display_count() function.\n
432 * It returns enum value which is the current number on success.\n
433 * Or a negative value(-1) is returned on failure.
434 * @return 0 on success, -1 if failed
438 * ret = device_get_display_count();
440 * printf("Fail to get number of displays\n");
444 int device_get_display_count(void);
448 * This API is used to make the phone go to a suspend (sleep) state. \n
449 * The suspend state consumes little battery power. \n
450 * If the caller process does not have permission, it returns failure.
451 * @return 0 on success, -1 if failed
455 * ret = device_power_suspend();
457 * printf("Fail to make the phone go to a suspend (sleep) state\n");
461 int device_power_suspend(void);
463 int device_get_led_brt(void);
464 int device_set_led_brt(int val);
465 int device_get_max_led(void);
468 * @} // end of internal APIs