DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

Sensors.h
Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed
3 // under the Mutual Non-Disclosure Agreement.
4 //
5 // Notice
6 // ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
7 // NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
8 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
9 // MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
10 //
11 // NVIDIA Corporation assumes no responsibility for the consequences of use of such
12 // information or for any infringement of patents or other rights of third parties that may
13 // result from its use. No license is granted by implication or otherwise under any patent
14 // or patent rights of NVIDIA Corporation. No third party distribution is allowed unless
15 // expressly authorized by NVIDIA. Details are subject to change without notice.
16 // This code supersedes and replaces all information previously supplied.
17 // NVIDIA Corporation products are not authorized for use as critical
18 // components in life support devices or systems without express written approval of
19 // NVIDIA Corporation.
20 //
21 // Copyright (c) 2016-2021 NVIDIA Corporation. All rights reserved.
22 //
23 // NVIDIA Corporation and its licensors retain all intellectual property and proprietary
24 // rights in and to this software and related documentation and any modifications thereto.
25 // Any use, reproduction, disclosure or distribution of this software and related
26 // documentation without an express license agreement from NVIDIA Corporation is
27 // strictly prohibited.
28 //
30 
54 #ifndef DW_SENSORS_SENSORS_H_
55 #define DW_SENSORS_SENSORS_H_
56 
57 #include <dw/core/base/Exports.h>
58 #include <dw/core/base/Types.h>
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
66 typedef enum dwPlatformOS {
69 
72 
75 
78 } dwPlatformOS;
79 
81 typedef struct dwSALObject* dwSALHandle_t;
82 
84 typedef struct dwSensorObject* dwSensorHandle_t;
85 
87 #define DW_SENSOR_MAX_PROTOCOL_NAME_LENGTH 32
88 #define DW_SENSOR_MAX_PARAMETER_STRING_LENGTH 512
90 
92 typedef struct dwSensorParams
93 {
97  const char8_t* protocol;
98 
105 
111  const void* auxiliarydata;
112 
114 
116 typedef struct dwSensorStats
117 {
119  uint64_t events;
120 
122  uint64_t errors;
123 
125  uint64_t drops;
126 
130 
134 
138 
141 
144 
145 } dwSensorStats;
146 
148 typedef enum dwSensorType {
159 } dwSensorType;
160 
163 {
166 
168  uint64_t event;
169 
171  uint64_t offset;
172 
174  uint64_t size;
175 
177 
178 //Holds the available seek table entries for the sensor
179 typedef struct dwSensorSeekTable
180 {
181  size_t numEntries;
182  uint64_t* timestamp;
183  uint64_t* offset;
184  uint64_t* frameNum;
185  size_t* frameSize;
187 
200 dwStatus dwSAL_initialize(dwSALHandle_t* const sal, dwContextHandle_t const context);
201 
213 dwStatus dwSAL_reset(dwSALHandle_t const sal);
214 
228 dwStatus dwSAL_release(dwSALHandle_t const sal);
229 
249 dwStatus dwSAL_createSensor(dwSensorHandle_t* const sensor, dwSensorParams const params, dwSALHandle_t const sal);
250 
267 dwStatus dwSAL_releaseSensor(dwSensorHandle_t const sensor);
268 
280 dwStatus dwSAL_getPlatform(dwPlatformOS* const os, dwSALHandle_t sal);
281 
294 dwStatus dwSAL_getPlatformInfo(char8_t const** const osName, dwPlatformOS const os, dwSALHandle_t const sal);
295 
311 dwStatus dwSAL_getNumSensors(uint32_t* const num, dwPlatformOS const os, dwSALHandle_t const sal);
312 
326 dwStatus dwSAL_getSensorProtocol(const char** const name, uint32_t const idx, dwPlatformOS const os, dwSALHandle_t const sal);
327 
344 dwStatus dwSAL_getSensorParameterString(const char** const parameters, uint32_t const idx,
345  dwPlatformOS const os, dwSALHandle_t const sal);
346 
367 dwStatus dwSensor_start(dwSensorHandle_t const sensor);
368 
380 dwStatus dwSensor_stop(dwSensorHandle_t const sensor);
381 
395 dwStatus dwSensor_reset(dwSensorHandle_t const sensor);
396 
420 dwStatus dwSensor_readRawData(const uint8_t** const data, size_t* const size,
421  dwTime_t const timeoutUs,
422  dwSensorHandle_t const sensor);
423 
438 dwStatus dwSensor_returnRawData(const uint8_t* const data, dwSensorHandle_t const sensor);
439 
456 dwStatus dwSensor_getSeekRange(size_t* const eventCount,
457  dwTime_t* const startTimestampUs, dwTime_t* const endTimestampUs,
458  dwSensorHandle_t const sensor);
459 
474 dwStatus dwSensor_getCurrentSeekPosition(size_t* const event, dwSensorHandle_t const sensor);
475 
493 dwStatus dwSensor_seekToTime(dwTime_t const timestampUs, dwSensorHandle_t const sensor);
494 
511 dwStatus dwSensor_seekToEvent(size_t const event, dwSensorHandle_t const sensor);
512 
531 dwStatus dwSensor_createSeekTable(dwSensorHandle_t const sensor);
532 
546 dwStatus dwSensor_getNumSeekTableEntries(size_t* const size, dwSensorHandle_t const hsensor);
547 
564 dwStatus dwSensor_getSeekTableEntries(dwSensorSeekTableEntry* const entries, size_t const numEntries, dwSensorHandle_t const sensor);
565 
590 dwStatus dwSensor_saveSeekTable(const char* const fileName, dwSensorHandle_t const sensor);
591 
613 dwStatus dwSensor_setThreadPriority(int32_t const priority, dwSensorHandle_t const sensor);
614 
635 dwStatus dwSensor_setThreadAffinity(uint32_t const affinityMask, dwSensorHandle_t const sensor);
636 
649 dwStatus dwSensor_getStats(dwSensorStats* const stats, dwSensorHandle_t const sensor);
650 
651 #ifdef __cplusplus
652 }
653 #endif
654 
656 #endif // DW_SENSORS_SENSORS_H_
NVIDIA DriveWorks API: Core Types
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.
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.
Holds sets of parameters for sensor creation.
Definition: Sensors.h:92
dwTime_t timeDeltaMax
Maximum observed time difference between two consecutive packets.
Definition: Sensors.h:137
uint64_t * timestamp
Definition: Sensors.h:182
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.
dwSensorType
Defines the type of sensors that are available in DriveWorks.
Definition: Sensors.h:148
DW_API_PUBLIC dwStatus dwSensor_getNumSeekTableEntries(size_t *const size, dwSensorHandle_t const hsensor)
Get the number of entries in the seek Table.
dwTime_t timeDeltaMin
Minimum observed time difference between two consecutive packets.
Definition: Sensors.h:133
const void * auxiliarydata
Additional data to pass to sensor creation function.
Definition: Sensors.h:111
Holds the available statistics for a sensor.
Definition: Sensors.h:116
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.
uint64_t size
size of the event present in the virtual data file, in bytes
Definition: Sensors.h:174
DW_API_PUBLIC dwStatus dwSensor_stop(dwSensorHandle_t const sensor)
Stops the sensor.
size_t numEntries
Definition: Sensors.h:181
aarch64 based Drive 5 QNX.
Definition: Sensors.h:74
A seek structure is made of memory offset, eventcount and timestamp.
Definition: Sensors.h:162
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.
DW_API_PUBLIC dwStatus dwSAL_reset(dwSALHandle_t const sal)
Resets the SAL (sensor abstraction layer) module.
aarch64 based Drive 5 Linux.
Definition: Sensors.h:71
uint64_t drops
Number of events dropped.
Definition: Sensors.h:125
uint64_t events
Number of normal events (excluding errors and drops).
Definition: Sensors.h:119
double float64_t
Definition: Types.h:71
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.
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 t...
struct dwSensorObject * dwSensorHandle_t
Handle representing a sensor.
Definition: Sensors.h:84
DW_API_PUBLIC dwStatus dwSensor_createSeekTable(dwSensorHandle_t const sensor)
Forces recreation of the seek table, for sensors that support seeking.
dwStatus
Status definition.
Definition: Status.h:180
uint64_t offset
offset into a file of this event
Definition: Sensors.h:171
uint64_t * frameNum
Definition: Sensors.h:184
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 t...
int64_t dwTime_t
Specifies a timestamp unit, in microseconds.
Definition: Types.h:82
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., &#39;camera.gmsl&#39; or &#39;can.file&#39;.
DW_API_PUBLIC dwStatus dwSAL_getPlatform(dwPlatformOS *const os, dwSALHandle_t sal)
Gets current platform the SDK is running on.
size_t * frameSize
Definition: Sensors.h:185
uint64_t * offset
Definition: Sensors.h:183
DW_API_PUBLIC dwStatus dwSAL_release(dwSALHandle_t const sal)
Releases the SAL (sensor abstraction layer) module.
DW_API_PUBLIC dwStatus dwSensor_reset(dwSensorHandle_t const sensor)
Resets the sensor.
dwTime_t timeDeltaCur
Current time difference between two consecutive packets.
Definition: Sensors.h:129
dwTime_t timestamp
timestamp of this entry
Definition: Sensors.h:165
dwPlatformOS
Defines the operating system in use.
Definition: Sensors.h:66
struct dwSALObject * dwSALHandle_t
Handle representing the Sensor Abstraction Layer interface.
Definition: Sensors.h:81
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.
DW_API_PUBLIC dwStatus dwSAL_initialize(dwSALHandle_t *const sal, dwContextHandle_t const context)
Creates and initializes a SAL (sensor abstraction layer) module.
Default Linux based platform.
Definition: Sensors.h:68
uint64_t event
counter of this event
Definition: Sensors.h:168
struct dwContextObject * dwContextHandle_t
Context handle.
Definition: Context.h:79
NVIDIA DriveWorks API: Core Methods
char char8_t
Definition: Types.h:72
DW_API_PUBLIC dwStatus dwSensor_start(dwSensorHandle_t const sensor)
Starts the sensor previously successfully created with &#39;dwSAL_createSensor()&#39;.
Number of available platforms.
Definition: Sensors.h:77
DW_API_PUBLIC dwStatus dwSensor_getSeekTableEntries(dwSensorSeekTableEntry *const entries, size_t const numEntries, dwSensorHandle_t const sensor)
Fill in the pre-allocated dwSensorSeekTableEntry array.
DW_API_PUBLIC dwStatus dwSensor_getCurrentSeekPosition(size_t *const event, dwSensorHandle_t const sensor)
Gets the current seek position of the sensor.
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.
DW_API_PUBLIC dwStatus dwSensor_getStats(dwSensorStats *const stats, dwSensorHandle_t const sensor)
Gets sensor statistics (if available).
DW_API_PUBLIC dwStatus dwSAL_releaseSensor(dwSensorHandle_t const sensor)
Releases a sensor managed by the SAL module.
DW_API_PUBLIC dwStatus dwSensor_returnRawData(const uint8_t *const data, dwSensorHandle_t const sensor)
Returns RAW data to sensor as a byte array.
#define DW_API_PUBLIC
Definition: Exports.h:54
const char8_t * protocol
Name of the protocol.
Definition: Sensors.h:97
float64_t timeDeltaStandardDeviation
Variance of all the deltas between consecutive timestamps.
Definition: Sensors.h:140
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.
float64_t timeDeltaMean
Mean of all the deltas between consecutive timestamps.
Definition: Sensors.h:143
uint64_t errors
Number of encountered errors.
Definition: Sensors.h:122
NVIDIA DriveWorks API: Core Exports
const char8_t * parameters
Array to additional parameters provided to sensor creation.
Definition: Sensors.h:104