MHVLib
20111011
An efficiency oriented runtime library for AVR microcontrollers
|
#include <MHV_Device_RX.h>
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 |
Definition at line 48 of file MHV_Device_RX.h.
MHV_Device_RX::MHV_Device_RX | ( | MHV_RingBuffer * | rxBuffer | ) | [protected] |
Constructor
rxBuffer | a buffer to read into |
Definition at line 41 of file MHV_Device_RX.cpp.
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
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
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
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
listener | an MHV_RXListener to notify that the device is ready |
Definition at line 134 of file MHV_Device_RX.cpp.
MHV_RXListener* MHV_Device_RX::_listener [protected] |
Definition at line 51 of file MHV_Device_RX.h.
MHV_RingBuffer* MHV_Device_RX::_rxBuffer [protected] |
Definition at line 50 of file MHV_Device_RX.h.