|
Tizen HAL API
1.0
|
The Sensor provides functions for getting/putting backend and creating sensor devices.
#include <hal-sensor.h>
The Sensor provides functions to get/put backend.
The Sensor provides creating and deleting functions.
For the sensors created by hal_sensor_create, Sensor provides operations.
Functions to get poll fd and sensors:
Functions to manipulate the behavior of sensors:
Functions to get/set attributes of sensors:
Function to flush sensor data:
Typedefs | |
| typedef struct _hal_backend_sensor_funcs | hal_backend_sensor_funcs |
| Structure for sensor functions. | |
| typedef struct sensor_info_t | sensor_info_t |
| Structure for sensor information data. | |
| typedef struct sensor_data_t | sensor_data_t |
| Structure for sensor data. | |
| typedef struct sensorhub_data_t | sensorhub_data_t |
| Structure of sensorhub data. | |
Defines | |
| #define | SENSOR_DATA_VALUE_SIZE 16 |
| Definition of sensor data value size. | |
| #define | SENSORHUB_DATA_VALUE_SIZE 4096 |
| Definition of sensorhub data value size. | |
| #define | SENSOR_PEDOMETER_DATA_DIFFS_SIZE 20 |
| Definition of pedometer data difference array size. | |
| struct sensor_device_s |
Structure for sensor device functions.
Data Fields | |
| int(* | get_poll_fd )(uint32_t sensor_device_id, int *poll_fd) |
| int(* | get_sensors )(uint32_t sensor_device_id, const sensor_info_t **sensors, size_t *sensors_len) |
| int(* | enable )(uint32_t sensor_device_id, uint32_t id) |
| int(* | disable )(uint32_t sensor_device_id, uint32_t id) |
| int(* | read_fd )(uint32_t sensor_device_id, uint32_t **ids, size_t *ids_len) |
| int(* | get_data )(uint32_t sensor_device_id, uint32_t id, sensor_data_t **data, size_t *length) |
| int(* | set_interval )(uint32_t sensor_device_id, uint32_t id, unsigned long val) |
| int(* | set_batch_latency )(uint32_t sensor_device_id, uint32_t id, unsigned long val) |
| int(* | set_attribute_int )(uint32_t sensor_device_id, uint32_t id, int32_t attribute, int32_t value) |
| int(* | set_attribute_str )(uint32_t sensor_device_id, uint32_t id, int32_t attribute, const char *value, size_t len) |
| int(* | get_attribute_int )(uint32_t sensor_device_id, uint32_t id, int32_t attribute, int32_t *value) |
| int(* | get_attribute_str )(uint32_t sensor_device_id, uint32_t id, int32_t attribute, char **value, size_t *len) |
| int(* | flush )(uint32_t sensor_device_id, uint32_t id) |
| int(* sensor_device_s::disable)(uint32_t sensor_device_id, uint32_t id) |
Disable this sensor
| int(* sensor_device_s::enable)(uint32_t sensor_device_id, uint32_t id) |
Enable this sensor
| int(* sensor_device_s::flush)(uint32_t sensor_device_id, uint32_t id) |
Flush sensor data
| int(* sensor_device_s::get_attribute_int)(uint32_t sensor_device_id, uint32_t id, int32_t attribute, int32_t *value) |
Get integer attribute value
| int(* sensor_device_s::get_attribute_str)(uint32_t sensor_device_id, uint32_t id, int32_t attribute, char **value, size_t *len) |
Get string attribute value
| int(* sensor_device_s::get_data)(uint32_t sensor_device_id, uint32_t id, sensor_data_t **data, size_t *length) |
Get sensor data
| int(* sensor_device_s::get_poll_fd)(uint32_t sensor_device_id, int *poll_fd) |
Get poll fd for event listening
| int(* sensor_device_s::get_sensors)(uint32_t sensor_device_id, const sensor_info_t **sensors, size_t *sensors_len) |
Get sensor entities
| int(* sensor_device_s::read_fd)(uint32_t sensor_device_id, uint32_t **ids, size_t *ids_len) |
Read sensor and return event ids
| int(* sensor_device_s::set_attribute_int)(uint32_t sensor_device_id, uint32_t id, int32_t attribute, int32_t value) |
Set attribute as an integer value
| int(* sensor_device_s::set_attribute_str)(uint32_t sensor_device_id, uint32_t id, int32_t attribute, const char *value, size_t len) |
Set attribute as a string value
| int(* sensor_device_s::set_batch_latency)(uint32_t sensor_device_id, uint32_t id, unsigned long val) |
Set batch latency
| int(* sensor_device_s::set_interval)(uint32_t sensor_device_id, uint32_t id, unsigned long val) |
Set sensor value interval
| struct _hal_backend_sensor_funcs |
Structure for sensor functions.
Data Fields | |
| int(* | create_sensor )(sensor_device_s ***sensor_devices, size_t *sensor_devices_len) |
| int(* | delete_sensor )(uint32_t *sensor_device_ids, size_t sensor_device_ids_len) |
| int(* _hal_backend_sensor_funcs::create_sensor)(sensor_device_s ***sensor_devices, size_t *sensor_devices_len) |
Create sensor devices
| int(* _hal_backend_sensor_funcs::delete_sensor)(uint32_t *sensor_device_ids, size_t sensor_device_ids_len) |
Delete sensors with their ids
| struct sensor_info_t |
Structure for sensor information data.
A platform sensor handler is generated based on this handle.
The 'id' can be assigned from HAL developer, so it has to be
unique per a sensor_device.
Data Fields | |
| uint32_t | id |
| const char * | name |
| int | type |
| unsigned int | event_type |
| const char * | model_name |
| const char * | vendor |
| float | min_range |
| float | max_range |
| float | resolution |
| int | min_interval |
| int | max_interval |
| int | max_batch_count |
| bool | wakeup_supported |
| unsigned int sensor_info_t::event_type |
Event type for Internal API
| uint32_t sensor_info_t::id |
Sensor id
Minimum batch count
Maximum interval of sensor value retrieval
| float sensor_info_t::max_range |
Maximum range of sensor value
Minimum interval of sensor value retrieval
| float sensor_info_t::min_range |
Minimum range of sensor value
| const char* sensor_info_t::model_name |
Model name of sensor
| const char* sensor_info_t::name |
Sensor name
Resolution of sensor value
Sensor type(sensor_device_type)
| const char* sensor_info_t::vendor |
Vendor of sensor
Support wakeup or not
| struct sensor_data_t |
Structure for sensor data.
Data Fields | |
| int | accuracy |
| unsigned long long | timestamp |
| int | value_count |
| float | values [16] |
Accuracy of value
| unsigned long long sensor_data_t::timestamp |
Timestamp of value
Number of values provided
| float sensor_data_t::values[16] |
Sensor values(array)
| struct sensorhub_data_t |
Structure of sensorhub data.
Data Fields | |
| int | accuracy |
| unsigned long long | timestamp |
| union { | |
| int value_count | |
| int hub_data_size | |
| }; | |
| Union of number of values. | |
| union { | |
| char values [4096] | |
| char hub_data [4096] | |
| }; | |
| Union of values. | |
| union { ... } |
Union of values.
Use "values" instead of "hub_data"(will be removed soon)
| union { ... } |
Union of number of values.
Use "value_count" instead of "hub_data_size"(will be removed soon)
Accuracy of value
| char sensorhub_data_t::hub_data[4096] |
Values of sensorhub (deprecated)
Number of values (deprecated)
| unsigned long long sensorhub_data_t::timestamp |
Timestamp of value
Number of values
| char sensorhub_data_t::values[4096] |
Values of sensorhub
| struct sensor_pedometer_data_t |
Structure of pedometer data.
Data Fields | |
| int | accuracy |
| unsigned long long | timestamp |
| int | value_count |
| float | values [16] |
| int | diffs_count |
| struct sensor_pedometer_data_t::differences | diffs [20] |
Accuracy of value
Array of differences of pedometer data
Number of struct differences Additional data attributes (not in sensor_data_t)
| unsigned long long sensor_pedometer_data_t::timestamp |
Timestamp of value
Number of values
| float sensor_pedometer_data_t::values[16] |
Values of pedometer sensor values = {step count, walk step count, run step count, moving distance, calorie burned, last speed, last stepping frequency (steps per sec), last step status (walking, running, ...)}
| struct sensor_pedometer_data_t::differences |
Structure of differences of pedometer data.
Additional data attributes (not in sensor_data_t)
Data Fields | |
| int | timestamp |
| int | steps |
| int | walk_steps |
| int | run_steps |
| int | walk_up_steps |
| int | walk_down_steps |
| int | run_up_steps |
| int | run_down_steps |
| float | distance |
| float | calories |
| float | speed |
Difference of calories
Difference of distance
Difference of run down steps
Difference of run steps
Difference of run up steps
Difference of speed
Difference of steps
Timestamp of difference
Difference of walk down steps
Difference of walk steps
Difference of walk up steps
| #define SENSOR_DATA_VALUE_SIZE 16 |
Definition of sensor data value size.
| #define SENSOR_PEDOMETER_DATA_DIFFS_SIZE 20 |
Definition of pedometer data difference array size.
| #define SENSORHUB_DATA_VALUE_SIZE 4096 |
Definition of sensorhub data value size.
| typedef struct _hal_backend_sensor_funcs hal_backend_sensor_funcs |
Structure for sensor functions.
| typedef struct sensor_data_t sensor_data_t |
Structure for sensor data.
| typedef struct sensor_info_t sensor_info_t |
Structure for sensor information data.
A platform sensor handler is generated based on this handle.
The 'id' can be assigned from HAL developer, so it has to be
unique per a sensor_device.
| typedef struct sensorhub_data_t sensorhub_data_t |
Structure of sensorhub data.
Enumeration(hal) for power state of lidar.
HAL_SENSOR_ATTR_LIDAR_POWER_STATE attribute value
Enumeration(hal) for sensitivity level of proximity sensor.
HAL_SENSOR_ATTR_PROXIMITY_SENSITIVITY_LEVEL attribute value
| enum sensor_accuracy_t |
| enum sensor_activity |
| enum sensor_attribute |
Structure for attributes of sensor.
| enum sensor_device_type |
Enumeration of sensor types for controlling the sensors.
Base unit