summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rwxr-xr-x[-rw-r--r--]include/device.h156
1 files changed, 151 insertions, 5 deletions
diff --git a/include/device.h b/include/device.h
index a05aef1..0fd8a1d 100644..100755
--- a/include/device.h
+++ b/include/device.h
@@ -41,9 +41,22 @@ typedef enum
DEVICE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
DEVICE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
DEVICE_ERROR_OPERATION_FAILED = TIZEN_ERROR_SYSTEM_CLASS | 0x12, /**< Operation failed */
+ DEVICE_ERROR_NOT_SUPPORTED = TIZEN_ERROR_SYSTEM_CLASS | 0x13, /**< Not supported in this device */
} device_error_e;
/**
+ * @brief Enumerations of the battery warning status
+ */
+typedef enum
+{
+ DEVICE_BATTERY_WARN_EMPTY, /**< The battery goes empty. Prepare for the safe termination of the application, because the device starts a shutdown process soon after entering this level. */
+ DEVICE_BATTERY_WARN_CRITICAL, /**< The battery charge is at a critical state. You may have to stop using multimedia features, because they are not guaranteed to work correctly at this battery status. */
+ DEVICE_BATTERY_WARN_LOW, /**< The battery has little charge left. */
+ DEVICE_BATTERY_WARN_NORMAL, /**< The battery status is not to be careful. */
+ DEVICE_BATTERY_WARN_FULL, /**< The battery status is full. */
+} device_battery_warn_e;
+
+/**
* @}
*/
@@ -55,13 +68,61 @@ typedef enum
/**
* @brief Called when an battery charge percentage changed
*
- * @param[out] percent The remaining battery charge percentage (0 ~ 100)
- * @param[in] user_data The user data passed from the callback registration function
+ * @param[in] percent The remaining battery charge percentage (0 ~ 100)
+ * @param[in] user_data The user data passed from the callback registration function
*
*/
typedef void (*device_battery_cb)(int percent, void *user_data);
/**
+ * @brief Called when the device warn about the battery status.
+ *
+ * @param[in] status The battery warning status
+ * @param[in] user_data The user data passed from the callback registration function
+ *
+ */
+typedef void (*device_battery_warn_cb)(device_battery_warn_e status, void *user_data);
+
+/**
+ * @brief Gets the battery warning status.
+ *
+ * @param[out] status The battery warning status.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #DEVICE_ERROR_NONE Successful
+ * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @see device_battery_status_e
+ * @see device_battery_status_set_cb()
+ */
+int device_battery_get_warning_status(device_battery_warn_e *status);
+
+/**
+ * @brief Set callback to be observing battery warning.
+ *
+ * @param[in] callback The callback function to set
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #DEVICE_ERROR_NONE Successful
+ * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @see device_battery_status_e
+ * @see device_battery_get_status()
+ */
+int device_battery_warning_set_cb(device_battery_warn_cb callback, void* user_data);
+
+/**
+ * @brief Unset battery warning callback function.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #DEVICE_ERROR_NONE Successful
+ * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ */
+int device_battery_warning_unset_cb(void);
+
+/**
* @brief Gets the battery charge percentage.
* @details It returns integer value from 0 to 100 that indicates remaining battery charge
* as a percentage of the maximum level.
@@ -75,12 +136,31 @@ typedef void (*device_battery_cb)(int percent, void *user_data);
* @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
*
* @see device_battery_is_full()
- * @see system_info_get_value_int(SYSTEM_INFO_KEY_BATTERY_PERCENTAGE, ...)
- * @see system_info_get_value_int(SYSTEM_INFO_KEY_BATTERY_CHARGE, ...)
+ * @see device_battery_get_detail()
+ * @see device_battery_set_cb()
*/
int device_battery_get_percent(int *percent);
/**
+ * @brief Gets the battery detail charge as a per ten thousand.
+ * @details It return integer value from 0 to 10000 that indicates remaining battery charge as a per ten thousand of the maximum level.
+ * @remarks this function return #DEVICE_ERROR_NOT_SUPPORTED when device can not be supported detail battery information.
+ *
+ * @param[out] detail The remaining battery charge as a per ten thousand. (0 ~ 10000)
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #DEVICE_ERROR_NONE Successful
+ * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #DEVICE_ERROR_NOT_SUPPORTED Not supported device
+ *
+ * @see device_battery_is_full()
+ * @see device_battery_get_percent()
+ * @see device_battery_set_cb()
+ */
+int device_battery_get_detail(int *detail);
+
+/**
* @brief Get charging state
*
* @param[out] charging The battery charging state.
@@ -162,6 +242,7 @@ int device_get_display_numbers(int* device_number);
* @see device_get_display_numbers()
* @see device_set_brightness()
* @see device_get_max_brightness()
+ * @see device_set_brightness_from_settings()
*/
int device_get_brightness(int display_index, int *brightness);
@@ -182,6 +263,7 @@ int device_get_brightness(int display_index, int *brightness);
* @see device_get_display_numbers()
* @see device_get_max_brightness()
* @see device_get_brightness()
+ * @see device_set_brightness_from_settings()
*/
int device_set_brightness(int display_index, int brightness);
@@ -201,10 +283,75 @@ int device_set_brightness(int display_index, int brightness);
* @see device_get_display_numbers()
* @see device_set_brightness()
* @see device_get_brightness()
+ * @see device_set_brightness_from_settings()
*/
int device_get_max_brightness(int display_index, int *max_brightness);
/**
+ * @brief Sets the display brightness value that registed in settings.
+ *
+ * @details
+ * This function set display brightness to condition in the settings.
+ * if auto brightness option is enabled in setting, display's brightness will be changed automatically.
+ *
+ * @param[in] display_index The index of the display, it be greater than or equal to 0 and less than \n
+ * the number of displays returned by device_get_display_numbers().\n
+ * The index zero is always assigned to the main display.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #DEVICE_ERROR_NONE Successful
+ * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @see device_get_display_numbers()
+ * @see device_get_max_brightness()
+ * @see device_set_brightness()
+ * @see device_get_brightness()
+ */
+int device_set_brightness_from_settings(int display_index);
+
+/**
+ * @brief Get brightness value of LED that placed to camera flash.
+ *
+ * @param[out] brightness brightness value of LED (0 ~ MAX)
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #DEVICE_ERROR_NONE Successful
+ * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ */
+int device_flash_get_brightness(int *brightness);
+
+/**
+ * @brief Set brightness value of LED that placed to camera flash.
+ *
+ * @param[in] brightness brightness value of LED (0 ~ MAX)
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #DEVICE_ERROR_NONE Successful
+ * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ */
+int device_flash_set_brightness(int brightness);
+
+/**
+ * @brief Get max brightness value of LED that placed to camera flash.
+ *
+ * @remark
+ * Brightness control does not support yet. so this functioon always return 1. \n
+ * Set function can only use to switch on/off the flash. \n
+ * Get function can only use to retrive on/off state of flash.
+ *
+ * @param[out] max_brightness max brightness value of LED
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #DEVICE_ERROR_NONE Successful
+ * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ */
+int device_flash_get_max_brightness(int *max_brightness);
+
+/**
* @}
*/
@@ -213,4 +360,3 @@ int device_get_max_brightness(int display_index, int *max_brightness);
#endif
#endif // __TIZEN_SYSTEM_DEVICE_H__
-