#include <ccommunication.h>


Public Member Functions | |
| CCommunication () | |
| virtual void | flush () |
| Flush transmitter andf receiver. | |
| virtual CMachine::ubit32 | rx (CByteArray *buffer, CMachine::ubit32 count=(-1)) |
| Receive maximum of count bytes into a CByteArray. | |
| virtual CMachine::ubit8 | rx () |
| Receive a sinlge byte. | |
| virtual void | rxFlush () |
| Flush receiver. | |
| virtual CMachine::ubit32 | rxReady () |
| Return the state of the receiver buffer. | |
| virtual CMachine::ubit32 | tx (CMachine::bit8 *str) |
| Transmit a string and append a newline - may yield CPU time if transmitter ring buffer is full. | |
| virtual CMachine::ubit32 | tx (CString &str) |
| Transmit a string - may yield CPU time if transmitter ring buffer is full. | |
| virtual CMachine::ubit32 | tx (CByteArray *bytes) |
| Transmit a byte array - may yield CPU time if transmitter ring buffer is full. | |
| virtual CMachine::ubit8 | tx (CMachine::ubit8 ch) |
| transmit a single byte - may yield CPU time if transmitter ring buffer is full. | |
| virtual void | txFlush () |
| Flush transmitter. | |
| virtual CMachine::ubit32 | txnl (CMachine::bit8 *str) |
| Transmit a string and append a newline - may yield CPU time if transmitter ring buffer is full. | |
| virtual CMachine::ubit32 | txnl (CString &str) |
| Transmit a string - may yield CPU time if transmitter ring buffer is full. | |
| virtual CMachine::ubit32 | txReady () |
| Return the state of the transmitter buffer. | |
| virtual | ~CCommunication () |
Protected Member Functions | |
| CRingBuffer * | rxRingBuffer () |
| CRingBuffer * | txRingBuffer () |
Private Attributes | |
| CRingBuffer | mRxRingBuffer |
| CRingBuffer | mTxRingBuffer |
Definition at line 35 of file ccommunication.h.
| PikeAero::CCommunication::CCommunication | ( | ) |
Definition at line 25 of file ccommunication.cpp.
References mRxRingBuffer, mTxRingBuffer, and PikeAero::CByteArray::resize().
00026 : CObject() 00027 { 00028 mRxRingBuffer.resize(16); 00029 mTxRingBuffer.resize(16); 00030 }

| PikeAero::CCommunication::~CCommunication | ( | ) | [virtual] |
Definition at line 33 of file ccommunication.cpp.
References PikeAero::CByteArray::clear(), mRxRingBuffer, and mTxRingBuffer.
00034 { 00035 mRxRingBuffer.clear(); 00036 mTxRingBuffer.clear(); 00037 }

| virtual void PikeAero::CCommunication::flush | ( | ) | [inline, virtual] |
| CMachine::ubit32 PikeAero::CCommunication::rx | ( | CByteArray * | buffer, | |
| CMachine::ubit32 | count = (-1) | |||
| ) | [virtual] |
Receive maximum of count bytes into a CByteArray.
| buffer | The CByteArray object to receive the bytes. | |
| count | Receive a maximum of this many bytes (-1 means unlimited). |
Definition at line 140 of file ccommunication.cpp.
References PikeAero::CByteArray::append(), PikeAero::CByteArray::clear(), rx(), and rxReady().
00141 { 00142 CMachine::ubit32 rc = 0; 00143 buffer->clear(); 00144 for ( rc = 0; rc < count; rc++ ) 00145 { 00146 if ( !rxReady() ) 00147 break; 00148 buffer->append( rx() ); 00149 } 00150 return rc; 00151 }

| CMachine::ubit8 PikeAero::CCommunication::rx | ( | ) | [virtual] |
Receive a sinlge byte.
Reimplemented in PikeAero::CCommunicationPacket.
Definition at line 129 of file ccommunication.cpp.
References PikeAero::CRingBuffer::remove(), and rxRingBuffer().
Referenced by PikeAero::CTaskConsolePacket::run(), PikeAero::CTaskConsole::run(), and rx().
00130 { 00131 return rxRingBuffer()->remove(); 00132 }


