pub enum MbusError {
Show 40 variants
ParseError,
BasicParseError,
Timeout,
ModbusException(u8),
IoError,
Unexpected,
ConnectionLost,
UnsupportedFunction(u8),
ReservedSubFunction(u16),
InvalidPduLength,
InvalidAduLength,
ConnectionFailed,
ConnectionClosed,
BufferTooSmall,
BufferLenMissmatch,
SendFailed,
InvalidAddress,
InvalidOffset,
TooManyRequests,
InvalidFunctionCode,
NoRetriesLeft,
TooManyFileReadSubRequests,
FileReadPduOverflow,
UnexpectedResponse,
InvalidTransport,
InvalidSlaveAddress,
ChecksumError,
InvalidConfiguration,
InvalidNumOfExpectedRsps,
InvalidDataLen,
InvalidQuantity,
InvalidValue,
InvalidAndMask,
InvalidOrMask,
InvalidByteCount,
InvalidDeviceIdentification,
InvalidDeviceIdCode,
InvalidMeiType,
InvalidBroadcastAddress,
BroadcastNotAllowed,
}Expand description
Represents a Modbus error.
Variants§
ParseError
An error occurred while parsing the Modbus ADU.
BasicParseError
This is used for receieved frame is fundamentally malformed
Timeout
The transaction timed out waiting for a response.
ModbusException(u8)
The server responded with a Modbus exception code.
IoError
An I/O error occurred during TCP communication.
Unexpected
An unexpected error occurred.
ConnectionLost
The connection was lost during an active transaction.
UnsupportedFunction(u8)
The function code is not supported
ReservedSubFunction(u16)
The sub-function code is not available
InvalidPduLength
The PDU length is invalid
InvalidAduLength
The ADU length is invalid
ConnectionFailed
Connection failed
ConnectionClosed
Connection closed
BufferTooSmall
The data was too large for the buffer
BufferLenMissmatch
Buffer length is not matching
SendFailed
Failed to send data
InvalidAddress
Invalid address
InvalidOffset
Invalid offset
TooManyRequests
Too many requests in flight, expected responses buffer is full
InvalidFunctionCode
Invalid function code
NoRetriesLeft
No retries left for the transaction
TooManyFileReadSubRequests
Too many sub-requests in a PDU, Max allowed is 35
FileReadPduOverflow
File read PDU overflow, total length of file read sub-requests exceeds maximum allowed bytes per PDU
UnexpectedResponse
An unexpected response was received that does not match the expected response type for the transaction.
InvalidTransport
The transport is invalid for the requested operation
InvalidSlaveAddress
Invalid slave address
ChecksumError
Checksum error
InvalidConfiguration
Invalid configuration
InvalidNumOfExpectedRsps
Invalid number of expected responses.
For Modbus Serial transports, only one request may be in flight at a time,
so the expected-response queue size must be exactly 1.
InvalidDataLen
Invalid data length
InvalidQuantity
Invalid Quantity
InvalidValue
Invalid Value
InvalidAndMask
Invalid Masking value
InvalidOrMask
Invalid Masking value
InvalidByteCount
Invalid byte count
InvalidDeviceIdentification
Invalid device identification
InvalidDeviceIdCode
Invalid device id code
InvalidMeiType
Invalid MEI type
InvalidBroadcastAddress
Invalid broadcast address (0): Broadcast must be created explicitly.
Use UnitIdOrSlaveAddr::new_broadcast_address() to signal broadcast intent.
BroadcastNotAllowed
Broadcast not allowed.
Note: This variant name contains a historical typo and is kept for compatibility with existing code.
Implementations§
Source§impl MbusError
impl MbusError
Sourcepub const fn broadcast_not_allowed() -> Self
pub const fn broadcast_not_allowed() -> Self
Returns the canonical “broadcast not allowed” error.
This helper exists to provide a correctly spelled API path while preserving the legacy enum variant name for compatibility.
Trait Implementations§
Source§impl Error for MbusError
impl Error for MbusError
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
use the Display impl or to_string()