NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 Release
SensorPlugin.h File Reference

Detailed Description

NVIDIA DriveWorks: Sensor Plugin Interface to interact with live sensors

Description: This file defines the interfaces to be implemented for live sensor plugins.

Definition in file SensorPlugin.h.

Go to the source code of this file.

Data Structures

struct  dwSensorPluginFunctions
 Function Table exposing sensor plugin functions. More...
 

Macros

#define SENSOR_PLUGIN_COMMON_FUNCTIONS
 

Typedefs

typedef voiddwSensorPluginSensorHandle_t
 Plugin handle. Used in plugin public interfaces. More...
 
typedef dwStatus(* dwSensorPlugin_initializeHandle) (dwSensorPluginSensorHandle_t *handle, char const *params, dwContextHandle_t ctx)
 Initialize a new handle to the sensor managed by the plugin module. More...
 
typedef dwStatus(* dwSensorPlugin_release) (dwSensorPluginSensorHandle_t handle)
 Releases a sensor managed by the plugin module. More...
 
typedef dwStatus(* dwSensorPlugin_start) (dwSensorPluginSensorHandle_t handle)
 Starts the sensor previously successfully created with 'dwSensorPlugin_createSensor' interface. More...
 
typedef dwStatus(* dwSensorPlugin_stop) (dwSensorPluginSensorHandle_t handle)
 Stops the sensor. More...
 
typedef dwStatus(* dwSensorPlugin_reset) (dwSensorPluginSensorHandle_t handle)
 Resets the sensor. More...
 
typedef dwStatus(* dwSensorPlugin_readRawData) (uint8_t const **data, size_t *size, dwTime_t *timestamp, dwTime_t timeout_us, dwSensorPluginSensorHandle_t handle)
 Reads RAW data for one single message from the sensor as byte array. More...
 
typedef dwStatus(* dwSensorPlugin_returnRawData) (uint8_t const *data, dwSensorPluginSensorHandle_t handle)
 Returns RAW data to sensor as a byte array. More...
 
typedef struct dwSensorPluginFunctions dwSensorPluginFunctions
 Function Table exposing sensor plugin functions. More...
 

Functions

DW_API_PUBLIC dwStatus dwSAL_registerSensorPlugin (dwSensorType sensorType, char const *codecMimeType, void const *funcTable, dwSALHandle_t const sal)
 Register sensor plugin which works with live sensors. More...
 

Macro Definition Documentation

◆ SENSOR_PLUGIN_COMMON_FUNCTIONS

#define SENSOR_PLUGIN_COMMON_FUNCTIONS
Value:
dwSensorPlugin_initializeHandle initializeHandle; \
dwSensorPlugin_release release; \
dwSensorPlugin_start start; \
dwSensorPlugin_stop stop; \
dwSensorPlugin_reset reset; \
dwSensorPlugin_readRawData readRawData; \
dwSensorPlugin_returnRawData returnRawData

Definition at line 156 of file SensorPlugin.h.

Typedef Documentation

◆ dwSensorPlugin_initializeHandle

typedef dwStatus(* dwSensorPlugin_initializeHandle) (dwSensorPluginSensorHandle_t *handle, char const *params, dwContextHandle_t ctx)

Initialize a new handle to the sensor managed by the plugin module.

Parameters
[out]handleA pointer to sensor handle.
[in]paramsSpecifies the parameters for the sensor.
[in]ctxcontext handle.
Returns
DW_INVALID_ARGUMENT - if pointer to the sensor handle is NULL.
DW_SUCCESS

Definition at line 46 of file SensorPlugin.h.

◆ dwSensorPlugin_readRawData

typedef dwStatus(* dwSensorPlugin_readRawData) (uint8_t const **data, size_t *size, dwTime_t *timestamp, dwTime_t timeout_us, dwSensorPluginSensorHandle_t handle)

Reads RAW data for one single message from the sensor as byte array.

This should be the raw unprocessed data received from the sensor. Generally this is the entrypoint to perform a read operation on the sensor.

For each raw "message" from the sensor, data must be packed in the following memory layout:

Payload Size (uint32_t) | Timestamp (dwTime_t) | Payload

It is the responsiblility of the plugin author to do perform the memory allocation for the memory buffer that will be given out via this API.

Please note the following considerations on the behavior of this API:

1. This API may be called several times before a call to 'dwSensorPlugin_returnRawData',
   which means your plugin implementation must support multiple "raw data" buffers in flight.
2. The buffer given out by this API will be returned by a call to '_dwSensorPlugin_returnRawData()'
3. The size reported as the output of this API shall include the header shown above
Note
To support the multiple buffers in flight behavior described again, a reference BufferPool data structure implementation is released with the plugin samples.
Parameters
[out]dataA pointer to the pointer to data that is populated with the RAW data.
[out]sizeA pointer to the size of the data array.
[out]timestampSpecifies the host timestamp of raw data message.
[in]timeout_usSpecifies the timeout in us to wait before unblocking.
[in]handleSpecifies the sensor handle to read from.
Returns
DW_INVALID_HANDLE - if the sensor handle is NULL or invalid
DW_NOT_SUPPORTED - if sensor does not implement this functionality.
DW_CALL_NOT_ALLOWED - if sensor cannot execute the call, for example, due to decoding data.
DW_INVALID_ARGUMENT - if one of the given arguments is invalid.
DW_TIME_OUT - if the requested timed out.
DW_SAL_SENSOR_ERROR - if there was an unrecoverable i/o error.
DW_SUCCESS

