DriveWorks SDK Reference

| 0.6.67 Release

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-2017 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 
52 #ifndef DW_SENSORS_SENSORS_H__
53 #define DW_SENSORS_SENSORS_H__
54 
55 #include <dw/core/Config.h>
56 #include <dw/core/Exports.h>
57 #include <dw/core/Types.h>
58 #include <dw/core/Context.h>
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
65 typedef enum dwPlatformOS {
68 
71 
74 } dwPlatformOS;
75 
77 typedef struct dwSALObject *dwSALHandle_t;
78 
80 typedef struct dwSensorObject *dwSensorHandle_t;
81 
83 #define DW_SENSOR_MAX_PROTOCOL_NAME_LENGTH 32
84 
86 typedef struct dwSensorParams {
90  const char *protocol;
91 
96  const char *parameters;
97 
104 
106 
108 typedef struct dwSensorStats {
110  uint64_t events;
111 
113  uint64_t errors;
114 
116  uint64_t drops;
117 } dwSensorStats;
118 
120 typedef enum dwSensorType
121 {
128 } dwSensorType;
129 
142 dwStatus dwSAL_initialize(dwSALHandle_t *sal, dwContextHandle_t context);
143 
155 dwStatus dwSAL_reset(dwSALHandle_t sal);
156 
170 dwStatus dwSAL_release(dwSALHandle_t *sal);
171 
191 dwStatus dwSAL_createSensor(dwSensorHandle_t *sensor, dwSensorParams params, dwSALHandle_t sal);
192 
209 dwStatus dwSAL_releaseSensor(dwSensorHandle_t *sensor);
210 
222 dwStatus dwSAL_getPlatform(dwPlatformOS *os, dwSALHandle_t sal);
223 
236 dwStatus dwSAL_getPlatformInfo(const char **osName, dwPlatformOS os, dwSALHandle_t sal);
237 
253 dwStatus dwSAL_getNumSensors(uint32_t *num, dwPlatformOS os, dwSALHandle_t sal);
254 
268 dwStatus dwSAL_getSensorProtocol(const char **name, uint32_t idx, dwPlatformOS os, dwSALHandle_t sal);
269 
286 dwStatus dwSAL_getSensorParameterString(const char **parameters, uint32_t idx,
287  dwPlatformOS os, dwSALHandle_t sal);
288 
309 dwStatus dwSensor_start(dwSensorHandle_t sensor);
310 
322 dwStatus dwSensor_stop(dwSensorHandle_t sensor);
323 
337 dwStatus dwSensor_reset(dwSensorHandle_t sensor);
338 
362 dwStatus dwSensor_readRawData(const uint8_t **data, size_t *size,
363  dwTime_t timeout_us,
364  dwSensorHandle_t sensor);
365 
380 dwStatus dwSensor_returnRawData(const uint8_t *data, dwSensorHandle_t sensor);
381 
382 
399 dwStatus dwSensor_getSeekRange(size_t *eventCount,
400  dwTime_t *startTimestamp_us, dwTime_t *endTimestamp_us,
401  dwSensorHandle_t sensor);
402 
417 dwStatus dwSensor_getCurrentSeekPosition(size_t *event, dwSensorHandle_t sensor);
418 
436 dwStatus dwSensor_seekToTime(dwTime_t timestamp_us, dwSensorHandle_t sensor);
437 
454 dwStatus dwSensor_seekToEvent(size_t event, dwSensorHandle_t sensor);
455 
474 dwStatus dwSensor_createSeekTable(dwSensorHandle_t sensor);
475 
500 dwStatus dwSensor_saveSeekTable(const char* fileName, dwSensorHandle_t sensor);
501 
502 
524 dwStatus dwSensor_setThreadPriority(int32_t priority, dwSensorHandle_t sensor);
525 
546 dwStatus dwSensor_setThreadAffinity(int32_t affinityMask, dwSensorHandle_t sensor);
547 
560 dwStatus dwSensor_getStats(dwSensorStats *stats, dwSensorHandle_t sensor);
561 
562 #ifdef __cplusplus
563 }
564 #endif
565 
567 
568 #endif // DW_SENSORS_SENSORS_H__
Holds sets of parameters for sensor creation.
Definition: Sensors.h:86
NVIDIA DriveWorks API: Core Types
DW_API_PUBLIC dwStatus dwSensor_createSeekTable(dwSensorHandle_t sensor)
Forces recreation of the seek table, for sensors that support seeking.
void * auxiliarydata
Additional data to pass to sensor creation function.
Definition: Sensors.h:103
dwSensorType
Defines the type of sensors that are available in DriveWorks.
Definition: Sensors.h:120
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.
Holds the available statistics for a sensor.
Definition: Sensors.h:108
uint64_t dwTime_t
Specifies a timestamp unit, in microseconds.
Definition: Types.h:89
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...
NVIDIA DriveWorks API: Core Methods
const char * parameters
Array to additional parameters provided to sensor creation.
Definition: Sensors.h:96
aarch64 based Vibrante 4 Linux.
Definition: Sensors.h:70
uint64_t drops
Number of events dropped.
Definition: Sensors.h:116
uint64_t events
Number of normal events (excluding errors and drops).
Definition: Sensors.h:110
NVIDIA DriveWorks API: Core Exports
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., camera.gmsl or can.file.
DW_API_PUBLIC dwStatus dwSAL_initialize(dwSALHandle_t *sal, dwContextHandle_t context)
Creates and initializes a SAL module.
DW_API_PUBLIC dwStatus dwSAL_releaseSensor(dwSensorHandle_t *sensor)
Releases a sensor managed by the SAL module.
const char * protocol
Name of the protocol.
Definition: Sensors.h:90
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:80
dwStatus
Status definition.
Definition: Status.h:167
DW_API_PUBLIC dwStatus dwSensor_start(dwSensorHandle_t sensor)
Starts the sensor previously successfully created with dwSAL_createSensor().
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.
DW_API_PUBLIC dwStatus dwSensor_reset(dwSensorHandle_t sensor)
Resets the sensor.
dwPlatformOS
Defines the operating system in use.
Definition: Sensors.h:65
struct dwSALObject * dwSALHandle_t
Handle representing the Sensor Abstraction Layer interface.
Definition: Sensors.h:77
Default Linux based platform.
Definition: Sensors.h:67
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:78
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:73
DW_API_PUBLIC dwStatus dwSensor_getStats(dwSensorStats *stats, dwSensorHandle_t sensor)
Gets sensor statistics (if available).
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.
#define DW_API_PUBLIC
Definition: Exports.h:76
DW_API_PUBLIC dwStatus dwSAL_reset(dwSALHandle_t sal)
Resets the SAL module.
DW_API_PUBLIC dwStatus dwSAL_release(dwSALHandle_t *sal)
Releases the SAL module.
uint64_t errors
Number of encountered errors.
Definition: Sensors.h:113