-rw-r--r-- | noncore/apps/opie-console/file_layer.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/opie-console/file_layer.h | 50 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_layer.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_layer.h | 86 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_serial.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_serial.h | 16 | ||||
-rw-r--r-- | noncore/apps/opie-console/main.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.pro | 11 |
8 files changed, 198 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/file_layer.cpp b/noncore/apps/opie-console/file_layer.cpp new file mode 100644 index 0000000..3be5f10 --- a/dev/null +++ b/noncore/apps/opie-console/file_layer.cpp | |||
@@ -0,0 +1,8 @@ | |||
1 | #include "file_layer.h" | ||
2 | |||
3 | FileTransferLayer::FileTransferLayer(IOLayer *layer) { | ||
4 | } | ||
5 | |||
6 | FileTransferLayer::~FileTransferLayer() { | ||
7 | } | ||
8 | |||
diff --git a/noncore/apps/opie-console/file_layer.h b/noncore/apps/opie-console/file_layer.h new file mode 100644 index 0000000..75fd94b --- a/dev/null +++ b/noncore/apps/opie-console/file_layer.h | |||
@@ -0,0 +1,50 @@ | |||
1 | #ifndef OPIE_FILE_LAYER_H | ||
2 | #define OPIE_FILE_LAYER_H | ||
3 | |||
4 | #include "io_layer.h" | ||
5 | |||
6 | class QFile; | ||
7 | /** | ||
8 | * this is the layer for sending files | ||
9 | */ | ||
10 | class FileTransferLayer : public QObject { | ||
11 | Q_OBJECT | ||
12 | public: | ||
13 | /** | ||
14 | *the io layer to be used | ||
15 | */ | ||
16 | FileTransferLayer( IOLayer* ); | ||
17 | virtual ~FileTransferLayer(); | ||
18 | |||
19 | public slots: | ||
20 | /** | ||
21 | * send a file over the layer | ||
22 | */ | ||
23 | virtual void sendFile( const QString& file ) = 0; | ||
24 | |||
25 | /** | ||
26 | * convience method | ||
27 | */ | ||
28 | virtual void sendFile( const QFile& ) = 0; | ||
29 | |||
30 | signals: | ||
31 | /** | ||
32 | * sent the file | ||
33 | */ | ||
34 | void sent(); | ||
35 | |||
36 | /** | ||
37 | * an error occured | ||
38 | */ | ||
39 | |||
40 | void error( int, const QString& ); | ||
41 | |||
42 | /* | ||
43 | * 100 == done | ||
44 | * | ||
45 | */ | ||
46 | void progress( const QString& file, int progress ); | ||
47 | |||
48 | }; | ||
49 | |||
50 | #endif | ||
diff --git a/noncore/apps/opie-console/io_layer.cpp b/noncore/apps/opie-console/io_layer.cpp new file mode 100644 index 0000000..8da5886 --- a/dev/null +++ b/noncore/apps/opie-console/io_layer.cpp | |||
@@ -0,0 +1,10 @@ | |||
1 | #include "io_layer.h" | ||
2 | |||
3 | IOLayer::IOLayer() { | ||
4 | } | ||
5 | |||
6 | IOLayer::IOLayer(const Config &config) { | ||
7 | } | ||
8 | |||
9 | IOLayer::~IOLayer() { | ||
10 | } | ||
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 | ||
diff --git a/noncore/apps/opie-console/io_serial.cpp b/noncore/apps/opie-console/io_serial.cpp new file mode 100644 index 0000000..42c86b5 --- a/dev/null +++ b/noncore/apps/opie-console/io_serial.cpp | |||
@@ -0,0 +1,12 @@ | |||
1 | #include "io_serial.h" | ||
2 | |||
3 | IOSerial::IOSerial(const Config &config) : IOLayer(config) { | ||
4 | } | ||
5 | |||
6 | |||
7 | void IOSerial::error(int number, const QString &error) { | ||
8 | } | ||
9 | |||
10 | void IOSerial::received(const QByteArray &array) { | ||
11 | } | ||
12 | |||
diff --git a/noncore/apps/opie-console/io_serial.h b/noncore/apps/opie-console/io_serial.h new file mode 100644 index 0000000..c6a2efd --- a/dev/null +++ b/noncore/apps/opie-console/io_serial.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef OPIE_IO_SERIAL | ||
2 | #define OPIE_IO_SERIAL | ||
3 | |||
4 | #include "io_layer.h" | ||
5 | |||
6 | class IOSerial : public IOLayer { | ||
7 | Q_OBJECT | ||
8 | public: | ||
9 | IOSerial(const Config &); | ||
10 | public slots: | ||
11 | void received(const QByteArray &); | ||
12 | void error(int, const QString &); | ||
13 | }; | ||
14 | |||
15 | |||
16 | #endif /* OPIE_IO_SERIAL */ | ||
diff --git a/noncore/apps/opie-console/main.cpp b/noncore/apps/opie-console/main.cpp new file mode 100644 index 0000000..7594174 --- a/dev/null +++ b/noncore/apps/opie-console/main.cpp | |||
@@ -0,0 +1,5 @@ | |||
1 | #include <qpe/qpeapplication.h> | ||
2 | |||
3 | int main(int argc, char **argv) { | ||
4 | return 0; | ||
5 | } | ||
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro new file mode 100644 index 0000000..4ce11a9 --- a/dev/null +++ b/noncore/apps/opie-console/opie-console.pro | |||
@@ -0,0 +1,11 @@ | |||
1 | TEMPLATE = app | ||
2 | CONFIG = qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/bin | ||
4 | HEADERS = io_layer.h io_serial.h file_layer.h | ||
5 | SOURCES = io_layer.cpp io_serial.cpp file_layer.cpp | ||
6 | INTERFACES = | ||
7 | INCLUDEPATH += $(OPIEDIR)/include | ||
8 | DEPENDPATH += $(OPIEDIR)/include | ||
9 | LIBS += -lqpe -lopie | ||
10 | TARGET = sysinfo | ||
11 | |||