Go to the documentation of this file.
36 # pragma warning(disable : 4290)
67 # define snprintf _snprintf
123 ungetch_valid(false),
141 virtual void Open(
void ) = 0;
144 virtual bool IsOpen(
void )
148 virtual void Close(
void ) = 0;
170 : serial_base(_serial_base),
171 old_timeout( serial_base->GetTimeout() )
173 if ( new_timeout != old_timeout )
180 if ( old_timeout != serial_base->
GetTimeout() )
195 virtual int write(
char const *ptr,
int len=0 ) = 0;
205 virtual ssize_t Read(
void *data, ssize_t
size,
long timeout_us,
bool return_on_less_data ) = 0;
224 virtual char* readline(
char* line,
int size,
char const* eol =
"\n",
bool return_on_less_data =
false );
244 return GetLastError();
257 virtual char const* GetErrorMessage( tErrorCode dw );
262 return GetErrorMessage( GetErrorNumber() );
#define NAMESPACE_SDH_END
cSerialBase * serial_base
Low-level communication class to access a serial port.
virtual double GetTimeout()
get the timeout for next readline() calls (negative value means: no timeout, wait for ever)
Derived exception class for exceptions related to communication between the SDHLibrary and the SDH.
helper class to set timeout of _serial_base on construction and reset to previous value on destructio...
Derived exception class for low-level serial communication related exceptions.
This file contains interface and implementation of class #SDH::cDBG, a class for colorfull debug mess...
int tErrorCode
type of the error code, DWORD on windows and int on Linux/cygwin
cSerialBaseException(char const *_type, cMsg const &_msg)
~cSetTimeoutTemporarily()
DTOR: restore the remembered timeout.
char const * GetLastErrorMessage(void)
return the last error message as string. The string returned will be overwritten by the next call to ...
NAMESPACE_SDH_START typedef void * tDeviceHandle
generic device handle for CAN devices
virtual void SetTimeout(double _timeout)
set the timeout for next readline() calls (negative value means: no timeout, wait for ever)
Class for short, fixed maximum length text messages.
double timeout
timeout in seconds
virtual ~cSerialBase(void)
dtor
A class to print colored debug messages.
#define NAMESPACE_SDH_START
cSerialBaseException(cMsg const &_msg)
bool ungetch_valid
Flag, true if ungetch is valid.
Interface of the exception base class #SDH::cSDHLibraryException and #SDH::cMsg.
This file contains settings to make the SDHLibrary compile on differen systems:
USING_NAMESPACE_SDH NAMESPACE_SDH_START std::ostream * g_sdh_debug_log
char ungetch
an already read data byte of the next line
Interface of class #SDH::cSDHBase.
cDBG dbg
A stream object to print colored debug messages.
virtual tErrorCode GetErrorNumber()
cSetTimeoutTemporarily(cSerialBase *_serial_base, double new_timeout)
CTOR: remember current timeout of _serial_base and set its timeout to new_timeout,...
sdhlibrary_cpp
Author(s): Dirk Osswald
autogenerated on Wed Mar 2 2022 01:00:58