rs232-cygwin.h
Go to the documentation of this file.
00001 //======================================================================
00028 //======================================================================
00029 
00030 #ifndef RS232_CYGWIN_H_
00031 #define RS232_CYGWIN_H_
00032 
00033 //----------------------------------------------------------------------
00034 // System Includes - include with <>
00035 //----------------------------------------------------------------------
00036 
00037 #include <string>
00038 #include <termios.h>
00039 
00040 //----------------------------------------------------------------------
00041 // Project Includes - include with ""
00042 //----------------------------------------------------------------------
00043 
00044 #include "sdhexception.h"
00045 #include "serialbase.h"
00046 #include "sdhlibrary_settings.h"
00047 
00048 //----------------------------------------------------------------------
00049 // Defines, enums, unions, structs,
00050 //----------------------------------------------------------------------
00051 
00052 NAMESPACE_SDH_START
00053 
00054 
00055 //----------------------------------------------------------------------
00056 // Global variables
00057 //----------------------------------------------------------------------
00058 
00059 
00060 //----------------------------------------------------------------------
00061 // Function and class member declarations
00062 //----------------------------------------------------------------------
00063 
00064 
00065 
00066 
00067 
00071 class cRS232Exception: public cSerialBaseException
00072 {
00073 public:
00074   cRS232Exception( cMsg const & _msg )
00075     : cSerialBaseException( "cRS232Exception", _msg )
00076   {}
00077 };
00078 //======================================================================
00079 
00080 
00084 class cRS232 : public cSerialBase
00085 {
00086 
00087 protected:
00089     int port;
00090 
00092     std::string device_format_string;
00093 
00095     unsigned long baudrate;
00096 
00098     int fd;
00099 
00101     tcflag_t BaudrateToBaudrateCode( unsigned long baudrate )
00102     throw (cRS232Exception*);
00103 
00104     int status;
00105 
00106     termios io_set_old;
00107 
00108 public:
00119   cRS232( int _port, unsigned long _baudrate, double _timeout, char const* _device_format_string = "/dev/ttyS%d" );
00120 
00133   void Open( void )
00134       throw (cRS232Exception*);
00135 
00137   bool IsOpen( void )
00138       throw();
00139 
00141   void Close( void )
00142       throw (cRS232Exception*);
00143 
00145 
00153   int write( char const *ptr, int len=0 )
00154       throw (cRS232Exception*);
00155 
00164   ssize_t Read( void *data, ssize_t size, long timeout_us, bool return_on_less_data )
00165       throw (cRS232Exception*);
00166 
00168   virtual bool UseCRC16()
00169   {
00170       return true;
00171   }
00172 
00173 };
00174 //======================================================================
00175 
00176 NAMESPACE_SDH_END
00177 
00178 #endif
00179 
00180 
00181 //======================================================================
00182 /*
00183   Here are some settings for the emacs/xemacs editor (and can be safely ignored):
00184   (e.g. to explicitely set C++ mode for *.h header files)
00185 
00186   Local Variables:
00187   mode:C++
00188   mode:ELSE
00189   End:
00190 */
00191 //======================================================================
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


schunk_sdh
Author(s): Florian Weisshardt
autogenerated on Tue Mar 5 2013 14:44:11