ADTF Device Toolbox SDK
Loading...
Searching...
No Matches
can_types.h
Go to the documentation of this file.
1
16
17#pragma once
18#include <stdint.h>
19#include <string.h>
20
24namespace adtf
25{
26
30namespace devicetb
31{
32
36namespace sdk
37{
38
42namespace can
43{
44
48namespace axle
49{
50#pragma pack(push, 1)
51
52using tChannelID = uint8_t;
53using tSignalID = uint32_t;
54using tMessageID = uint32_t;
55using tNetworkNodeID = uint32_t;
56
57static constexpr const uint8_t CAN_CHANNEL_MIN = 1;
58static constexpr const uint8_t CAN_CHANNEL_MAX = 16;
59// CAN standard message id 0..0x7FF
60static constexpr const uint32_t CAN_MSGID_STANDARD_MAX = 0x7FF;
61// CAN extended message id 0..0x1FFFFFFF
62static constexpr const uint32_t CAN_MSGID_EXTENDED_MAX = 0x1FFFFFFF;
63
64static constexpr const uint8_t INVALID_CHANNEL_ID = 0xFF;
65static constexpr const uint32_t INVALID_SIGNAL_ID = 0xFFFFFFFF;
66static constexpr const uint32_t INVALID_MESSAGE_ID = 0xFFFFFFFF;
67
68static constexpr const uint32_t CAN_SIGNALID_HEADER_TAG = 0x10000000;
69static constexpr const uint32_t CAN_SIGNALID_HEADER_CHANNEL = 0x10000001;
70static constexpr const uint32_t CAN_SIGNALID_HEADER_HWTIME = 0x10000002;
71
72enum eSignalType
73{
74 CAN_SIGNAL_TYPE_INVALID = 0,
75 CAN_SIGNAL_TYPE_NORMAL = 1,
76 CAN_SIGNAL_TYPE_MULTIPLEXOR = 2,
77 CAN_SIGNAL_TYPE_MULTIPLEXED = 3
78};
79
81{
82 uint32_t nValue;
83 const char* strDescription;
84};
85
86typedef enum
87{
88 DT_CAN_UNKNOWN = 0,
89 DT_CAN_UNSIGNED = 1,
90 DT_CAN_SIGNED = 2,
91 DT_CAN_IEEE_FLOAT = 3,
92 DT_CAN_IEEE_DOUBLE = 4
94
96{
97 tSignalID nSignalID;
98 tMessageID nMessageId;
100
101 const char* strSignalName;
102 const char* strUnit;
103 const char* strDescription;
104
105 uint8_t nSignalType;
106 uint8_t nStartbit;
107 uint8_t nBitlen;
108 uint8_t nType;
109
111 bool bSigned;
114
116 uint64_t nStartRawValue;
117 double f64Factor;
118 double f64Offset;
119 double f64Min;
120 double f64Max;
121
124
125 uint64_t nReserved2;
126};
127
129{
130 enum eTypeTag
131 {
132 TAG_INVALID = 0,
133 TAG_RAW_VALUE = 1,
134 TAG_FLOAT64 = 2,
135 TAG_UINT64 = 3,
136 TAG_INT64 = 4,
137 TAG_UINT32 = 5,
138 TAG_INT32 = 6,
139 TAG_FLOAT32 = 7
140 };
141
142 uint8_t nTypeTag = TAG_INVALID; // see eTypeTag
143 uint8_t nReserved[7] = {}; // reserved, set to 0
144
145 union
146 {
147 float f32Value; // used when nTAG == TAG_FLOAT32
148 double f64Value; // used when nTag == TAG_FLOAT64
149 uint64_t nui64Value; // used when nTag == TAG_UINT64
150 int64_t ni64Value; // used when nTag == TAG_INT64
151 uint32_t nui32Value; // used when nTag == TAG_UINT32
152 int32_t ni32Value; // used when nTag == TAG_INT32
153 uint64_t n64RawValue = 0; // used when nTag == TAG_RAW_VALUE
154 };
155
156 const char* strValue = nullptr; // Value from TEXTTABLE, may be NULL
157 uint8_t nReserved2[8] = {}; // reserved, set to 0
158};
159
161{
162 tMessageID nMessageID;
164 const char* strMessageName;
165
166 uint8_t nDataLength;
167 uint8_t nReserved[3];
168
169 uint32_t nCycleTime;
170 tNetworkNodeID nNetworkNodeID;
171
172 uint32_t nSignalCount;
174
175 const char* strDescription;
176};
177
183{
189 {
192 };
193
204
215
221 {
222 MSG_IDMASK_BASE = 0x000007FF,
223 MSG_IDMASK_EXTENDED = 0x1FFFFFFF,
224 MSG_EXTENDED_FLAG = 0x80000000
225 };
226
231 {
232 uint8_t ui8Tag;
233 uint8_t ui8Channel;
234 int64_t tmTimeStamp;
235 };
236
240 struct tData
241 {
242 uint32_t ui32Id;
243 uint8_t ui8Length;
244 uint8_t ui8Reserved;
245 uint16_t ui16Flags;
246 uint16_t ui16Reserved;
247 uint32_t ui32Reserved;
248 uint8_t aui8Data[8];
249 };
250
254 struct tStatus
255 {
256 uint32_t ui32BitRate;
257 uint32_t ui32RxBitCount;
258 uint32_t ui32TxBitCount;
261 uint8_t ui8BusStatus;
262 uint8_t ui8Reserved;
263 uint32_t ui32Reserved;
264 };
265
267
268 union
269 {
272 };
273};
274
275#pragma pack(pop)
276
277} // namespace axle
278
282namespace jack
283{
284#pragma pack(push, 1)
285
286static constexpr const uint8_t CAN_CHANNEL_MIN = 0;
287
288#pragma pack(pop)
289} //namespace jack
290
291using jack::CAN_CHANNEL_MIN;
292using axle::CAN_CHANNEL_MAX;
293
295using tChannelID = axle::tChannelID;
296using tSignalID = axle::tSignalID;
297using tMessageID = axle::tMessageID;
298using eSignalType = axle::eSignalType;
299using tSignalRawDataType = axle::tSignalRawDataType;
303
304} // namespace can
305} // namespace sdk
306} // namespace devicetb
307} // namespace adtf
Namespace for functionality provided by V3.0.0.
Definition can_coder_intf.h:41
Namespace for functionality provided by V3.9.0.
Definition can_types.h:283
Namespace for CAN in ADTF-Devicetoolbox.
Definition can_coder_intf.h:35
axle::tMessageInfo tMessageInfo
Definition can_types.h:302
axle::tMessageID tMessageID
Definition can_types.h:297
axle::tSignalValue tSignalValue
Definition can_types.h:301
axle::tSignalID tSignalID
Definition can_types.h:296
axle::tChannelID tChannelID
Definition can_types.h:295
axle::tSignalInfo tSignalInfo
Definition can_types.h:300
axle::tSignalRawDataType tSignalRawDataType
Definition can_types.h:299
axle::eSignalType eSignalType
Definition can_types.h:298
axle::tCANData tCANData
Definition can_types.h:294
Namespace for SDK of ADTF-Devicetoolbox.
Definition bus_database_intf.h:42
Devicetoolbox - Namespace.
Definition bus_database_intf.h:36
ADTF - Namespace.
Definition bus_database_intf.h:30
uint16_t ui16Flags
Flags.
Definition can_types.h:245
uint32_t ui32Id
id of can message. For extended CAN messages bit 31 is set. Use the members of the enum eMsgId to get...
Definition can_types.h:242
uint8_t ui8Length
length of data [0..8]
Definition can_types.h:243
uint16_t ui16Reserved
reserved, should be zero
Definition can_types.h:246
uint32_t ui32Reserved
reserved, should be zero
Definition can_types.h:247
uint8_t aui8Data[8]
data field
Definition can_types.h:248
uint8_t ui8Reserved
reserved, should be zero
Definition can_types.h:244
uint8_t ui8Tag
Type of contained message (see eMessageTag)
Definition can_types.h:232
uint8_t ui8Channel
Channel that received this message.
Definition can_types.h:233
int64_t tmTimeStamp
Hardware timestamp in micro seconds.
Definition can_types.h:234
uint16_t ui16TxErrorCounter
Error counter for the transmit section of the CAN controller.
Definition can_types.h:260
uint32_t ui32TxBitCount
Count of transmitted bits.
Definition can_types.h:258
uint32_t ui32RxBitCount
Count of received bits.
Definition can_types.h:257
uint8_t ui8Reserved
reserved, should be zero
Definition can_types.h:262
uint32_t ui32Reserved
reserved, should be zero
Definition can_types.h:263
uint8_t ui8BusStatus
Flags.
Definition can_types.h:261
uint32_t ui32BitRate
CAN bus bitrate.
Definition can_types.h:256
uint16_t ui16RxErrorCounter
Error counter for the receive section of the CAN controller.
Definition can_types.h:259
eDataFlags
Definition can_types.h:198
@ DF_ERROR_FRAME
Indicates an error frame.
Definition can_types.h:200
@ DF_REMOTE_FRAME
Indicates a remote frame.
Definition can_types.h:201
@ DF_NONE
Standard flags.
Definition can_types.h:199
@ DF_TX_COMPLETED
Notification for successful message transmission.
Definition can_types.h:202
tData sData
used when ui8Tag == MT_Data
Definition can_types.h:270
eMessageTag
Definition can_types.h:189
@ MT_Data
Data.
Definition can_types.h:190
@ MT_Status
Status.
Definition can_types.h:191
tStatus sStatus
used when ui8Tag == MT_Status
Definition can_types.h:271
eMsgId
Definition can_types.h:221
@ MSG_EXTENDED_FLAG
Extended CAN messages are marked by bit 31.
Definition can_types.h:224
@ MSG_IDMASK_EXTENDED
Message IDs for extended frame format use 29 bit identifiers.
Definition can_types.h:223
@ MSG_IDMASK_BASE
Message IDs for base frame format use 11 bit identifiers.
Definition can_types.h:222
tMessageHeader sHeader
CAN message header structure.
Definition can_types.h:266
eBusStatus
Definition can_types.h:209
@ BS_ERROR_WARNING
One of the error counters has reached the warning level.
Definition can_types.h:212
@ BS_OFFLINE
Bus is offline.
Definition can_types.h:210
@ BS_ERROR_ACTIVE
Bus is online.
Definition can_types.h:213
@ BS_ERROR_PASSIVE
One of the error counters has reached the error level.
Definition can_types.h:211
uint8_t nReserved[3]
reserved
Definition can_types.h:167
tNetworkNodeID nNetworkNodeID
Network node id.
Definition can_types.h:170
const char * strMessageName
Name of can message.
Definition can_types.h:164
const tSignalInfo * psSignalInfo
Pointer to array of signal infos.
Definition can_types.h:173
const char * strDescription
Description of CAN message.
Definition can_types.h:175
uint32_t nSignalCount
Number of signals of this message.
Definition can_types.h:172
tMessageID nMessageID
CAN message id.
Definition can_types.h:162
uint32_t nCycleTime
Cycle time of message in milliseconds (0 if undefined)
Definition can_types.h:169
uint8_t nDataLength
Length of message [bytes].
Definition can_types.h:166
bool bCANExtended
CAN extended id.
Definition can_types.h:163
const char * strSignalName
Name of CAN signal.
Definition can_types.h:101
const char * strUnit
Unit of CAN signal.
Definition can_types.h:102
double f64Min
Minimum value of range of CAN signal.
Definition can_types.h:119
bool bByteOrderMotorola
Byte order of signal is motorola.
Definition can_types.h:110
double f64Max
Maximum value of range of CAN signal.
Definition can_types.h:120
tSignalID nMultiplexorSignalID
Signal ID of multiplexor.
Definition can_types.h:112
uint64_t nDefaultRawValue
Represents the GenSigInactiveValue.
Definition can_types.h:115
double f64Offset
Offset value of CAN signal.
Definition can_types.h:118
uint8_t nType
is type IEEE Float or IEEE Double (see tSignalRawDataType)
Definition can_types.h:108
const char * strDescription
Description of CAN signal.
Definition can_types.h:103
double f64Factor
Scale factor of CAN signal.
Definition can_types.h:117
bool bCANExtended
CAN extended id.
Definition can_types.h:99
bool bSigned
Indicates if signal is signed value or not.
Definition can_types.h:111
int32_t nRequiredMultiplexorValue
Required multiplexor value for this signal to be valid.
Definition can_types.h:113
tMessageID nMessageId
CAN message id.
Definition can_types.h:98
uint8_t nBitlen
Bit length of CAN signal.
Definition can_types.h:107
uint8_t nStartbit
Startbit of CAN signal.
Definition can_types.h:106
uint32_t nValueTableSize
Size of value table array (0 if no table is defined)
Definition can_types.h:122
tSignalID nSignalID
Signal ID.
Definition can_types.h:97
uint64_t nReserved2
reserved
Definition can_types.h:125
uint8_t nSignalType
see eSignalType
Definition can_types.h:105
uint64_t nStartRawValue
Represents the GenSigStartValue.
Definition can_types.h:116
tValueInfo * pValueTable
Pointer to sorted value table array.
Definition can_types.h:123
const char * strDescription
Description.
Definition can_types.h:83
uint32_t nValue
Value.
Definition can_types.h:82