Kallisto Linux API
Library for interacting with Kallisto devices
SensorManager Class Reference

Public Member Functions

std::vector< hardware::Sensor * > getSensors ()
 
std::vector< hardware::Sensor * > getSensors (hardware::Sensor::SensorType type)
 
std::vector< hardware::Sensor * > getSensors (std::string address)
 
hardware::SensorgetSensor (hardware::Sensor::SensorType type)
 
hardware::SensorgetSensor (hardware::Sensor::SensorType type, std::string address)
 
error::KallistoDetailedResult registerListener (hardware::SensorEventListener &listener, hardware::Sensor &sensor, const std::chrono::microseconds delay)
 
error::KallistoDetailedResult registerListener (hardware::SensorEventListener &listener, hardware::Sensor &sensor)
 
error::KallistoDetailedResult unregisterListener (hardware::SensorEventListener &listener, hardware::Sensor &sensor)
 
error::KallistoDetailedResult unregisterListener (hardware::SensorEventListener &listener)
 

Friends

class KallistoCore
 

Member Function Documentation

◆ getSensor() [1/2]

Use this method to get a sensor of a certain type. Will return the first sensor of the passed type.

Note
The pointer is only safe to store while the Kallisto that contains it is available.
Parameters
typeThe type of the desired sensor. See type class for the available types.
Returns
The sensor of the requested type or nullptr if none available.

◆ getSensor() [2/2]

hardware::Sensor* getSensor ( hardware::Sensor::SensorType  type,
std::string  address 
)

Use this method to get a sensor of a certain type from a certain device. Will return the first sensor of the passed type.

Note
The pointer is only safe to store while the Kallisto that contains it is available.
Parameters
typeThe type of the desired sensor. See type class for the available types.
Returns
The sensor of the requested type or nullptr if none available.

◆ getSensors() [1/3]

std::vector<hardware::Sensor*> getSensors ( )

Use this method to get the list of available sensors.

Note
The pointers are only safe to store while the Kallisto that contains it is available.
Returns
A list with all the sensors available.

◆ getSensors() [2/3]

std::vector<hardware::Sensor*> getSensors ( hardware::Sensor::SensorType  type)

Use this method to get the list of available sensors of a certain type.

Note
The pointers are only safe to store while the Kallisto that contains it is available.
Parameters
typeThe type of the desired sensors. See type class for the available types.
Returns
A list with all the sensors available of the requested type.

◆ getSensors() [3/3]

std::vector<hardware::Sensor*> getSensors ( std::string  address)

Use this method to get the list of available sensors of a certain device.

Note
The pointers are only safe to store while the Kallisto that contains it is available.
Parameters
addressThe address of the desired sensors.
Returns
A list with all the sensors available of the requested type.

◆ registerListener() [1/2]

error::KallistoDetailedResult registerListener ( hardware::SensorEventListener listener,
hardware::Sensor sensor,
const std::chrono::microseconds  delay 
)

Registers a listener for the given sensor.

Should only be used with sensors that report continuously.

Blocking function.

See also
hardware::Sensor::ReportingMode
hardware::Sensor::getReportingMode()
Parameters
listenerA listener to receive sensor events.
sensorThe sensor to register to.
rateUsThe rate sensor events are delivered at. This is only a hint to the system. Events may be received faster or slower than the specified rate. Some sensors reporting mode don't use this delay since they report only on changes.
Returns
A detailed result.

◆ registerListener() [2/2]

error::KallistoDetailedResult registerListener ( hardware::SensorEventListener listener,
hardware::Sensor sensor 
)

Registers a listener for the given sensor.

Should only be used with sensors that report on changes.

Blocking function.

See also
hardware::Sensor::ReportingMode
hardware::Sensor::getReportingMode()
Parameters
listenerA listener to receive sensor events.
sensorThe sensor to register to.
Returns
A detailed result.

◆ unregisterListener() [1/2]

error::KallistoDetailedResult unregisterListener ( hardware::SensorEventListener listener,
hardware::Sensor sensor 
)

Unregisters the listener for the passed sensor.

Blocking function if the device is no longer in use.

Parameters
listenerThe listener used in SensorManager#registerListener(SensorEventListener, Sensor, std::chrono::microseconds) call.
sensorThe sensor used in SensorManager#registerListener(SensorEventListener, Sensor, std::chrono::microseconds) call.
Returns
A detailed result.

◆ unregisterListener() [2/2]

Unregisters the listener for all sensors.

Blocking function if the device is no longer in use.

Parameters
listenerThe listener used in SensorManager#registerListener(SensorEventListener, Sensor, std::chrono::microseconds) call.
Returns
A detailed result.

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