Telematics SDK - Interface Specification  v1.46.10
Sensor control

Data Structures

class  telux::sensor::ISensorEventListener
 This file hosts the sensor interfaces to configure, activate or get data from the individual sensors available - Gyroscope, Accelerometer, etc. More...
 
class  telux::sensor::ISensor
 ISensor interface is used to access the different services provided by the sensor to configure, activate and get sensor data. More...
 
class  telux::sensor::ISensorManager
 Sensor Manager class provides APIs to interact with the sensor sub-system and get access to other sensor objects which can be used to configure, activate or get data from the individual sensors available - Gyro, Accelero, etc. More...
 

Detailed Description

This section contains APIs related to sensor configuration, sensor control and data acquisition from sensors.


Data Structure Documentation

class telux::sensor::ISensorEventListener

This file hosts the sensor interfaces to configure, activate or get data from the individual sensors available - Gyroscope, Accelerometer, etc.

ISensorEventListener interface is used to receive notifications related to sensor events and configuration updates

The listener method can be invoked from multiple different threads. Client needs to make sure that implementation is thread-safe.

Public Member Functions

virtual void onEvent (std::shared_ptr< std::vector< SensorEvent >> events)
 
virtual void onConfigurationUpdate (SensorConfiguration configuration)
 
virtual ~ISensorEventListener ()
 

Constructor & Destructor Documentation

virtual telux::sensor::ISensorEventListener::~ISensorEventListener ( )
virtual

The destructor for the sensor event listener

Member Function Documentation

virtual void telux::sensor::ISensorEventListener::onEvent ( std::shared_ptr< std::vector< SensorEvent >>  events)
virtual

This function is called to notify about available sensor events

Parameters
[in]events- List of sensor events
Note
Eval: This is a new API and is being evaluated. It is subject to change and could break backwards compatibility.
virtual void telux::sensor::ISensorEventListener::onConfigurationUpdate ( SensorConfiguration  configuration)
virtual

This function is called to notify any change in sensor configuration.

Parameters
[in]configuration- The new configuration for the sensor telux::sensor::SensorConfiguration. Fields that have changed can be identified using the telux::sensor::SensorConfiguration::updateMask and fields that are valid can be identified using telux::sensor::SensorConfiguration::validityMask
Note
Eval: This is a new API and is being evaluated. It is subject to change and could break backwards compatibility.
class telux::sensor::ISensor

ISensor interface is used to access the different services provided by the sensor to configure, activate and get sensor data.

Public Member Functions

virtual SensorInfo getSensorInfo ()=0
 
virtual telux::common::Status configure (SensorConfiguration configuration)=0
 
virtual SensorConfiguration getConfiguration ()=0
 
virtual telux::common::Status activate ()=0
 
virtual telux::common::Status deactivate ()=0
 
virtual telux::common::Status enableLowPowerMode ()=0
 
virtual telux::common::Status disableLowPowerMode ()=0
 
virtual telux::common::Status registerListener (std::weak_ptr< ISensorEventListener > listener)=0
 
virtual telux::common::Status deregisterListener (std::weak_ptr< ISensorEventListener > listener)=0
 
virtual ~ISensor ()
 

Constructor & Destructor Documentation

virtual telux::sensor::ISensor::~ISensor ( )
virtual

Destructor for ISensor

Member Function Documentation

virtual SensorInfo telux::sensor::ISensor::getSensorInfo ( )
pure virtual

Get the information related to sensor

Returns
information retated to sensor - telux::sensor::SensorInfo
Note
Eval: This is a new API and is being evaluated. It is subject to change and could break backwards compatibility.
virtual telux::common::Status telux::sensor::ISensor::configure ( SensorConfiguration  configuration)
pure virtual

Configure sensor with desired sampling rate and batch count. Any change in sampling rate or batch count of the sensor will be notified via telux::sensor::ISensorEventListener::onConfigurationUpdate.

In case a sensor needs to be reconfigured after having been activated, the sensor should be deactivated, configured and activated again as a part of the reconfiguration process.

It is always recommended that configuration of a sensor is done before activating it. If a sensor is activated without configuration, the sensor is configured with a default configuration and activated. The default configuration would have the sampling rate set to minimum sampling rate supported telux::sensor::SensorInfo::samplingRates and the batch count set to maximum batch count supported telux::sensor::SensorInfo::maxBatchCountSupported

Parameters
[in]configuration- The desired configuration for the sensor telux::sensor::SensorConfiguration. Ensure the required validity mask telux::sensor::SensorConfiguration::validityMask is set for the configuration.
Returns
status of configuration request - telux::common::Status
Note
Eval: This is a new API and is being evaluated. It is subject to change and could break backwards compatibility.
virtual SensorConfiguration telux::sensor::ISensor::getConfiguration ( )
pure virtual

Get the current configuration of this sensor

Returns
the current configuration of the sensor. telux::sensor::SensorConfiguration::validityMask should be checked to know which of the fields in the returned configuration is valid.
Note
Eval: This is a new API and is being evaluated. It is subject to change and could break backwards compatibility.
virtual telux::common::Status telux::sensor::ISensor::activate ( )
pure virtual

