UART Class Reference

An UART receiver/transmitter. More...

#include <yatemodem.h>

Inheritance diagram for UART:

DebugEnabler ETSIModem

List of all members.

Public Types

enum  State {
  Idle, BitStart, BitData, BitParity,
  BitStop, UARTError
}
enum  Error {
  EFraming, EParity, EChksum, EInvalidData,
  EUnknown, EStopped, ENone
}

Public Member Functions

 UART (State state, const NamedList &params, const char *name=0)
virtual ~UART ()
State state () const
Error error () const
int modemType () const
const BitAccumulatoraccumulator () const
virtual void reset (State newState=Idle)
bool demodulate (const DataBlock &data)
bool modulate (DataBlock &dest, NamedList &params)
void modulate (DataBlock &dest, const DataBlock &src)
bool recvBit (bool value)
virtual bool recvByte (unsigned char data)
virtual bool fskStarted ()

Static Public Attributes

static TokenDict s_errors []

Protected Member Functions

virtual int idleRecvByte (unsigned char data)
virtual bool createMsg (NamedList &params, DataBlock &data)
bool error (Error e)


Detailed Description

An UART receiver/transmitter.

Accumulate data bits received from a modem


Member Enumeration Documentation

enum Error

UART error enumeration

enum State

UART state enumeration

Reimplemented in ETSIModem.


Constructor & Destructor Documentation

UART ( State  state,
const NamedList params,
const char *  name = 0 
)

Constructor

Parameters:
state The initial state of this UART
params The UART's parameters
name The name of this debug enabler

virtual ~UART (  )  [inline, virtual]

Destructor


Member Function Documentation

const BitAccumulator& accumulator (  )  const [inline]

Get the data bit accumulator used by this UART

Returns:
The data bit accumulator used by this UART

virtual bool createMsg ( NamedList params,
DataBlock data 
) [inline, protected, virtual]

Create a buffer containing the byte representation of a message to be sent

Parameters:
params The list containing message parameters
data Destination message data buffer
Returns:
False on failure

Reimplemented in ETSIModem.

bool demodulate ( const DataBlock data  )  [inline]

Send data to the enclosed modem to be demodulated

Parameters:
data The data to process
Returns:
False to stop processing

bool error ( Error  e  )  [protected]

Set the error state of this UART

Parameters:
e The error
Returns:
False

Error error (  )  const [inline]

Get the current error state of this UART, if any

Returns:
The current error state of this UART as enumeration

virtual bool fskStarted (  )  [inline, virtual]

Notification from modem that the FSK start was detected

Returns:
False to stop the modem

virtual int idleRecvByte ( unsigned char  data  )  [inline, protected, virtual]

Process an accumulated byte in Idle state

Parameters:
data The byte to process
Returns:
Negative to stop, positive to change state to BitStart, 0 to continue

Reimplemented in ETSIModem.

int modemType (  )  const [inline]

Get the type of this UART's modem

Returns:
The type of this UART's modem

void modulate ( DataBlock dest,
const DataBlock src 
) [inline]

Create a buffer containing the modulated representation of another one

Parameters:
dest Destination buffer
src Source buffer

bool modulate ( DataBlock dest,
NamedList params 
) [inline]

Create a buffer containing the modulated representation of a list of parameters

Parameters:
dest Destination buffer
params The list containing the values to be modulated
Returns:
False on failure (an 'error' parameter will be set in params)

bool recvBit ( bool  value  ) 

Push a bit of data into this UART. Once a data byte is accumulated, push it back to itself

Parameters:
value The bit to be processed
Returns:
False to stop feeding data

virtual bool recvByte ( unsigned char  data  )  [inline, virtual]

Push a data byte into this UART

Parameters:
data The byte to be processed
Returns:
False to stop feeding data

Reimplemented in ETSIModem.

virtual void reset ( State  newState = Idle  )  [virtual]

Reset this UART

Parameters:
newState The state to reset to

State state (  )  const [inline]

Get the current state of this UART

Returns:
The current state of this UART as enumeration


Member Data Documentation

TokenDict s_errors[] [static]

Keeps the names associated with UART errors


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

Generated on Sun Dec 7 21:36:13 2008 for Yate by  doxygen 1.5.7.1