anbox-platform-sdk  1.23.0
Anbox Platform SDK API documentation
anbox::SensorProcessor Class Referenceabstract

SensorProcessor allows processing sensor events from the Android container and perform sensor processing for a variety of sensor devices. More...

#include <sensor_processor.h>

+ Collaboration diagram for anbox::SensorProcessor:

Public Member Functions

 SensorProcessor ()=default
 
virtual ~SensorProcessor ()=default
 
 SensorProcessor (const SensorProcessor &)=delete
 
SensorProcessoroperator= (const SensorProcessor &)=delete
 
virtual AnboxSensorType supported_sensors () const =0
 Sensors supported by this processor. More...
 
virtual int read_data (AnboxSensorData *data, int timeout)=0
 Read available sensor data. More...
 
virtual int inject_data (AnboxSensorData data)=0
 Inject sensor data into AnboxPlatform. More...
 

Detailed Description

SensorProcessor allows processing sensor events from the Android container and perform sensor processing for a variety of sensor devices.

Definition at line 29 of file sensor_processor.h.

Constructor & Destructor Documentation

◆ SensorProcessor() [1/2]

anbox::SensorProcessor::SensorProcessor ( )
default

◆ ~SensorProcessor()

virtual anbox::SensorProcessor::~SensorProcessor ( )
virtualdefault

◆ SensorProcessor() [2/2]

anbox::SensorProcessor::SensorProcessor ( const SensorProcessor )
delete

Member Function Documentation

◆ inject_data()

virtual int anbox::SensorProcessor::inject_data ( AnboxSensorData  data)
pure virtual

Inject sensor data into AnboxPlatform.

This function allows injecting sensor data into the platform and letting the SensorProcessor handle the sensor data.

Parameters
dataa chunk of sensor data to be pushed into the internal queue.
Returns
0 on success, otherwise returns EINVAL on error occurs.
Note
This function is only used in our test suite to facilitate our automation tests and it is subject to change at any time.

◆ operator=()

SensorProcessor& anbox::SensorProcessor::operator= ( const SensorProcessor )
delete

◆ read_data()

virtual int anbox::SensorProcessor::read_data ( AnboxSensorData data,
int  timeout 
)
pure virtual

Read available sensor data.

Anbox will call read_data() to query the plugin for the next available sensor data which is then forwarded to the Android container. If no sensor data is available and timeout is set to -1, the function must block until sensor data is available.

Parameters
sensordata provided by the processor on a successful read
timeoutmaximum number of milliseconds to wait for the next available sensor data. The following possible values for timeout must be handled:
timeout Behavior
0 Non-blocking mode; return -EIO immediately if no sensor data to process.
< 0 Block indefinitely until a sensor data is available.
> 0 Wait up to a maximum of timeout milliseconds for a sensor data.
Returns
0 on success otherwise returns EINVAL on error occurs.

◆ supported_sensors()

virtual AnboxSensorType anbox::SensorProcessor::supported_sensors ( ) const
pure virtual

Sensors supported by this processor.

Internally Anbox will tell Android about the supported sensors and ensure they are being exposed through the right Android APIs. Multiple sensor types can be specified by using OR bitwise operator.

Returns
sensors that are supported by this processor

The documentation for this class was generated from the following file: