summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/io_serial.h
Side-by-side diff
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.h51
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 */