00001 00055 #define _EXPORT_CCL_ 00056 00057 00058 #include "CigiIO.h" 00059 00060 00061 // ==================================================================== 00062 // Construction/Destruction 00063 // ==================================================================== 00064 00065 // ================================================ 00066 // CigiIO 00067 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv 00068 CigiIO::CigiIO(CigiIncomingMsg &InMsg, CigiOutgoingMsg &OutMsg) 00069 : MsgIn(InMsg), MsgOut(OutMsg) 00070 { 00071 int stat = CIGI_SUCCESS; 00072 00073 stat = MsgOut.BeginMsg(); 00074 00075 } 00076 00077 // ================================================ 00078 // ~CigiIO 00079 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv 00080 CigiIO::~CigiIO() 00081 { 00082 00083 } 00084 00085 // ==================================================================== 00086 // Processing 00087 // ==================================================================== 00088 00089 // ================================================ 00090 // Send 00091 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv 00092 int CigiIO::Send() 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 } 00114 00115 // ================================================ 00116 // Receive 00117 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv 00118 int CigiIO::Receive() 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 } 00145 00146 00147 // ================================================ 00148 // Recv 00149 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv 00150 int CigiIO::Recv() 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 } 00177 00178 00179