The Callback API provides functions to observe the changing of device state.
Required Header
#include <device/callback.h>
Overview
The Callback API provides the way to observe the changing of device state.
This API allows observing of the following events:
- Battery capacity
- Battery level
- Battery charging
- Display state
- Flash led state
Typedef Documentation
Called when a device status is changed.
Each device callback has a different output param type.
So you need to check below output param before using this function.
callback enum output type
DEVICE_CALLBACK_BATTERY_CAPACITY int
DEVICE_CALLBACK_BATTERY_LEVEL int
DEVICE_CALLBACK_BATTERY_CHARGING bool
DEVICE_CALLBACK_DISPLAY_STATE int
DEVICE_CALLBACK_FLASH_BRIGHTNESS int
- Since :
- 2.3
- Parameters:
-
[out] | type | The device type to monitor |
[out] | value | The changed value |
[out] | user_data | The user data passed from the callback registration function |
Enumeration Type Documentation
Enumeration for the device state callback.
- Since :
- 2.3
- Enumerator:
DEVICE_CALLBACK_BATTERY_CAPACITY |
Called when a battery charge percentage is changed
|
DEVICE_CALLBACK_BATTERY_LEVEL |
Called when a battery level is changed
|
DEVICE_CALLBACK_BATTERY_CHARGING |
Called when battery charging state is changed
|
DEVICE_CALLBACK_DISPLAY_STATE |
Called when a display state is changed
|
DEVICE_CALLBACK_FLASH_BRIGHTNESS |
Called when a flash brightness is changed (Since Tizen )
|
Function Documentation
Adds a callback to the observing device state.
- Since :
- 2.3
- Parameters:
-
[in] | type | The device type to monitor |
[in] | callback | The callback function to add |
[in] | user_data | The user data to be passed to the callback function |
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
Removes a device callback function.
- Since :
- 2.3
- Parameters:
-
[in] | type | The device type to monitor |
[in] | callback | The callback function to remove |
- Returns:
0
on success, otherwise a negative error value
- Return values:
-