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 @@ | |||
1 | #ifndef OPIE_IO_SERIAL | 1 | #ifndef OPIE_IO_SERIAL |
2 | #define OPIE_IO_SERIAL | 2 | #define OPIE_IO_SERIAL |
3 | 3 | ||
4 | #include <qsocketnotifier.h> | ||
4 | #include "io_layer.h" | 5 | #include "io_layer.h" |
5 | 6 | ||
7 | /* Default values to be used if the profile information is incomplete */ | ||
8 | #define SERIAL_DEFAULT_DEVICE "/dev/ttyS0" | ||
9 | #define SERIAL_DEFAULT_BAUD 9600 | ||
10 | #define SERIAL_DEFAULT_PARITY 0 | ||
11 | #define SERIAL_DEFAULT_DBITS 8 | ||
12 | #define SERIAL_DEFAULT_SBITS 1 | ||
13 | #define SERIAL_DEFAULT_FLOW 0 | ||
14 | |||
15 | /* IOSerial implements a RS232 IO Layer */ | ||
16 | |||
6 | class IOSerial : public IOLayer { | 17 | class IOSerial : public IOLayer { |
7 | Q_OBJECT | 18 | Q_OBJECT |
8 | public: | 19 | public: |
20 | enum Parity { | ||
21 | ParityNone = 0, | ||
22 | ParityEven, | ||
23 | ParityOdd, | ||
24 | ParitySpace, | ||
25 | ParityMark | ||
26 | }; | ||
27 | |||
28 | enum Flow { | ||
29 | FlowHW = 0x01, | ||
30 | FlowSW = 0x02 | ||
31 | }; | ||
32 | |||
9 | IOSerial(const Config &); | 33 | IOSerial(const Config &); |
10 | public slots: | 34 | ~IOSerial(); |
35 | |||
36 | QString identifier() const; | ||
37 | QString name() const; | ||
38 | signals: | ||
11 | void received(const QByteArray &); | 39 | void received(const QByteArray &); |
12 | void error(int, const QString &); | 40 | void error(int, const QString &); |
41 | public slots: | ||
42 | void send(const QByteArray &); | ||
43 | bool open(); | ||
44 | void close(); | ||
45 | void reload(const Config &); | ||
46 | protected: | ||
47 | int getBaud(int baud) const; | ||
48 | protected slots: | ||
49 | void dataArrived(); | ||
50 | void errorOccured(); | ||
51 | protected: | ||
52 | QSocketNotifier *m_read; | ||
53 | QSocketNotifier *m_error; | ||
54 | QString m_device; | ||
55 | int m_baud; | ||
56 | int m_parity; | ||
57 | int m_dbits; | ||
58 | int m_sbits; | ||
59 | int m_flow; | ||
60 | int m_fd; | ||
13 | }; | 61 | }; |
14 | 62 | ||
15 | |||
16 | #endif /* OPIE_IO_SERIAL */ | 63 | #endif /* OPIE_IO_SERIAL */ |