DriveWorks SDK Reference
3.0.4260 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-2020 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 
58 #ifndef DW_SENSORS_SENSORS_H_
59 #define DW_SENSORS_SENSORS_H_
60 
61 #include <dw/core/Exports.h>
62 #include <dw/core/Types.h>
63 #include <dw/core/Context.h>
64 
65 #ifdef __cplusplus
66 extern "C" {
67 #endif
68 
70 typedef enum dwPlatformOS {
73 
76 
79 
82 } dwPlatformOS;
83 
85 typedef struct dwSALObject* dwSALHandle_t;
86 
88 typedef struct dwSensorObject* dwSensorHandle_t;
89 
91 #define DW_SENSOR_MAX_PROTOCOL_NAME_LENGTH 32
92 #define DW_SENSOR_MAX_PARAMETER_STRING_LENGTH 512
94 
96 typedef struct dwSensorParams
97 {
101  // FP: TODO(dwplc):
102  // coverity[autosar_cpp14_a3_9_1_violation]
103  const char* protocol;
104 
110  // FP: TODO(dwplc):
111  // coverity[autosar_cpp14_a3_9_1_violation]
112  const char* parameters;
113 
119  const void* auxiliarydata;
120 
122 
124 typedef struct dwSensorStats
125 {
127  uint64_t events;
128 
130  uint64_t errors;
131 
133  uint64_t drops;
134 
138 
142 
146 
149 
152 
153 } dwSensorStats;
154 
156 typedef enum dwSensorType {
166 } dwSensorType;
167 
170 {
173 
175  uint64_t event;
176 
178  uint64_t offset;
179 
181  uint64_t size;
182 
184 
185 //Holds the available seek table entries for the sensor
186 typedef struct dwSensorSeekTable
187 {
188  size_t numEntries;
189  uint64_t* timestamp;
190  uint64_t* offset;
191  uint64_t* frameNum;
192  size_t* frameSize;
194 
207 dwStatus dwSAL_initialize(dwSALHandle_t* sal, dwContextHandle_t context);
208 
220 dwStatus dwSAL_reset(dwSALHandle_t sal);
221 
235 dwStatus dwSAL_release(dwSALHandle_t sal);
236 
256 dwStatus dwSAL_createSensor(dwSensorHandle_t* sensor, dwSensorParams params, dwSALHandle_t sal);
257 
274 dwStatus dwSAL_releaseSensor(dwSensorHandle_t sensor);
275 
287 dwStatus dwSAL_getPlatform(dwPlatformOS* os, dwSALHandle_t sal);
288 
301 // FP: TODO(dwplc):
302 // coverity[autosar_cpp14_a3_9_1_violation]
303 dwStatus dwSAL_getPlatformInfo(const char** osName, dwPlatformOS os, dwSALHandle_t sal);
304 
320 dwStatus dwSAL_getNumSensors(uint32_t* num, dwPlatformOS os, dwSALHandle_t sal);
321 
335 // FP: TODO(dwplc):
336 // coverity[autosar_cpp14_a3_9_1_violation]
337 dwStatus dwSAL_getSensorProtocol(const char** name, uint32_t idx, dwPlatformOS os, dwSALHandle_t sal);
338 
355 // FP: TODO(dwplc):
356 // coverity[autosar_cpp14_a3_9_1_violation]
357 dwStatus dwSAL_getSensorParameterString(const char** parameters, uint32_t idx,
358  dwPlatformOS os, dwSALHandle_t sal);
359 
380 dwStatus dwSensor_start(dwSensorHandle_t sensor);
381 
393 dwStatus dwSensor_stop(dwSensorHandle_t sensor);
394 
408 dwStatus dwSensor_reset(dwSensorHandle_t sensor);
409 
433 dwStatus dwSensor_readRawData(const uint8_t** data, size_t* size,
434  dwTime_t timeout_us,
435  dwSensorHandle_t sensor);
436 
451 dwStatus dwSensor_returnRawData(const uint8_t* data, dwSensorHandle_t sensor);
452 
469 dwStatus dwSensor_getSeekRange(size_t* eventCount,
470  dwTime_t* startTimestamp_us, dwTime_t* endTimestamp_us,
471  dwSensorHandle_t sensor);
472 
487 dwStatus dwSensor_getCurrentSeekPosition(size_t* event, dwSensorHandle_t sensor);
488 
506 dwStatus dwSensor_seekToTime(dwTime_t timestamp_us, dwSensorHandle_t sensor);
507 
524 dwStatus dwSensor_seekToEvent(size_t event, dwSensorHandle_t sensor);
525 
544 dwStatus dwSensor_createSeekTable(dwSensorHandle_t sensor);
545 
559 dwStatus dwSensor_getNumSeekTableEntries(size_t* size, dwSensorHandle_t hsensor);
560 
577 dwStatus dwSensor_getSeekTableEntries(dwSensorSeekTableEntry* entries, size_t numEntries, dwSensorHandle_t sensor);
578 
603 // FP: TODO(dwplc):
604 // coverity[autosar_cpp14_a3_9_1_violation]
605 dwStatus dwSensor_saveSeekTable(const char* fileName, dwSensorHandle_t sensor);
606 
628 dwStatus dwSensor_setThreadPriority(int32_t priority, dwSensorHandle_t sensor);
629 
650 dwStatus dwSensor_setThreadAffinity(int32_t affinityMask, dwSensorHandle_t sensor);
651 
664 dwStatus dwSensor_getStats(dwSensorStats* stats, dwSensorHandle_t sensor);
665 
666 #ifdef __cplusplus
667 }
668 #endif
669 
671 
672 #endif // DW_SENSORS_SENSORS_H_
Holds sets of parameters for sensor creation.
Definition: Sensors.h:96
dwTime_t timeDeltaMax
Maximum observed time difference between two consecutive packets.
Definition: Sensors.h:145
NVIDIA DriveWorks API: Core Types
uint64_t * timestamp
Definition: Sensors.h:189
DW_API_PUBLIC dwStatus dwSensor_createSeekTable(dwSensorHandle_t sensor)
Forces recreation of the seek table, for sensors that support seeking.
DW_API_PUBLIC dwStatus dwSensor_getNumSeekTableEntries(size_t *size, dwSensorHandle_t hsensor)
Get the number of entries in the seek Table.
dwSensorType
Defines the type of sensors that are available in DriveWorks.
Definition: Sensors.h:156
dwTime_t timeDeltaMin
Minimum observed time difference between two consecutive packets.
Definition: Sensors.h:141
DW_API_PUBLIC dwStatus dwSensor_returnRawData(const uint8_t *data, dwSensorHandle_t sensor)
Returns RAW data to sensor as a byte array.
DW_API_PUBLIC dwStatus dwSensor_stop(dwSensorHandle_t sensor)
Stops the sensor.
DW_API_PUBLIC dwStatus dwSensor_seekToTime(dwTime_t timestamp_us, dwSensorHandle_t sensor)
Seeks the sensor to a specific timestamp, for sensors that support seeking.
const void * auxiliarydata
Additional data to pass to sensor creation function.
Definition: Sensors.h:119
Holds the available statistics for a sensor.
Definition: Sensors.h:124
uint64_t size
size of the event present in the virtual data file, in bytes
Definition: Sensors.h:181
DW_API_PUBLIC dwStatus dwSensor_setThreadPriority(int32_t priority, dwSensorHandle_t sensor)
Sets the priority of the internal thread, for sensors that use an internal thread to communicate to t...
size_t numEntries
Definition: Sensors.h:188
NVIDIA DriveWorks API: Core Methods
const char * parameters
Array to additional parameters provided to sensor creation.
Definition: Sensors.h:112
aarch64 based Drive 5 QNX.
Definition: Sensors.h:78
A seek structure is made of memory offset, eventcount and timestamp.
Definition: Sensors.h:169
aarch64 based Drive 5 Linux.
Definition: Sensors.h:75
uint64_t drops
Number of events dropped.
Definition: Sensors.h:133
uint64_t events
Number of normal events (excluding errors and drops).
Definition: Sensors.h:127
double float64_t
Definition: Types.h:71
DW_API_PUBLIC dwStatus dwSAL_getSensorParameterString(const char **parameters, uint32_t idx, dwPlatformOS os, dwSALHandle_t sal)
Gets the parameter string acceptable by a sensor.
DW_API_PUBLIC dwStatus dwSAL_getSensorProtocol(const char **name, uint32_t idx, dwPlatformOS os, dwSALHandle_t 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_initialize(dwSALHandle_t *sal, dwContextHandle_t context)
Creates and initializes a SAL (sensor abstraction layer) module.
const char * protocol
Name of the protocol.
Definition: Sensors.h:103
DW_API_PUBLIC dwStatus dwSAL_getNumSensors(uint32_t *num, dwPlatformOS os, dwSALHandle_t sal)
Gets number of available sensors for a platform.
struct dwSensorObject * dwSensorHandle_t
Handle representing a sensor.
Definition: Sensors.h:88
dwStatus
Status definition.
Definition: Status.h:166
uint64_t offset
offset into a file of this event
Definition: Sensors.h:178
uint64_t * frameNum
Definition: Sensors.h:191
DW_API_PUBLIC dwStatus dwSensor_start(dwSensorHandle_t sensor)
Starts the sensor previously successfully created with &#39;dwSAL_createSensor()&#39;.
int64_t dwTime_t
Specifies a timestamp unit, in microseconds.
Definition: Types.h:82
DW_API_PUBLIC dwStatus dwSensor_setThreadAffinity(int32_t affinityMask, dwSensorHandle_t sensor)
Sets the affinity of the internal thread, for sensors that use an internal thread to communicate to t...
DW_API_PUBLIC dwStatus dwSensor_getSeekRange(size_t *eventCount, dwTime_t *startTimestamp_us, dwTime_t *endTimestamp_us, dwSensorHandle_t sensor)
Retrieves the valid range of seek parameters, for sensors that support seeking.
size_t * frameSize
Definition: Sensors.h:192
DW_API_PUBLIC dwStatus dwSensor_reset(dwSensorHandle_t sensor)
Resets the sensor.
uint64_t * offset
Definition: Sensors.h:190
dwTime_t timeDeltaCur
Current time difference between two consecutive packets.
Definition: Sensors.h:137
dwTime_t timestamp
timestamp of this entry
Definition: Sensors.h:172
dwPlatformOS
Defines the operating system in use.
Definition: Sensors.h:70
struct dwSALObject * dwSALHandle_t
Handle representing the Sensor Abstraction Layer interface.
Definition: Sensors.h:85
DW_API_PUBLIC dwStatus dwSAL_releaseSensor(dwSensorHandle_t sensor)
Releases a sensor managed by the SAL module.
Default Linux based platform.
Definition: Sensors.h:72
uint64_t event
counter of this event
Definition: Sensors.h:175
DW_API_PUBLIC dwStatus dwSensor_readRawData(const uint8_t **data, size_t *size, dwTime_t timeout_us, dwSensorHandle_t sensor)
Reads RAW data from sensor as byte array.
DW_API_PUBLIC dwStatus dwSensor_saveSeekTable(const char *fileName, dwSensorHandle_t sensor)
Saves the seek table for the sensor to a file, for sensors that support seek tables.
struct dwContextObject * dwContextHandle_t
Context handle.
Definition: Context.h:80
DW_API_PUBLIC dwStatus dwSAL_getPlatformInfo(const char **osName, dwPlatformOS os, dwSALHandle_t sal)
Gets detailed information about the running hardware platform and operating system.
Number of available platforms.
Definition: Sensors.h:81
DW_API_PUBLIC dwStatus dwSensor_getStats(dwSensorStats *stats, dwSensorHandle_t sensor)
Gets sensor statistics (if available).
NVIDIA DriveWorks API: Core Exports
DW_API_PUBLIC dwStatus dwSensor_getSeekTableEntries(dwSensorSeekTableEntry *entries, size_t numEntries, dwSensorHandle_t sensor)
Fill in the pre-allocated dwSensorSeekTableEntry array.
DW_API_PUBLIC dwStatus dwSensor_seekToEvent(size_t event, dwSensorHandle_t sensor)
Seeks the sensor to an event, for sensors that support seeking.
DW_API_PUBLIC dwStatus dwSAL_createSensor(dwSensorHandle_t *sensor, dwSensorParams params, dwSALHandle_t sal)
Creates a new sensor managed by the SAL module with the given parameters.
DW_API_PUBLIC dwStatus dwSensor_getCurrentSeekPosition(size_t *event, dwSensorHandle_t sensor)
Gets the current seek position of the sensor.
DW_API_PUBLIC dwStatus dwSAL_getPlatform(dwPlatformOS *os, dwSALHandle_t sal)
Gets current platform the SDK is running on.
DW_API_PUBLIC dwStatus dwSAL_release(dwSALHandle_t sal)
Releases the SAL (sensor abstraction layer) module.
#define DW_API_PUBLIC
Definition: Exports.h:56
float64_t timeDeltaStandardDeviation
Variance of all the deltas between consecutive timestamps.
Definition: Sensors.h:148
DW_API_PUBLIC dwStatus dwSAL_reset(dwSALHandle_t sal)
Resets the SAL (sensor abstraction layer) module.
float64_t timeDeltaMean
Mean of all the deltas between consecutive timestamps.
Definition: Sensors.h:151
uint64_t errors
Number of encountered errors.
Definition: Sensors.h:130