DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

Detailed Description

Defines methods common to all sensors.

Data Structures

struct  dwSensorParams
 Holds sets of parameters for sensor creation. More...
 
struct  dwSensorSeekTable
 
struct  dwSensorSeekTableEntry
 A seek structure is made of memory offset, eventcount and timestamp. More...
 
struct  dwSensorStats
 Holds the available statistics for a sensor. More...
 

Macros

#define DW_SENSOR_MAX_PARAMETER_STRING_LENGTH   512
 Maximal length of the parameter string of a sensor. More...
 
#define DW_SENSOR_MAX_PROTOCOL_NAME_LENGTH   32
 Maximal length of the protocol name of a sensor. More...
 

Typedefs

typedef struct dwSALObject * dwSALHandle_t
 Handle representing the Sensor Abstraction Layer interface. More...
 
typedef struct dwSensorObject * dwSensorHandle_t
 Handle representing a sensor. More...
 

Enumerations

enum  dwPlatformOS {
  DW_PLATFORM_OS_LINUX = 0,
  DW_PLATFORM_OS_V5L = 1,
  DW_PLATFORM_OS_V5Q = 2,
  DW_PLATFORM_NUM = 3
}
 Defines the operating system in use. More...
 
enum  dwSensorType {
  DW_SENSOR_CAMERA = 0,
  DW_SENSOR_LIDAR,
  DW_SENSOR_GPS,
  DW_SENSOR_IMU,
  DW_SENSOR_CAN,
  DW_SENSOR_RADAR,
  DW_SENSOR_TIME,
  DW_SENSOR_DATA,
  DW_SENSOR_ULTRASONIC,
  DW_SENSOR_COUNT
}
 Defines the type of sensors that are available in DriveWorks. More...
 

Functions

DW_API_PUBLIC dwStatus dwSAL_createSensor (dwSensorHandle_t *const sensor, dwSensorParams const params, dwSALHandle_t const sal)
 Creates a new sensor managed by the SAL module with the given parameters. More...
 
DW_API_PUBLIC dwStatus dwSAL_getNumSensors (uint32_t *const num, dwPlatformOS const os, dwSALHandle_t const sal)
 Gets number of available sensors for a platform. More...
 
DW_API_PUBLIC dwStatus dwSAL_getPlatform (dwPlatformOS *const os, dwSALHandle_t sal)
 Gets current platform the SDK is running on. More...
 
DW_API_PUBLIC dwStatus dwSAL_getPlatformInfo (char8_t const **const osName, dwPlatformOS const os, dwSALHandle_t const sal)
 Gets detailed information about the running hardware platform and operating system. More...
 
DW_API_PUBLIC dwStatus dwSAL_getSensorParameterString (const char **const parameters, uint32_t const idx, dwPlatformOS const os, dwSALHandle_t const sal)
 Gets the parameter string acceptable by a sensor. More...
 
DW_API_PUBLIC dwStatus dwSAL_getSensorProtocol (const char **const name, uint32_t const idx, dwPlatformOS const os, dwSALHandle_t const sal)
 Gets protocol name of a sensor for a given index, e.g., 'camera.gmsl' or 'can.file'. More...
 
DW_API_PUBLIC dwStatus dwSAL_initialize (dwSALHandle_t *const sal, dwContextHandle_t const context)
 Creates and initializes a SAL (sensor abstraction layer) module. More...
 
DW_API_PUBLIC dwStatus dwSAL_release (dwSALHandle_t const sal)
 Releases the SAL (sensor abstraction layer) module. More...
 
DW_API_PUBLIC dwStatus dwSAL_releaseSensor (dwSensorHandle_t const sensor)
 Releases a sensor managed by the SAL module. More...
 
DW_API_PUBLIC dwStatus dwSAL_reset (dwSALHandle_t const sal)
 Resets the SAL (sensor abstraction layer) module. More...
 
DW_API_PUBLIC dwStatus dwSensor_createSeekTable (dwSensorHandle_t const sensor)
 Forces recreation of the seek table, for sensors that support seeking. More...
 
