Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
|
Data Structures | |
struct | sensing_sensor_version |
Sensor Version. More... | |
struct | sensing_sensor_info |
Sensor basic constant information. More... | |
struct | sensing_callback_list |
Sensing subsystem event callback list. More... | |
struct | sensing_sensor_config |
Sensing subsystem sensor configure, including interval, sensitivity, latency. More... | |
Macros | |
#define | SENSING_SENSOR_VERSION(_major, _minor, _hotfix, _build) |
Macro to create a sensor version value. | |
#define | SENSING_SENSOR_FLAG_REPORT_ON_EVENT BIT(0) |
Sensor flag indicating if this sensor is on event reporting data. | |
#define | SENSING_SENSOR_FLAG_REPORT_ON_CHANGE BIT(1) |
Sensor flag indicating if this sensor is on change reporting data. | |
#define | SENSING_SENSITIVITY_INDEX_ALL -1 |
SENSING_SENSITIVITY_INDEX_ALL indicating sensitivity of each data field should be set. | |
Typedefs | |
typedef void * | sensing_sensor_handle_t |
Define Sensing subsystem sensor handle. | |
typedef void(* | sensing_data_event_t) (sensing_sensor_handle_t handle, const void *buf, void *context) |
Sensor data event receive callback. | |
Enumerations | |
enum | sensing_sensor_state { SENSING_SENSOR_STATE_READY = 0 , SENSING_SENSOR_STATE_OFFLINE = 1 } |
Sensing subsystem sensor state. More... | |
enum | sensing_sensor_attribute { SENSING_SENSOR_ATTRIBUTE_INTERVAL = 0 , SENSING_SENSOR_ATTRIBUTE_SENSITIVITY = 1 , SENSING_SENSOR_ATTRIBUTE_LATENCY = 2 , SENSING_SENSOR_ATTRIBUTE_MAX } |
Sensing subsystem sensor config attribute. More... | |
Functions | |
int | sensing_get_sensors (int *num_sensors, const struct sensing_sensor_info **info) |
Get all supported sensor instances' information. | |
int | sensing_open_sensor (const struct sensing_sensor_info *info, struct sensing_callback_list *cb_list, sensing_sensor_handle_t *handle) |
Open sensor instance by sensing sensor info. | |
int | sensing_open_sensor_by_dt (const struct device *dev, struct sensing_callback_list *cb_list, sensing_sensor_handle_t *handle) |
Open sensor instance by device. | |
int | sensing_close_sensor (sensing_sensor_handle_t *handle) |
Close sensor instance. | |
int | sensing_set_config (sensing_sensor_handle_t handle, struct sensing_sensor_config *configs, int count) |
Set current config items to Sensing subsystem. | |
int | sensing_get_config (sensing_sensor_handle_t handle, struct sensing_sensor_config *configs, int count) |
Get current config items from Sensing subsystem. | |
const struct sensing_sensor_info * | sensing_get_sensor_info (sensing_sensor_handle_t handle) |
Get sensor information from sensor instance handle. | |
Sensing Subsystem API .
#define SENSING_SENSITIVITY_INDEX_ALL -1 |
#include <zephyr/sensing/sensing.h>
SENSING_SENSITIVITY_INDEX_ALL indicating sensitivity of each data field should be set.
#define SENSING_SENSOR_FLAG_REPORT_ON_CHANGE BIT(1) |
#include <zephyr/sensing/sensing.h>
Sensor flag indicating if this sensor is on change reporting data.
Reporting sensor data when the sensor data changes.
Exclusive with SENSING_SENSOR_FLAG_REPORT_ON_EVENT
#define SENSING_SENSOR_FLAG_REPORT_ON_EVENT BIT(0) |
#include <zephyr/sensing/sensing.h>
Sensor flag indicating if this sensor is on event reporting data.
Reporting sensor data when the sensor event occurs, such as a motion detect sensor reporting a motion or motionless detected event.
#define SENSING_SENSOR_VERSION | ( | _major, | |
_minor, | |||
_hotfix, | |||
_build ) |
#include <zephyr/sensing/sensing.h>
Macro to create a sensor version value.
typedef void(* sensing_data_event_t) (sensing_sensor_handle_t handle, const void *buf, void *context) |
#include <zephyr/sensing/sensing.h>
Sensor data event receive callback.
handle | The sensor instance handle. |
buf | The data buffer with sensor data. |
context | User provided context pointer. |
typedef void* sensing_sensor_handle_t |
#include <zephyr/sensing/sensing.h>
Define Sensing subsystem sensor handle.
#include <zephyr/sensing/sensing.h>
Sensing subsystem sensor config attribute.
enum sensing_sensor_state |
#include <zephyr/sensing/sensing.h>
Sensing subsystem sensor state.
Enumerator | |
---|---|
SENSING_SENSOR_STATE_READY | The sensor is ready. |
SENSING_SENSOR_STATE_OFFLINE | The sensor is offline. |
int sensing_close_sensor | ( | sensing_sensor_handle_t * | handle | ) |
#include <zephyr/sensing/sensing.h>
Close sensor instance.
handle | The sensor instance handle need to close. |
int sensing_get_config | ( | sensing_sensor_handle_t | handle, |
struct sensing_sensor_config * | configs, | ||
int | count ) |
#include <zephyr/sensing/sensing.h>
Get current config items from Sensing subsystem.
handle | The sensor instance handle. |
configs | The configs to be get according to config attribute. |
count | count of configs. |
const struct sensing_sensor_info * sensing_get_sensor_info | ( | sensing_sensor_handle_t | handle | ) |
#include <zephyr/sensing/sensing.h>
Get sensor information from sensor instance handle.
handle | The sensor instance handle. |
int sensing_get_sensors | ( | int * | num_sensors, |
const struct sensing_sensor_info ** | info ) |
#include <zephyr/sensing/sensing.h>
Get all supported sensor instances' information.
This API just returns read only information of sensor instances, pointer info will directly point to internal buffer, no need for caller to allocate buffer, no side effect to sensor instances.
num_sensors | Get number of sensor instances. |
info | For receiving sensor instances' information array pointer. |
int sensing_open_sensor | ( | const struct sensing_sensor_info * | info, |
struct sensing_callback_list * | cb_list, | ||
sensing_sensor_handle_t * | handle ) |
#include <zephyr/sensing/sensing.h>
Open sensor instance by sensing sensor info.
Application clients use it to open a sensor instance and get its handle. Support multiple Application clients for open same sensor instance, in this case, the returned handle will different for different clients. meanwhile, also register sensing callback list
info | The sensor info got from sensing_get_sensors |
cb_list | callback list to be registered to sensing, must have a static lifetime. |
handle | The opened instance handle, if failed will be set to NULL. |
int sensing_open_sensor_by_dt | ( | const struct device * | dev, |
struct sensing_callback_list * | cb_list, | ||
sensing_sensor_handle_t * | handle ) |
#include <zephyr/sensing/sensing.h>
Open sensor instance by device.
Application clients use it to open a sensor instance and get its handle. Support multiple Application clients for open same sensor instance, in this case, the returned handle will different for different clients. meanwhile, also register sensing callback list.
dev | pointer device get from device tree. |
cb_list | callback list to be registered to sensing, must have a static lifetime. |
handle | The opened instance handle, if failed will be set to NULL. |
int sensing_set_config | ( | sensing_sensor_handle_t | handle, |
struct sensing_sensor_config * | configs, | ||
int | count ) |
#include <zephyr/sensing/sensing.h>
Set current config items to Sensing subsystem.
handle | The sensor instance handle. |
configs | The configs to be set according to config attribute. |
count | count of configs. |