41 # include <sys/select.h> 42 # include <sys/ioctl.h> 85 line[len++] = ungetch;
86 ungetch_valid =
false;
92 timeout_us = (long) (timeout*1000000.0);
98 n = Read( line + len, 1, timeout_us, return_on_less_data );
107 if (strchr( eol, c ) !=
NULL)
111 if (size > 0 && len >= size-1)
116 throw new cSerialBaseException(
cMsg(
"Timeout while reading line from device (timeout_us=%ld line=\"%s\")", timeout_us, line ) );
129 static char return_msg[512];
133 FormatMessageA( FORMAT_MESSAGE_ALLOCATE_BUFFER |
134 FORMAT_MESSAGE_FROM_SYSTEM |
135 FORMAT_MESSAGE_IGNORE_INSERTS,
138 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
143 StringCchPrintfA( return_msg,
145 "error 0x%x = %d = \"%s\"",
149 snprintf( return_msg, 511,
"error 0x%x = %d = \"%s\"", dw, dw, strerror( dw ) );
Interface of auxilliary utility functions for SDHLibrary-CPP.
int tErrorCode
type of the error code, DWORD on windows and int on Linux/cygwin
virtual char const * GetErrorMessage(tErrorCode dw)
#define USING_NAMESPACE_SDH
This file contains settings to make the SDHLibrary compile on differen systems:
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.
Class for short, fixed maximum length text messages.
virtual char * readline(char *line, int size, char const *eol="\n", bool return_on_less_data=false)
Read a line from the device.