Telematics SDK - Interface Specification  v1.46.10
Sensor service

Data Structures

struct  telux::sensor::SensorInfo
 Information related to sensor. More...
 
struct  telux::sensor::SensorConfiguration
 Configurable parameters of a sensor. More...
 
struct  telux::sensor::MotionSensorData
 Structure of a single sample from a motion sensor. More...
 
struct  telux::sensor::UncalibratedMotionSensorData
 Structure of a single sample from uncalibrated motion sensor. More...
 
struct  telux::sensor::SensorEvent
 Structure of a single sensor event. More...
 
struct  telux::sensor::SensorFeature
 Feature offered by sensor hardware and/or software framework. More...
 
struct  telux::sensor::SensorFeatureEvent
 Structure of an event that is generated from a sensor feature. More...
 
class  telux::sensor::SensorFactory
 SensorFactory is the central factory to create instances of sensor objects. More...
 
union  telux::sensor::SensorEvent.__unnamed__
 

Typedefs

using telux::sensor::SensorConfigMask = std::bitset< SensorConfigParams::SENSOR_CONFIG_NUM_PARAMS >
 

Enumerations

enum  telux::sensor::SensorType {
  telux::sensor::SensorType::ACCELEROMETER = 1, telux::sensor::SensorType::GYROSCOPE = 4, telux::sensor::SensorType::GYROSCOPE_UNCALIBRATED = 16, telux::sensor::SensorType::ACCELEROMETER_UNCALIBRATED = 35,
  telux::sensor::SensorType::INVALID = 0xFF
}
 Enumeration of different sensors available. More...
 
enum  telux::sensor::SensorConfigParams { telux::sensor::SAMPLING_RATE, telux::sensor::BATCH_COUNT, telux::sensor::SENSOR_CONFIG_NUM_PARAMS }
 

Detailed Description

This section contains APIs, data structures and components to access the sensor sub-system.


Data Structure Documentation

struct telux::sensor::SensorInfo

Information related to sensor.

Data Fields
int id

Unique identifier for the sensor.

SensorType type

The type of sensor, telux::sensor::SensorType

string name

The name of the sensor This name is used to get a reference to a sensor with telux::sensor::ISensorManager::getSensor

string vendor

The name of the vendor

vector< float > samplingRates

List of supported sampling rates by the sensor hardware, number of samples per second (Hz)

float maxSamplingRate

The maximum sampling rate the sensor can be configured for. This can be set in /etc/sensors.conf for each sensor and should be less than the maximum sampling rate supported by the sensor hardware, number of samples per second (Hz)

This attribute should be considered while using the API telux::sensor::ISensor::configure

uint32_t maxBatchCountSupported

Maximum batch count supported by the sensor, i.e. the maximum number of sensor events that the underlying framework can buffer.

This attribute should be considered while using the API telux::sensor::ISensor::configure

uint32_t minBatchCountSupported

Minimum batch count supported by the sensor. This is set in /etc/sensors.conf for each sensor.

This attribute should be considered while using the API telux::sensor::ISensor::configure

int range

The range offered by the sensor. This configuration can be set in /etc/sensors.conf for each sensor.

For accelerometers, this is the number of Gs (force per unit mass due to gravity)in either direction (+/-) on each axis

For gyroscopes, this is the number of degrees per second (dps) in either direction (+/-) along each axis

struct telux::sensor::SensorConfiguration

Configurable parameters of a sensor.

Data Fields
float samplingRate

The sampling rate for the sensor, number of samples per second (Hz)

In case of telux::sensor::ISensor::configure, the requested sampling rate should be one of the sampling rates provided in the telux::sensor::SensorInfo::samplingRates and should be less than the telux::sensor::SensorInfo::maxSamplingRate.

If the requested sampling rate is less than the minimum value in the telux::sensor::SensorInfo::samplingRates, it will be set to the least of the values in telux::sensor::SensorInfo::samplingRates

