canserial-esd.h
Go to the documentation of this file.
1 //======================================================================
28 //======================================================================
29 
30 #ifndef CANSERIAL_ESD_H_
31 #define CANSERIAL_ESD_H_
32 
33 //----------------------------------------------------------------------
34 // System Includes - include with <>
35 //----------------------------------------------------------------------
36 
37 
38 //----------------------------------------------------------------------
39 // Project Includes - include with ""
40 //----------------------------------------------------------------------
41 
42 #include "sdhexception.h"
43 #include "serialbase.h"
44 #include "basisdef.h"
45 #include "sdhlibrary_settings.h"
46 
47 //----------------------------------------------------------------------
48 // Defines, enums, unions, structs,
49 //----------------------------------------------------------------------
50 
52 
54 #define CAN_ESD_TXQUEUESIZE 32
55 
57 #define CAN_ESD_RXQUEUESIZE 512
58 
59 //----------------------------------------------------------------------
60 // Global variables
61 //----------------------------------------------------------------------
62 
63 
64 //----------------------------------------------------------------------
65 // Function and class member declarations
66 //----------------------------------------------------------------------
67 
70 
71 
76 {
77 public:
78  cCANSerial_ESDException( cMsg const & _msg )
79  : cSerialBaseException( "cCANSerial_ESDException", _msg )
80  {}
81 };
82 //======================================================================
83 
97 class VCC_EXPORT cCANSerial_ESD : public cSerialBase
98 {
99 
100 protected:
101 
103  int net;
104 
106  unsigned long baudrate;
107 
109  int id_read;
110 
112  int id_write;
113 
114  // ntcan_handle was removed from here, see class comment and GetHandle()
115 
117  unsigned int BaudrateToBaudrateCode( unsigned long baudrate );
118 
119  int status;
120 
121 private:
124 
126  cCANSerial_ESD( cCANSerial_ESD const& other );
127 
129  cCANSerial_ESD& operator=( cCANSerial_ESD const& rhs );
130 
131 public:
142  cCANSerial_ESD( int _net, unsigned long _baudrate, double _timeout, int _id_read, int _id_write );
143 
153  cCANSerial_ESD( tDeviceHandle _ntcan_handle, double _timeout, int _id_read, int _id_write );
154 
156  ~cCANSerial_ESD();
157 
161  void Open( void );
162 
164  bool IsOpen( void )
165  throw();
166 
168  void Close( void );
169 
171 
179  int write( char const *ptr, int len=0 );
180 
189  ssize_t Read( void *data, ssize_t size, long timeout_us, bool return_on_less_data );
190 
192  void SetTimeout( double _timeout );
193 
197  virtual tErrorCode GetErrorNumber();
198 
204  virtual char const* GetErrorMessage( tErrorCode dw );
205 
207  tDeviceHandle GetHandle();
208 };
209 //======================================================================
210 
212 
213 #endif
214 
215 
216 //======================================================================
217 /*
218  Here are some settings for the emacs/xemacs editor (and can be safely ignored):
219  (e.g. to explicitely set C++ mode for *.h header files)
220 
221  Local Variables:
222  mode:C++
223  mode:ELSE
224  End:
225 */
226 //======================================================================
Derived exception class for low-level CAN ESD related exceptions.
Definition: canserial-esd.h:75
cCANSerial_ESDException(cMsg const &_msg)
Definition: canserial-esd.h:78
cCANSerial_ESD_Internal * pimpl
ptr to private, implementation specific members (using the &#39;Pimpl&#39; (pointer to implementatino) design...
int net
the ESD CAN net to use
virtual bool IsOpen(void)=0
Return true if communication channel is open.
int id_read
the CAN ID used for reading
virtual void SetTimeout(double _timeout)
set the timeout for next readline() calls (negative value means: no timeout, wait for ever) ...
Definition: serialbase.h:151
internal hardware specific implementation details of the lowlevel ESD CAN interface ...
int tErrorCode
type of the error code, DWORD on windows and int on Linux/cygwin
Definition: serialbase.h:233
Interface of the exception base class #SDH::cSDHLibraryException and #SDH::cMsg.
Low-level communication class to access a serial port.
Definition: serialbase.h:105
#define NAMESPACE_SDH_START
unsigned long baudrate
the baudrate to use in bit/s
virtual char const * GetErrorMessage(tErrorCode dw)
Definition: serialbase.cpp:127
UInt16 size
Definition: dsa.h:269
virtual int write(char const *ptr, int len=0)=0
Write data to a previously opened port.
#define NAMESPACE_SDH_END
This file contains settings to make the SDHLibrary compile on differen systems:
virtual void Open(void)=0
Open rs232 port port.
This file contains some basic definitions (defines, macros, datatypes)
Interface of class #SDH::cSerialBase, a virtal base class to access serial communication channels lik...
Derived exception class for low-level serial communication related exceptions.
Definition: serialbase.h:86
virtual void Close(void)=0
Close the previously opened communication channel.
Class for short, fixed maximum length text messages.
Definition: sdhexception.h:77
virtual ssize_t Read(void *data, ssize_t size, long timeout_us, bool return_on_less_data)=0
Low-level communication class to access a CAN port from company ESD (http://www.esd.eu/)
Definition: canserial-esd.h:97
NAMESPACE_SDH_START typedef void * tDeviceHandle
generic device handle for CAN devices
Definition: serialbase.h:64
int id_write
the CAN ID used for writing
virtual tErrorCode GetErrorNumber()
Definition: serialbase.h:241


sdhlibrary_cpp
Author(s): Dirk Osswald
autogenerated on Mon Feb 28 2022 23:41:51