Emeric Vigier | 2f62582 | 2012-08-06 11:09:52 -0400 | [diff] [blame] | 1 | /** ******************************************************************** |
| 2 | * C/C++ Source: serialecho.h |
| 3 | * |
| 4 | * Class definitions for the SerialEcho and related classes. |
| 5 | * This package requires the Serial, TTYSession and Thread classes |
| 6 | * from the FSF Common C++ library (v 1.2.4 cplusplus.sourceforge.net) |
| 7 | * |
| 8 | * SerialEcho is a monitor on the serial port which runs in its own |
| 9 | * thread and is responsible for detecting and echoing any serial |
| 10 | * input. The class is based on the ttysession class so it can be |
| 11 | * used as any fstream-like class |
| 12 | * |
| 13 | * @author: Gary Lawrence Murphy <garym@canada.com> |
| 14 | * Copyright: 2000 TeleDynamics Communications Inc (www.teledyn.com) |
| 15 | ******************************************************************** |
| 16 | */ |
| 17 | |
| 18 | #ifndef SERIALECHO_H |
| 19 | #define SERIALECHO_H |
| 20 | |
| 21 | #include <cc++/common.h> |
| 22 | |
| 23 | #ifdef CCXX_NAMESPACES |
| 24 | using namespace std; |
| 25 | using namespace ost; |
| 26 | #endif |
| 27 | |
| 28 | class SerialEcho : public TTYSession { |
| 29 | public: |
| 30 | |
| 31 | SerialEcho(const char *device, |
| 32 | int priority = 0, int stacksize = 0); |
| 33 | |
| 34 | // Exception classes |
| 35 | class xError{}; // nebulous inexplicable error |
| 36 | class xLocked{}; // port is there but we are locked out |
| 37 | class xOverrun{}; // too much data, too little time |
| 38 | |
| 39 | protected: |
| 40 | |
| 41 | void run(); |
| 42 | }; |
| 43 | |
| 44 | #endif |