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);};
219 inline void setError(
bool enable)
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);
377 inline char *getErrorString(
void)
387 inline int getBufferSize(
void)
451 void endStream(
void);
478 int overflow(
int ch);
509 void interactive(
bool flag);
564 void open(
const char *name);
574 inline bool operator!()
598 TTYSession(
const char *name,
int pri = 0,
int stack = 0);
641 bool detect_disconnect;
664 void setDetectPending(
bool );
669 inline bool getDetectPending(
void )
const
670 {
return detect_pending; }
676 void setDetectOutput(
bool );
681 inline bool getDetectOutput(
void )
const
682 {
return detect_output; }
688 virtual void expired(
void);
695 virtual void pending(
void);
701 virtual void disconnect(
void);
712 inline int output(
void *buf,
int len)
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);
857 inline int getCount(
void)
865 #ifdef COMMON_STD_EXCEPTION
866 class __EXPORT SerException :
public IOException
869 SerException(
const String &str) : IOException(str) {};
873 #ifdef CCXX_NAMESPACES