automotive_diag/uds/
reset_types.rs

1use crate::utils::{enum_wrapper, python_test};
2
3enum_wrapper!(uds, ResetType, ResetTypeByte);
4python_test!(uds, ResetType, HardReset, SoftReset);
5
6/// Reset ECU subcommand
7#[repr(u8)]
8#[derive(strum::FromRepr, Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
9#[cfg_attr(feature = "defmt", derive(defmt::Format))]
10#[cfg_attr(feature = "iter", derive(strum::EnumIter))]
11#[cfg_attr(feature = "pyo3", pyo3::pyclass(eq, eq_int))]
12#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
13pub enum ResetType {
14    /// Signals the ECU to perform a hard-reset,
15    /// simulating a forceful power off/on cycle
16    ///
17    /// This might result in both non-volatile memory and volatile memory locations being re-initialized
18    HardReset = 0x01,
19
20    /// Signals the ECU to perform a simulated key off/on cycle,
21    /// simulating the usual key-off/on cycle
22    ///
23    /// This typically results in the preservation of non-volatile memory,
24    /// but volatile memory will be re-initialized
25    KeyOffReset = 0x02,
26
27    /// Signals the ECU to perform a soft reset, simply rebooting the current
28    /// application running on it.
29    ///
30    /// This will result in the preservation of both non-volatile and volatile memory
31    SoftReset = 0x03,
32
33    /// Enables a rapid power shutdown on the ECU during a key-off cycle.
34    ///
35    /// IMPORTANT: Once this has been used, the diagnostic server **cannot** send
36    /// any other messages other than `ECUReset` in order to not disturb the rapid power
37    /// shutdown function.
38    EnableRapidPowerShutDown = 0x04,
39
40    /// Disables a rapid power shutdown on the ECU during a key-off cycle.
41    DisableRapidPowerShutDown = 0x05,
42}