If the requested sampling rate is not one of the supported sampling rates in telux::sensor::SensorInfo::samplingRates, the requested value is floored to the nearest value in telux::sensor::SensorInfo::samplingRates

Consider telux::sensor::SensorInfo::samplingRates having values 12, 26, 52. If requested sampling rate in configure API is 7, the sampling rate considered by the sensor framework would be 12. If requested sampling rate in configure API is 51, the sampling rate considered by the sensor framework would be 26.

In case of a configuration update received via telux::sensor::ISensorEventListener::onConfigurationUpdate, the current sampling rate configuration is passed to the listener

uint32_t batchCount

The batch count of the sensor.

Batch count is the count of number of samples the underlying framework would buffer before notifying the client of the data. The intention is to reduce the number of interactions between the hardware, framework and the user application to reduce power consumption, improve compute efficiency and reduce number of interactions between different components. It is important to consider latency while deciding the batch count for a sensor. Higher the batch count, more is the latency for the samples.

In case of telux::sensor::ISensor::configure, the requested batch count should be lesser than the maximum supported batch count telux::sensor::SensorInfo::maxBatchCountSupported. Also, the batch count considered is impacted by the telux::sensor::SensorInfo::minBatchCountSupported.

If the requested batch count is less than telux::sensor::SensorInfo::minBatchCountSupported, it will be set to telux::sensor::SensorInfo::minBatchCountSupported

If the requested batch count is not a multiple of telux::sensor::SensorInfo::minBatchCountSupported, the requested value is floored to the nearest multiple of telux::sensor::SensorInfo::minBatchCountSupported

Consider telux::sensor::SensorInfo::minBatchCountSupported having a value of 7. If requested batchCount in configure API is 2, the batchCount considered by the sensor framework would be 7. If requested batchCount in configure API is 23, the batchCount considered by the sensor framework would be 21.

In case of a configuration update telux::sensor::ISensorEventListener::onConfigurationUpdate, this field indicates the current configuration for batch count.

SensorConfigMask validityMask

Bitset indicating the validity of the received sensor configuration via telux::sensor::ISensor::getConfiguration and telux::sensor::ISensorEventListener::onConfigurationUpdate. The configuration items that were never set would have return false when tested for using std::bitset::test

Further, this bitset should be set by the user to indicate the valid fields while configuring the sensor using telux::sensor::ISensor::configure. For continuous stream of data from a sensor, the validity of SAMPLING_RATE and BATCH_COUNT from SensorConfigParams should be considered. If the sensor had been already configured with both sampling rate and batch count, it is possible to reconfigure the sensor partially with just one of these attributes and setting the required validity flag.

SensorConfigMask updateMask

Bitset indicating the parameters that were updated since last notification via telux::sensor::ISensorEventListener::onConfigurationUpdate

struct telux::sensor::MotionSensorData

Structure of a single sample from a motion sensor.

Data Fields
float x

x-axis data, meter per second per second for accelerometer, radians per second for gyroscope

float y

y-axis data, meter per second per second for accelerometer, radians per second for gyroscope

float z

z-axis data, meter per second per second for accelerometer, radians per second for gyroscope

struct telux::sensor::UncalibratedMotionSensorData

Structure of a single sample from uncalibrated motion sensor.

Data Fields
MotionSensorData data

Uncalibrated motion sensor data MotionSensorData

MotionSensorData bias

Bias for the uncalibrated data MotionSensorData

struct telux::sensor::SensorEvent

Structure of a single sensor event.

Data Fields
uint64_t timestamp

Timestamp when the event was generated on the hardware, nanosecond since boot-up

union SensorEvent __unnamed__

Sensor data

struct telux::sensor::SensorFeature

Feature offered by sensor hardware and/or software framework.

Data Fields
string name

Name of the feature

struct telux::sensor::SensorFeatureEvent

Structure of an event that is generated from a sensor feature.

Data Fields
uint64_t timestamp

Best estimate of timestamp indicating the time of occurance of the event, nanosecond since boot-up

string name

Name of the feature that generated the event

