IGSTK
|
00001 /*========================================================================= 00002 00003 Program: Image Guided Surgery Software Toolkit 00004 Module: $RCSfile: igstkSerialCommunicationForWindows.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-02-11 01:41:51 $ 00007 Version: $Revision: 1.12 $ 00008 00009 Copyright (c) ISC Insight Software Consortium. All rights reserved. 00010 See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #ifndef __igstkSerialCommunicationForWindows_h 00019 #define __igstkSerialCommunicationForWindows_h 00020 00021 #include <windows.h> 00022 00023 #include "igstkSerialCommunication.h" 00024 00025 namespace igstk 00026 { 00027 00044 class SerialCommunicationForWindows : public SerialCommunication 00045 { 00046 public: 00047 00049 igstkStandardClassTraitsMacro( SerialCommunicationForWindows, 00050 SerialCommunication ) 00051 00052 public: 00053 00055 typedef SerialCommunication::ResultType ResultType; 00056 00057 protected: 00058 00060 typedef HANDLE HandleType; 00061 00063 SerialCommunicationForWindows(); 00064 00066 ~SerialCommunicationForWindows(); 00067 00069 virtual ResultType InternalOpenPort( void ); 00070 00073 virtual ResultType InternalUpdateParameters( void ); 00074 00076 virtual ResultType InternalClosePort( void ); 00077 00079 virtual ResultType InternalSendBreak( void ); 00080 00082 virtual void InternalSleep( int milliseconds ); 00083 00085 virtual ResultType InternalPurgeBuffers( void ); 00086 00088 virtual ResultType InternalWrite( const char *message, 00089 unsigned int numberOfBytes ); 00090 00092 virtual ResultType InternalRead( char *data, unsigned int numberOfBytes, 00093 unsigned int &bytesRead ); 00094 00098 virtual ResultType InternalSetRTS(unsigned int signal); 00099 00101 virtual ResultType InternalSetTimeout( unsigned int timeoutPeriod ); 00102 00104 virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const; 00105 00106 private: 00107 00108 unsigned int m_OldTimeoutPeriod; 00109 00110 HandleType m_PortHandle; // com port handle 00111 }; 00112 00113 } // end namespace igstk 00114 00115 #endif // __igstkSerialCommunicationForWindows_h