DriveWorks SDK Reference
3.5.78 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 {
102 
109 
115  const void* auxiliarydata;
116 
118 
120 typedef struct dwSensorStats
121 {
123  uint64_t events;
124 
126  uint64_t errors;
127 
129  uint64_t drops;
130 
134 
138 
142 
145 
148 
149 } dwSensorStats;
150 
152 typedef enum dwSensorType {
162 } dwSensorType;
163 
166 {
169 
171  uint64_t event;
172 
174  uint64_t offset;
175 
177  uint64_t size;
178 
180 
181 //Holds the available seek table entries for the sensor
182 typedef struct dwSensorSeekTable
183 {
184  size_t numEntries;
185  uint64_t* timestamp;
186  uint64_t* offset;
187  uint64_t* frameNum;
188  size_t* frameSize;
190 
203 dwStatus dwSAL_initialize(dwSALHandle_t* const sal, dwContextHandle_t const context);
204 
216 dwStatus dwSAL_reset(dwSALHandle_t const sal);
217 
231 dwStatus dwSAL_release(dwSALHandle_t const sal);
232 
252 dwStatus dwSAL_createSensor(dwSensorHandle_t* const sensor, dwSensorParams const params, dwSALHandle_t const sal);
253 
270 dwStatus dwSAL_releaseSensor(dwSensorHandle_t const sensor);
271 
283 dwStatus dwSAL_getPlatform(dwPlatformOS* const os, dwSALHandle_t sal);
284 
297 dwStatus dwSAL_getPlatformInfo(char8_t const** const osName, dwPlatformOS const os, dwSALHandle_t const sal);
298 
314 dwStatus dwSAL_getNumSensors(uint32_t* const num, dwPlatformOS const os, dwSALHandle_t const sal);
315 
329 dwStatus dwSAL_getSensorProtocol(const char** const name, uint32_t const idx, dwPlatformOS const os, dwSALHandle_t const sal);
330 
347 dwStatus dwSAL_getSensorParameterString(const char** const parameters, uint32_t const idx,
348  dwPlatformOS const os, dwSALHandle_t const sal);
349 
370 dwStatus dwSensor_start(dwSensorHandle_t const sensor);
371 
383 dwStatus dwSensor_stop(dwSensorHandle_t const sensor);
384 
398 dwStatus dwSensor_reset(dwSensorHandle_t const sensor);
399 
423 dwStatus dwSensor_readRawData(const uint8_t** const data, size_t* const size,
424  dwTime_t const timeout_us,
425  dwSensorHandle_t const sensor);
426 
441 dwStatus dwSensor_returnRawData(const uint8_t* const data, dwSensorHandle_t const sensor);
442 
459 dwStatus dwSensor_getSeekRange(size_t* const eventCount,
460  dwTime_t* const startTimestamp_us, dwTime_t* const endTimestamp_us,
461  dwSensorHandle_t const sensor);
462 
477 dwStatus dwSensor_getCurrentSeekPosition(size_t* const event, dwSensorHandle_t const sensor);
478 
496 dwStatus dwSensor_seekToTime(dwTime_t const timestamp_us, dwSensorHandle_t const sensor);
497 
514 dwStatus dwSensor_seekToEvent(size_t const event, dwSensorHandle_t const sensor);
515 
534 dwStatus dwSensor_createSeekTable(dwSensorHandle_t const sensor);
535 
549 dwStatus dwSensor_getNumSeekTableEntries(size_t* const size, dwSensorHandle_t const hsensor);
550 
567 dwStatus dwSensor_getSeekTableEntries(dwSensorSeekTableEntry* const entries, size_t const numEntries, dwSensorHandle_t const sensor);
568 
593 dwStatus dwSensor_saveSeekTable(const char* const fileName, dwSensorHandle_t const sensor);
594 
616 dwStatus dwSensor_setThreadPriority(int32_t const priority, dwSensorHandle_t const sensor);
617 
638 dwStatus dwSensor_setThreadAffinity(int32_t const affinityMask, dwSensorHandle_t const sensor);
639 
652 dwStatus dwSensor_getStats(dwSensorStats* const stats, dwSensorHandle_t const sensor);
653 
654 #ifdef __cplusplus
655 }
656 #endif
657 
659 
660 #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:141
NVIDIA DriveWorks API: Core Types
uint64_t * timestamp
Definition: Sensors.h:185
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:152
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:137
const void * auxiliarydata
Additional data to pass to sensor creation function.
Definition: Sensors.h:115
Holds the available statistics for a sensor.
Definition: Sensors.h:120
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:177
DW_API_PUBLIC dwStatus dwSensor_stop(dwSensorHandle_t const sensor)
Stops the sensor.
DW_API_PUBLIC dwStatus dwSensor_readRawData(const uint8_t **const data, size_t *const size, dwTime_t const timeout_us, dwSensorHandle_t const sensor)
Reads RAW data from sensor as byte array.
size_t numEntries
Definition: Sensors.h:184
NVIDIA DriveWorks API: Core Methods
aarch64 based Drive 5 QNX.
Definition: Sensors.h:78
A seek structure is made of memory offset, eventcount and timestamp.
Definition: Sensors.h:165
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:75
uint64_t drops
Number of events dropped.
Definition: Sensors.h:129
uint64_t events
Number of normal events (excluding errors and drops).
Definition: Sensors.h:123
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:88
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:178
uint64_t offset
offset into a file of this event
Definition: Sensors.h:174
DW_API_PUBLIC dwStatus dwSensor_seekToTime(dwTime_t const timestamp_us, dwSensorHandle_t const sensor)
Seeks the sensor to a specific timestamp, for sensors that support seeking.
uint64_t * frameNum
Definition: Sensors.h:187
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:188
uint64_t * offset
Definition: Sensors.h:186
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:133
dwTime_t timestamp
timestamp of this entry
Definition: Sensors.h:168
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_getNumSensors(uint32_t *const num, dwPlatformOS const os, dwSALHandle_t const sal)
Gets number of available sensors for a platform.
DW_API_PUBLIC dwStatus dwSensor_setThreadAffinity(int32_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...
DW_API_PUBLIC dwStatus dwSAL_initialize(dwSALHandle_t *const sal, dwContextHandle_t const context)
Creates and initializes a SAL (sensor abstraction layer) module.
DW_API_PUBLIC dwStatus dwSensor_getSeekRange(size_t *const eventCount, dwTime_t *const startTimestamp_us, dwTime_t *const endTimestamp_us, dwSensorHandle_t const sensor)
Retrieves the valid range of seek parameters, for sensors that support seeking.
Default Linux based platform.
Definition: Sensors.h:72
uint64_t event
counter of this event
Definition: Sensors.h:171
struct dwContextObject * dwContextHandle_t
Context handle.
Definition: Context.h:80
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:81
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.
NVIDIA DriveWorks API: Core Exports
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:56
const char8_t * protocol
Name of the protocol.
Definition: Sensors.h:101
float64_t timeDeltaStandardDeviation
Variance of all the deltas between consecutive timestamps.
Definition: Sensors.h:144
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:147
uint64_t errors
Number of encountered errors.
Definition: Sensors.h:126
const char8_t * parameters
Array to additional parameters provided to sensor creation.
Definition: Sensors.h:108