int id

The ID of the generated event

class telux::sensor::SensorFactory

SensorFactory is the central factory to create instances of sensor objects.

Public Member Functions

virtual std::shared_ptr< ISensorManagergetSensorManager (telux::common::InitResponseCb clientCallback=nullptr)=0
 
virtual std::shared_ptr< ISensorFeatureManagergetSensorFeatureManager (telux::common::InitResponseCb clientCallback=nullptr)=0
 

Static Public Member Functions

static SensorFactorygetInstance ()
 

Protected Member Functions

 SensorFactory ()
 
virtual ~SensorFactory ()
 

Constructor & Destructor Documentation

telux::sensor::SensorFactory::SensorFactory ( )
protected
virtual telux::sensor::SensorFactory::~SensorFactory ( )
protectedvirtual

Member Function Documentation

static SensorFactory& telux::sensor::SensorFactory::getInstance ( )
static

Get Sensor Factory instance.

Returns
The singleton instance of SensorFactory object
Note
Eval: This is a new API and is being evaluated. It is subject to change and could break backwards compatibility.
virtual std::shared_ptr<ISensorManager> telux::sensor::SensorFactory::getSensorManager ( telux::common::InitResponseCb  clientCallback = nullptr)
pure virtual

Get an instance of Sensor Manager. The ownership of the returned object is with the caller of this method. The reference to the instance is not held by the SensorFactory. If the returned reference is released, any request for ISensorManager shall result in creation of a new instance

Parameters
[in]clientCallbackOptional callback to get the initialization status of SensorManager telux::common::InitResponseCb
Returns
An instance of ISensorManager If the initialization of the manager and underlying system fails, nullptr is returned
Note
Eval: This is a new API and is being evaluated. It is subject to change and could break backwards compatibility.
virtual std::shared_ptr<ISensorFeatureManager> telux::sensor::SensorFactory::getSensorFeatureManager ( telux::common::InitResponseCb  clientCallback = nullptr)
pure virtual

Get an instance of Sensor Feature Manager. The ownership of the returned object is with the caller of this method. The reference to the instance is not held by the SensorFactory. If the returned reference is released, any request for ISensorFeatureManager shall result in creation of a new instance

Parameters
[in]clientCallbackOptional callback to get the initialization status of SensorFeatureManager telux::common::InitResponseCb
Returns
An instance of ISensorFeatureManager If the initialization of the manager and underlying system fails, nullptr is returned
Note
Eval: This is a new API and is being evaluated. It is subject to change and could break backwards compatibility.
union telux::sensor::SensorEvent.__unnamed__

Sensor data

Data Fields
MotionSensorData calibrated

Calibrated data - should be accessed when the SensorType that generated the sensor event accounts for calibration - SensorType::ACCELEROMETER or SensorType::GYROSCOPE

UncalibratedMotionSensorData uncalibrated

Uncalibrated data - should be accessed when the SensorType that generated the sensor event provides uncalibrated data along with bias information - SensorType::ACCELEROMETER_UNCALIBRATED or SensorType::GYROSCOPE_UNCALIBRATED

Typedef Documentation

using telux::sensor::SensorConfigMask = typedef std::bitset<SensorConfigParams::SENSOR_CONFIG_NUM_PARAMS>

Enumeration Type Documentation

Enumeration of different sensors available.

Enumerator
ACCELEROMETER 

ID for the accelerometer sensor

GYROSCOPE 

ID for the gyroscope sensor

GYROSCOPE_UNCALIBRATED 

ID for the uncalibrated gyroscope sensor

ACCELEROMETER_UNCALIBRATED 

ID for the uncalibrated accelerometer sensor

INVALID 

Denotes that the sensor type is either unknown or invalid

Enumeration listing the different configuration parameters in

Enumerator
SAMPLING_RATE 

Corresponds to SensorConfiguration::samplingRate

BATCH_COUNT 

Corresponds to SensorConfiguration::batchCount

SENSOR_CONFIG_NUM_PARAMS