Yate
UART Class Reference

An UART receiver/transmitter. More...

#include <yatemodem.h>

Inheritance diagram for UART:
DebugEnabler ETSIModem

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 ()
 
- Public Member Functions inherited from DebugEnabler
 DebugEnabler (int level=TelEngine::debugLevel(), bool enabled=true)
 
int debugLevel () const
 
int debugLevel (int level)
 
bool debugEnabled () const
 
void debugEnabled (bool enable)
 
const char * debugName () const
 
bool debugAt (int level) const
 
bool debugChained () const
 
void debugChain (const DebugEnabler *chain=0)
 
void debugCopy (const DebugEnabler *original=0)
 

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)
 
- Protected Member Functions inherited from DebugEnabler
void debugName (const char *name)
 

Detailed Description

An UART receiver/transmitter.

Accumulate data bits received from a modem

Member Enumeration Documentation

◆ Error

enum Error

UART error enumeration

◆ State

enum State

UART state enumeration

Constructor & Destructor Documentation

◆ UART()

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

Constructor

Parameters
stateThe initial state of this UART
paramsThe UART's parameters
nameThe name of this debug enabler

References state().

◆ ~UART()

virtual ~UART ( )
inlinevirtual

Destructor

Member Function Documentation

◆ accumulator()

const BitAccumulator & accumulator ( ) const
inline

Get the data bit accumulator used by this UART

Returns
The data bit accumulator used by this UART

◆ createMsg()

virtual bool createMsg ( NamedList & params,
DataBlock & data )
inlineprotectedvirtual

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

Parameters
paramsThe list containing message parameters
dataDestination message data buffer
Returns
False on failure

Reimplemented in ETSIModem.

Referenced by modulate().

◆ demodulate()

bool demodulate ( const DataBlock & data)
inline

Send data to the enclosed modem to be demodulated

Parameters
dataThe data to process
Returns
False to stop processing

◆ error() [1/2]

Error error ( ) const
inline

Get the current error state of this UART, if any

Returns
The current error state of this UART as enumeration

◆ error() [2/2]

bool error ( Error e)
protected

Set the error state of this UART

Parameters
eThe error
Returns
False

◆ fskStarted()

virtual bool fskStarted ( )
inlinevirtual

Notification from modem that the FSK start was detected

Returns
False to stop the modem

◆ idleRecvByte()

virtual int idleRecvByte ( unsigned char data)
inlineprotectedvirtual

Process an accumulated byte in Idle state

Parameters
dataThe byte to process
Returns
Negative to stop, positive to change state to BitStart, 0 to continue

Reimplemented in ETSIModem.

◆ modemType()

int modemType ( ) const
inline

Get the type of this UART's modem

Returns
The type of this UART's modem

◆ modulate() [1/2]

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

Create a buffer containing the modulated representation of another one

Parameters
destDestination buffer
srcSource buffer

◆ modulate() [2/2]

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

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

Parameters
destDestination buffer
paramsThe list containing the values to be modulated
Returns
False on failure (an 'error' parameter will be set in params)

References createMsg().

◆ recvBit()

bool recvBit ( bool value)

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

Parameters
valueThe bit to be processed
Returns
False to stop feeding data

◆ recvByte()

virtual bool recvByte ( unsigned char data)
inlinevirtual

Push a data byte into this UART

Parameters
dataThe byte to be processed
Returns
False to stop feeding data

Reimplemented in ETSIModem.

◆ reset()

virtual void reset ( State newState = Idle)
virtual

Reset this UART

Parameters
newStateThe state to reset to

◆ state()

State state ( ) const
inline

Get the current state of this UART

Returns
The current state of this UART as enumeration

Referenced by UART().

Member Data Documentation

◆ s_errors

TokenDict s_errors[]
static

Keeps the names associated with UART errors


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