#include <CigiIO.h>
Public Member Functions | |
CigiIO (CigiIncomingMsg &InMsg, CigiOutgoingMsg &OutMsg) | |
virtual | ~CigiIO () |
int | Send (void) |
int | Receive (void) |
int | Recv (void) |
Protected Member Functions | |
virtual int | Write (Cigi_uint8 *Buffer, int Length)=0 |
virtual int | Read (Cigi_uint8 *Buffer, int MaxLength)=0 |
Protected Attributes | |
CigiIncomingMsg & | MsgIn |
CigiOutgoingMsg & | MsgOut |
Definition at line 58 of file CigiIO.h.
CigiIO::CigiIO | ( | CigiIncomingMsg & | InMsg, | |
CigiOutgoingMsg & | OutMsg | |||
) |
General Constructor
Definition at line 68 of file CigiIO.cpp.
References CigiOutgoingMsg::BeginMsg(), CIGI_SUCCESS, and MsgOut.
00069 : MsgIn(InMsg), MsgOut(OutMsg) 00070 { 00071 int stat = CIGI_SUCCESS; 00072 00073 stat = MsgOut.BeginMsg(); 00074 00075 }
CigiIO::~CigiIO | ( | ) | [virtual] |
virtual int CigiIO::Read | ( | Cigi_uint8 * | Buffer, | |
int | MaxLength | |||
) | [protected, pure virtual] |
A pure virtual function to input the data.
This function is not implemented by this class.
Buffer | - A pointer to the buffer to fill. | |
MaxLength | - The maximum length allowed for the message in bytes. |
int CigiIO::Receive | ( | void | ) |
Receive and processes a message
Definition at line 118 of file CigiIO.cpp.
References CigiIncomingMsg::AdvanceCrntBuffer(), CIGI_ERROR_MISCELLANEOUS, CIGI_SUCCESS, CigiIncomingMsg::GetMsgBuffer(), CigiIncomingMsg::GetMsgBufSize(), MsgIn, CigiIncomingMsg::ProcessIncomingMsg(), Read(), and CigiIncomingMsg::SetCrntMsgSize().
00119 { 00120 int stat = CIGI_SUCCESS; 00121 00122 MsgIn.AdvanceCrntBuffer(); 00123 00124 Cigi_uint8 *NextBuf = MsgIn.GetMsgBuffer(); 00125 00126 int size = Read(NextBuf,MsgIn.GetMsgBufSize()); 00127 00128 if(size > 0) 00129 { 00130 MsgIn.SetCrntMsgSize(size); 00131 00132 MsgIn.ProcessIncomingMsg(); 00133 00134 } 00135 else 00136 { 00137 size = 0; 00138 stat = CIGI_ERROR_MISCELLANEOUS; 00139 MsgIn.SetCrntMsgSize(size); 00140 } 00141 00142 return(stat); 00143 00144 }
int CigiIO::Recv | ( | void | ) |
Receive a message and store it for later processing
Definition at line 150 of file CigiIO.cpp.
References CigiIncomingMsg::AdvanceCrntBuffer(), CIGI_ERROR_MISCELLANEOUS, CIGI_SUCCESS, CigiIncomingMsg::GetMsgBuffer(), CigiIncomingMsg::GetMsgBufSize(), MsgIn, Read(), and CigiIncomingMsg::SetCrntMsgSize().
00151 { 00152 int stat = CIGI_SUCCESS; 00153 00154 MsgIn.AdvanceCrntBuffer(); 00155 00156 Cigi_uint8 *NextBuf = MsgIn.GetMsgBuffer(); 00157 00158 int size = Read(NextBuf,MsgIn.GetMsgBufSize()); 00159 00160 if(size > 0) 00161 { 00162 MsgIn.SetCrntMsgSize(size); 00163 00164 MsgIn.AdvanceCrntBuffer(); 00165 00166 } 00167 else 00168 { 00169 size = 0; 00170 stat = CIGI_ERROR_MISCELLANEOUS; 00171 MsgIn.SetCrntMsgSize(size); 00172 } 00173 00174 return(stat); 00175 00176 }
int CigiIO::Send | ( | void | ) |
Processes and send a message.
Definition at line 92 of file CigiIO.cpp.
References CigiOutgoingMsg::BeginMsg(), CIGI_SUCCESS, CigiOutgoingMsg::GetMsg(), CigiOutgoingMsg::LockMsg(), MsgOut, CigiOutgoingMsg::UnlockMsg(), CigiOutgoingMsg::UpdateFrameCntr(), and Write().
00093 { 00094 Cigi_uint8 *buff; 00095 int len; 00096 00097 int stat = CIGI_SUCCESS; 00098 00099 stat = MsgOut.UpdateFrameCntr(); 00100 00101 stat = MsgOut.LockMsg(); 00102 00103 buff = MsgOut.GetMsg(len); 00104 00105 Write(buff,len); 00106 00107 stat = MsgOut.UnlockMsg(); 00108 00109 stat = MsgOut.BeginMsg(); // prep for next message 00110 00111 return(stat); 00112 00113 }
virtual int CigiIO::Write | ( | Cigi_uint8 * | Buffer, | |
int | Length | |||
) | [protected, pure virtual] |
A pure virtual function to output the data.
This function is not implemented by this class.
Buffer | - A pointer to the buffer to write | |
Length | - The length of the message in bytes. |
Referenced by Send().
CigiIncomingMsg& CigiIO::MsgIn [protected] |
CigiOutgoingMsg& CigiIO::MsgOut [protected] |