canserial-peak.h
Go to the documentation of this file.
00001 //======================================================================
00012 //======================================================================
00013 
00014 #ifndef CANSERIAL_PEAK_H_
00015 #define CANSERIAL_PEAK_H_
00016 
00017 //----------------------------------------------------------------------
00018 // System Includes - include with <>
00019 //----------------------------------------------------------------------
00020 
00021 
00022 //----------------------------------------------------------------------
00023 // Project Includes - include with ""
00024 //----------------------------------------------------------------------
00025 
00026 #include "sdhexception.h"
00027 #include "serialbase.h"
00028 #include "basisdef.h"
00029 #include "sdhlibrary_settings.h"
00030 
00031 //----------------------------------------------------------------------
00032 // Defines, enums, unions, structs,
00033 //----------------------------------------------------------------------
00034 
00035 NAMESPACE_SDH_START
00036 
00037 //----------------------------------------------------------------------
00038 // Global variables
00039 //----------------------------------------------------------------------
00040 
00041 
00042 //----------------------------------------------------------------------
00043 // Function and class member declarations
00044 //----------------------------------------------------------------------
00045 
00046 
00048 class cCANSerial_PEAK_Internal;
00049 
00050 
00051 
00055 class VCC_EXPORT cCANSerial_PEAKException: public cSerialBaseException
00056 {
00057 public:
00058    cCANSerial_PEAKException( cMsg const & _msg )
00059        : cSerialBaseException( "cCANSerial_PEAKException", _msg )
00060    {}
00061 };
00062 //======================================================================
00063 
00064 
00078 class VCC_EXPORT cCANSerial_PEAK : public cSerialBase
00079 {
00080 
00081 protected:
00082 
00084     unsigned long baudrate;
00085 
00087     int id_read;
00088 
00090     int id_write;
00091 
00092     // handle was removed from here, see class comment and GetHandle()
00093 
00095     int BaudrateToBaudrateCode( unsigned long baudrate )
00096     throw (cCANSerial_PEAKException*);
00097 
00098     char m_device[64];
00099 
00100 private:
00102     cCANSerial_PEAK_Internal* pimpl;
00103 
00105     cCANSerial_PEAK( cCANSerial_PEAK const& other );
00106 
00108     cCANSerial_PEAK& operator=( cCANSerial_PEAK const& rhs );
00109 
00110 public:
00121    cCANSerial_PEAK( unsigned long _baudrate, double _timeout, int _id_read, int _id_write, const char *device="/dev/pcanusb0" )
00122        throw (cCANSerial_PEAKException*);
00123 
00133    cCANSerial_PEAK( tDeviceHandle _peak_handle, double _timeout, int _id_read, int _id_write )
00134        throw (cCANSerial_PEAKException*);
00135 
00137    ~cCANSerial_PEAK();
00138 
00146    tDeviceHandle GetHandle();
00147 
00151    void Open( void )
00152        throw (cCANSerial_PEAKException*);
00153 
00155    bool IsOpen( void )
00156        throw();
00157 
00159    void Close( void )
00160        throw (cCANSerial_PEAKException*);
00161 
00163 
00171    int write( char const *ptr, int len=0 )
00172        throw (cCANSerial_PEAKException*);
00173 
00182    ssize_t Read( void *data, ssize_t size, long timeout_us, bool return_on_less_data )
00183        throw (cCANSerial_PEAKException*);
00184 
00186    void SetTimeout( double _timeout )
00187        throw (cSerialBaseException*);
00188 
00192    virtual tErrorCode GetErrorNumber();
00193 
00199    virtual char const* GetErrorMessage( tErrorCode dw );
00200 
00201 };
00202 //======================================================================
00203 
00204 NAMESPACE_SDH_END
00205 
00206 #endif
00207 
00208 
00209 //======================================================================
00210 /*
00211  Here are some settings for the emacs/xemacs editor (and can be safely ignored):
00212  (e.g. to explicitely set C++ mode for *.h header files)
00213 
00214  Local Variables:
00215  mode:C++
00216  mode:ELSE
00217  End:
00218 */
00219 //======================================================================


schunk_sdh
Author(s): Florian Weisshardt
autogenerated on Mon Oct 6 2014 07:29:15