Skip to main content

dpdu_api_types/
enums.rs

1#[repr(u32)]
2#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
3/// Item type values
4pub enum PduIt {
5    /// IOCTL UNUM32
6    IoUnum32 = 0x1000,
7    /// IOCTL program voltage
8    IoProgVoltage = 0x1001,
9    /// IOCTL Byte Array
10    IoByteArray = 0x1002,
11    /// IOCTL Filter
12    IoFilter = 0x1003,
13    /// IOCTL event queue priority
14    IoEventQueueProperty = 0x1004,
15    /// Resource status
16    RscStatus = 0x1100,
17    /// Communication parameter (ComParam)
18    Param = 0x1200,
19    /// Result
20    Result = 0x1300,
21    /// Status notification
22    Status = 0x1301,
23    /// Error notification
24    Error = 0x1302,
25    /// Information notification
26    Info = 0x1303,
27    /// Resource ID
28    RscId = 0x1400,
29    /// Resource conflict
30    RscConflict = 0x1500,
31    /// Module ID
32    ModuleId = 0x1600,
33    /// Unique response ID table
34    UniqueRespIdTable = 0x1700,
35    /// DoIP Vehicle ID request
36    IoVehicleIdRequest = 0x1800,
37    /// DoIP ethernet activation
38    EthSwitchState = 0x1801,
39    /// DoIP entity addressing
40    EntityAddress = 0x1802,
41    /// DoIP entity status
42    EntityStatus = 0x1803,
43}
44
45#[repr(u32)]
46#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
47/// Communication primitive (ComParam) type
48pub enum PduCopt {
49    /// Start communication with an ECU
50    StartComm = 0x8001,
51    /// Stop communication with an ECU
52    StopComm = 0x8002,
53    /// Updates an existing [ComParameter] on an active logical communication link
54    UpdateParam = 0x8003,
55    /// Send request or response data
56    SendRecv = 0x8004,
57    /// Wait a specified time before executing the next [ComPrimitive]
58    Delay = 0x8005,
59    /// Opposite of [PduCopt::UpdateParam], copies active com param from logical communication
60    /// link to a working buffer
61    RestoreParam = 0x8006,
62}
63
64#[repr(u32)]
65#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
66/// Object type
67pub enum PduObjt {
68    /// Protocol object
69    Protocol = 0x8021,
70    /// Bus type object
71    BusType = 0x8022,
72    /// IO control object
73    IoCtrl = 0x8023,
74    /// Communication Parameter object
75    ComParam = 0x8024,
76    /// Pin type object
77    PinType = 0x8025,
78    /// resource object
79    Resource = 0x8026,
80}
81
82#[repr(u32)]
83#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
84/// Status codes
85pub enum PduStatus {
86    /// Communication parameter has not been acted upon yet
87    CopstIdle = 0x8010,
88    /// Communication parameter is being run
89    CopstExecuting = 0x8011,
90    /// Communication parameter is finished being run
91    CopstFinished = 0x8012,
92    /// Communication parameter was cancelled
93    CopstCancelled = 0x8013,
94    /// Communication parameter is waiting to be executed again (Cyclic communication parameter)
95    CopstWaiting = 0x8014,
96    /// Communication logical link is offline
97    CllstOffline = 0x8050,
98    /// Communication logical link is online
99    CllstOnline = 0x8051,
100    /// Communication logical link is online and has been started (In a Tx/Rx state)
101    CllstCommStarted = 0x8052,
102    /// Vehicle communication interface is ready for communication
103    ModstReady = 0x8060,
104    /// Vehicle communication interface is not ready for communication
105    ModstNotReady = 0x8061,
106    /// Vehicle communication interface is unavailable for connection
107    ModstNotAvail = 0x8062,
108    /// Vehicle communication interface is available for connection
109    ModstAvail = 0x8063,
110}
111
112#[repr(u32)]
113#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
114/// Information events
115pub enum PduInfo {
116    /// New vehicle communication list is available
117    ModuleListChange = 0x8070,
118    /// A change has occurred with the lock status on a shared resource
119    ResourceLockChange = 0x8071,
120    /// A communication parameter on a logical link has been changed
121    ComParamChange = 0x8072,
122}
123
124#[repr(u32)]
125#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
126/// Event callback
127pub enum PduEvtData {
128    /// There is event data available to read by the application
129    Available = 0x801,
130    /// The ComLogicalLink has lost event data due to a buffer overrun
131    Lost = 0x0802,
132}
133
134#[repr(u32)]
135#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
136/// Filter type
137pub enum PduFilter {
138    /// Matched messages go into the receive queue
139    Pass = 0x00000001,
140    /// Matched messages stay out of the receive queue
141    Block = 0x00000002,
142    /// Matches messages go into the receive queue that are UUDT only (For ISO1765)
143    PassUUDT = 0x00000011,
144    /// Matches messages stay out of the receive queue that are UUDT only (For ISO1765)
145    BlockUUDT = 0x00000012,
146}
147
148#[repr(u32)]
149#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
150/// IOCTL queue mode
151pub enum PduQueueMode {
152    /// Attempt to allocate memory for every event coming in to the receive queue. This queue size can keep
153    /// growing until the API runs out of allocation memory
154    Unlimited = 0x00000000,
155    /// Attempt to allocate a fixed buffer size for events coming into the receive queue. Events are discarded
156    /// from the receive queue if the buffer is full
157    Limited = 0x00000001,
158    /// Attempt to allocate a fixed buffer size for events coming into the receive queue. Events overwrite
159    /// stored events if the buffer is full (Like a circular buffer)
160    Circular = 0x00000002,
161}
162
163#[repr(u32)]
164#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
165/// Function return values
166pub enum PduError {
167    /// No Error (Function call OK)
168    StatusNoError = 0x00000000,
169    /// Function call failed (Generic failure)
170    FctFailed = 0x00000001,
171    /// Reserved for ISO 22900-2
172    Reserved1 = 0x00000010,
173    /// Communication failed between host and MVCI
174    CommPcToVciFailed = 0x00000011,
175    /// PDU API has not yet been constructed
176    PduApiNotConstructed = 0x00000020,
177    /// PDU Destruct was not called before another PDU Construct
178    SharingViolation = 0x00000021,
179    /// Resource is already in use
180    ResourceBusy = 0x00000030,
181    /// Resource table changed
182    ResourceTableChanged = 0x00000031,
183    /// Generic resource error
184    ResourceError = 0x00000032,
185    /// ComLogicalLink cannot be offline and perform the requested action
186    CllNotConnected = 0x00000040,
187    /// ComLogicalLink must be started to perform the requested action
188    CllNotStarted = 0x00000041,
189    /// A parameter parsed into the function was invalid
190    InvalidParameters = 0x00000050,
191    /// A handle provided was invalid
192    InvalidHandle = 0x00000060,
193    /// Option value was unsupported
194    ValueNotSupported = 0x00000061,
195    /// IOCTL Command ID was unsupported
196    IdNotSupported = 0x00000062,
197    /// Communication parameter was unsupported
198    ComParamNotSupported = 0x00000063,
199    /// Physical communication parameter cannot be changed as it is locked by another LogicalLink
200    ComParamLocked = 0x00000064,
201    /// Transmit queue is full
202    TxQueueFull = 0x00000070,
203    /// No more events are available to read
204    EventQueueEmpty = 0x00000071,
205    /// IOCTL - Voltage value supplied is unsupported by the MVCI module
206    VoltageNotSupported = 0x00000080,
207    /// IOCTL - Pin or resource is not supported by the MVCI module
208    MuxRscNotSupported = 0x00000081,
209    /// Cable attached to MVCI module is unknown
210    CableUnknown = 0x00000082,
211    /// No cable attached to the MVCI module
212    NoCableDetected = 0x00000083,
213    /// ComLogicalLink is already connected
214    CllConnected = 0x00000084,
215    /// Physical Com parameters cannot be changes as a temporary one
216    TempParamNotAllowed = 0x00000090,
217    /// Resource is already locked
218    RscLocked = 0x000000A0,
219    /// Resource is already locked by another ComLogicalLink
220    RscLockedByAnotherCll = 0x000000A1,
221    /// Resource is already unlocked
222    RscNotLocked = 0x000000A2,
223    /// Module is not connected or ready
224    ModuleNotConnected = 0x000000A3,
225    /// API software is out of date
226    ApiSwOutOfDate = 0x000000A4,
227    /// VCI firmware is out of date
228    ModuleFwOutOfDate = 0x000000A5,
229    /// Requested pin is not routed by the MVCI's cable
230    PinNotConnected = 0x000000A6,
231    /// IP protocol not supported
232    IpProtocolNotSupported = 0x000000B0,
233    /// DoIP Routing activation failed (Generic failure)
234    DoIPRoutingActivationFailed = 0x000000B1,
235    /// DoIP Routing activation failed - missing / wrong authentication
236    DoIPRoutingActivationAuthFailed = 0x000000B2,
237    /// DoIP Logical address is defined multiple times so it is ambiguous
238    DoIPAmbiguousLogicalAddress = 0x000000B3,
239    /// DoIP Routing activation failed - Unknown or invalid source address
240    DoIPRoutineActivationInvalidSrcAddress = 0x000000B4,
241    /// DoIP Routing activation failed - No more free sockets available
242    DoIPRoutingActivationNoDataSocketAvailable = 0x000000B5,
243    /// DoIP Routing activation failed - The source address changed
244    DoIPRoutineActivationSourceAddressChanged = 0x000000B6,
245    /// DoIP Routing activation failed - Source address already in use
246    DoIPRoutingActivationSourceAddressInUse = 0x000000B7,
247    /// DoIP Routing activation failed - Rejected confirmation
248    DoIPRoutineActivationConfirmationRejected = 0x000000B8,
249    /// DoIP Routing activation failed - Requested activation type was unsupported
250    DoIPRoutineActivationTypeUnsupported = 0x000000B9,
251    /// DoIP Routing activation failed - Response code was unknown
252    DoIPRoutineActivationResponseCodeUnknown = 0x000000BA,
253    /// DoIP Routing activation failed - Timeout waiting for activation response
254    DoIPRoutingActivationResponseTimeout = 0x000000BB,
255    /// DoIP general timeout
256    DoIPResponseTimeout = 0x000000BC,
257}
258
259#[repr(u32)]
260#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
261/// Function error events (Used in asynchronous situations)
262pub enum PduErrorEvt {
263    /// No error
264    NoError = 0x00000000,
265    /// Structure of the received data frame was incorrect
266    FrameStruct = 0x00000100,
267    /// Transmit error
268    TxError = 0x00000101,
269    /// Tester present transmit error or ECU responded negatively to the request
270    TesterPresentError = 0x00000102,
271    /// ComParam could not be set as resource was locked
272    RscLocked = 0x00000109,
273    /// Receive message timeout
274    RxTimeout = 0x00000103,
275    /// Receive message error at a protocol level
276    RxError = 0x00000104,
277    /// ComPrimitive error by protocol
278    ProtErr = 0x00000105,
279    /// Communication to MVCI module was lost
280    LostCommToVCI = 0x00000106,
281    /// MVCI hardware fault
282    VCIHardwareFault = 0x00000107,
283    /// Protocol initialization error
284    InitError = 0x00000108,
285}
286
287#[repr(u32)]
288#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
289/// ComParam data type
290pub enum PduPt {
291    /// Unsigned 8 bit
292    Unum8 = 0x000000101,
293    /// Signed 8 bit
294    Snum8 = 0x000000102,
295    /// Unsigned 16 bit
296    Unum16 = 0x000000103,
297    /// Signed 16 bit
298    Snum16 = 0x000000104,
299    /// Unsigned 32 bit
300    Unum32 = 0x000000105,
301    /// Signed 32 bit
302    Snum32 = 0x000000106,
303    /// Byte array
304    ByteField = 0x000000107,
305    /// Structure
306    StructField = 0x000000108,
307    /// Array of 32bit values
308    LongField = 0x00000109,
309}
310
311#[repr(u32)]
312#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
313/// ComParam data class
314pub enum PduPc {
315    /// Message timing
316    Timing = 1,
317    /// Initialization of communication
318    Init = 2,
319    /// General com param
320    Com = 3,
321    /// Error handling ComParam
322    ErrHdl = 4,
323    /// BusType specific ComParam
324    BusType = 5,
325    ///
326    UniqueId = 6,
327    /// Tester present ComParam
328    TesterPresent = 7,
329}
330
331#[repr(u32)]
332#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
333/// ComParam struct type
334pub enum PduCpst {
335    /// Session timing
336    SessionTiming = 0x00000001,
337    /// Access timing
338    AccessTiming = 0x00000002,
339}
340
341#[repr(u8)]
342#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
343/// Vehicle preselection mode
344pub enum VidPreselectMode {
345    /// No preselection
346    None = 0,
347    /// DoIP with given VIN
348    VIN = 1,
349    /// DoIP with given EID
350    EID = 2,
351}
352
353#[repr(u8)]
354#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
355/// DoIP Combination mode
356pub enum CombinationMode {
357    /// No combination
358    None = 0,
359    /// Combine common VIN
360    VIN = 1,
361    /// Combine common GroupID
362    Group = 2,
363    /// Combine all
364    All = 3,
365}
366
367#[repr(u8)]
368#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
369/// Timing set types used by [ParamStructAccessTiming]
370pub enum TimingSet {
371    /// Default timing set
372    Default = 1,
373    /// Override received timing from ECU
374    OverrideReceived = 2,
375    /// Override received timing from tester
376    OverrideTester = 3,
377    /// Normal timing set
378    Normal = 4,
379    /// Extended timing set
380    Extended = 0xFF,
381}