DW_API_PUBLIC dwStatus dwSensor_getCurrentSeekPosition (size_t *const event, dwSensorHandle_t const sensor)
 Gets the current seek position of the sensor. More...
 
DW_API_PUBLIC dwStatus dwSensor_getNumSeekTableEntries (size_t *const size, dwSensorHandle_t const hsensor)
 Get the number of entries in the seek Table. More...
 
DW_API_PUBLIC dwStatus dwSensor_getSeekRange (size_t *const eventCount, dwTime_t *const startTimestampUs, dwTime_t *const endTimestampUs, dwSensorHandle_t const sensor)
 Retrieves the valid range of seek parameters, for sensors that support seeking. More...
 
DW_API_PUBLIC dwStatus dwSensor_getSeekTableEntries (dwSensorSeekTableEntry *const entries, size_t const numEntries, dwSensorHandle_t const sensor)
 Fill in the pre-allocated dwSensorSeekTableEntry array. More...
 
DW_API_PUBLIC dwStatus dwSensor_getStats (dwSensorStats *const stats, dwSensorHandle_t const sensor)
 Gets sensor statistics (if available). More...
 
DW_API_PUBLIC dwStatus dwSensor_readRawData (const uint8_t **const data, size_t *const size, dwTime_t const timeoutUs, dwSensorHandle_t const sensor)
 Reads RAW data from sensor as byte array. More...
 
DW_API_PUBLIC dwStatus dwSensor_reset (dwSensorHandle_t const sensor)
 Resets the sensor. More...
 
DW_API_PUBLIC dwStatus dwSensor_returnRawData (const uint8_t *const data, dwSensorHandle_t const sensor)
 Returns RAW data to sensor as a byte array. More...
 
DW_API_PUBLIC dwStatus dwSensor_saveSeekTable (const char *const fileName, dwSensorHandle_t const sensor)
 Saves the seek table for the sensor to a file, for sensors that support seek tables. More...
 
DW_API_PUBLIC dwStatus dwSensor_seekToEvent (size_t const event, dwSensorHandle_t const sensor)
 Seeks the sensor to an event, for sensors that support seeking. More...
 
DW_API_PUBLIC dwStatus dwSensor_seekToTime (dwTime_t const timestampUs, dwSensorHandle_t const sensor)
 Seeks the sensor to a specific timestamp, for sensors that support seeking. More...
 
DW_API_PUBLIC dwStatus dwSensor_setThreadAffinity (uint32_t const affinityMask, dwSensorHandle_t const sensor)
 Sets the affinity of the internal thread, for sensors that use an internal thread to communicate to the OS drivers. More...
 
DW_API_PUBLIC dwStatus dwSensor_setThreadPriority (int32_t const priority, dwSensorHandle_t const sensor)
 Sets the priority of the internal thread, for sensors that use an internal thread to communicate to the OS drivers. More...
 
DW_API_PUBLIC dwStatus dwSensor_start (dwSensorHandle_t const sensor)
 Starts the sensor previously successfully created with 'dwSAL_createSensor()'. More...
 
DW_API_PUBLIC dwStatus dwSensor_stop (dwSensorHandle_t const sensor)
 Stops the sensor. More...
 

Data Structure Documentation

◆ dwSensorParams

struct dwSensorParams
Data Fields
const void * auxiliarydata Additional data to pass to sensor creation function.

This data can be also used for data which cannot be passed as a string, but is required during sensor creation. Only specific subset of sensors might expect any data here, hence in general this should be NULL.

const char8_t * parameters Array to additional parameters provided to sensor creation.

In general, this array has a form of key/value pairs separated by commas, i.e., key1=value1,key2=value2,key3=value3. Only first DW_SENSOR_MAX_PARAMETER_STRING_LENGTH characters are used.

const char8_t * protocol Name of the protocol.

Only first DW_SENSOR_MAX_PROTOCOL_NAME_LENGTH characters are used.

◆ dwSensorSeekTable

