YModem Class Reference
[Comms - Y-Modem (and X-Modem) transmission protocol]

Base class for YModemRx and YModemTx. More...

#include <ymodem.h>

Inheritance diagram for YModem:
Inheritance graph
[legend]

List of all members.

Protected Types

enum  ControlCharacters
enum  Error {
  ErrorTimeout = -200,
  ErrorBlockRetriesExceded = -201
}

Protected Member Functions

uint8_t Checksum (const uint8_t *data, size_t size)
uint16_t CRC16 (const uint8_t *data, size_t size)
uint16_t UpdateCRC16 (uint16_t crcIn, uint8_t byte)
int InChar (unsigned timeout)
void Cancel ()

Protected Attributes

SerialPortPort

Detailed Description

Base class for YModemRx and YModemTx.

Definition at line 46 of file ymodem.h.


Member Enumeration Documentation

enum YModem::ControlCharacters [protected]

Enumeration of control characted used in communications protocol.

Definition at line 101 of file ymodem.h.

enum YModem::Error [protected]

Enumeration of possible error values.

Enumerator:
ErrorTimeout 

Timed out trying to communicate with other device

ErrorBlockRetriesExceded 

A block could not be sent

Definition at line 114 of file ymodem.h.


Member Function Documentation

uint8_t YModem::Checksum ( const uint8_t data,
size_t  size 
) [protected]

Checksum a block of data.

Parameters:
data Start of data to checksum.
size Size of data.
Returns:
Sum of bytes in data, modulo 256.

Definition at line 66 of file ymodem.cpp.

uint16_t YModem::CRC16 ( const uint8_t data,
size_t  size 
) [protected]

Calculate CRC for a block of data.

Parameters:
data Start of data to checksum.
size Size of data.
Returns:
CRC of data.

Definition at line 54 of file ymodem.cpp.

uint16_t YModem::UpdateCRC16 ( uint16_t  crcIn,
uint8_t  byte 
) [protected]

Update CRC value by accumulating another byte of data.

Parameters:
crcIn Previous CRC value.
byte A byte of data.
Returns:
Updated CRC value.

Definition at line 36 of file ymodem.cpp.

int YModem::InChar ( unsigned  timeout  )  [protected]

Receive a single character. If the timeout period is exceeded, ErrorTimeout is returned.

Parameters:
timeout Time in milliseconds to wait if no data available.
Returns:
The character received, or a negative error value if failed.

Definition at line 76 of file ymodem.cpp.

void YModem::Cancel (  )  [protected]

Send CANcel sequence.

Definition at line 88 of file ymodem.cpp.


Member Data Documentation

SerialPort& YModem::Port [protected]

The serial port to use for communications.

Definition at line 124 of file ymodem.h.


The documentation for this class was generated from the following files:

Generated by  doxygen 1.6.1