Struct xmodem::Xmodem
[−]
[src]
pub struct Xmodem { pub max_errors: u32, pub pad_byte: u8, pub block_length: BlockLength, // some fields omitted }
Configuration for the XMODEM transfer.
Fields
max_errors: u32
The number of errors that can occur before the communication is considered a failure. Errors include unexpected bytes and timeouts waiting for bytes.
pad_byte: u8
The byte used to pad the last block. XMODEM can only send blocks of a certain size, so if the message is not a multiple of that size the last block needs to be padded.
block_length: BlockLength
The length of each block. There are only two options: 128-byte blocks (standard XMODEM) or 1024-byte blocks (XMODEM-1k).
Methods
impl Xmodem
[src]
fn new() -> Self
Creates the XMODEM config with default parameters.
fn send<D: Read + Write, R: Read>(
&mut self,
dev: &mut D,
stream: &mut R
) -> Result<()>
&mut self,
dev: &mut D,
stream: &mut R
) -> Result<()>
Starts the XMODEM transmission.
dev
should be the serial communication channel (e.g. the serial device).
stream
should be the message to send (e.g. a file).
Timeouts
This method has no way of setting the timeout of dev
, so it's up to the caller
to set the timeout of the device before calling this method. Timeouts on receiving
bytes will be counted against max_errors
, but timeouts on transmitting bytes
will be considered a fatal error.
Trait Implementations
impl Copy for Xmodem
[src]
impl Clone for Xmodem
[src]
fn clone(&self) -> Xmodem
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more