IGSTK
igstkSerialCommunicationForPosix.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Image Guided Surgery Software Toolkit
4  Module: $RCSfile: igstkSerialCommunicationForPosix.h,v $
5  Language: C++
6  Date: $Date: 2008-02-11 01:41:51 $
7  Version: $Revision: 1.14 $
8 
9  Copyright (c) ISC Insight Software Consortium. All rights reserved.
10  See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 
18 #ifndef __igstkSerialCommunicationForPosix_h
19 #define __igstkSerialCommunicationForPosix_h
20 
22 
23 namespace igstk
24 {
25 
42 {
43 public:
44 
48 
49 public:
50 
53 
54 protected:
55 
58 
61 
63  virtual ResultType InternalOpenPort( void );
64 
67  virtual ResultType InternalUpdateParameters( void );
68 
70  virtual ResultType InternalClosePort( void );
71 
73  virtual ResultType InternalSendBreak( void );
74 
76  virtual void InternalSleep( unsigned int milliseconds );
77 
79  virtual ResultType InternalPurgeBuffers( void );
80 
82  virtual ResultType InternalWrite( const char *message,
83  unsigned int numberOfBytes );
84 
86  virtual ResultType InternalRead( char *data, unsigned int numberOfBytes,
87  unsigned int &bytesRead );
88 
92  virtual ResultType InternalSetRTS( unsigned int signal );
93 
95  virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
96 
97 private:
98 
100  itkStaticConstMacro( INVALID_HANDLE ,int, -1 );
101 
103  int m_PortHandle;
104 
106  unsigned int m_OldTimeoutPeriod;
107 };
108 
109 } // end namespace igstk
110 
111 #endif // __igstkSerialCommunicationForPosix_h
virtual ResultType InternalSendBreak(void)
Send a serial break.
virtual ResultType InternalClosePort(void)
Closes serial port.
SerialCommunicationForPosix()
Macro with standard traits declarations.
virtual void PrintSelf(std::ostream &os, itk::Indent indent) const
Print object information.
virtual ResultType InternalPurgeBuffers(void)
Purge the input and output buffers.
#define igstkStandardClassTraitsMacro(classname, superclassname)
Convenience macro for traits of a non-templated class.
Definition: igstkMacros.h:275
This class implements Posix specific methods for 32-bit communication over a Serial Port(RS-232 conne...
Communication::ResultType ResultType
virtual ResultType InternalSetRTS(unsigned int signal)
Set the RTS (ready-to-send) value 0 : Clear the RTS (request-to-send) signal 1 : Sends the RTS signal...
virtual void InternalSleep(unsigned int milliseconds)
Sleep for the specified number of milliseconds.
virtual ResultType InternalWrite(const char *message, unsigned int numberOfBytes)
Write data.
This class implements communication over a serial port via RS-232.
virtual ResultType InternalOpenPort(void)
Opens serial port for communication;.
virtual ResultType InternalUpdateParameters(void)
Set communication on the open port as per the communication parameters.
virtual ResultType InternalRead(char *data, unsigned int numberOfBytes, unsigned int &bytesRead)
Read data.