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))
30 #include "devman_error.h"
31 /** START: This code related to the opensource api will be removed */
32 #include "devman_managed.h"
33 /** END: Will be remved */
41 * @ingroup DEVICE_MANAGER
42 * @brief This file contains the API for the status of devices
49 * @defgroup DEVICE_MANAGER Device Manager
50 * @ingroup SYSTEM_FRAMEWORK
51 * @brief Device Manager library
53 * Device manager provides APIs to control devices or to get the status of devices.
54 * <br> Use devman.pc and include devman.h and devman_haptic.h files
56 * @addtogroup DEVICE_MANAGER
64 typedef enum devtype_list {
65 DEVTYPE_POWERSUPPLY, /**< battery, PMIC, etc about power */
66 DEVTYPE_DISPLAY0, /**< main screen */
67 DEVTYPE_DISPLAY1, /**< sub screen */
68 DEVTYPE_HAPTIC, /**< motor */
69 DEVTYPE_LED, /**< LED */
70 DEVTYPE_JACK, /**< jack - Micro USB, 3.5 pi jack etc */
71 DEVTYPE_TOUCHSCREEN, /**< main touch screen */
72 DEVTYPE_TOUCHKEY, /**< touchkey */
75 DEVTYPE_MMC, /**< MMC card(Micro SD) */
76 DEVTYPE_EFFECT_HAPTIC, /**< extended touchsense */
84 * DEVTYPE_POWER property for generic APIs
88 POWER_PROP_WAKEUP_COUNT,
93 * DEVTYPE_POWERSUPPLY property for generic APIs
96 /**< Battery is full-charged.*/
97 POWER_SUPPLY_PROP_CHARGE_FULL,
98 /**< Battery is being charged now */
99 POWER_SUPPLY_PROP_CHARGE_NOW,
100 /**< Current remaining battery */
101 POWER_SUPPLY_PROP_CAPACITY,
102 /**< iBattery status about cahrge */
103 POWER_SUPPLY_PROP_BATTERY_HEALTH,
104 /**< Current remaining battery expressed 1/10000 */
105 POWER_SUPPLY_PROP_CAPACITY_RAW,
110 * DEVTYPE_DISPLAY0 and DEVTYPE_DISPLAY1 property for generic APIs
114 DISPLAY_PROP_BRIGHTNESS,
115 DISPLAY_PROP_MIN_BRIGHTNESS,
116 DISPLAY_PROP_MAX_BRIGHTNESS,
118 DISPLAY_PROP_DISPLAY_COUNT,
119 DISPLAY_PROP_ACL_CONTROL,
120 DISPLAY_PROP_IMAGE_ENHANCE_MODE,
121 DISPLAY_PROP_IMAGE_ENHANCE_SCENARIO,
122 DISPLAY_PROP_IMAGE_ENHANCE_TONE,
123 DISPLAY_PROP_IMAGE_ENHANCE_OUTDOOR,
124 DISPLAY_PROP_IMAGE_ENHANCE_INFO,
129 * DEVTYPE_LED property for generic APIs
133 LED_PROP_MAX_BRIGHTNESS,
138 * DEVTYPE_JACK property for generic APIs
141 JACK_PROP_EARJACK_ONLINE,
143 JACK_PROP_MIC_ONLINE, /**< Microphone */
144 JACK_PROP_TVOUT_ONLINE, /**< analog tvout */
145 JACK_PROP_USB_ONLINE, /**< USB connection */
146 JACK_PROP_TA_ONLINE, /**< Travel Adapter(Charger) */
147 JACK_PROP_HDMI_ONLINE, /**< Digital tvout */
148 JACK_PROP_USB_PATH, /**< */
149 JACK_PROP_EARKEY_PRESS, /**< */
150 JACK_PROP_CRADLE_ONLINE,/**< Cradle connection */
155 * DEVTYPE_TOUCHKEY property for generic APIs
168 * DEVTYPE_UART property for generic APIs
171 UART_PROP_SELECT_PATH,
176 * DEVTYPE_MMC property for generic APIs
183 * @fn int device_get_property(devtype_t devtype, int property, int *value)
185 * This generic API is used to get the property values of supported devices.\n
186 * If the caller process does not have permission, it returns failure.
187 * @param[in] devtype device type that you want to get the value
188 * @param[in] property value property that you want to get the value
189 * @param[out] *value current value of device property
190 * @return 0 on success, -1 if failed
191 * @see device_set_property()
195 * if( device_get_property(DEVTYPE_POWERSUPPLY, POWER_SUPPLY_PROP_CAPACITY, &val) < 0 )
196 * printf("Fail to get property\n");
198 * printf("Property is %d\n", val);
202 int device_get_property(devtype_t devtype, int property, int *value);
205 * @fn int device_set_property(devtype_t devtype, int property, int value)
207 * This generic API is used to set the property values of supported devices.\n
208 * If the caller process does not have permission, it returns failure.
209 * @param[in] devtype device type that you want to set the value
210 * @param[in] property value property that you want to set the value
211 * @param[in] value value that you want to set
212 * @return 0 on success, -1 if failed
213 * @see device_get_property()
217 * if( device_set_property(DEVTYPE_DISPLAY0, DISPLAY_PROP_BRIGHTNESS, val) < 0 )
218 * printf("Fail to set property\n");
220 * printf("Property is set %d\n", val);
224 int device_set_property(devtype_t devtype, int property, int value);
226 /* Application level interfaces */
230 * This API is used to get the remaining battery percentage.\n
231 * It gets the Battery percentage by calling device_get_property() function.\n
232 * It returns integer value(0~100) that indicate remaining batterty percentage on success.\n
233 * Or a negative value(-1) is returned on failure.
234 * @return On success, integer value(0~100) is returned.
235 * Or a negative value(-1) is returned on failure.
236 * @see device_is_battery_full(), device_get_battery_pct_raw()
241 * battery = device_get_battery_pct();
243 * printf("Fail to get the remaining battery percentage.\n");
245 * printf("remaining battery percentage : %d\n", battery);
249 int device_get_battery_pct(void);
253 * This API is used to get the remaining battery percentage expressed 1/10000.\n
254 * It gets the Battery percentage by calling device_get_property() function.\n
255 * It returns integer value(0~10000) that indicate remaining batterty percentage on success.\n
256 * Or a negative value(-1) is returned on failure.
257 * @return On success, integer value(0~10000) is returned.
258 * Or a negative value(-1) is returned on failure.
259 * @see device_is_battery_full(), device_get_battery_pct()
264 * battery = device_get_battery_pct_raw();
266 * printf("Fail to get the remaining battery percentage.\n");
268 * printf("remaining battery percentage expressed 1/10000 : %d\n", battery);
272 int device_get_battery_pct_raw(void);
276 * This API is used to get the fully charged status of battery.\n
277 * It gets the fully charged status of Battery by calling device_get_property() function.\n
278 * If the status of battery is full, it returns 1.\n
279 * Or a negative value(-1) is returned, if the status of battery is not full.
280 * @return 1 with battery full, or 0 on not full-charged, -1 if failed
281 * @see device_get_battery_pct()
285 * if ( device_is_battery_full() > 0 )
286 * printf("battery fully chared\n");
290 int device_is_battery_full(void);
294 * Battery health status
297 BAT_UNKNOWN = 0, /**< */
299 BAT_OVERHEAT, /**< */
301 BAT_OVERVOLTAGE, /**< */
302 BAT_UNSPECIFIED, /**< */
304 BAT_HEALTH_MAX, /**< */
309 * This API is used to get the battery health status.\n
310 * It gets the battery health status by calling device_get_property() function.\n
311 * It returns integer value(0~6) that indicate battery health status on success.\n
312 * Or a negative value(-1) is returned, if the status of battery is not full.
313 * @return interger value, -1 if failed\n
314 * (0 BATTERY_UNKNOWN, 1 GOOD, 2 OVERHEAT, 3 DEAD, 4 OVERVOLTAGE, 5 UNSPECIFIED, 6 COLD)
319 * bat_health =device_get_battery_health();
320 * if(bat_health != BAT_GOOD)
321 * printf("battery health is not good\n");
325 int device_get_battery_health(void);
332 DEV_DISPLAY_0, /**< */
333 DEV_DISPLAY_1, /**< */
334 DEV_MAIN_DISPLAY = DEV_DISPLAY_0, /**< */
339 * This API is used to get the current brightness of the display.\n
340 * It gets the current brightness of the display by calling device_get_property() function.\n
341 * It returns integer value which is the current brightness on success.\n
342 * Or a negative value(-1) is returned on failure.
343 * @param[in] num display number that you want to get the brightness value
344 * @return current brightness value on success, -1 if failed
345 * @see device_set_diplay_brt()
350 * cur_brt = device_get_display_brt(0);
352 * printf("Fail to get the current brightness of the display.\n");
354 * printf("Current brightness of the display is %d\n", cur_brt);
358 int device_get_display_brt(display_num_t num);
362 * This API is used to set the current brightness of the display.\n
363 * It sets the current brightness of the display by calling device_set_property() function.\n
364 * MUST use this API very carefully. \n
365 * you MUST set original brightness by device_release_brt_ctrl(),
366 * after you finish your job using this API.
367 * @param[in] num display number that you want to set the brightness value
368 * @param[in] val brightness value that you want to set
369 * @return 0 on success, -1 if failed
370 * @see device_get_diplay_brt(), device_release_brt_ctrl()
374 * if( device_set_display_brt(0,6) < 0 )
375 * printf("Fail to set the current brightness of the display0\n");
377 * printf("The current brightness of the display0 is set 6\n");
381 int device_set_display_brt(display_num_t num, int val);
385 * This API is used to release brightness control.\n
386 * It sets the current brightness of the display by calling device_set_property() function.\n
387 * MUST call this API after you finished the job which need to change the brightness.
388 * @param[in] num display number
389 * @return 0 on success, -1 if failed
390 * @see device_set_display_brt()
394 * org_val = device_get_display_brt(0);
395 * device_set_display_brt(0,1);
397 * ret = device_release_brt_ctrl(0);
399 * printf("Fail to release brightness control\n");
403 int device_release_brt_ctrl(display_num_t num);
407 * This API is used to get the min brightness of the display.\n
408 * It gets the current brightness of the display by calling device_get_property() function.\n
409 * It returns integer value which is the min brightness on success.\n
410 * Or a negative value(-1) is returned on failure
411 * @param[in] num display number
412 * @return min brightness value on success, -1 if failed
417 * min_brt = device_get_min_brt(0);
419 * printf("Fail to get the min brightness of the display.\n");
421 * printf("Min brightness of the display is %d\n", min_brt);
425 int device_get_min_brt(display_num_t num);
429 * This API is used to get the max brightness of the display.\n
430 * It gets the current brightness of the display by calling device_get_property() function.\n
431 * It returns integer value which is the max brightness on success.\n
432 * Or a negative value(-1) is returned on failure
433 * @param[in] num display number
434 * @return max brightness value on success, -1 if failed
439 * max_brt = device_get_max_brt(0);
441 * printf("Fail to get the max brightness of the display.\n");
443 * printf("Max brightness of the display is %d\n", max_brt);
447 int device_get_max_brt(display_num_t num);
454 LCD_GAMMA_22 = 1, /**< 8500K , 2.2 GAMMA*/
455 LCD_GAMMA_19 = 2, /**< 8500K , 1.9 GAMMA*/
456 LCD_GAMMA_17 = 3, /**< 8500K , 1.7 GAMMA*/
457 LCD_GAMMA_NORMAL = LCD_GAMMA_22, /**< Normal screen */
458 LCD_GAMMA_PLAY_RECORD = LCD_GAMMA_19, /**< Playing or recording cam */
459 LCD_GAMMA_PREVIEW = LCD_GAMMA_17, /**< Preview */
460 LCD_GAMMA_MOVIE = LCD_GAMMA_19, /**< Movie */
461 LCD_GAMMA_CAMERA = 11, /**< Camera */
466 * This API is used to get the current gamma of the display.\n
467 * It gets the current gamma of the display by calling device_get_property() function.\n
468 * It returns enum value which is the current gamma on success.\n
469 * Or a negative value(-1) is returned on failure.
470 * @param[in] num display number that you want to get the gamma value
471 * @return current gamma enum value on success, -1 if failed
472 * @see device_set_diplay_gamma()
477 * cur_brt = device_get_display_gamma(0);
479 * printf("Fail to get the current gamma of the display.\n");
481 * printf("Current gamma of the display is %d\n", cer_brt);
485 int device_get_display_gamma(display_num_t num);
489 * This API is used to set the specific gamma value of the display .\n
490 * It sets the specific gamma value of the display by calling device_set_property() function.\n
491 * MUST use this API very carefully. \n
492 * you MUST set original gamma by device_release_gamma_ctrl(),
493 * after you finish your job using this API.
494 * @param[in] num display number that you want to set the gamma value
495 * @param[in] new_val lcd gamma enum value that you want to set
496 * @return 0 on success, -1 if failed
497 * @see device_get_diplay_gammat(), device_release_gamma_ctrl()
501 * if( device_set_display_gamma(0,1) < 0 )
502 * printf("Fail to set the specific gamma of the display0\n");
504 * printf("The gamma of the display0 is set 1(LCD_GAMMA_22)\n");
508 int device_set_display_gamma(display_num_t num,
509 display_gamma_t new_val);
513 * This API is used to release gamma control.\n
514 * It sets the gamma of the display by calling device_set_property() function.\n
515 * MUST call this API after you finished the job which need to change the gamma.
516 * @param[in] num display number
517 * @param[in] org_val original gamma enums value before you control the gamma
518 * @return 0 on success, -1 if failed
519 * @see device_set_display_gamma()
523 * org_val = device_get_display_gamma(0);
524 * device_set_display_gamma(0,2);
526 * ret = device_release_gamma_ctrl(0, org_val);
528 * printf("Fail to release gamma control\n");
532 int device_release_gamma_ctrl(display_num_t num,
533 display_gamma_t org_val);
537 * This API is used to get number of displays on the phone.\n
538 * It gets the current number of displays by calling device_get_display_count() function.\n
539 * It returns enum value which is the current number on success.\n
540 * Or a negative value(-1) is returned on failure.
541 * @return 0 on success, -1 if failed
545 * ret = device_get_display_count();
547 * printf("Fail to get number of displays\n");
551 int device_get_display_count(void);
555 * This API is used to make the phone go to a suspend (sleep) state. \n
556 * The suspend state consumes little battery power. \n
557 * If the caller process does not have permission, it returns failure.
558 * @return 0 on success, -1 if failed
562 * ret = device_power_suspend();
564 * printf("Fail to make the phone go to a suspend (sleep) state\n");
568 int device_power_suspend(void);
572 * This API is used to get the current brightness of the led.\n
573 * It gets the current brightness of the led by calling device_get_property() function.\n
574 * It returns integer value which is the current brightness on success.\n
575 * Or a negative value(-1) is returned on failure.
576 * @return current brightness value on success, -1 if failed
577 * @see device_set_led_brt()
582 * cur_brt = device_get_led_brt();
584 * printf("Fail to get the current brightness of the led.\n");
586 * printf("Current brightness of the led is %d\n", cur_brt);
590 int device_get_led_brt(void);
594 * This API is used to set the current brightness of the led.\n
595 * It sets the current brightness of the led by calling device_set_property() function.\n
596 * @param[in] val brightness value that you want to set
597 * @return 0 on success, -1 if failed
598 * @see device_get_led_brt()
602 * if( device_set_led_brt(1) < 0 )
603 * printf("Fail to set the brightness of the led\n");
606 int device_set_led_brt(int val);
610 * This API is used to get the max brightness of the led.\n
611 * It gets the current brightness of the led by calling device_get_property() function.\n
612 * It returns integer value which is the max brightness on success.\n
613 * Or a negative value(-1) is returned on failure
614 * @return max brightness value on success, -1 if failed
619 * max_brt = device_get_max_led(0);
621 * printf("Fail to get the max brightness of the led.\n");
625 int device_get_max_led(void);
629 * This API is used to get the current state for acl.\n
630 * It gets the current state for acl by calling device_get_property() function.\n
631 * @param[in] num display number that you want to set the gamma value
632 * @return current status for acl(1 on, 0 off) on success, -1 if failed
633 * @see device_set_acl_control_status()
638 * acl_stat = device_get_acl_control_status(0);
640 * printf("Fail to get the current status for acl.\n");
642 * printf("Current status for acl is %d\n", cur_brt);
646 int device_get_acl_control_status(display_num_t num);
650 * This API is used to set the current status for acl.\n
651 * It sets the current status for acl by calling device_set_property() function.\n
652 * @param[in] num display number that you want to set the brightness value
653 * @param[in] val status for acl(1 on, 0 off) that you want to set
654 * @return 0 on success, -1 if failed
655 * @see device_get_acl_control_status()
659 * if( device_set_acl_control_status(0, 1) < 0 )
660 * printf("Fail to set the current status for acl\n");
662 * printf("The current status for acl is set 6\n");
666 int device_set_acl_control_status(display_num_t num, int val);
669 * @} // end of internal APIs