Activate the sensor. Once activated, any available sensor event will be notified via telux::sensor::ISensorEventListener::onEvent

It is always recommended that configuration of a sensor is done before activating it. If a sensor is activated without configuration, the sensor is configured with a default configuration and activated. The default configuration would have the sampling rate set to minimum sampling rate supported telux::sensor::SensorInfo::samplingRates and the batch count set to maximum batch count supported telux::sensor::SensorInfo::maxBatchCountSupported

Returns
status of activation request - telux::common::Status
Note
Eval: This is a new API and is being evaluated. It is subject to change and could break backwards compatibility.
virtual telux::common::Status telux::sensor::ISensor::deactivate ( )
pure virtual

Deactivate the sensor. Once deactivated, no further sensor events will be notified via telux::sensor::ISensorEventListener::onEvent

Returns
status of deactivation request - telux::common::Status
Note
Eval: This is a new API and is being evaluated. It is subject to change and could break backwards compatibility.
virtual telux::common::Status telux::sensor::ISensor::enableLowPowerMode ( )
pure virtual

Request the sensor to operate in low power mode. The sensor should be in deactivated state to exercise this API. The success of this request depends on the capabilities of the underlying hardware.

Returns
status of request - telux::common::Status
Note
Eval: This is a new API and is being evaluated. It is subject to change and could break backwards compatibility.
virtual telux::common::Status telux::sensor::ISensor::disableLowPowerMode ( )
pure virtual

Request the sensor to exit low power mode. The sensor should be in deactivated state to exercise this API. The success of this request depends on the capabilities of the underlying hardware.

Returns
status of request - telux::common::Status
Note
Eval: This is a new API and is being evaluated. It is subject to change and could break backwards compatibility.
virtual telux::common::Status telux::sensor::ISensor::registerListener ( std::weak_ptr< ISensorEventListener listener)
pure virtual

Register a listener for sensor related events

Returns
status of registration request - telux::common::Status
Note
Eval: This is a new API and is being evaluated. It is subject to change and could break backwards compatibility.
virtual telux::common::Status telux::sensor::ISensor::deregisterListener ( std::weak_ptr< ISensorEventListener listener)
pure virtual

Deregister a sensor event listener

Returns
status of deregistration request - telux::common::Status
Note
Eval: This is a new API and is being evaluated. It is subject to change and could break backwards compatibility.
class telux::sensor::ISensorManager

Sensor Manager class provides APIs to interact with the sensor sub-system and get access to other sensor objects which can be used to configure, activate or get data from the individual sensors available - Gyro, Accelero, etc.

Public Member Functions

virtual telux::common::ServiceStatus getServiceStatus ()=0
 
virtual telux::common::Status getAvailableSensorInfo (std::vector< SensorInfo > &info)=0
 
virtual telux::common::Status getSensor (std::shared_ptr< ISensor > &sensor, std::string name)=0
 
virtual ~ISensorManager ()
 

Constructor & Destructor Documentation

virtual telux::sensor::ISensorManager::~ISensorManager ( )
virtual

Destructor for ISensorManager

Member Function Documentation

virtual telux::common::ServiceStatus telux::sensor::ISensorManager::getServiceStatus ( )
pure virtual

Checks the status of sensor sub-system and returns the result.

Returns
the status of sensor sub-system status telux::common::ServiceStatus
Note
Eval: This is a new API and is being evaluated. It is subject to change and could break backwards compatibility.
virtual telux::common::Status telux::sensor::ISensorManager::getAvailableSensorInfo ( std::vector< SensorInfo > &  info)
pure virtual

Get information related to the sensors available in the system.

Parameters
[out]infoList of information on sensors available in the system telux::sensor::SensorInfo
Returns
status of the request telux::common::Status
Note
Eval: This is a new API and is being evaluated. It is subject to change and could break backwards compatibility.
virtual telux::common::Status telux::sensor::ISensorManager::getSensor ( std::shared_ptr< ISensor > &  sensor,
std::string  name 
)
pure virtual

Get an instance of ISensor to interact with the underlying sensor. The provided instance is not a singleton. Everytime this method is called a new sensor object is created. It is the caller's responsibility to maintain the object Every instance of the sensor returned acts as new client and can configure the underlying sensor with it's own configuration and it's own callbacks for telux::sensor::ISensorEvent and configuration update among other events telux::sensor::ISenorEventListener.

Parameters
[out]sensor- An instance of telux::sensor::ISensor to interact with the underlying sensor is provided as a result of the method If the initialization of the sensor and underlying system fails, sensor is set to nullptr
[in]name- The unique name of the sensor telux::sensor::SensorInfo::name that was provided in the list of sensor information by telux::sensor::getAvailableSensorInfo
Returns
Status of request telux::common::Status
Note
Eval: This is a new API and is being evaluated. It is subject to change and could break backwards compatibility.