struct dwSensorSeekTable
Data Fields
uint64_t * frameNum
size_t * frameSize
size_t numEntries
uint64_t * offset
uint64_t * timestamp

◆ dwSensorSeekTableEntry

struct dwSensorSeekTableEntry
Data Fields
uint64_t event counter of this event
uint64_t offset offset into a file of this event
uint64_t size size of the event present in the virtual data file, in bytes
dwTime_t timestamp timestamp of this entry

◆ dwSensorStats

struct dwSensorStats
Data Fields
uint64_t drops Number of events dropped.
uint64_t errors Number of encountered errors.
uint64_t events Number of normal events (excluding errors and drops).
dwTime_t timeDeltaCur Current time difference between two consecutive packets.
dwTime_t timeDeltaMax Maximum observed time difference between two consecutive packets.
float64_t timeDeltaMean Mean of all the deltas between consecutive timestamps.
dwTime_t timeDeltaMin Minimum observed time difference between two consecutive packets.
float64_t timeDeltaStandardDeviation Variance of all the deltas between consecutive timestamps.

Macro Definition Documentation

◆ DW_SENSOR_MAX_PARAMETER_STRING_LENGTH

#define DW_SENSOR_MAX_PARAMETER_STRING_LENGTH   512

Maximal length of the parameter string of a sensor.

Definition at line 89 of file Sensors.h.

◆ DW_SENSOR_MAX_PROTOCOL_NAME_LENGTH

#define DW_SENSOR_MAX_PROTOCOL_NAME_LENGTH   32

Maximal length of the protocol name of a sensor.

Definition at line 87 of file Sensors.h.

Typedef Documentation

◆ dwSALHandle_t

typedef struct dwSALObject* dwSALHandle_t

Handle representing the Sensor Abstraction Layer interface.

Definition at line 81 of file Sensors.h.

◆ dwSensorHandle_t

typedef struct dwSensorObject* dwSensorHandle_t

Handle representing a sensor.

Definition at line 84 of file Sensors.h.

Enumeration Type Documentation

◆ dwPlatformOS

Defines the operating system in use.

Enumerator
DW_PLATFORM_OS_LINUX 

Default Linux based platform.

DW_PLATFORM_OS_V5L 

aarch64 based Drive 5 Linux.

DW_PLATFORM_OS_V5Q 

aarch64 based Drive 5 QNX.

DW_PLATFORM_NUM 

Number of available platforms.

Definition at line 66 of file Sensors.h.

◆ dwSensorType

Defines the type of sensors that are available in DriveWorks.

Enumerator
DW_SENSOR_CAMERA 
DW_SENSOR_LIDAR 
DW_SENSOR_GPS 
DW_SENSOR_IMU 
DW_SENSOR_CAN 
DW_SENSOR_RADAR 
DW_SENSOR_TIME 
DW_SENSOR_DATA 
DW_SENSOR_ULTRASONIC 
DW_SENSOR_COUNT 

Definition at line 148 of file Sensors.h.

Function Documentation

◆ dwSAL_createSensor()

DW_API_PUBLIC dwStatus dwSAL_createSensor ( dwSensorHandle_t *const  sensor,
dwSensorParams const  params,
dwSALHandle_t const  sal 
)

Creates a new sensor managed by the SAL module with the given parameters.

The created sensor has to be released using the 'dwSAL_releaseSensor()' method.

Note
This returned sensor handle must be released using the 'dwSAL_releaseSensor()' method.
Parameters
[out]sensorA pointer to sensor handle that became valid after creation.
[in]paramsSpecifies the parameters for sensor creation.
[in]salSpecifies the handle to the SAL module that will manage the sensor.
Returns
DW_INVALID_ARGUMENT - if pointer to the sensor is NULL or protocol name is NULL
DW_INVALID_HANDLE - if provided SAL handle is invalid.
DW_SAL_NO_DRIVER_FOUND - if provided protocol name is unknown.
DW_SAL_SENSOR_ERROR - if a non recoverable error happens during sensor creation. For a virtual sensor which is reading from a file it could be file I/O error.
DW_SUCCESS

