MHVLib  20111011
An efficiency oriented runtime library for AVR microcontrollers
MHV_Device_RX Class Reference

#include <MHV_Device_RX.h>

Inheritance diagram for MHV_Device_RX:
MHV_HardwareSerial

List of all members.

Public Member Functions

int asyncReadLine (char *buffer, uint8_t bufferLength)
int busyReadLine (char *buffer, uint8_t bufferLength)
int read ()
void flush ()
bool ready ()
void registerListener (MHV_RXListener *listener)
void deregisterListener ()
void handleEvents ()

Protected Member Functions

 MHV_Device_RX (MHV_RingBuffer *rxBuffer)

Protected Attributes

MHV_RingBuffer_rxBuffer
MHV_RXListener_listener

Detailed Description

Definition at line 48 of file MHV_Device_RX.h.


Constructor & Destructor Documentation

MHV_Device_RX::MHV_Device_RX ( MHV_RingBuffer rxBuffer) [protected]

Constructor

Parameters:
rxBuffera buffer to read into

Definition at line 41 of file MHV_Device_RX.cpp.


Member Function Documentation

int MHV_Device_RX::asyncReadLine ( char *  buffer,
uint8_t  bufferLength 
)

If we have a line, copy it into a buffer & null terminate, stripping CR/LF returns 0 if we have successfully copied a line returns -1 if there was no line available returns -2 if the buffer was too small returns -3 if we have reached the end of the ringbuffer with no line terminator

Definition at line 53 of file MHV_Device_RX.cpp.

int MHV_Device_RX::busyReadLine ( char *  buffer,
uint8_t  bufferLength 
)

If we have a line, copy it into a buffer & null terminate, stripping CR/LF Blocks until a line is available

Returns:
0 if we have successfully copied a line
-2 if the buffer was too small
-3 if we have reached the end of the ringbuffer with no line terminator

Definition at line 91 of file MHV_Device_RX.cpp.

void MHV_Device_RX::deregisterListener ( )

Deregister interest for lines/overflows from an RX device

Definition at line 141 of file MHV_Device_RX.cpp.

void MHV_Device_RX::flush ( )

Discard remaining data in the receive buffer

Definition at line 108 of file MHV_Device_RX.cpp.

void MHV_Device_RX::handleEvents ( )

Call from the main loop to handle any events

Definition at line 149 of file MHV_Device_RX.cpp.

int MHV_Device_RX::read ( void  )

Read a byte from the receive buffer

Returns:
the byte, or -1 if there is nothing to read

Definition at line 101 of file MHV_Device_RX.cpp.

bool MHV_Device_RX::ready ( )

Check if a line is ready, or the ringbuffer is full

Returns:
true if either of the situations occur0

Definition at line 116 of file MHV_Device_RX.cpp.

void MHV_Device_RX::registerListener ( MHV_RXListener listener)

Register interest for lines/overflows from an RX device

Parameters:
listeneran MHV_RXListener to notify that the device is ready

Definition at line 134 of file MHV_Device_RX.cpp.


Member Data Documentation

Definition at line 51 of file MHV_Device_RX.h.

Definition at line 50 of file MHV_Device_RX.h.


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