dpdu_rust/
enums.rs

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