◆ dwSAL_getNumSensors()

DW_API_PUBLIC dwStatus dwSAL_getNumSensors ( uint32_t *const  num,
dwPlatformOS const  os,
dwSALHandle_t const  sal 
)

Gets number of available sensors for a platform.

Note
Only sensor queried for the current platform can be created using
See also
dwSAL_createSensor().
Parameters
[out]numA pointer to return number of sensor in the SAL.
[in]osSpecifies the identifier of the platform you are querying for.
[in]salSpecifies the SAL handle created with 'dwSAL_initialize()'.
Returns
DW_INVALID_HANDLE - if provided SAL or sensor handle is invalid.
DW_INVALID_ARGUMENT - if provided pointer is invalid.
DW_SUCCESS

◆ dwSAL_getPlatform()

DW_API_PUBLIC dwStatus dwSAL_getPlatform ( dwPlatformOS *const  os,
dwSALHandle_t  sal 
)

Gets current platform the SDK is running on.

Parameters
[out]osA pointer to the identifier of the platform the SDK is running on.
[in]salSpecifies the SAL handle created with 'dwSAL_initialize()'.
Returns
DW_INVALID_HANDLE - if provided SAL or sensor handle is invalid.
DW_SUCCESS

◆ dwSAL_getPlatformInfo()

DW_API_PUBLIC dwStatus dwSAL_getPlatformInfo ( char8_t const **const  osName,
dwPlatformOS const  os,
dwSALHandle_t const  sal 
)

Gets detailed information about the running hardware platform and operating system.

Parameters
[out]osNameA pointer to the pointer of the return location; short string of the name of the current platform.
[in]osSpecifies the identifier of the platform you are querying for.
[in]salSpecifies the SAL handle created with 'dwSAL_initialize()'.
Returns
DW_INVALID_HANDLE - if provided SAL or sensor handle is invalid
DW_SUCCESS

◆ dwSAL_getSensorParameterString()

DW_API_PUBLIC dwStatus dwSAL_getSensorParameterString ( const char **const  parameters,
uint32_t const  idx,
dwPlatformOS const  os,
dwSALHandle_t const  sal 
)

Gets the parameter string acceptable by a sensor.

A sensor generates a human readable string with parameters it accepts. It might contain optional parameters indicated with []. Parameters indicated with {a,b,c} means either or. All parameters are represented as key=value pairs, separated by a comma.

Parameters
[out]parametersA pointer to the pointer to the null terminated string will be returned here.
[in]idxSpecifies the index of a sensor; index must be between 0 and 'dwSAL_getNumSensors()-1'.
[in]osSpecifies the identifier of the platform you query.
[in]salSpecifies the SAL handle created with 'dwSAL_initialize()'.
Returns
DW_INVALID_HANDLE - if provided SAL or sensor handle is invalid.
DW_INVALID_ARGUMENT - if provided pointer is invalid or index outside of range.
DW_SUCCESS

◆ dwSAL_getSensorProtocol()

DW_API_PUBLIC dwStatus dwSAL_getSensorProtocol ( const char **const  name,
uint32_t const  idx,
dwPlatformOS const  os,
dwSALHandle_t const  sal 
)

Gets protocol name of a sensor for a given index, e.g., 'camera.gmsl' or 'can.file'.

Parameters
[out]nameA pointer to the pointer of the null terminated string will be returned here.
[in]idxSpecifies the index of a sensor; index must be between 0 and 'dwSAL_getNumSensors()-1'.
[in]osSpecifies the identifier of the platform you query.
[in]salSpecifies the SAL handle created with 'dwSAL_initialize()'.
Returns
DW_INVALID_HANDLE - if provided SAL or sensor handle is invalid.
DW_INVALID_ARGUMENT - if provided pointer is invalid or the index outside of range.
DW_SUCCESS

◆ dwSAL_initialize()

DW_API_PUBLIC dwStatus dwSAL_initialize ( dwSALHandle_t *const  sal,
dwContextHandle_t const  context 
)