| virtual void PikeAero::CCommunication::rxFlush | ( | ) | [inline, virtual] |
Flush receiver.
Reimplemented in PikeAero::CCommunicationPacket.
Definition at line 102 of file ccommunication.h.
Referenced by flush().

| CMachine::ubit32 PikeAero::CCommunication::rxReady | ( | ) | [virtual] |
Return the state of the receiver buffer.
Definition at line 166 of file ccommunication.cpp.
References PikeAero::CRingBuffer::length(), and rxRingBuffer().
Referenced by rx().
00167 { 00168 return rxRingBuffer()->length(); 00169 }


| CRingBuffer* PikeAero::CCommunication::rxRingBuffer | ( | ) | [inline, protected] |
Definition at line 110 of file ccommunication.h.
References mRxRingBuffer.
Referenced by PikeAero::CCommunicationUART::irq(), rx(), and rxReady().
00110 {return &mRxRingBuffer;}

| CMachine::ubit32 PikeAero::CCommunication::tx | ( | CMachine::bit8 * | str | ) | [virtual] |
Transmit a string and append a newline - may yield CPU time if transmitter ring buffer is full.
Transmit a string.
true indicates successful operation, otherwise a failure occured.
Definition at line 100 of file ccommunication.cpp.
00101 { 00102 CMachine::ubit32 len = strlen((const char*)str); 00103 for(CMachine::bit32 n=0; n < len; n++) 00104 { 00105 tx(str[n]); 00106 } 00107 return len; 00108 }

| CMachine::ubit32 PikeAero::CCommunication::tx | ( | CString & | str | ) | [virtual] |
Transmit a string - may yield CPU time if transmitter ring buffer is full.
Transmit a string.
true indicates successful operation, otherwise a failure occured.
Definition at line 71 of file ccommunication.cpp.
References PikeAero::CByteArray::at(), PikeAero::CString::length(), and tx().
00072 { 00073 CMachine::ubit32 len = str.length(); 00074 for(CMachine::ubit32 n=0; n < len; n++) 00075 { 00076 tx(str.at(n)); 00077 } 00078 return len; 00079 }

| CMachine::ubit32 PikeAero::CCommunication::tx | ( | CByteArray * | bytes | ) | [virtual] |
Transmit a byte array - may yield CPU time if transmitter ring buffer is full.
Transmit a byte array.
true indicates successful operation, otherwise a failure occured.
Definition at line 57 of file ccommunication.cpp.
References PikeAero::CByteArray::at(), PikeAero::CByteArray::length(), and tx().
00058 { 00059 CMachine::ubit32 len = bytes->length(); 00060 for(CMachine::ubit32 n=0; n < len; n++) 00061 { 00062 tx(bytes->at(n)); 00063 } 00064 return len; 00065 }

| CMachine::ubit8 PikeAero::CCommunication::tx | ( | CMachine::ubit8 | ch | ) | [virtual] |
transmit a single byte - may yield CPU time if transmitter ring buffer is full.
While the transmitter ring buffer is full, yield CPU time.
Reimplemented in PikeAero::CCommunicationPacket, and PikeAero::CCommunicationUART.
Definition at line 43 of file ccommunication.cpp.
References txRingBuffer(), and PikeAero::CTaskScheduler::yield().
Referenced by PikeAero::CTaskTerminal::clearAttributes(), PikeAero::CTaskConsole::commandHelp(), PikeAero::CTaskTerminal::cursorMoveAbsolute(), PikeAero::CTaskTerminal::cursorMoveBackward(), PikeAero::CTaskTerminal::cursorMoveDown(), PikeAero::CTaskTerminal::cursorMoveForward(), PikeAero::CTaskTerminal::cursorMoveUp(), PikeAero::CTaskConsole::drawCommandPrompt(), PikeAero::CTaskConsole::drawStatusBar(), PikeAero::CTaskTerminal::eraseDisplay(), PikeAero::CTaskTerminal::eraseLine(), PikeAero::CTaskConsolePacket::monitor(), PikeAero::CTaskConsole::monitor(), PikeAero::CTaskConsole::run(), PikeAero::CTaskTerminal::setAttributeReverseVideo(), tx(), and txnl().
00044 { 00045 while(!txRingBuffer()->insert(ch)) 00046 { 00047 /** While the transmitter ring buffer is full, yield CPU time. */ 00048 CTaskScheduler::yield(); 00049 } 00050 return ch; 00051 }


