pub enum CanError {
TransmitTimeout,
LostArbitration(u8),
ControllerProblem(ControllerProblem),
ProtocolViolation {
vtype: ViolationType,
location: Location,
},
TransceiverError,
NoAck,
BusOff,
BusError,
Restarted,
DecodingFailure(CanErrorDecodingFailure),
Unknown(u32),
}Expand description
A CAN bus error derived from an error frame.
An CAN interface device driver can send detailed error information up to the application in an “error frame”. These are selectable by the application by applying an error bitmask to the socket to choose which types of errors to receive.
The error frame can then be converted into this CanError which is a
proper Rust error type which implements std::error::Error.
Most error types here corresponds to a bit in the error mask of a CAN ID
word of an error frame - a frame in which the CAN error flag
(CAN_ERR_FLAG) is set. But there are additional types to handle any
problems decoding the error frame.
Variants§
TransmitTimeout
TX timeout (by netdevice driver)
LostArbitration(u8)
Arbitration was lost. Contains the bit number after which arbitration was lost or 0 if unspecified.
ControllerProblem(ControllerProblem)
Controller problem
ProtocolViolation
Fields
vtype: ViolationTypeThe type of protocol violation
Protocol violation at the specified Location.
TransceiverError
Transceiver Error.
NoAck
No ACK received for current CAN frame.
BusOff
Bus off (due to too many detected errors)
BusError
Bus error (due to too many detected errors)
Restarted
The bus has been restarted
DecodingFailure(CanErrorDecodingFailure)
There was an error decoding the error frame
Unknown(u32)
Unknown, possibly invalid, error
Trait Implementations§
source§impl Error for CanError
impl Error for CanError
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
source§impl From<CanError> for CanErrorFrame
impl From<CanError> for CanErrorFrame
source§impl From<CanErrorFrame> for CanError
impl From<CanErrorFrame> for CanError
source§fn from(frame: CanErrorFrame) -> Self
fn from(frame: CanErrorFrame) -> Self
Constructs a CAN error from an error frame.