$search
00001 //====================================================================== 00028 //====================================================================== 00029 00030 #ifndef CANSERIAL_ESD_H_ 00031 #define CANSERIAL_ESD_H_ 00032 00033 //---------------------------------------------------------------------- 00034 // System Includes - include with <> 00035 //---------------------------------------------------------------------- 00036 00037 00038 //---------------------------------------------------------------------- 00039 // Project Includes - include with "" 00040 //---------------------------------------------------------------------- 00041 00042 #include "sdhexception.h" 00043 #include "serialbase.h" 00044 #include "basisdef.h" 00045 #include "sdhlibrary_settings.h" 00046 00047 //---------------------------------------------------------------------- 00048 // Defines, enums, unions, structs, 00049 //---------------------------------------------------------------------- 00050 00051 NAMESPACE_SDH_START 00052 00054 #define CAN_ESD_TXQUEUESIZE 32 00055 00057 #define CAN_ESD_RXQUEUESIZE 512 00058 00059 //---------------------------------------------------------------------- 00060 // Global variables 00061 //---------------------------------------------------------------------- 00062 00063 00064 //---------------------------------------------------------------------- 00065 // Function and class member declarations 00066 //---------------------------------------------------------------------- 00067 00069 class cCANSerial_ESD_Internal; 00070 00071 00075 class VCC_EXPORT cCANSerial_ESDException: public cSerialBaseException 00076 { 00077 public: 00078 cCANSerial_ESDException( cMsg const & _msg ) 00079 : cSerialBaseException( "cCANSerial_ESDException", _msg ) 00080 {} 00081 }; 00082 //====================================================================== 00083 00097 class VCC_EXPORT cCANSerial_ESD : public cSerialBase 00098 { 00099 00100 protected: 00101 00103 int net; 00104 00106 unsigned long baudrate; 00107 00109 int id_read; 00110 00112 int id_write; 00113 00114 // ntcan_handle was removed from here, see class comment and GetHandle() 00115 00117 unsigned int BaudrateToBaudrateCode( unsigned long baudrate ) 00118 throw (cCANSerial_ESDException*); 00119 00120 int status; 00121 00122 private: 00124 cCANSerial_ESD_Internal* pimpl; 00125 00127 cCANSerial_ESD( cCANSerial_ESD const& other ); 00128 00130 cCANSerial_ESD& operator=( cCANSerial_ESD const& rhs ); 00131 00132 public: 00143 cCANSerial_ESD( int _net, unsigned long _baudrate, double _timeout, int _id_read, int _id_write ) 00144 throw (cCANSerial_ESDException*); 00145 00155 cCANSerial_ESD( tDeviceHandle _ntcan_handle, double _timeout, int _id_read, int _id_write ) 00156 throw (cCANSerial_ESDException*); 00157 00159 ~cCANSerial_ESD(); 00160 00164 void Open( void ) 00165 throw (cCANSerial_ESDException*); 00166 00168 bool IsOpen( void ) 00169 throw(); 00170 00172 void Close( void ) 00173 throw (cCANSerial_ESDException*); 00174 00176 00184 int write( char const *ptr, int len=0 ) 00185 throw (cCANSerial_ESDException*); 00186 00195 ssize_t Read( void *data, ssize_t size, long timeout_us, bool return_on_less_data ) 00196 throw (cCANSerial_ESDException*); 00197 00199 void SetTimeout( double _timeout ) 00200 throw (cSerialBaseException*); 00201 00205 virtual tErrorCode GetErrorNumber(); 00206 00212 virtual char const* GetErrorMessage( tErrorCode dw ); 00213 00215 tDeviceHandle GetHandle(); 00216 }; 00217 //====================================================================== 00218 00219 NAMESPACE_SDH_END 00220 00221 #endif 00222 00223 00224 //====================================================================== 00225 /* 00226 Here are some settings for the emacs/xemacs editor (and can be safely ignored): 00227 (e.g. to explicitely set C++ mode for *.h header files) 00228 00229 Local Variables: 00230 mode:C++ 00231 mode:ELSE 00232 End: 00233 */ 00234 //======================================================================