# class UART | An UART receiver/transmitter. More...
Full name | `TelEngine::UART`
Definition | `#include <libs/ymodem/yatemodem.h>`
Inherits | TelEngine::DebugEnabler [public ]
Inherited by | ETSIModem
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Types

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

#### Public Methods

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

#### Public Members

- static TokenDict s_errors[]

#### Protected Methods

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

## Detailed Description

Accumulate data bits received from a modem

enum State { Idle, BitStart, BitData, BitParity, BitStop, UARTError, } | ### State

UART state enumeration

enum Error { EFraming, EParity, EChksum, EInvalidData, EUnknown, EStopped, ENone } | ### Error

UART error enumeration

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

Constructor

Parameters:

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

~UART () | ### ~UART

[virtual]

Destructor

inline State state () | ### state

[const]

Get the current state of this UART

Returns: The current state of this UART as enumeration

inline Error error () | ### error

[const]

Get the current error state of this UART, if any

Returns: The current error state of this UART as enumeration

inline int modemType () | ### modemType

[const]

Get the type of this UART's modem

Returns: The type of this UART's modem

inline const BitAccumulator& accumulator () | ### accumulator

[const]

Get the data bit accumulator used by this UART

Returns: The data bit accumulator used by this UART

void reset (State newState = Idle) | ### reset

[virtual]

Reset this UART

Parameters:

newState | The state to reset to

inline bool demodulate (const DataBlock& data) | ### demodulate

Send data to the enclosed modem to be demodulated

Parameters:

data | The data to process

Returns: False to stop processing

inline bool modulate (DataBlock& dest, NamedList& params) | ### modulate

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)

inline void modulate (DataBlock& dest, const DataBlock& src) | ### modulate

Create a buffer containing the modulated representation of another one

Parameters:

dest | Destination buffer
src | Source buffer

bool recvBit (bool value) | ### recvBit

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

bool recvByte (unsigned char data) | ### recvByte

[virtual]

Push a data byte into this UART

Parameters:

data | The byte to be processed

Returns: False to stop feeding data

bool fskStarted () | ### fskStarted

[virtual]

Notification from modem that the FSK start was detected

Returns: False to stop the modem

static TokenDict s_errors[] | ### s_errors[]

int idleRecvByte (unsigned char data) | ### idleRecvByte

[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

bool createMsg (NamedList& params, DataBlock& data) | ### createMsg

[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

bool error (Error e) | ### error

[protected]

Set the error state of this UART

Parameters:

e | The error

Returns: False

Generated by: paulc on bussard on Mon Feb 10 13:15:47 2014, using kdoc 2.0a54.