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 //======================================================================
serialbase.h
Interface of class #SDH::cSerialBase, a virtal base class to access serial communication channels lik...
cCANSerial_ESDException
Derived exception class for low-level CAN ESD related exceptions.
Definition: canserial-esd.h:75
cSerialBase::Close
virtual void Close(void)=0
Close the previously opened communication channel.
size
UInt16 size
Definition: dsa.h:269
NAMESPACE_SDH_END
#define NAMESPACE_SDH_END
Definition: sdhlibrary_settings.h:80
cSerialBase
Low-level communication class to access a serial port.
Definition: serialbase.h:105
cSerialBase::IsOpen
virtual bool IsOpen(void)=0
Return true if communication channel is open.
cCANSerial_ESD::status
int status
Definition: canserial-esd.h:119
cSerialBaseException
Derived exception class for low-level serial communication related exceptions.
Definition: serialbase.h:86
cCANSerial_ESD_Internal
internal hardware specific implementation details of the lowlevel ESD CAN interface
Definition: canserial-esd.cpp:113
cSerialBase::tErrorCode
int tErrorCode
type of the error code, DWORD on windows and int on Linux/cygwin
Definition: serialbase.h:233
cCANSerial_ESD::baudrate
unsigned long baudrate
the baudrate to use in bit/s
Definition: canserial-esd.h:106
cCANSerial_ESD::id_write
int id_write
the CAN ID used for writing
Definition: canserial-esd.h:112
tDeviceHandle
NAMESPACE_SDH_START typedef void * tDeviceHandle
generic device handle for CAN devices
Definition: serialbase.h:64
cSerialBase::SetTimeout
virtual void SetTimeout(double _timeout)
set the timeout for next readline() calls (negative value means: no timeout, wait for ever)
Definition: serialbase.h:151
cMsg
Class for short, fixed maximum length text messages.
Definition: sdhexception.h:77
cCANSerial_ESD::id_read
int id_read
the CAN ID used for reading
Definition: canserial-esd.h:109
NAMESPACE_SDH_START
#define NAMESPACE_SDH_START
Definition: sdhlibrary_settings.h:79
cSerialBase::Open
virtual void Open(void)=0
Open rs232 port port.
cSerialBase::GetErrorMessage
virtual char const * GetErrorMessage(tErrorCode dw)
Definition: serialbase.cpp:127
sdhexception.h
Interface of the exception base class #SDH::cSDHLibraryException and #SDH::cMsg.
basisdef.h
This file contains some basic definitions (defines, macros, datatypes)
cCANSerial_ESDException::cCANSerial_ESDException
cCANSerial_ESDException(cMsg const &_msg)
Definition: canserial-esd.h:78
cSerialBase::Read
virtual ssize_t Read(void *data, ssize_t size, long timeout_us, bool return_on_less_data)=0
cSerialBase::write
virtual int write(char const *ptr, int len=0)=0
Write data to a previously opened port.
sdhlibrary_settings.h
This file contains settings to make the SDHLibrary compile on differen systems:
cCANSerial_ESD
Low-level communication class to access a CAN port from company ESD (http://www.esd....
Definition: canserial-esd.h:97
cSerialBase::GetErrorNumber
virtual tErrorCode GetErrorNumber()
Definition: serialbase.h:241
cCANSerial_ESD::net
int net
the ESD CAN net to use
Definition: canserial-esd.h:103
cCANSerial_ESD::pimpl
cCANSerial_ESD_Internal * pimpl
ptr to private, implementation specific members (using the 'Pimpl' (pointer to implementatino) design...
Definition: canserial-esd.h:123


sdhlibrary_cpp
Author(s): Dirk Osswald
autogenerated on Wed Mar 2 2022 01:00:58