Creates and initializes a SAL (sensor abstraction layer) module.

This method loads all available sensor drivers.

Parameters
[out]salA pointer to the SAL handle will be returned here.
[in]contextSpecifies the handle to the context under which the SAL module is created.
Returns
DW_INVALID_ARGUMENT - if pointer to the SAL handle is NULL.
DW_INVALID_HANDLE - if provided context handle is invalid.
DW_SUCCESS

◆ dwSAL_release()

DW_API_PUBLIC dwStatus dwSAL_release ( dwSALHandle_t const  sal)

Releases the SAL (sensor abstraction layer) module.

This method releases all created sensors and unloads all drivers.

Note
This method renders the SAL handle unusable.
Parameters
[in]salThe SAL handle to be released.
Returns
DW_INVALID_HANDLE - if provided SAL handle is invalid.
DW_SUCCESS

◆ dwSAL_releaseSensor()

DW_API_PUBLIC dwStatus dwSAL_releaseSensor ( dwSensorHandle_t const  sensor)

Releases a sensor managed by the SAL module.

In cases where a specific sensor needs to be released, this method can be used. In all other cases, the automatic sensor release of the 'dwSAL_release()' method is sufficient.

Note
This method renders the sensor handle unusable.
Parameters
[in]sensorThe handle to a sensor created previously with 'dwSAL_createSensor()'.
Returns
DW_INVALID_HANDLE - if provided SAL or sensor handle is invalid.
DW_SAL_SENSOR_ERROR - if provided sensor is not managed by this SAL.
DW_SUCCESS

◆ dwSAL_reset()

DW_API_PUBLIC dwStatus dwSAL_reset ( dwSALHandle_t const  sal)

Resets the SAL (sensor abstraction layer) module.

This method resets all sensors managed by this module.

Parameters
[in]salSpecifies the SAL handle to reset.
Returns
DW_INVALID_HANDLE - if provided SAL handle is invalid.
DW_ERROR - error of a sensor that could not be reset.
DW_SUCCESS

◆ dwSensor_createSeekTable()

DW_API_PUBLIC dwStatus dwSensor_createSeekTable ( dwSensorHandle_t const  sensor)

Forces recreation of the seek table, for sensors that support seeking.

Parameters
[in]sensorHandle to the sensor which seek table to write out
Returns
DW_INVALID_HANDLE - if provided sensor handle is invalid.
DW_NOT_SUPPORTED - if sensor does not implement this functionality, i.e. no seeking
DW_INVALID_ARGUMENT - if given fileName is invalid
DW_NOT_AVAILABLE - if sensor data contains non-monotonic timestamps
DW_SAL_SENSOR_ERROR - if a non recoverable error happens during table creation, for example file I/O error.
DW_SUCCESS
Note
This method will perform dynamic memory allocations, hence should not be used during run-time.
A sensor will be reset to the very first event after table creation.

◆ dwSensor_getCurrentSeekPosition()

DW_API_PUBLIC dwStatus dwSensor_getCurrentSeekPosition ( size_t *const  event,
dwSensorHandle_t const  sensor 
)

Gets the current seek position of the sensor.

The event index corresponding to the next sensor event which will be read with sensor's read methods.

Parameters
[out]eventEvent number which in the range [0;eventCount) of the next event.
[in]sensorHandle to the sensor which seek table to write out
Returns
DW_INVALID_HANDLE - if provided sensor handle is invalid.
DW_NOT_SUPPORTED - if sensor does not implement this functionality, i.e. no seeking
DW_NOT_AVAILABLE - if sensor supports seeking, but no seeking information is available
DW_END_OF_STREAM - if next read position is end of stream
DW_SUCCESS

◆ dwSensor_getNumSeekTableEntries()

DW_API_PUBLIC dwStatus dwSensor_getNumSeekTableEntries ( size_t *const  size,
dwSensorHandle_t const  hsensor 
)

Get the number of entries in the seek Table.

