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
00029
00030
00031 #ifndef CANSERIAL_PEAK_H_
00032 #define CANSERIAL_PEAK_H_
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #include "sdhexception.h"
00044 #include "serialbase.h"
00045 #include "basisdef.h"
00046 #include "sdhlibrary_settings.h"
00047
00048
00049
00050
00051
00052 NAMESPACE_SDH_START
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00065 class cCANSerial_PEAK_Internal;
00066
00067
00068
00072 class VCC_EXPORT cCANSerial_PEAKException: public cSerialBaseException
00073 {
00074 public:
00075 cCANSerial_PEAKException(cMsg const & _msg)
00076 : cSerialBaseException("cCANSerial_PEAKException", _msg)
00077 {}
00078 };
00079
00080
00081
00095 class VCC_EXPORT cCANSerial_PEAK : public cSerialBase
00096 {
00097
00098 protected:
00099
00101 unsigned long baudrate;
00102
00104 int id_read;
00105
00107 int id_write;
00108
00109
00110
00112 int BaudrateToBaudrateCode(unsigned long baudrate)
00113 throw (cCANSerial_PEAKException*);
00114
00115 char m_device[64];
00116
00117 private:
00119 cCANSerial_PEAK_Internal* pimpl;
00120
00122 cCANSerial_PEAK(cCANSerial_PEAK const& other);
00123
00125 cCANSerial_PEAK& operator=(cCANSerial_PEAK const& rhs);
00126
00127 public:
00138 cCANSerial_PEAK(unsigned long _baudrate, double _timeout, int _id_read, int _id_write, const char *device = "/dev/pcanusb0")
00139 throw (cCANSerial_PEAKException*);
00140
00150 cCANSerial_PEAK(tDeviceHandle _peak_handle, double _timeout, int _id_read, int _id_write)
00151 throw (cCANSerial_PEAKException*);
00152
00154 ~cCANSerial_PEAK();
00155
00163 tDeviceHandle GetHandle();
00164
00168 void Open(void)
00169 throw (cCANSerial_PEAKException*);
00170
00172 bool IsOpen(void)
00173 throw();
00174
00176 void Close(void)
00177 throw (cCANSerial_PEAKException*);
00178
00180
00188 int write(char const *ptr, int len = 0)
00189 throw (cCANSerial_PEAKException*);
00190
00199 ssize_t Read(void *data, ssize_t size, long timeout_us, bool return_on_less_data)
00200 throw (cCANSerial_PEAKException*);
00201
00203 void SetTimeout(double _timeout)
00204 throw (cSerialBaseException*);
00205
00209 virtual tErrorCode GetErrorNumber();
00210
00216 virtual char const* GetErrorMessage(tErrorCode dw);
00217
00218 };
00219
00220
00221 NAMESPACE_SDH_END
00222
00223 #endif
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236