#[non_exhaustive]pub enum Event {
Started {
check: Check,
},
Progress {
bytes: u64,
total: Option<u64>,
},
FileEnd {
data: Vec<u8>,
last_block: usize,
padding: usize,
},
Error(Error),
Done,
}Expand description
Something that happened during a transfer.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Started
The check the transfer runs with is settled: sender, on the receiver’s
start character, and again if a later start character before the
first ACK changes it (C or D at any time before the first ACK; NAK
only after D, the 49G’s fallback to checksum: after C a NAK asks
for a damaged block 1 again in CRC-16); receiver, on the first block.
Progress
After each acknowledged block (send) or accepted new block (receive).
Fields
FileEnd
Receive: EOT acknowledged; the file as received.
Fields
data: Vec<u8>Every data byte received, padding of the last block included:
stripping it is the caller’s job. XModem carries no file length.
For an HP object (the calculators send binary objects: an 8-byte
HPHP48-x/HPHP49-x header, then the object), the real end is
found by walking the object: read its prolog and the size its
type implies (a length field for strings, code and the like, the
nested objects for composites), and cut there.
last_block: usizeSize of the last block (128 or 1024; 0 for an empty transfer): the most padding the file can carry.
padding: usizeTrailing bytes of the last block equal to its final byte, when that byte is 0x1A or 0x00: the likely padding. A hint only; real data may end in such bytes, and the 49G’s XSEND pads with whatever follows the object in memory (hint 0), while the 48GX pads with zeros. Only the object-length walk finds the real end.
Error(Error)
Terminal failure; the machine is idle.
Done
Terminal success. The machine is idle, or, as receiver, lingers
after the final ACK (Config::linger).