Parameters
[out]sizeA pointer to the size of the seek table
[in]hsensorHandle to the sensor to get size of seek table entry
Returns
DW_INVALID_HANDLE - if provided sensor handle is invalid.
DW_SUCCESS
Note
Use this method after calling dwSensor_createSeekTable

◆ dwSensor_getSeekRange()

DW_API_PUBLIC dwStatus dwSensor_getSeekRange ( size_t *const  eventCount,
dwTime_t *const  startTimestampUs,
dwTime_t *const  endTimestampUs,
dwSensorHandle_t const  sensor 
)

Retrieves the valid range of seek parameters, for sensors that support seeking.

Parameters
[out]eventCountNumber of events available to be sought to. Each event represents one data unit returned by the sensor from its read() method, e.g. one camera frame for camera, one CAN message, for a CAN sensor, etc.
[out]startTimestampUsTimestamp of the very first event in usec
[out]endTimestampUsTimestamp of the very last event in usec
[in]sensorHandle to the sensor which seek table to write out
Returns
DW_INVALID_HANDLE - if provided sensor handle is invalid.
DW_NOT_SUPPORTED - if sensor does not implement this functionality, i.e. no seeking
DW_NOT_AVAILABLE - if sensor supports seeking, but no seeking information is available
DW_SUCCESS

◆ dwSensor_getSeekTableEntries()

DW_API_PUBLIC dwStatus dwSensor_getSeekTableEntries ( dwSensorSeekTableEntry *const  entries,
size_t const  numEntries,
dwSensorHandle_t const  sensor 
)

Fill in the pre-allocated dwSensorSeekTableEntry array.

Parameters
[out]entriesFilled in array with seekTable entries
[in]numEntriesThe number of entries allocated in the entries array
[in]sensorHandle to the sensor which seek table to write out
Returns
DW_INVALID_HANDLE - if provided sensor handle is invalid.
DW_NOT_SUPPORTED - if sensor does not implement this functionality, i.e. no seeking
DW_INVALID_ARGUMENT - if the table provided is not large enough to fit the entire table
DW_SUCCESS
Note
See dwSensor_getNumSeekTableEntries to get the number of entries

◆ dwSensor_getStats()

DW_API_PUBLIC dwStatus dwSensor_getStats ( dwSensorStats *const  stats,
dwSensorHandle_t const  sensor 
)

Gets sensor statistics (if available).

Parameters
[out]statsA pointer to a structure containing the statistics.
[in]sensorHandle to the sensor
Returns
DW_INVALID_HANDLE - if provided sensor handle is invalid.
DW_NOT_SUPPORTED - if sensor does not implement this functionality
DW_NOT_AVAILABLE - if attempted to get stats from a running sensor
DW_SUCCESS

◆ dwSensor_readRawData()

DW_API_PUBLIC dwStatus dwSensor_readRawData ( const uint8_t **const  data,
size_t *const  size,
dwTime_t const  timeoutUs,
dwSensorHandle_t const  sensor 
)

Reads RAW data from sensor as byte array.

This call must be followed by 'dwSensor_returnRawData'. A sensor might provide access to raw data (i.e., unprocessed as received from hardware) data for an extended usage. Such data can for example be passed to serializer.

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.
[in]timeoutUsSpecifies the timeout in US to wait before unblocking.
[in]sensorSpecifies the sensor to read from.
Returns
DW_INVALID_HANDLE - if provided sensor handle is invalid.
DW_NOT_SUPPORTED - if sensor does not implement this functionality.
DW_END_OF_STREAM - if currently no new RAW data is available.
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
Note
On an I/O error a new read attempt will start before the failed location. Hence on file systems, such as network based file system, a new attempt to read data can be taken.

◆ dwSensor_reset()

DW_API_PUBLIC dwStatus dwSensor_reset ( dwSensorHandle_t const  sensor)

Resets the sensor.

The method blocks while the sensor is reset.

