author | wazlaf <wazlaf> | 2002-09-28 14:58:25 (UTC) |
---|---|---|
committer | wazlaf <wazlaf> | 2002-09-28 14:58:25 (UTC) |
commit | ea1975bdf411de3e08e7b84d2480a522596fe143 (patch) (side-by-side diff) | |
tree | 3cd90b3440fa190e9853f66cbd1e9dfaeb6f330c /noncore/apps/opie-console/io_serial.h | |
parent | 93f90487bf9d2b8937a4933aef2ee472b5cdc89c (diff) | |
download | opie-ea1975bdf411de3e08e7b84d2480a522596fe143.zip opie-ea1975bdf411de3e08e7b84d2480a522596fe143.tar.gz opie-ea1975bdf411de3e08e7b84d2480a522596fe143.tar.bz2 |
Some changes in io_layer.h; Untested Serial IOLayer implementation added
Diffstat (limited to 'noncore/apps/opie-console/io_serial.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/io_serial.h | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/io_serial.h b/noncore/apps/opie-console/io_serial.h index c6a2efd..1d34411 100644 --- a/noncore/apps/opie-console/io_serial.h +++ b/noncore/apps/opie-console/io_serial.h @@ -1,16 +1,63 @@ #ifndef OPIE_IO_SERIAL #define OPIE_IO_SERIAL +#include <qsocketnotifier.h> #include "io_layer.h" +/* Default values to be used if the profile information is incomplete */ +#define SERIAL_DEFAULT_DEVICE "/dev/ttyS0" +#define SERIAL_DEFAULT_BAUD 9600 +#define SERIAL_DEFAULT_PARITY 0 +#define SERIAL_DEFAULT_DBITS 8 +#define SERIAL_DEFAULT_SBITS 1 +#define SERIAL_DEFAULT_FLOW 0 + +/* IOSerial implements a RS232 IO Layer */ + class IOSerial : public IOLayer { Q_OBJECT public: + enum Parity { + ParityNone = 0, + ParityEven, + ParityOdd, + ParitySpace, + ParityMark + }; + + enum Flow { + FlowHW = 0x01, + FlowSW = 0x02 + }; + IOSerial(const Config &); -public slots: + ~IOSerial(); + + QString identifier() const; + QString name() const; +signals: void received(const QByteArray &); void error(int, const QString &); +public slots: + void send(const QByteArray &); + bool open(); + void close(); + void reload(const Config &); +protected: + int getBaud(int baud) const; +protected slots: + void dataArrived(); + void errorOccured(); +protected: + QSocketNotifier *m_read; + QSocketNotifier *m_error; + QString m_device; + int m_baud; + int m_parity; + int m_dbits; + int m_sbits; + int m_flow; + int m_fd; }; - #endif /* OPIE_IO_SERIAL */ |