| virtual void PikeAero::CCommunication::txFlush | ( | ) | [inline, virtual] |
Flush transmitter.
Reimplemented in PikeAero::CCommunicationPacket.
Definition at line 97 of file ccommunication.h.
Referenced by flush().

| CMachine::ubit32 PikeAero::CCommunication::txnl | ( | CMachine::bit8 * | str | ) | [virtual] |
Transmit a string and append a newline - may yield CPU time if transmitter ring buffer is full.
Definition at line 114 of file ccommunication.cpp.
00115 { 00116 CMachine::ubit32 len = strlen((const char*)str); 00117 for(CMachine::bit32 n=0; n < len; n++) 00118 { 00119 tx(str[n]); 00120 } 00121 tx("\r\n"); 00122 return len; 00123 }

| CMachine::ubit32 PikeAero::CCommunication::txnl | ( | CString & | str | ) | [virtual] |
Transmit a string - may yield CPU time if transmitter ring buffer is full.
Transmit a string and append a newline.
true indicates successful operation, otherwise a failure occured.
Definition at line 85 of file ccommunication.cpp.
References PikeAero::CByteArray::at(), PikeAero::CString::length(), and tx().
Referenced by PikeAero::CCommandHandler::commandQM2C(), PikeAero::CCommandHandler::commandQM2S(), PikeAero::CCommandHandler::commandQMC(), PikeAero::CCommandHandler::commandQMDT(), PikeAero::CCommandHandler::commandQMS(), PikeAero::CCommandHandler::commandQSM2C(), PikeAero::CCommandHandler::commandQSM2S(), PikeAero::CCommandHandler::commandQSM2X(), PikeAero::CCommandHandler::commandQSM2Y(), PikeAero::CCommandHandler::commandQSMC(), PikeAero::CCommandHandler::commandQSMS(), PikeAero::CCommandHandler::commandQSMV(), PikeAero::CCommandHandler::commandSM2C(), PikeAero::CCommandHandler::commandSM2S(), PikeAero::CCommandHandler::commandSMC(), PikeAero::CCommandHandler::commandSMDT(), PikeAero::CCommandHandler::commandSMS(), PikeAero::CCommandHandler::commandSSM2C(), PikeAero::CCommandHandler::commandSSM2S(), PikeAero::CCommandHandler::commandSSM2X(), PikeAero::CCommandHandler::commandSSM2Y(), PikeAero::CCommandHandler::commandSSMC(), PikeAero::CCommandHandler::commandSSMS(), PikeAero::CCommandHandler::commandSSMV(), and PikeAero::CCommandHandler::replyReturn().
00086 { 00087 CMachine::ubit32 len = str.length(); 00088 for(CMachine::ubit32 n=0; n < len; n++) 00089 { 00090 tx(str.at(n)); 00091 } 00092 tx("\r\n"); 00093 return len; 00094 }


| CMachine::ubit32 PikeAero::CCommunication::txReady | ( | ) | [virtual] |
Return the state of the transmitter buffer.
Definition at line 157 of file ccommunication.cpp.
References PikeAero::CRingBuffer::free(), and txRingBuffer().
00158 { 00159 return txRingBuffer()->free(); 00160 }

| CRingBuffer* PikeAero::CCommunication::txRingBuffer | ( | ) | [inline, protected] |
Definition at line 111 of file ccommunication.h.
References mTxRingBuffer.
Referenced by PikeAero::CCommunicationUART::irq(), PikeAero::CCommunicationUART::tx(), tx(), and txReady().
00111 {return &mTxRingBuffer;}

Definition at line 114 of file ccommunication.h.
Referenced by CCommunication(), rxRingBuffer(), and ~CCommunication().
Definition at line 115 of file ccommunication.h.
Referenced by CCommunication(), txRingBuffer(), and ~CCommunication().
1.5.8