Note
References to sensor data must be returned prior to this call.
Parameters
[in]sensorSpecifies the sensor handle of a sensor previously created with 'dwSAL_createSensor()'.
Returns
DW_CUDA_ERROR - if the underlying sensor driver had a CUDA error.
DW_NVMEDIA_ERROR - if underlying sensor driver had an NvMedia error.
DW_INVALID_HANDLE - if given handle is not valid.
DW_SUCCESS

◆ dwSensor_returnRawData()

DW_API_PUBLIC dwStatus dwSensor_returnRawData ( const uint8_t *const  data,
dwSensorHandle_t const  sensor 
)

Returns RAW data to sensor as a byte array.

This call must be preceded by 'dwSensor_readRawData'.

Parameters
[in]dataA pointer to data that was populated with the RAW data.
[in]sensorSpecifies the sensor the data came from.
Returns
DW_INVALID_HANDLE - if provided sensor handle is 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

◆ dwSensor_saveSeekTable()

DW_API_PUBLIC dwStatus dwSensor_saveSeekTable ( const char *const  fileName,
dwSensorHandle_t const  sensor 
)

Saves the seek table for the sensor to a file, for sensors that support seek tables.

A seek table is available if a virtual sensor has been requested to create/load one during creation. Refer to each individual sensor to see what parameters need to be passed to instantiate or load seek table.

It is guaranteed that any seek table written out by this method can be parsed by the corresponding virtual sensor.

Parameters
[in]fileNameName of the file under a reachable path to write seek table to.
[in]sensorHandle to the sensor which seek table to write out
Returns
DW_INVALID_HANDLE - if provided sensor handle is invalid.
DW_NOT_SUPPORTED - if sensor does not implement this functionality, i.e. no seeking
DW_FILE_NOT_FOUND - if cannot open the file for writing
DW_END_OF_STREAM - if there was a problem while writing out the file, for example disk full
DW_INVALID_ARGUMENT - if given fileName is invalid
DW_NOT_AVAILABLE - if no seek table is currently available for the sensor
DW_SUCCESS
Note
Most of the virtual sensors expect their seek table to be stored next to the data file, having same name as the data file with an additional extension .seek, e.g. '/path/canbus.can.seek'

◆ dwSensor_seekToEvent()

DW_API_PUBLIC dwStatus dwSensor_seekToEvent ( size_t const  event,
dwSensorHandle_t const  sensor 
)

Seeks the sensor to an event, for sensors that support seeking.

Next readFrame(), readMessage(), etc. method would start to read from this event.

Parameters
[in]eventNumber of the event to seek to. Must be in the range [0; eventCount)
[in]sensorHandle to the sensor which seek table to write out
Returns
DW_INVALID_HANDLE - if provided sensor handle is invalid.
DW_NOT_SUPPORTED - if sensor does not implement this functionality, i.e. no seeking
DW_NOT_AVAILABLE - if sensor supports seeking, but no seeking information is available
DW_INVALID_ARGUMENT - if given event number is above available number of events
DW_SUCCESS
See also
dwSensor_getSeekRange()

◆ dwSensor_seekToTime()

DW_API_PUBLIC dwStatus dwSensor_seekToTime ( dwTime_t const  timestampUs,
dwSensorHandle_t const  sensor 
)

Seeks the sensor to a specific timestamp, for sensors that support seeking.

Next readFrame(), readMessage(), etc. method would start to read from an event which timestamp is greater or equal to the seek timestamp.

Parameters
[in]timestampUsTimestamp in usec to seek sensor to. Must be in the range [startTimestamp_us; endTimestamp_us]
[in]sensorHandle to the sensor which seek table to write out
Returns
DW_INVALID_HANDLE - if provided sensor handle is invalid.
DW_NOT_SUPPORTED - if sensor does not implement this functionality, i.e. no seeking
DW_NOT_AVAILABLE - if sensor supports seeking, but no seeking information is available
DW_INVALID_ARGUMENT - if given timestamp is outside the supported range
DW_SUCCESS
See also
dwSensor_getSeekRange()

◆ dwSensor_setThreadAffinity()

