Diffstat (limited to 'noncore/apps/opie-console/io_layer.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/io_layer.h | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/io_layer.h b/noncore/apps/opie-console/io_layer.h new file mode 100644 index 0000000..c8f41d7 --- a/dev/null +++ b/noncore/apps/opie-console/io_layer.h | |||
@@ -0,0 +1,86 @@ | |||
1 | #ifndef OPIE_IO_LAYER_H | ||
2 | #define OPIE_IO_LAYER_H | ||
3 | |||
4 | #include <qobject.h> | ||
5 | |||
6 | |||
7 | /** | ||
8 | * This is the base class for IO Layers | ||
9 | * It will used to sent and recv data( QByteArray ) | ||
10 | * it | ||
11 | */ | ||
12 | class Config; | ||
13 | class IOLayer : public QObject { | ||
14 | Q_OBJECT | ||
15 | public: | ||
16 | enum Error { | ||
17 | NoError = -1, | ||
18 | Refuse = 0, | ||
19 | CouldNotOpen =1, | ||
20 | ClosedUnexpected =2, | ||
21 | ClosedError =3, | ||
22 | Terminate = 4 | ||
23 | /* add more errors here */ | ||
24 | }; | ||
25 | /** | ||
26 | * a small c'tor | ||
27 | */ | ||
28 | IOLayer(); | ||
29 | |||
30 | /** | ||
31 | * create an IOLayer instance from a config file | ||
32 | * can be used by session managemnt/profiles | ||
33 | */ | ||
34 | IOLayer( const Config& ); | ||
35 | |||
36 | /** | ||
37 | * destructor | ||
38 | */ | ||
39 | virtual ~IOLayer(); | ||
40 | signals: | ||
41 | /** | ||
42 | * received input as QCString | ||
43 | */ | ||
44 | virtual void received( const QByteArray& ) = 0; | ||
45 | |||
46 | /** | ||
47 | * an error occured | ||
48 | * int for the error number | ||
49 | * and QString for a text | ||
50 | */ | ||
51 | virtual void error( int, const QString& ) = 0; | ||
52 | |||
53 | public slots: | ||
54 | /** | ||
55 | * send a QCString to the device | ||
56 | */ | ||
57 | virtual void send( const QByteArray& ) = 0; | ||
58 | |||
59 | /** | ||
60 | * bool open | ||
61 | */ | ||
62 | virtual bool open() = 0; | ||
63 | |||
64 | /** | ||
65 | * close the io | ||
66 | */ | ||
67 | virtual void close() = 0; | ||
68 | |||
69 | /** | ||
70 | * closes and reloads the settings | ||
71 | */ | ||
72 | virtual void reload( const Config& ) = 0; | ||
73 | |||
74 | /** | ||
75 | * a small internal identifier | ||
76 | */ | ||
77 | virtual QString identifier()const = 0; | ||
78 | |||
79 | /** | ||
80 | * a short name | ||
81 | */ | ||
82 | virtual QString name()const = 0; | ||
83 | |||
84 | }; | ||
85 | |||
86 | #endif | ||