Tizen Native API
6.0
|
The Sensor API provides functions to make use of sensors in the device.
Required Header
#include <sensor.h>
Overview
This Sensor API provides functions to make use of sensors in the device, define new sensor instances from applications, request to record sensor events, and acquire the recorded events. It also provides functions for getting information of a sensor, for example, the vendor and the resolution of its data.
Related Features
A variety of sensors are typically available on mobile and wearable devices. Regarding the types of sensors, this API is related with the following features:
- http://tizen.org/feature/sensor.accelerometer
- http://tizen.org/feature/sensor.barometer
- http://tizen.org/feature/sensor.gyroscope
- http://tizen.org/feature/sensor.magnetometer
- http://tizen.org/feature/sensor.photometer
- http://tizen.org/feature/sensor.proximity
- http://tizen.org/feature/sensor.tiltmeter
- http://tizen.org/feature/sensor.ultraviolet
- http://tizen.org/feature/sensor.temperature
- http://tizen.org/feature/sensor.humidity
- http://tizen.org/feature/sensor.linear_acceleration
- http://tizen.org/feature/sensor.rotation_vector
- http://tizen.org/feature/sensor.gravity
- http://tizen.org/feature/sensor.heart_rate_monitor
- http://tizen.org/feature/sensor.heart_rate_monitor.led_green
- http://tizen.org/feature/sensor.heart_rate_monitor.led_ir
- http://tizen.org/feature/sensor.heart_rate_monitor.led_red
- http://tizen.org/feature/sensor.heart_rate_monitor.batch
- http://tizen.org/feature/sensor.heart_rate_monitor.led_green.batch
- http://tizen.org/feature/sensor.gyroscope.uncalibrated
- http://tizen.org/feature/sensor.magnetometer.uncalibrated
- http://tizen.org/feature/sensor.gyroscope_rotation_vector
- http://tizen.org/feature/sensor.geomagnetic_rotation_vector
- http://tizen.org/feature/sensor.pedometer
- http://tizen.org/feature/sensor.sleep_monitor
- http://tizen.org/feature/sensor.stress_monitor
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.
Functions | |
int | sensor_is_supported (sensor_type_e type, bool *supported) |
Checks whether a given sensor type is supported in the current device. | |
int | sensor_is_supported_by_uri (const char *uri, bool *supported) |
Checks whether a sensor corresponding to a given URI is supported in the current device. | |
int | sensor_is_wake_up (sensor_h sensor, bool *wakeup) |
Checks whether a given sensor is a wake-up sensor or not. | |
int | sensor_get_default_sensor (sensor_type_e type, sensor_h *sensor) |
Gets the handle for the default sensor of a given type. | |
int | sensor_get_default_sensor_by_uri (const char *uri, sensor_h *sensor) |
Gets the handle for the default sensor of a given sensor URI. | |
int | sensor_get_sensor_list (sensor_type_e type, sensor_h **list, int *sensor_count) |
Gets the handle list of the sensors of a given type. | |
int | sensor_get_sensor_list_by_uri (const char *uri, sensor_h **list, int *sensor_count) |
Gets the handle list of the sensors of a given URI. | |
int | sensor_get_uri (sensor_h sensor, char **uri) |
Gets the URI of a sensor. | |
int | sensor_get_name (sensor_h sensor, char **name) |
Gets the name of a sensor. | |
int | sensor_get_vendor (sensor_h sensor, char **vendor) |
Gets the vendor of a sensor. | |
int | sensor_get_type (sensor_h sensor, sensor_type_e *type) |
Gets the type of a sensor, if it belongs to the known types defined in sensor_type_e. | |
int | sensor_get_min_range (sensor_h sensor, float *min_range) |
Gets the lower bound of the sensor reading of a sensor. | |
int | sensor_get_max_range (sensor_h sensor, float *max_range) |
Gets the upper bound of the sensor readings of a sensor. | |
int | sensor_get_resolution (sensor_h sensor, float *resolution) |
Gets the resolution of the sensor readings of a sensor. | |
int | sensor_get_min_interval (sensor_h sensor, int *min_interval) |
Gets the possible shorted update interval of a sensor. | |
int | sensor_get_fifo_count (sensor_h sensor, int *fifo_count) |
Gets the size of the hardware FIFO of a sensor. | |
int | sensor_get_max_batch_count (sensor_h sensor, int *max_batch_count) |
Gets the maximum batch count of a sensor. | |
int | sensor_add_sensor_added_cb (sensor_added_cb callback, void *user_data) |
Adds a callback function to be invoked when a new sensor is added. | |
int | sensor_remove_sensor_added_cb (sensor_added_cb callback) |
Removes a callback function added using sensor_add_sensor_added_cb(). | |
int | sensor_add_sensor_removed_cb (sensor_removed_cb callback, void *user_data) |
Adds a callback function to be invoked when a sensor is removed. | |
int | sensor_remove_sensor_removed_cb (sensor_removed_cb callback) |
Removes a callback function added using sensor_add_sensor_removed_cb(). | |
Typedefs | |
typedef void * | sensor_h |
Sensor handle. | |
typedef void(* | sensor_added_cb )(const char *uri, void *user_data) |
Called when a new sensor is added. | |
typedef void(* | sensor_removed_cb )(const char *uri, void *user_data) |
Called when a sensor is removed. |
Typedef Documentation
typedef void(* sensor_added_cb)(const char *uri, void *user_data) |
Called when a new sensor is added.
- Since :
- 4.0
- Remarks:
- uri should not be freed and can be used only in the callback. To use outside the callback, make a copy.
- Parameters:
-
[in] uri The URI of the newly added sensor [in] user_data The user data had passed to sensor_add_sensor_added_cb().
- Precondition:
- A callback function needs to be set using sensor_add_sensor_added_cb().
typedef void* sensor_h |
Sensor handle.
The handle for controlling a specific sensor can be retrieved using sensor_get_default_sensor().
The function returns the handle of the default sensor of a given type, and usually, a device has one sensor for one type. However, if the device supports multiple sensors of the same type, sensor_get_sensor_list() function can be used to get the list of all the sensors of the type.
- Since :
- 2.3.1
typedef void(* sensor_removed_cb)(const char *uri, void *user_data) |
Called when a sensor is removed.
- Since :
- 4.0
- Remarks:
- uri should not be freed and can be used only in the callback. To use outside the callback, make a copy.
- Parameters:
-
[in] uri The URI of the removed sensor [in] user_data The user data had passed to sensor_add_sensor_removed_cb()
- Precondition:
- A callback function needs to be set using sensor_add_sensor_removed_cb().
Enumeration Type Documentation
enum sensor_error_e |
Enumeration for errors.
- Since :
- 2.3.1
- Enumerator:
Enumeration for heart-rate monitor batch sensor state.
In its sensor_event_s, SENSOR_HRM_BATCH reports the user's heart-rate monitor state as one of the followings.
- Since :
- 5.5
- Enumerator:
Enumeration for pedestrian state.
In its sensor_event_s, SENSOR_HUMAN_PEDOMETER reports the user's pedestrian state as one of the followings.
- Since :
- 3.0
enum sensor_proximity_e |
Enumeration for proximity sensor events.
In its sensor_event_s, SENSOR_PROXIMITY reports the existence of nearby objects in front of the sensor as one of the followings.
- Since :
- 2.3.1
enum sensor_sleep_state_e |
Enumeration for sleep state.
In its sensor_event_s, SENSOR_HUMAN_SLEEP_MONITOR reports the user's sleep state as one of the followings.
- Since :
- 3.0
enum sensor_type_e |
Enumeration for sensor types.
- Since :
- 2.3.1
- Enumerator:
SENSOR_ALL All sensors. This can be used to retrieve sensor_h for all available sensors.
SENSOR_ACCELEROMETER Accelerometer
SENSOR_GRAVITY Gravity sensor
SENSOR_LINEAR_ACCELERATION Linear acceleration sensor
SENSOR_MAGNETIC Magnetic sensor
SENSOR_ROTATION_VECTOR Rotation vector sensor
SENSOR_ORIENTATION Orientation sensor
SENSOR_GYROSCOPE Gyroscope
SENSOR_LIGHT Light sensor
SENSOR_PROXIMITY Proximity sensor
SENSOR_PRESSURE Pressure sensor
SENSOR_ULTRAVIOLET Ultraviolet sensor
SENSOR_TEMPERATURE Temperature sensor
SENSOR_HUMIDITY Humidity sensor
SENSOR_HRM Heart-rate monitor
Privilege : http://tizen.org/privilege/healthinfoSENSOR_HRM_LED_GREEN Green LED sensor of HRM
Privilege : http://tizen.org/privilege/healthinfoSENSOR_HRM_LED_IR Infra-Red LED sensor of HRM
Privilege : http://tizen.org/privilege/healthinfoSENSOR_HRM_LED_RED Red LED sensor of HRM
Privilege : http://tizen.org/privilege/healthinfoSENSOR_GYROSCOPE_UNCALIBRATED Uncalibrated Gyroscope sensor (Since 2.3.2)
SENSOR_GEOMAGNETIC_UNCALIBRATED Uncalibrated Geomagnetic sensor (Since 2.3.2)
SENSOR_GYROSCOPE_ROTATION_VECTOR Gyroscope-based rotation vector sensor (Since 2.3.2)
SENSOR_GEOMAGNETIC_ROTATION_VECTOR Geomagnetic-based rotation vector sensor (Since 2.3.2)
SENSOR_SIGNIFICANT_MOTION Significant motion sensor (Since 4.0)
SENSOR_HRM_BATCH Heart-rate monitor batch sensor (Since 5.5)
Privilege : http://tizen.org/privilege/healthinfoSENSOR_HRM_LED_GREEN_BATCH Green LED of HRM batch sensor (Since 5.5)
Privilege : http://tizen.org/privilege/healthinfoSENSOR_HUMAN_PEDOMETER Pedometer (Since 3.0)
Privilege : http://tizen.org/privilege/healthinfoSENSOR_HUMAN_SLEEP_MONITOR Sleep monitor (Since 3.0)
Privilege : http://tizen.org/privilege/healthinfoSENSOR_HUMAN_SLEEP_DETECTOR Sleep detector (Since 3.0)
Privilege : http://tizen.org/privilege/healthinfoSENSOR_HUMAN_STRESS_MONITOR Stress monitor (Since 3.0)
Privilege : http://tizen.org/privilege/healthinfo- Deprecated:
- Deprecated since 5.5
SENSOR_LAST End of sensor enum values
- Deprecated:
- Deprecated since 3.0
SENSOR_CUSTOM Custom sensor
- Deprecated:
- Deprecated since 3.0
Function Documentation
int sensor_add_sensor_added_cb | ( | sensor_added_cb | callback, |
void * | user_data | ||
) |
Adds a callback function to be invoked when a new sensor is added.
- Since :
- 4.0
- Parameters:
-
[in] callback A callback function to be added [in] user_data A user data to be passed to the callback function
- Returns:
- SENSOR_ERROR_NONE on success, otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter SENSOR_ERROR_OPERATION_FAILED Operation failed
- See also:
- sensor_remove_sensor_added_cb()
int sensor_add_sensor_removed_cb | ( | sensor_removed_cb | callback, |
void * | user_data | ||
) |
Adds a callback function to be invoked when a sensor is removed.
- Since :
- 4.0
- Parameters:
-
[in] callback A callback function to be removed [in] user_data A user data to be passed to the callback function
- Returns:
- SENSOR_ERROR_NONE on success, otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter SENSOR_ERROR_OPERATION_FAILED Operation failed
- See also:
- sensor_remove_sensor_removed_cb()
int sensor_get_default_sensor | ( | sensor_type_e | type, |
sensor_h * | sensor | ||
) |
Gets the handle for the default sensor of a given type.
This function returns the handle for the sensor of a given type. If the device has more than one sensor of the given type, this function returns the default sensor of the given type, which is designated by the device.
- Since :
- 2.3.1
- Remarks:
- Some sensor types are privileged. An application should have the privilege http://tizen.org/privilege/healthinfo to get handles for the following sensors: SENSOR_HRM, SENSOR_HRM_LED_GREEN, SENSOR_HRM_LED_IR, SENSOR_HRM_LED_RED, SENSOR_HUMAN_PEDOMETER, SENSOR_HUMAN_SLEEP_MONITOR, SENSOR_HUMAN_SLEEP_DETECTOR, and SENSOR_HUMAN_STRESS_MONITOR.
- Parameters:
-
[in] type A sensor type to get the handle of its default sensor [out] sensor The sensor handle of the default sensor
- Returns:
- SENSOR_ERROR_NONE on success; Otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter SENSOR_ERROR_NOT_SUPPORTED The sensor type is not supported in the current device SENSOR_ERROR_PERMISSION_DENIED Permission denied
int sensor_get_default_sensor_by_uri | ( | const char * | uri, |
sensor_h * | sensor | ||
) |
Gets the handle for the default sensor of a given sensor URI.
This function returns the handle for the sensor of a given URI. If the device has more than one sensor of the given URI, this function returns the default sensor of the URI, which is designated by the device.
See Sensor URIs for more details about the URI format.
- Since :
- 4.0
- Remarks:
- Some sensor types are privileged. An application should have the privilege http://tizen.org/privilege/healthinfo to get handles for the sensor URIs of "healthinfo" category. See Sensor URIs to find the "healthinfo" category sensor URIs.
- Parameters:
-
[in] uri A sensor or a sensor type URI to get the handle of its default sensor [out] sensor The default sensor handle
- Returns:
- SENSOR_ERROR_NONE on success, otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter SENSOR_ERROR_NOT_SUPPORTED The URI is not supported in the current device SENSOR_ERROR_PERMISSION_DENIED Permission denied
int sensor_get_fifo_count | ( | sensor_h | sensor, |
int * | fifo_count | ||
) |
Gets the size of the hardware FIFO of a sensor.
This function returns the size of the hardware FIFO that may be used by a specific sensor to support batching. However, regarding the underlying hardware configuration, the returned count may not mean the maximum number of sensor data that can be batched. See sensor_get_max_batch_count() for such purpose, finding out the possible maximum number of batched data.
- Since :
- 2.3.1
- Parameters:
-
[in] sensor A sensor handle [out] fifo_count The FIFO count
- Returns:
- SENSOR_ERROR_NONE on success, otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter SENSOR_ERROR_OPERATION_FAILED Operation failed
int sensor_get_max_batch_count | ( | sensor_h | sensor, |
int * | max_batch_count | ||
) |
Gets the maximum batch count of a sensor.
This function returns the maximum number of sensor data events that can be possibly delivered when the batched data are flushed. Therefore, this count can be used to check whether the sensor supports batching or not.
If this returns a positive count, i.e., the sensor supports batching, the count also can be used to guess the possible longest batch latency of the sensor, with respect to the update interval to use.
- Since :
- 2.3.1
- Parameters:
-
[in] sensor A sensor handle [out] max_batch_count If the sensor does not support batching, 0; Otherwise a positive integer.
- Returns:
- SENSOR_ERROR_NONE on success, otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter SENSOR_ERROR_OPERATION_FAILED Operation failed
int sensor_get_max_range | ( | sensor_h | sensor, |
float * | max_range | ||
) |
Gets the upper bound of the sensor readings of a sensor.
This function returns the upper bound of the range of possible sensor values, which are generated by the corresponding sensor denoted by a sensor handle.
If all sensor values are in the same unit, e.g., or degrees, the upper bound of all sensor values is returned. Otherwise, the upper bound of the representative sensor value, e.g., the step count of SENSOR_HUMAN_PEDOMETER, is returned.
- Since :
- 2.3.1
- Parameters:
-
[in] sensor A sensor handle [out] max_range The upper bound
- Returns:
- SENSOR_ERROR_NONE on success, otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter SENSOR_ERROR_OPERATION_FAILED Operation failed
- See also:
- sensor_get_min_range()
int sensor_get_min_interval | ( | sensor_h | sensor, |
int * | min_interval | ||
) |
Gets the possible shorted update interval of a sensor.
- Since :
- 2.3.1
- Parameters:
-
[in] sensor A sensor handle [out] min_interval The shorted interval in milliseconds
- Returns:
- SENSOR_ERROR_NONE on success, otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter SENSOR_ERROR_OPERATION_FAILED Operation failed
int sensor_get_min_range | ( | sensor_h | sensor, |
float * | min_range | ||
) |
Gets the lower bound of the sensor reading of a sensor.
This function returns the lower bound of the range of possible sensor values, which are generated by the corresponding sensor denoted by a sensor handle.
If all sensor values are in the same unit, e.g., or degrees, the lower bound of all sensor values is returned. Otherwise, the lower bound of the representative sensor value, e.g., the step count of SENSOR_HUMAN_PEDOMETER, is returned.
- Since :
- 2.3.1
- Parameters:
-
[in] sensor A sensor handle [out] min_range The lower bound
- Returns:
- SENSOR_ERROR_NONE on success, otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter SENSOR_ERROR_OPERATION_FAILED Operation failed
- See also:
- sensor_get_max_range()
int sensor_get_name | ( | sensor_h | sensor, |
char ** | name | ||
) |
Gets the name of a sensor.
- Since :
- 2.3.1
- Remarks:
- The name must be released using free(), if not being used anymore.
- Parameters:
-
[in] sensor A sensor handle [out] name The name of the sensor
- Returns:
- SENSOR_ERROR_NONE on success, otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter
int sensor_get_resolution | ( | sensor_h | sensor, |
float * | resolution | ||
) |
Gets the resolution of the sensor readings of a sensor.
This function returns the resolution of the sensor readings. The resolution denotes the smallest difference between sensor readings, each of which is in the range that can be verified by sensor_get_min_range() and sensor_get_max_range().
- Since :
- 2.3.1
- Parameters:
-
[in] sensor A sensor handle [out] resolution The resolution
- Returns:
- SENSOR_ERROR_NONE on success, otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter SENSOR_ERROR_OPERATION_FAILED Operation failed
int sensor_get_sensor_list | ( | sensor_type_e | type, |
sensor_h ** | list, | ||
int * | sensor_count | ||
) |
Gets the handle list of the sensors of a given type.
A device may have more than one sensors of the given type. In such case, this function can be used to get the handles of all sensors of the type.
The first element of the list denotes the default sensor, which can be retrieved by sensor_get_default_sensor().
- Since :
- 2.3.1
- Remarks:
- Some sensor types are privileged. An application should have the privilege http://tizen.org/privilege/healthinfo to get handles for the following sensors: SENSOR_HRM, SENSOR_HRM_LED_GREEN, SENSOR_HRM_LED_IR, SENSOR_HRM_LED_RED, SENSOR_HUMAN_PEDOMETER, SENSOR_HUMAN_SLEEP_MONITOR, SENSOR_HUMAN_SLEEP_DETECTOR, and SENSOR_HUMAN_STRESS_MONITOR.
Instead of specifying a sensor type, by using SENSOR_ALL, applications can get the list of handles for all available sensors.
The list must be released using free(), if not being used anymore.
- Parameters:
-
[in] type A sensor type to get the list of sensor handles [out] list An array of the sensor handles [out] sensor_count The number of handles contained in list
- Returns:
- SENSOR_ERROR_NONE on success; Otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter SENSOR_ERROR_NOT_SUPPORTED The sensor type is not supported in the current device SENSOR_ERROR_PERMISSION_DENIED Permission denied SENSOR_ERROR_OUT_OF_MEMORY Out of memory
int sensor_get_sensor_list_by_uri | ( | const char * | uri, |
sensor_h ** | list, | ||
int * | sensor_count | ||
) |
Gets the handle list of the sensors of a given URI.
A device may have more than one sensor of the given URI. In such case, this function can be used to get the handles of all sensors of the given URI.
See Sensor URIs for more details about the URI format.
- Since :
- 4.0
- Remarks:
- Some sensors require one or more privileges. An application should have the corresponding privilege to get handles for such sensors. See sensor_get_default_sensor_by_uri() for more details.
The list must be released using free(), if not being used anymore.
- Parameters:
-
[in] uri A sensor or a sensor type URI to get the list of sensor handles [out] list An array of the sensor handles [out] sensor_count The number of handles contained in list
- Returns:
- SENSOR_ERROR_NONE on success, otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter SENSOR_ERROR_NOT_SUPPORTED The URI is not supported in the current device SENSOR_ERROR_PERMISSION_DENIED Permission denied SENSOR_ERROR_OUT_OF_MEMORY Out of memory
int sensor_get_type | ( | sensor_h | sensor, |
sensor_type_e * | type | ||
) |
Gets the type of a sensor, if it belongs to the known types defined in sensor_type_e.
- Since :
- 2.3.1
- Parameters:
-
[in] sensor A sensor handle [out] type The type of the sensor
- Returns:
- SENSOR_ERROR_NONE on success, otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter SENSOR_ERROR_NO_DATA No known sensor type for the given sensor SENSOR_ERROR_OPERATION_FAILED Operation failed
int sensor_get_uri | ( | sensor_h | sensor, |
char ** | uri | ||
) |
Gets the URI of a sensor.
- Since :
- 4.0
- Remarks:
- The uri must be released using free(), if not being used anymore.
- Parameters:
-
[in] sensor A sensor handle [out] uri The URI of the sensor
- Returns:
- SENSOR_ERROR_NONE on success, otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter
int sensor_get_vendor | ( | sensor_h | sensor, |
char ** | vendor | ||
) |
Gets the vendor of a sensor.
- Since :
- 2.3.1
- Remarks:
- The vendor must be released using free(), if not being used anymore.
- Parameters:
-
[in] sensor A sensor handle [out] vendor The vendor of the sensor
- Returns:
- SENSOR_ERROR_NONE on success, otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter
int sensor_is_supported | ( | sensor_type_e | type, |
bool * | supported | ||
) |
Checks whether a given sensor type is supported in the current device.
If the given sensor type is not supported, sensor_get_default_sensor() will return an error. It is thus recommended to check the availability of the sensor before actually acquiring sensor_h.
- Since :
- 2.3.1
- Parameters:
-
[in] type A sensor type to check [out] supported If supported, true
; Otherwisefalse
- Returns:
- SENSOR_ERROR_NONE on success; Otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter
- See also:
- sensor_is_supported_by_uri()
int sensor_is_supported_by_uri | ( | const char * | uri, |
bool * | supported | ||
) |
Checks whether a sensor corresponding to a given URI is supported in the current device.
To correctly check the availability of a sensor, a valid URI should be provided. The valid form of URIs is explained in Sensor URIs.
If a URI with the sensor's name is given, for example, http://tizen.org/sensor/general/light/front, the availability of the "front" light sensor is checked. Otherwise, if a URI without the name, http://tizen.org/sensor/general/light, is given, this function checks the availability of any light sensor in the device.
It is recommended to check the availability of the sensors corresponding to the URI before actually acquiring sensor_h.
- Since :
- 4.0
- Parameters:
-
[in] uri A sensor or a sensor type URI to check [out] supported If supported, true
, otherwisefalse
- Returns:
- SENSOR_ERROR_NONE on success, otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter
- See also:
- sensor_is_supported()
int sensor_is_wake_up | ( | sensor_h | sensor, |
bool * | wakeup | ||
) |
Checks whether a given sensor is a wake-up sensor or not.
If a sensor is a wake-up sensor, the sensor is able to wake-up the system to report its sensor data even if the system is in sleep mode.
- Since :
- 2.3.2
- Parameters:
-
[in] sensor A sensor handle to check [out] wakeup If the sensor is a wake-up sensor, true
; Otherwisefalse
- Returns:
- SENSOR_ERROR_NONE on success, otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter
- Precondition:
- The handle
sensor
needs to be initialized using sensor_get_default_sensor() or sensor_get_sensor_list() in advance.
int sensor_remove_sensor_added_cb | ( | sensor_added_cb | callback | ) |
Removes a callback function added using sensor_add_sensor_added_cb().
- Since :
- 4.0
- Parameters:
-
[in] callback A callback function to be removed
- Returns:
- SENSOR_ERROR_NONE on success, otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter SENSOR_ERROR_OPERATION_FAILED Operation failed
- See also:
- sensor_add_sensor_added_cb()
int sensor_remove_sensor_removed_cb | ( | sensor_removed_cb | callback | ) |
Removes a callback function added using sensor_add_sensor_removed_cb().
- Since :
- 4.0
- Parameters:
-
[in] callback A callback function to be removed
- Returns:
- SENSOR_ERROR_NONE on success, otherwise a negative error value
- Return values:
-
SENSOR_ERROR_NONE Successful SENSOR_ERROR_INVALID_PARAMETER Invalid parameter SENSOR_ERROR_OPERATION_FAILED Operation failed
- See also:
- sensor_add_sensor_removed_cb()