DW_API_PUBLIC dwStatus dwSensor_setThreadAffinity ( uint32_t const  affinityMask,
dwSensorHandle_t const  sensor 
)

Sets the affinity of the internal thread, for sensors that use an internal thread to communicate to the OS drivers.

Parameters
[in]affinityMaskBit mask setting 1 to CPU which shall execute sensor thread
[in]sensorHandle to the sensor to set thread priority
Returns
DW_INVALID_HANDLE - if provided sensor handle is invalid.
DW_NOT_SUPPORTED - if sensor does not implement this functionality, i.e. sensor does not has an internal thread or priority of the internal thread cannot be changed
DW_INVALID_ARGUMENT - if given affinity mask is outside of the valid range, i.e. points to invalid CPU
DW_NOT_AVAILABLE - if sensor is not running yet, i.e. sensor must be started before change can happen
DW_CALL_NOT_ALLOWED - if setting thread affinity is not allowed now, for example due to wrong privileges
DW_INTERNAL_ERROR - an internal error indicating unrecoverable error, in general this should not happen
DW_SUCCESS
Note
If multiple sensors have been created from same physical sensor, the thread affinity will be applied to the thread communicating with the phyiscal device, hence affecting all these sensors.

◆ dwSensor_setThreadPriority()

DW_API_PUBLIC dwStatus dwSensor_setThreadPriority ( int32_t const  priority,
dwSensorHandle_t const  sensor 
)

Sets the priority of the internal thread, for sensors that use an internal thread to communicate to the OS drivers.

This method sets the priority of the internal thread, if the sensor implementation supports it.

Parameters
[in]priorityPriority of the thread to set. In general the priority is in range [1;99]
[in]sensorHandle to the sensor to set thread priority
Returns
DW_INVALID_HANDLE - if provided sensor handle is invalid.
DW_NOT_SUPPORTED - if sensor does not implement this functionality, i.e. sensor does not has an internal thread or priority of the internal thread cannot be changed
DW_INVALID_ARGUMENT - if given priority number is outside of the valid range
DW_NOT_AVAILABLE - if sensor is not running yet, i.e. sensor must be started before change can happen
DW_CALL_NOT_ALLOWED - if setting thread priority is not allowed now, for example due to wrong privileges
DW_INTERNAL_ERROR - an internal error indicating unrecoverable error, in general this should not happen
DW_SUCCESS
Note
If multiple sensors have been created from same physical sensor, the thread priority will be applied to the thread communicating with the phyiscal device, hence affecting all these sensors.

◆ dwSensor_start()

DW_API_PUBLIC dwStatus dwSensor_start ( dwSensorHandle_t const  sensor)

Starts the sensor previously successfully created with 'dwSAL_createSensor()'.

After a sensor is successfully started, new sensor data can be acquired using corresponding sensor methods.

Note
This method might spawn a thread, depending on the sensor implementation. It is, however, guaranteed that the data returned by the sensor is valid in the calling thread. For example, a CUDA camera image is created in the same CUDA context as the callee.
Parameters
[in]sensorSpecifies the sensor handle of the sensor previously created with 'dwSAL_createSensor()'.
Returns
DW_CUDA_ERROR - if the underlying sensor driver had a CUDA error.
DW_NVMEDIA_ERROR - if underlying sensor driver had an NvMedia error.
DW_INVALID_HANDLE - if given handle is not valid.
DW_END_OF_STREAM - if end of stream reached.
DW_SUCCESS

◆ dwSensor_stop()

DW_API_PUBLIC dwStatus dwSensor_stop ( dwSensorHandle_t const  sensor)

Stops the sensor.

The method blocks while the sensor is stopped.

Parameters
[in]sensorSpecifies the sensor handle of a sensor previously created with 'dwSAL_createSensor()'.
Returns
DW_CUDA_ERROR - if the underlying sensor driver had a CUDA error.
DW_NVMEDIA_ERROR - if underlying sensor driver had an NvMedia error.
DW_INVALID_HANDLE - if given handle is not valid.
DW_SUCCESS