00001 00002 00003 #ifndef MioWin32_h 00004 #define MioWin32_h 00005 00006 #include "Mio.h" 00007 #include <windows.h> 00008 00015 class MioWin32 : public Mio 00016 { 00017 00018 public: 00019 00023 virtual ~MioWin32( 00024 ); 00025 00029 MioWin32( 00030 ); 00031 00038 bool OpenComPort( 00039 const char * port 00041 ); 00042 00046 void CloseComPort( 00047 ); 00048 00052 bool IsOpen( 00053 ) const 00054 { 00055 return m_PortHandle != INVALID_HANDLE_VALUE; 00056 } 00057 00061 virtual Mio_Rc ResetCommunicationPort( 00062 ); 00063 00067 virtual Mio_Rc SendRawDataToMio( 00068 const void * data, 00069 int data_len 00070 ); 00071 00075 virtual Mio_Rc ReceiveRawDataFromMio( 00076 void * data, 00077 int data_len, 00078 int & data_bytes_received, 00079 unsigned timeout_ms 00080 ); 00081 00085 virtual unsigned GetCurrentTimeMs( 00086 ); 00087 00091 virtual unsigned GetElapsedTimeMs( 00092 unsigned start_time 00093 ); 00094 00095 00096 private: 00097 00098 00100 HANDLE m_PortHandle; 00101 00103 DCB m_OldDCB; 00104 00106 HANDLE m_WriteEvent; 00107 00109 HANDLE m_ReadEvent; 00110 00112 OVERLAPPED m_WriteOvlp; 00113 00115 OVERLAPPED m_ReadOvlp; 00116 00117 }; 00118 00119 00120 #endif // MioWin32_h