- Welcome
- Getting Started With the NVIDIA DriveWorks SDK
- Modules
- Samples
- Tools
- Tutorials
- SDK Porting Guide
- DriveWorks API
- More
Defines the CAN message interpreter methods.
Data Structures | |
struct | dwCANInterpreterInterface |
Interface for callback based CAN data interpreter. More... | |
Macros | |
#define | DW_SENSORS_CAN_INTERPRETER_MAX_MESSAGE_NAME_LEN 32 |
Maximal length of a message name [characters]. More... | |
#define | DW_SENSORS_CAN_INTERPRETER_MAX_SIGNAL_NAME_LEN 32 |
Maximal length of a signal name [characters]. More... | |
#define | DW_SENSORS_CAN_INTERPRETER_MESSAGE_MAX_SIGNALS 128 |
Maximal number of signals in a DBC message. More... | |
Typedefs | |
typedef void(* | dwCANInterpreterAddMessageFunc_t) (const dwCANMessage *msg, void *userData) |
Pushes new messages to the interpreter. More... | |
typedef bool(* | dwCANInterpreterGetDataf32Func_t) (float32_t *value, dwTime_t *timestamp_us, uint32_t idx, void *userData) |
Returns false if no float32 data is available. More... | |
typedef bool(* | dwCANInterpreterGetDataf64Func_t) (float64_t *value, dwTime_t *timestamp_us, uint32_t idx, void *userData) |
Returns false if no float64 data is available. More... | |
typedef bool(* | dwCANInterpreterGetDatai32Func_t) (int32_t *value, dwTime_t *timestamp_us, uint32_t idx, void *userData) |
Returns false if no int32 data is available. More... | |
typedef uint32_t(* | dwCANInterpreterGetNumAvailableFunc_t) (void *userData) |
Gets the number of signals available to be retrieved. The same signal may be available multiple times. More... | |
typedef bool(* | dwCANInterpreterGetSignalInfoFunc_t) (const char8_t **name, dwTrivialDataType *type, dwCANVehicleData *data, uint32_t idx, void *userData) |
Gets the name and type of a signal; the callback must return false if the query fails. More... | |
typedef struct dwCANInterpreterObject * | dwCANInterpreterHandle_t |
CAN message interpreter handle. More... | |
Functions | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_buildFromCallbacks (dwCANInterpreterHandle_t *interpreter, dwCANInterpreterInterface callbacks, void *userData, dwContextHandle_t context) |
Creates a CAN data interpreter based on user provided callbacks. More... | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_buildFromDBC (dwCANInterpreterHandle_t *interpreter, const char8_t *inputDBC, dwContextHandle_t ctx) |
Creates a CAN data interpreter based on DBC file format. More... | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_buildFromDBCString (dwCANInterpreterHandle_t *interpreter, const char8_t *dbc, dwContextHandle_t ctx) |
Creates a CAN data interpreter based on DBC file format and initializes the interpreter from a string. More... | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_consume (const dwCANMessage *msg, dwCANInterpreterHandle_t interpreter) |
Pushes a new message to the interpreter. More... | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_createMessage (dwCANMessage *msg, uint32_t id, dwCANInterpreterHandle_t interpreter) |
Initializes an empty can message an interpreter can encoded signals into. More... | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_createMessageFromName (dwCANMessage *msg, const char8_t *msgName, dwCANInterpreterHandle_t interpreter) |
Initializes an empty can message an interpreter can encoded signals into. More... | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_encodef32 (float32_t value, const char8_t *signal, dwCANMessage *msg, dwCANInterpreterHandle_t interpreter) |
Encodes a value for a signal into a given message. More... | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_encodef64 (float64_t value, const char8_t *signal, dwCANMessage *msg, dwCANInterpreterHandle_t interpreter) |
Same as dwCANInterpreter_encodef32, but for float64 types. More... | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_encodei32 (int32_t value, const char8_t *signal, dwCANMessage *msg, dwCANInterpreterHandle_t interpreter) |
Same as dwCANInterpreter_encodef32, but for int32 types. More... | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_getDataSignalIndex (uint32_t *idx, dwCANVehicleData data, dwCANInterpreterHandle_t interpreter) |
Gets the index of a signal of the last consumed message that corresponds to a certain predefined data type. More... | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_getf32 (float32_t *value, dwTime_t *timestamp_us, uint32_t idx, dwCANInterpreterHandle_t interpreter) |
Gets a 'float32_t' value from the available values. More... | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_getf64 (float64_t *value, dwTime_t *timestamp_us, uint32_t idx, dwCANInterpreterHandle_t interpreter) |
Same as dwCANInterpreter_getf32, but for float64 types. More... | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_geti32 (int32_t *value, dwTime_t *timestamp_us, uint32_t idx, dwCANInterpreterHandle_t interpreter) |
Same as dwCANInterpreter_getf32, but for int32 types. More... | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_getNumberSignals (uint32_t *num, dwCANInterpreterHandle_t interpreter) |
Gets the number of signals decoded and available for consumption by the application side. More... | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_getNumberSignalsInMessage (uint32_t *num, const dwCANMessage *msg, dwCANInterpreterHandle_t interpreter) |
Gets the number of signals a CAN interpreter can encode into the provided message. More... | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_getSignalName (const char8_t **name, uint32_t idx, dwCANInterpreterHandle_t interpreter) |
Gets the name of a signal available for consumption by the application as a string. More... | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_getSignalNameInMessage (const char8_t **name, uint32_t idx, const dwCANMessage *msg, dwCANInterpreterHandle_t interpreter) |
Gets the name of a signal that the CAN interpreter can encode in the currently active encoded message. More... | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_getSignalRange (float64_t *minimum, float64_t *maximum, uint32_t idx, dwCANInterpreterHandle_t interpreter) |
Returns the range of validity of data for a signal available for consumption by the application. More... | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_getSignalType (dwTrivialDataType *type, uint32_t idx, dwCANInterpreterHandle_t interpreter) |
Returns the type of the value of a signal available for consumption by the application. More... | |
DW_API_PUBLIC dwStatus | dwCANInterpreter_release (dwCANInterpreterHandle_t interpreter) |
Closes previously opened interpreter. More... | |
struct dwCANInterpreterInterface |
Data Fields | ||
---|---|---|
dwCANInterpreterAddMessageFunc_t | addMessage | |
dwCANInterpreterGetDataf32Func_t | getDataf32 | |
dwCANInterpreterGetDataf64Func_t | getDataf64 | |
dwCANInterpreterGetDatai32Func_t | getDatai32 | |
dwCANInterpreterGetNumAvailableFunc_t | getNumAvailableSignals | |
dwCANInterpreterGetSignalInfoFunc_t | getSignalInfo |
#define DW_SENSORS_CAN_INTERPRETER_MAX_MESSAGE_NAME_LEN 32 |
Maximal length of a message name [characters].
Definition at line 59 of file Interpreter.h.
#define DW_SENSORS_CAN_INTERPRETER_MAX_SIGNAL_NAME_LEN 32 |
Maximal length of a signal name [characters].
Definition at line 62 of file Interpreter.h.
#define DW_SENSORS_CAN_INTERPRETER_MESSAGE_MAX_SIGNALS 128 |
Maximal number of signals in a DBC message.
Definition at line 56 of file Interpreter.h.
typedef void(* dwCANInterpreterAddMessageFunc_t) (const dwCANMessage *msg, void *userData) |
Pushes new messages to the interpreter.
Definition at line 72 of file Interpreter.h.
typedef bool(* dwCANInterpreterGetDataf32Func_t) (float32_t *value, dwTime_t *timestamp_us, uint32_t idx, void *userData) |
Returns false if no float32 data is available.
Definition at line 83 of file Interpreter.h.
typedef bool(* dwCANInterpreterGetDataf64Func_t) (float64_t *value, dwTime_t *timestamp_us, uint32_t idx, void *userData) |
Returns false if no float64 data is available.
Definition at line 86 of file Interpreter.h.
typedef bool(* dwCANInterpreterGetDatai32Func_t) (int32_t *value, dwTime_t *timestamp_us, uint32_t idx, void *userData) |
Returns false if no int32 data is available.
Definition at line 89 of file Interpreter.h.
typedef uint32_t(* dwCANInterpreterGetNumAvailableFunc_t) (void *userData) |
Gets the number of signals available to be retrieved. The same signal may be available multiple times.
Definition at line 75 of file Interpreter.h.
typedef bool(* dwCANInterpreterGetSignalInfoFunc_t) (const char8_t **name, dwTrivialDataType *type, dwCANVehicleData *data, uint32_t idx, void *userData) |
Gets the name and type of a signal; the callback must return false if the query fails.
Definition at line 78 of file Interpreter.h.
typedef struct dwCANInterpreterObject* dwCANInterpreterHandle_t |
CAN message interpreter handle.
Definition at line 69 of file Interpreter.h.
DW_API_PUBLIC dwStatus dwCANInterpreter_buildFromCallbacks | ( | dwCANInterpreterHandle_t * | interpreter, |
dwCANInterpreterInterface | callbacks, | ||
void * | userData, | ||
dwContextHandle_t | context | ||
) |
Creates a CAN data interpreter based on user provided callbacks.
Such an interpreter can be used same way as the DBC based one. Any non-provided method, i.e., set to NULL, is indicated with DW_NOT_IMPLEMENTED error when calling the corresponding interpreter method.
[out] | interpreter | A pointer to the place to return a valid interpreter handle on success. |
[in] | callbacks | Specifies a set of callback defining the interpreter interface. |
[in] | userData | A pointer to the user data to be passed to callbacks. |
[in] | context | Specifies the handler to the context under which the interpreted is to be created. |
DW_API_PUBLIC dwStatus dwCANInterpreter_buildFromDBC | ( | dwCANInterpreterHandle_t * | interpreter, |
const char8_t * | inputDBC, | ||
dwContextHandle_t | ctx | ||
) |
Creates a CAN data interpreter based on DBC file format.
[out] | interpreter | A pointer to the place to return a valid interpreter handle on success. |
[in] | inputDBC | A pointer to the file path for the input DBC file. |
[in] | ctx | Specifies the handler to the context under which the interpreter is to be created. |
DW_API_PUBLIC dwStatus dwCANInterpreter_buildFromDBCString | ( | dwCANInterpreterHandle_t * | interpreter, |
const char8_t * | dbc, | ||
dwContextHandle_t | ctx | ||
) |
Creates a CAN data interpreter based on DBC file format and initializes the interpreter from a string.
[out] | interpreter | A pointer to the place to return a valid interpreter handle on success. |
[in] | dbc | String content of a DBC file. |
[in] | ctx | Specifies the handler to the context under which the interpreter is to be created. |
dwCANInterpreter_buildFromDBC()
with a difference that a string is accepted as input DW_API_PUBLIC dwStatus dwCANInterpreter_consume | ( | const dwCANMessage * | msg, |
dwCANInterpreterHandle_t | interpreter | ||
) |
Pushes a new message to the interpreter.
It is the responsibility of the interpreter to parse the message and fill out internal structures to be capable of delivering the current vehicle state to the application. The state can be retrieved using the 'dwCANInterpreter_getX()' methods.
[in] | msg | A pointer to the CAN frame to be consumed by the interpreter. |
[in] | interpreter | Specifies the interpreter handle previously created or opened through a file. |
DW_API_PUBLIC dwStatus dwCANInterpreter_createMessage | ( | dwCANMessage * | msg, |
uint32_t | id, | ||
dwCANInterpreterHandle_t | interpreter | ||
) |
Initializes an empty can message an interpreter can encoded signals into.
[out] | msg | A pointer to a CAN message to be initialized. |
[in] | id | CAN ID of the message. |
[in] | interpreter | Specifies the interpreter handle previously create or opened through a file. |
DW_API_PUBLIC dwStatus dwCANInterpreter_createMessageFromName | ( | dwCANMessage * | msg, |
const char8_t * | msgName, | ||
dwCANInterpreterHandle_t | interpreter | ||
) |
Initializes an empty can message an interpreter can encoded signals into.
[out] | msg | A pointer to a CAN message to be initialized. |
[in] | msgName | Name of the CAN message. |
[in] | interpreter | Specifies the interpreter handle previously create or opened through a file. |
DW_API_PUBLIC dwStatus dwCANInterpreter_encodef32 | ( | float32_t | value, |
const char8_t * | signal, | ||
dwCANMessage * | msg, | ||
dwCANInterpreterHandle_t | interpreter | ||
) |
Encodes a value for a signal into a given message.
The signal must be defined within the message ID. The size of the message changes to be at least the size required to cover the encoded value.
[in] | value | The value for the signal to be encoded. |
[in] | signal | Specifies the name of the signal to set value. |
[in] | msg | CAN message to be used for encoding. |
[in] | interpreter | Specifies the interpreter handle previously created. |
DW_API_PUBLIC dwStatus dwCANInterpreter_encodef64 | ( | float64_t | value, |
const char8_t * | signal, | ||
dwCANMessage * | msg, | ||
dwCANInterpreterHandle_t | interpreter | ||
) |
Same as dwCANInterpreter_encodef32, but for float64 types.
DW_API_PUBLIC dwStatus dwCANInterpreter_encodei32 | ( | int32_t | value, |
const char8_t * | signal, | ||
dwCANMessage * | msg, | ||
dwCANInterpreterHandle_t | interpreter | ||
) |
Same as dwCANInterpreter_encodef32, but for int32 types.
DW_API_PUBLIC dwStatus dwCANInterpreter_getDataSignalIndex | ( | uint32_t * | idx, |
dwCANVehicleData | data, | ||
dwCANInterpreterHandle_t | interpreter | ||
) |
Gets the index of a signal of the last consumed message that corresponds to a certain predefined data type.
Some SDK modules need to know how to access data from CAN bus, independent on the definition of the signal name.
[out] | idx | An index is returned here. On succes the index is in range [0; dwCANInterpreter_getNumberSignals()-1]. |
[in] | data | Specifies the ID of the data signal you are interested in. |
[in] | interpreter | Specifies the interpreter handle previously created. |
DW_API_PUBLIC dwStatus dwCANInterpreter_getf32 | ( | float32_t * | value, |
dwTime_t * | timestamp_us, | ||
uint32_t | idx, | ||
dwCANInterpreterHandle_t | interpreter | ||
) |
Gets a 'float32_t' value from the available values.
The timestamp represent the time when the signal value was valid, i.e., when signal was received.
[out] | value | A pointer to the data value is returned here. |
[out] | timestamp_us | Timestamp of the signal. |
[in] | idx | Specifies the index within the max event numbers from dwCANInterpreter_getNumberSignals API. |
[in] | interpreter | A pointer to the interpreter handle previously created or opened through a file. |
DW_API_PUBLIC dwStatus dwCANInterpreter_getf64 | ( | float64_t * | value, |
dwTime_t * | timestamp_us, | ||
uint32_t | idx, | ||
dwCANInterpreterHandle_t | interpreter | ||
) |
Same as dwCANInterpreter_getf32, but for float64 types.
DW_API_PUBLIC dwStatus dwCANInterpreter_geti32 | ( | int32_t * | value, |
dwTime_t * | timestamp_us, | ||
uint32_t | idx, | ||
dwCANInterpreterHandle_t | interpreter | ||
) |
Same as dwCANInterpreter_getf32, but for int32 types.
DW_API_PUBLIC dwStatus dwCANInterpreter_getNumberSignals | ( | uint32_t * | num, |
dwCANInterpreterHandle_t | interpreter | ||
) |
Gets the number of signals decoded and available for consumption by the application side.
In general the number of signals is the number of valid signals found in last consumed CAN message. However this does not have to be true in all cases, especially in callback based interpreters.
[out] | num | A pointer to the variable to be filled with the number. |
[in] | interpreter | Specifies the interpreter handle previously created or opened through a file. |
DW_API_PUBLIC dwStatus dwCANInterpreter_getNumberSignalsInMessage | ( | uint32_t * | num, |
const dwCANMessage * | msg, | ||
dwCANInterpreterHandle_t | interpreter | ||
) |
Gets the number of signals a CAN interpreter can encode into the provided message.
[out] | num | A pointer to variable, which is filled with the number. |
[in] | msg | CAN message to be used for encoding. |
[in] | interpreter | Specifies the interpreter handle previously create or opened through a file. |
DW_API_PUBLIC dwStatus dwCANInterpreter_getSignalName | ( | const char8_t ** | name, |
uint32_t | idx, | ||
dwCANInterpreterHandle_t | interpreter | ||
) |
Gets the name of a signal available for consumption by the application as a string.
[out] | name | A pointer to a const char8_t array containing a null-terminated string with signal name. |
[in] | idx | Specifies the index of a signal that is in range [0; dwCANInterpreter_getNumberSignals()-1]. |
[in] | interpreter | Specifies the interpreter handle previously created or opened through a file. |
DW_API_PUBLIC dwStatus dwCANInterpreter_getSignalNameInMessage | ( | const char8_t ** | name, |
uint32_t | idx, | ||
const dwCANMessage * | msg, | ||
dwCANInterpreterHandle_t | interpreter | ||
) |
Gets the name of a signal that the CAN interpreter can encode in the currently active encoded message.
[out] | name | A pointer to a const char8_t array containing a null-terminated string with signal name. |
[in] | idx | Specifies the index of a signal that is in range [0:dwCANInterpreter_getNumberSignalsInMessage()-1]. |
[in] | msg | CAN message to be used for encoding. |
[in] | interpreter | Specifies the interpreter handle previously created or opened through a file. |
DW_API_PUBLIC dwStatus dwCANInterpreter_getSignalRange | ( | float64_t * | minimum, |
float64_t * | maximum, | ||
uint32_t | idx, | ||
dwCANInterpreterHandle_t | interpreter | ||
) |
Returns the range of validity of data for a signal available for consumption by the application.
[out] | minimum | The minimum of the range of validity. |
[out] | maximum | The maximum of the range of validity. |
[in] | idx | Specifies the index of a signal that is in range [0; dwCANInterpreter_getNumberSignals()-1]. |
[in] | interpreter | Specifies the interpreter handle previously created. |
DW_API_PUBLIC dwStatus dwCANInterpreter_getSignalType | ( | dwTrivialDataType * | type, |
uint32_t | idx, | ||
dwCANInterpreterHandle_t | interpreter | ||
) |
Returns the type of the value of a signal available for consumption by the application.
[out] | type | The data type is returned here. |
[in] | idx | Specifies the index of a signal that is in range [0; dwCANInterpreter_getNumberSignals()-1]. |
[in] | interpreter | Specifies the interpreter handle previously created. |
DW_API_PUBLIC dwStatus dwCANInterpreter_release | ( | dwCANInterpreterHandle_t | interpreter | ) |
Closes previously opened interpreter.
This unloads the interpreter plugin as well as deallocates previously allocated memory.
[in] | interpreter | The interpreter handle previously created or opened through a file. |