/[H9]/trunk/FlisServer/Serial.cpp
ViewVC logotype

Diff of /trunk/FlisServer/Serial.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 112 by kevin, Tue Nov 27 15:26:42 2007 UTC revision 113 by kevin, Sat Dec 1 14:18:33 2007 UTC
# Line 111  void CSerial::close() Line 111  void CSerial::close()
111          if (mIsopen)          if (mIsopen)
112          {          {
113                  while (getComstat().cbOutQue >0)                  while (getComstat().cbOutQue >0)
114                    {
115                          Sleep(5);                          Sleep(5);
116                    }
117                  SetCommState(mComport,&mDcbRestore);                  SetCommState(mComport,&mDcbRestore);
118                  CloseHandle(mComport);                  CloseHandle(mComport);
119                  mIsopen = false;                  mIsopen = false;
# Line 125  unsigned char CSerial::readByte() Line 127  unsigned char CSerial::readByte()
127          unsigned long size;          unsigned long size;
128    
129          if (!mIsopen)          if (!mIsopen)
130            {
131                  throw std::exception("Port not opened");                  throw std::exception("Port not opened");
132            }
133    
134          ReadFile(mComport,&out,1,&size,0);          ReadFile(mComport,&out,1,&size,0);
135  // Error check.  // Error check.
# Line 135  unsigned char CSerial::readByte() Line 139  unsigned char CSerial::readByte()
139                  CloseHandle(mComport);                  CloseHandle(mComport);
140                  throw std::exception(error.c_str());                  throw std::exception(error.c_str());
141          }          }
142            
143    
144          //printByte("Read", out);          //printByte("Read", out);
145          return out;          return out;

Legend:
Removed from v.112  
changed lines
  Added in v.113

  ViewVC Help
Powered by ViewVC 1.1.20