pub trait NrcError: Into<u8> + core::fmt::Debug {
fn general_reject() -> Self;
fn service_not_supported() -> Self;
fn sub_function_not_supported() -> Self;
fn incorrect_message_length_or_invalid_format() -> Self;
fn response_too_long() -> Self;
fn busy_repeat_request() -> Self;
fn conditions_not_correct() -> Self;
fn request_sequence_error() -> Self;
fn no_response_from_subnet_component() -> Self;
fn failure_prevents_execution_of_requested_action() -> Self;
fn request_out_of_range() -> Self;
fn security_access_denied() -> Self;
fn invalid_key() -> Self;
fn exceeded_number_of_attempts() -> Self;
fn required_time_delay_not_expired() -> Self;
fn upload_download_not_accepted() -> Self;
fn transfer_data_suspended() -> Self;
fn general_programming_failure() -> Self;
fn wrong_block_sequence_counter() -> Self;
fn response_pending() -> Self;
fn sub_function_not_supported_in_active_session() -> Self;
fn service_not_supported_in_active_session() -> Self;
fn rpm_too_high() -> Self;
fn rpm_too_low() -> Self;
fn engine_is_running() -> Self;
fn engine_is_not_running() -> Self;
fn engine_run_time_too_low() -> Self;
fn temperature_too_high() -> Self;
fn temperature_too_low() -> Self;
fn vehicle_speed_too_high() -> Self;
fn vehicle_speed_too_low() -> Self;
fn throttle_pedal_too_high() -> Self;
fn throttle_pedal_too_low() -> Self;
fn transmission_range_not_in_neutral() -> Self;
fn transmission_range_not_in_gear() -> Self;
fn brake_switches_not_closed() -> Self;
fn shifter_level_not_in_park() -> Self;
fn torque_converter_clutch_locked() -> Self;
fn voltage_too_high() -> Self;
fn voltage_too_low() -> Self;
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[repr(u8)]
pub enum BuiltinNrc {
GeneralReject = 0x10,
ServiceNotSupported = 0x11,
SubFunctionNotSupported = 0x12,
IncorrectMessageLengthOrInvalidFormat = 0x13,
ResponseTooLong = 0x14,
BusyRepeatRequest = 0x21,
ConditionsNotCorrect = 0x22,
RequestSequenceError = 0x24,
NoResponseFromSubnetComponent = 0x25,
FailurePreventsExecutionOfRequestedAction = 0x26,
RequestOutOfRange = 0x31,
SecurityAccessDenied = 0x33,
InvalidKey = 0x35,
ExceededNumberOfAttempts = 0x36,
RequiredTimeDelayNotExpired = 0x37,
UploadDownloadNotAccepted = 0x70,
TransferDataSuspended = 0x71,
GeneralProgrammingFailure = 0x72,
WrongBlockSequenceCounter = 0x73,
ResponsePending = 0x78,
SubFunctionNotSupportedInActiveSession = 0x7E,
ServiceNotSupportedInActiveSession = 0x7F,
RpmTooHigh = 0x81,
RpmTooLow = 0x82,
EngineIsRunning = 0x83,
EngineIsNotRunning = 0x84,
EngineRunTimeTooLow = 0x85,
TemperatureTooHigh = 0x86,
TemperatureTooLow = 0x87,
VehicleSpeedTooHigh = 0x88,
VehicleSpeedToLow = 0x89,
ThrottlePedalTooHigh = 0x8A,
ThrottlePedalTooLow = 0x8B,
TransmissionRangeNotInNeutral = 0x8C,
TransmissionRangeNotInGear = 0x8D,
BrakeSwitchesNotClosed = 0x8F,
ShifterLevelNotInPark = 0x90,
TorqueConverterClutchLocked = 0x91,
VoltageTooHigh = 0x92,
VoltageTooLow = 0x93
}
impl From<BuiltinNrc> for u8 {
fn from(n: BuiltinNrc) -> u8 {
n as u8
}
}
impl NrcError for BuiltinNrc {
fn general_reject() -> Self {
Self::GeneralReject
}
fn service_not_supported() -> Self {
Self::ServiceNotSupported
}
fn sub_function_not_supported() -> Self {
Self::SubFunctionNotSupported
}
fn incorrect_message_length_or_invalid_format() -> Self {
Self::IncorrectMessageLengthOrInvalidFormat
}
fn response_too_long() -> Self {
Self::ResponseTooLong
}
fn busy_repeat_request() -> Self {
Self::BusyRepeatRequest
}
fn conditions_not_correct() -> Self {
Self::ConditionsNotCorrect
}
fn request_sequence_error() -> Self {
Self::RequestSequenceError
}
fn no_response_from_subnet_component() -> Self { Self::NoResponseFromSubnetComponent }
fn failure_prevents_execution_of_requested_action() -> Self {
Self::FailurePreventsExecutionOfRequestedAction
}
fn request_out_of_range() -> Self {
Self::RequestOutOfRange
}
fn security_access_denied() -> Self {
Self::SecurityAccessDenied
}
fn invalid_key() -> Self {
Self::InvalidKey
}
fn exceeded_number_of_attempts() -> Self {
Self::ExceededNumberOfAttempts
}
fn required_time_delay_not_expired() -> Self {
Self::RequiredTimeDelayNotExpired
}
fn upload_download_not_accepted() -> Self {
Self::UploadDownloadNotAccepted
}
fn transfer_data_suspended() -> Self {
Self::TransferDataSuspended
}
fn general_programming_failure() -> Self {
Self::GeneralProgrammingFailure
}
fn wrong_block_sequence_counter() -> Self {
Self::WrongBlockSequenceCounter
}
fn response_pending() -> Self {
Self::ResponsePending
}
fn sub_function_not_supported_in_active_session() -> Self {
Self::SubFunctionNotSupportedInActiveSession
}
fn service_not_supported_in_active_session() -> Self {
Self::ServiceNotSupportedInActiveSession
}
fn rpm_too_high() -> Self {
Self::RpmTooHigh
}
fn rpm_too_low() -> Self {
Self::RpmTooLow
}
fn engine_is_running() -> Self {
Self::EngineIsRunning
}
fn engine_is_not_running() -> Self {
Self::EngineIsNotRunning
}
fn engine_run_time_too_low() -> Self {
Self::EngineRunTimeTooLow
}
fn temperature_too_high() -> Self {
Self::TemperatureTooHigh
}
fn temperature_too_low() -> Self {
Self::TemperatureTooLow
}
fn vehicle_speed_too_high() -> Self {
Self::VehicleSpeedTooHigh
}
fn vehicle_speed_too_low() -> Self {
Self::VehicleSpeedToLow
}
fn throttle_pedal_too_high() -> Self {
Self::ThrottlePedalTooHigh
}
fn throttle_pedal_too_low() -> Self {
Self::ThrottlePedalTooLow
}
fn transmission_range_not_in_neutral() -> Self {
Self::TransmissionRangeNotInNeutral
}
fn transmission_range_not_in_gear() -> Self {
Self::TransmissionRangeNotInGear
}
fn brake_switches_not_closed() -> Self {
Self::BrakeSwitchesNotClosed
}
fn shifter_level_not_in_park() -> Self {
Self::ShifterLevelNotInPark
}
fn torque_converter_clutch_locked() -> Self {
Self::TorqueConverterClutchLocked
}
fn voltage_too_high() -> Self {
Self::VoltageTooHigh
}
fn voltage_too_low() -> Self {
Self::VoltageTooLow
}
}