Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00045
00046
00047 #ifndef CANSERIAL_ESD_H_
00048 #define CANSERIAL_ESD_H_
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 #include "sdhexception.h"
00060 #include "serialbase.h"
00061 #include "basisdef.h"
00062 #include "sdhlibrary_settings.h"
00063
00064
00065
00066
00067
00068 NAMESPACE_SDH_START
00069
00071 #define CAN_ESD_TXQUEUESIZE 32
00072
00074 #define CAN_ESD_RXQUEUESIZE 512
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00086 class cCANSerial_ESD_Internal;
00087
00088
00092 class VCC_EXPORT cCANSerial_ESDException: public cSerialBaseException
00093 {
00094 public:
00095 cCANSerial_ESDException(cMsg const & _msg)
00096 : cSerialBaseException("cCANSerial_ESDException", _msg)
00097 {}
00098 };
00099
00100
00114 class VCC_EXPORT cCANSerial_ESD : public cSerialBase
00115 {
00116
00117 protected:
00118
00120 int net;
00121
00123 unsigned long baudrate;
00124
00126 int id_read;
00127
00129 int id_write;
00130
00131
00132
00134 unsigned int BaudrateToBaudrateCode(unsigned long baudrate)
00135 throw (cCANSerial_ESDException*);
00136
00137 int status;
00138
00139 private:
00141 cCANSerial_ESD_Internal* pimpl;
00142
00144 cCANSerial_ESD(cCANSerial_ESD const& other);
00145
00147 cCANSerial_ESD& operator=(cCANSerial_ESD const& rhs);
00148
00149 public:
00160 cCANSerial_ESD(int _net, unsigned long _baudrate, double _timeout, int _id_read, int _id_write)
00161 throw (cCANSerial_ESDException*);
00162
00172 cCANSerial_ESD(tDeviceHandle _ntcan_handle, double _timeout, int _id_read, int _id_write)
00173 throw (cCANSerial_ESDException*);
00174
00176 ~cCANSerial_ESD();
00177
00181 void Open(void)
00182 throw (cCANSerial_ESDException*);
00183
00185 bool IsOpen(void)
00186 throw();
00187
00189 void Close(void)
00190 throw (cCANSerial_ESDException*);
00191
00193
00201 int write(char const *ptr, int len = 0)
00202 throw (cCANSerial_ESDException*);
00203
00212 ssize_t Read(void *data, ssize_t size, long timeout_us, bool return_on_less_data)
00213 throw (cCANSerial_ESDException*);
00214
00216 void SetTimeout(double _timeout)
00217 throw (cSerialBaseException*);
00218
00222 virtual tErrorCode GetErrorNumber();
00223
00229 virtual char const* GetErrorMessage(tErrorCode dw);
00230
00232 tDeviceHandle GetHandle();
00233 };
00234
00235
00236 NAMESPACE_SDH_END
00237
00238 #endif
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251