Telematics SDK - API Reference
v1.54.0
|
Data Structures | |
class | telux::sensor::ISensorEventListener |
ISensorEventListener interface is used to receive notifications related to sensor events and configuration updates. More... | |
class | telux::sensor::ISensorClient |
ISensorClient interface is used to access the different services provided by the sensor framework to configure, activate and acquire 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... | |
Typedefs | |
using | telux::sensor::SelfTestResultCallback = std::function< void(telux::common::ErrorCode result)> |
This file hosts the sensor interfaces to configure, activate or get data from the individual sensors available - Gyroscope, Accelerometer, etc. More... | |
using | telux::sensor::ISensor = ISensorClient |
This section contains APIs related to sensor configuration, sensor control and data acquisition from sensors.
class telux::sensor::ISensorEventListener |
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 () |
|
virtual |
The destructor for the sensor event listener
|
virtual |
This function is called to notify about available sensor events. Note the following constraints on this listener API It shall not perform time consuming (compute or I/O intensive) operations on this thread It shall not inovke an sensor APIs on this thread due to the underlying concurrency model
On platforms with Access control enabled, the client needs to have TELUX_SENSOR_DATA_READ permission for this listener API to be invoked.
[in] | events | - List of sensor events |
|
virtual |
This function is called to notify any change in the configuration of the ISensorClient object this listener is associated with.
On platforms with Access control enabled, the client needs to have TELUX_SENSOR_DATA_READ permission for this listener API to be invoked.
[in] | configuration | - The new configuration of the sensor client. 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 |
class telux::sensor::ISensorClient |
ISensorClient interface is used to access the different services provided by the sensor framework to configure, activate and acquire sensor data.
Each instance of this class is a unique sensor client to the underlying sensor framework and any number of such clients can exist in a given process. Each of these clients can acquire data from the underlying sensor framework with different configurations.
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 | selfTest (SelfTestType selfTestType, SelfTestResultCallback cb)=0 |
virtual telux::common::Status | registerListener (std::weak_ptr< ISensorEventListener > listener)=0 |
virtual telux::common::Status | deregisterListener (std::weak_ptr< ISensorEventListener > listener)=0 |
virtual | ~ISensorClient () |
virtual telux::common::Status | enableLowPowerMode ()=0 |
virtual telux::common::Status | disableLowPowerMode ()=0 |
|
virtual |
Destructor for ISensorClient.
Internally, the sensor client object is first deactivated and then destroyed.
|
pure virtual |
Get the information related to sensor
|
pure virtual |
Configure the sensor client 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 client needs to be reconfigured after having been activated, the client should be deactivated, configured and activated again as a part of the reconfiguration process.
It is always recommended that configuration of a client is done before activating it. If a client is activated without configuration, the client 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
On platforms with Access control enabled, Caller needs to have TELUX_SENSOR_DATA_READ permission to invoke this API successfully.
[in] | configuration | - The desired configuration for the client telux::sensor::SensorConfiguration. Ensure the required validity mask telux::sensor::SensorConfiguration::validityMask is set for the configuration. |
|
pure virtual |
Get the current configuration of this sensor client
On platforms with Access control enabled, Caller needs to have TELUX_SENSOR_DATA_READ permission to invoke this API successfully.
|
pure virtual |
Activate the sensor client. Once activated, any available sensor event will be notified via telux::sensor::ISensorEventListener::onEvent
It is always recommended that configuration of a client is done before activating it. If a client is activated without configuration, the client is configured with the 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. Activating an already activated sensor would result in the API returning telux::common::Status::SUCCESS.
Activating this sensor client would not impact other inactive sensor clients.
On platforms with Access control enabled, Caller needs to have TELUX_SENSOR_DATA_READ permission to invoke this API successfully.
|
pure virtual |
Deactivate the sensor client. Once deactivated, no further sensor events will be notified via telux::sensor::ISensorEventListener::onEvent. Deactivating an already inactive sensor would result in the API returning telux::common::Status::SUCCESS.
Deactivating this sensor client would not impact other active sensor clients.
On platforms with Access control enabled, Caller needs to have TELUX_SENSOR_DATA_READ permission to invoke this API successfully.
|
pure virtual |
Initiate self test on this sensor
If there are active data acquisition sessions corresponding to this sensor, these will be paused and the self test is initiated. Once the self test is complete the sensor data sessions will be restored.
On platforms with Access control enabled, Caller needs to have TELUX_SENSOR_PRIVILEGED_OPS permission to invoke this API successfully.
[in] | selfTestType | - The type of self test to be performed - telux::sensor::SelfTestType |
[in] | cb | - Callback to get the result of the self test initiated |
|
pure virtual |
Register a listener for sensor related events
|
pure virtual |
Deregister a sensor event listener
|
pure virtual |
Deprecated APIs 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.
|
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.
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< ISensorClient > &sensor, std::string name)=0 |
virtual telux::common::Status | getSensorClient (std::shared_ptr< ISensorClient > &sensor, std::string name)=0 |
virtual | ~ISensorManager () |
|
virtual |
Destructor for ISensorManager
|
pure virtual |
Checks the status of sensor sub-system and returns the result.
|
pure virtual |
Get information related to the sensors available in the system.
[out] | info | List of information on sensors available in the system telux::sensor::SensorInfo |
|
pure virtual |
Get an instance of ISensorClient 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 manage the object's lifetime. 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::SensorEvent and configuration update among other events telux::sensor::ISensorEventListener.
[out] | sensor | - An instance of telux::sensor::ISensorClient 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::ISensorManager::getAvailableSensorInfo |
|
pure virtual |
Get an instance of ISensorClient 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 manage the object's lifetime. 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::SensorEvent and configuration update among other events telux::sensor::ISensorEventListener.
[out] | sensor | - An instance of telux::sensor::ISensorClient 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::ISensorManager::getAvailableSensorInfo |
using telux::sensor::SelfTestResultCallback = typedef std::function<void(telux::common::ErrorCode result)> |
This file hosts the sensor interfaces to configure, activate or get data from the individual sensors available - Gyroscope, Accelerometer, etc.
This function is invoked when a result for a self-test initiated using telux::sensor::ISensorClient::selfTest is available.
[in] | result | The result of the self test - telux::common::ErrorCode |
using telux::sensor::ISensor = typedef ISensorClient |