00001 /*========================================================================= 00002 00003 Program: Image Guided Surgery Software Toolkit 00004 Module: $RCSfile: igstkSerialCommunicationForPosix.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-02-11 01:41:51 $ 00007 Version: $Revision: 1.14 $ 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 __igstkSerialCommunicationForPosix_h 00019 #define __igstkSerialCommunicationForPosix_h 00020 00021 #include "igstkSerialCommunication.h" 00022 00023 namespace igstk 00024 { 00025 00041 class SerialCommunicationForPosix : public SerialCommunication 00042 { 00043 public: 00044 00046 igstkStandardClassTraitsMacro( SerialCommunicationForPosix, \ 00047 SerialCommunication ) 00048 00049 public: 00050 00052 typedef SerialCommunication::ResultType ResultType; 00053 00054 protected: 00055 00057 SerialCommunicationForPosix(); 00058 00060 ~SerialCommunicationForPosix(); 00061 00063 virtual ResultType InternalOpenPort( void ); 00064 00067 virtual ResultType InternalUpdateParameters( void ); 00068 00070 virtual ResultType InternalClosePort( void ); 00071 00073 virtual ResultType InternalSendBreak( void ); 00074 00076 virtual void InternalSleep( unsigned int milliseconds ); 00077 00079 virtual ResultType InternalPurgeBuffers( void ); 00080 00082 virtual ResultType InternalWrite( const char *message, 00083 unsigned int numberOfBytes ); 00084 00086 virtual ResultType InternalRead( char *data, unsigned int numberOfBytes, 00087 unsigned int &bytesRead ); 00088 00092 virtual ResultType InternalSetRTS( unsigned int signal ); 00093 00095 virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const; 00096 00097 private: 00098 00100 itkStaticConstMacro( INVALID_HANDLE ,int, -1 ); 00101 00103 int m_PortHandle; 00104 00106 unsigned int m_OldTimeoutPeriod; 00107 }; 00108 00109 } // end namespace igstk 00110 00111 #endif // __igstkSerialCommunicationForPosix_h