From bdbd20a9a0415e2284e21923ed03d4ca3f6615e8 Mon Sep 17 00:00:00 2001 From: wazlaf Date: Wed, 25 Sep 2002 20:56:38 +0000 Subject: preliminary skeleton --- (limited to 'noncore') 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 @@ +#include "file_layer.h" + +FileTransferLayer::FileTransferLayer(IOLayer *layer) { +} + +FileTransferLayer::~FileTransferLayer() { +} + 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 @@ +#ifndef OPIE_FILE_LAYER_H +#define OPIE_FILE_LAYER_H + +#include "io_layer.h" + +class QFile; +/** + * this is the layer for sending files + */ +class FileTransferLayer : public QObject { + Q_OBJECT +public: + /** + *the io layer to be used + */ + FileTransferLayer( IOLayer* ); + virtual ~FileTransferLayer(); + +public slots: + /** + * send a file over the layer + */ + virtual void sendFile( const QString& file ) = 0; + + /** + * convience method + */ + virtual void sendFile( const QFile& ) = 0; + +signals: + /** + * sent the file + */ + void sent(); + + /** + * an error occured + */ + + void error( int, const QString& ); + + /* + * 100 == done + * + */ + void progress( const QString& file, int progress ); + +}; + +#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 @@ +#include "io_layer.h" + +IOLayer::IOLayer() { +} + +IOLayer::IOLayer(const Config &config) { +} + +IOLayer::~IOLayer() { +} 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 @@ +#ifndef OPIE_IO_LAYER_H +#define OPIE_IO_LAYER_H + +#include + + +/** + * This is the base class for IO Layers + * It will used to sent and recv data( QByteArray ) + * it + */ +class Config; +class IOLayer : public QObject { + Q_OBJECT +public: + enum Error { + NoError = -1, + Refuse = 0, + CouldNotOpen =1, + ClosedUnexpected =2, + ClosedError =3, + Terminate = 4 + /* add more errors here */ + }; + /** + * a small c'tor + */ + IOLayer(); + + /** + * create an IOLayer instance from a config file + * can be used by session managemnt/profiles + */ + IOLayer( const Config& ); + + /** + * destructor + */ + virtual ~IOLayer(); +signals: + /** + * received input as QCString + */ + virtual void received( const QByteArray& ) = 0; + + /** + * an error occured + * int for the error number + * and QString for a text + */ + virtual void error( int, const QString& ) = 0; + +public slots: + /** + * send a QCString to the device + */ + virtual void send( const QByteArray& ) = 0; + + /** + * bool open + */ + virtual bool open() = 0; + + /** + * close the io + */ + virtual void close() = 0; + + /** + * closes and reloads the settings + */ + virtual void reload( const Config& ) = 0; + + /** + * a small internal identifier + */ + virtual QString identifier()const = 0; + + /** + * a short name + */ + virtual QString name()const = 0; + +}; + +#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 @@ +#include "io_serial.h" + +IOSerial::IOSerial(const Config &config) : IOLayer(config) { +} + + +void IOSerial::error(int number, const QString &error) { +} + +void IOSerial::received(const QByteArray &array) { +} + 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 @@ +#ifndef OPIE_IO_SERIAL +#define OPIE_IO_SERIAL + +#include "io_layer.h" + +class IOSerial : public IOLayer { + Q_OBJECT +public: + IOSerial(const Config &); +public slots: + void received(const QByteArray &); + void error(int, const QString &); +}; + + +#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 @@ +#include + +int main(int argc, char **argv) { + return 0; +} 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 @@ +TEMPLATE = app +CONFIG = qt warn_on release +DESTDIR = $(OPIEDIR)/bin +HEADERS = io_layer.h io_serial.h file_layer.h +SOURCES = io_layer.cpp io_serial.cpp file_layer.cpp +INTERFACES = +INCLUDEPATH += $(OPIEDIR)/include +DEPENDPATH += $(OPIEDIR)/include +LIBS += -lqpe -lopie +TARGET = sysinfo + -- cgit v0.9.0.2