44 #ifndef CCXX_SERIAL_H_
45 #define CCXX_SERIAL_H_
47 #ifndef CCXX_MISSING_H_
51 #ifndef CCXX_THREAD_H_
55 #ifndef CCXX_EXCEPTION_H_
61 #define INVALID_HANDLE_VALUE (-1)
64 #ifdef CCXX_NAMESPACES
156 void initSerial(
void);
169 void open(
const char *fname);
184 virtual int aRead(
char * Data,
const int Length);
192 virtual int aWrite(
const char * Data,
const int Length);
210 {
error(errExtended, err);};
220 {flags.thrown = !enable;};
232 int setPacketInput(
int size,
unsigned char btimer = 0);
243 int setLineInput(
char newline = 13,
char nl1 = 0);
253 void flushInput(
void);
258 void flushOutput(
void);
263 void waitOutput(
void);
269 void endSerial(
void);
276 void initConfig(
void);
316 Error setSpeed(
unsigned long speed);
324 Error setCharBits(
int bits);
332 Error setParity(Parity parity);
340 Error setStopBits(
int bits);
348 Error setFlowControl(Flow flow);
360 void sendBreak(
void);
451 void endStream(
void);
478 int overflow(
int ch);
509 void interactive(
bool flag);
564 void open(
const char *name);
598 TTYSession(
const char *name,
int pri = 0,
int stack = 0);
664 void setDetectPending(
bool );
670 {
return detect_pending; }
676 void setDetectOutput(
bool );
682 {
return detect_output; }
688 virtual void expired(
void);
695 virtual void pending(
void);
701 virtual void disconnect(
void);
713 {
return aWrite((
char *)buf, len);};
718 virtual void output(
void);
729 inline int input(
void *buf,
int len)
730 {
return aRead((
char *)buf, len);};
808 virtual void onUpdate(
unsigned char flag);
814 virtual void onEvent(
void);
834 void update(
unsigned char flag = 0xff);
844 SerialService(
int pri = 0,
size_t stack = 0,
const char *
id = NULL);
865 #ifdef COMMON_STD_EXCEPTION
866 class __EXPORT SerException :
public IOException
869 SerException(
const String &str) : IOException(str) {};
873 #ifdef CCXX_NAMESPACES
The TTYSession aggragates a TTYStream and a Common C++ Thread which is assumed to be the execution co...
__EXPORT AppLog & error(AppLog &sl)
Manipulator for error level.
bool operator!()
Test to see if stream is opened.
int getCount(void)
Get current reference count.
Serial()
This allows later ttystream class to open and close a serial device.
substitute functions which may be missing in target platform libc.
The Mutex class is used to protect a section of code so that at any given time only a single thread c...
int input(void *buf, int len)
Receive "input" for pending data from the serial port.
This is a generic and portable string class.
int output(void *buf, int len)
Transmit "send" data to the serial port.
GNU Common C++ exception model base classes.
TTY streams are used to represent serial connections that are fully "streamable" objects using C++ st...
bool getDetectPending(void) const
Get the current state of the DetectPending flag.
Synchronization and threading services.
The SerialService is a thead service object that is meant to service attached serial ports...
Error getErrorNumber(void)
Often used by a "catch" to fetch the last error of a thrown serial.
char * getErrorString(void)
Often used by a "catch" to fetch the user set error string of a thrown serial.
class __EXPORT SerialService
bool getDetectOutput(void) const
Get the current state of the DetectOutput flag.
int getBufferSize(void)
Get the "buffer" size for buffered operations.
The Serial class is used as the base for all serial I/O services under APE.
void error(char *err)
This service is used to thow application defined serial errors where the application specific error c...
Every thread of execution in an application is created by instantiating an object of a class derived ...
void setError(bool enable)
This method is used to turn the error handler on or off for "throwing" execptions by manipulating the...
Timer ports are used to provide synchronized timing events when managed under a "service thread" such...
A more natural C++ "ttystream" class for use by non-threaded applications.
void setTimeout(timeout_t to)
Set the timeout control.
The serial port is an internal class which is attached to and then serviced by a specified SerialServ...
class __EXPORT SerialPort