Definition at line 138 of file SensorPlugin.h.

◆ dwSensorPlugin_release

typedef dwStatus(* dwSensorPlugin_release) (dwSensorPluginSensorHandle_t handle)

Releases a sensor managed by the plugin module.

Note
This method renders the sensor handle unusable.
Parameters
[in]handleThe handle to a sensor created previously with the 'dwSensorPlugin_createHandle' interface.
Returns
DW_INVALID_HANDLE - if the sensor handle is NULL or invalid
DW_SUCCESS

Definition at line 60 of file SensorPlugin.h.

◆ dwSensorPlugin_reset

typedef dwStatus(* dwSensorPlugin_reset) (dwSensorPluginSensorHandle_t handle)

Resets the sensor.

The method shall block while the sensor is reset.

Note
It is guarunteed that all outstanding references to sensor data will be returned prior to this call.
Parameters
[in]handleA sensor handle previously created w/ the 'dwSensorPlugin_createHandle' interface.
Returns
DW_INVALID_HANDLE - if the sensor handle is NULL or invalid
DW_SAL_SENSOR_ERROR - if a non recoverable error happens during sensor reset.
DW_SUCCESS

Definition at line 98 of file SensorPlugin.h.

◆ dwSensorPlugin_returnRawData

typedef dwStatus(* dwSensorPlugin_returnRawData) (uint8_t const *data, dwSensorPluginSensorHandle_t handle)

Returns RAW data to sensor as a byte array.

The returned pointer must have been previously obtained by a call to the 'dwSensorPlugin_readRawData' interface.

Parameters
[in]dataA pointer to data that was populated with the RAW data.
[in]handleSpecifies the sensor the data came from.
Returns
DW_INVALID_HANDLE - if the sensor handle is NULL or invalid
DW_CALL_NOT_ALLOWED - if sensor cannot execute the call, for example, due to decoding data.
DW_NOT_SUPPORTED - if sensor does not implement this functionality.
DW_INVALID_ARGUMENT - if given data pointer is invalid.
DW_SUCCESS

Definition at line 154 of file SensorPlugin.h.

◆ dwSensorPlugin_start

typedef dwStatus(* dwSensorPlugin_start) (dwSensorPluginSensorHandle_t handle)

Starts the sensor previously successfully created with 'dwSensorPlugin_createSensor' interface.

Sensor data should ready to be received using the '_dwSensorPlugin_readRawData()' API after the execution of this call.

Parameters
[in]handleA sensor handle previously created w/ the 'dwSensorPlugin_createHandle' interface.
Returns
DW_INVALID_HANDLE - if the sensor handle is NULL or invalid
DW_SAL_SENSOR_ERROR - if a non recoverable error happens during sensor start.
DW_SUCCESS

Definition at line 74 of file SensorPlugin.h.

◆ dwSensorPlugin_stop

typedef dwStatus(* dwSensorPlugin_stop) (dwSensorPluginSensorHandle_t handle)

Stops the sensor.

This method shall block while the sensor is stopped.

Parameters
[in]handleA sensor handle previously created w/ the 'dwSensorPlugin_createHandle' interface.
Returns
DW_INVALID_HANDLE - if the sensor handle is NULL or invalid
DW_SAL_SENSOR_ERROR - if a non recoverable error happens during sensor stop.
DW_SUCCESS

Definition at line 85 of file SensorPlugin.h.

◆ dwSensorPluginFunctions

Function Table exposing sensor plugin functions.

◆ dwSensorPluginSensorHandle_t

Plugin handle. Used in plugin public interfaces.

Definition at line 33 of file SensorPlugin.h.

Function Documentation

◆ dwSAL_registerSensorPlugin()

DW_API_PUBLIC dwStatus dwSAL_registerSensorPlugin ( dwSensorType  sensorType,
char const *  codecMimeType,
void const *  funcTable,
dwSALHandle_t const  sal 
)

Register sensor plugin which works with live sensors.

Parameters
[in]sensorTypethe sensor type of registered sensor plugin
[in]codecMimeTypethe codec type of registered CodecHeader plugin
[in]funcTablepointer to sensor plugin function pointer table
[in]salSpecifies the SAL handle to register sensor plugin.
Returns
DW_INVALID_ARGUMENT if codecMimeType, funcTable or sal is nullptr.
DW_BUFFER_FULL if no available entry in registration factory DW_SUCCESS
API Group
  • Init: Yes
  • Runtime: No
  • De-Init: No
dwSensorPlugin_initializeHandle
dwStatus(* dwSensorPlugin_initializeHandle)(dwSensorPluginSensorHandle_t *handle, char const *params, dwContextHandle_t ctx)
Initialize a new handle to the sensor managed by the plugin module.
Definition: SensorPlugin.h:46