Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

io_serial.h

Go to the documentation of this file.
00001 #ifndef OPIE_IO_SERIAL
00002 #define OPIE_IO_SERIAL
00003 
00004 #include <qsocketnotifier.h>
00005 #include "io_layer.h"
00006 
00007 /* Default values to be used if the profile information is incomplete */
00008 #define SERIAL_DEFAULT_DEVICE       "/dev/ttyS0"
00009 #define SERIAL_DEFAULT_BAUD         9600
00010 #define SERIAL_DEFAULT_PARITY       0
00011 #define SERIAL_DEFAULT_DBITS        8
00012 #define SERIAL_DEFAULT_SBITS        1
00013 #define SERIAL_DEFAULT_FLOW         0
00014 
00015 /* IOSerial implements a RS232 IO Layer */
00016 
00017 class IOSerial : public IOLayer {
00018     Q_OBJECT
00019 public:
00020     enum Parity {
00021         ParityNone = 0,
00022         ParityEven,
00023         ParityOdd,
00024         ParitySpace,
00025         ParityMark
00026     };
00027 
00028     enum Flow {
00029         FlowHW = 0x01,
00030         FlowSW = 0x02
00031     };
00032 
00033     IOSerial(const Profile &);
00034     ~IOSerial();
00035 
00036     virtual QString identifier() const;
00037     virtual QString name() const;
00038     int rawIO() const;
00039     void closeRawIO (int fd );
00040     virtual QBitArray supports() const;
00041     virtual bool isConnected();
00042 
00043 /*signals:
00044     void received(const QByteArray &);
00045     void error(int, const QString &);
00046 */
00047 public slots:
00048     virtual void send(const QByteArray &);
00049     virtual bool open();
00050     virtual void close();
00051     virtual void reload(const Profile &);
00052 protected:
00053     int baud(int baud) const;
00054     void internDetach();
00055     void internAttach();
00056 protected slots:
00057     void dataArrived();
00058     void errorOccured();
00059 protected:
00060     QSocketNotifier *m_read;
00061     QSocketNotifier *m_error;
00062     QString          m_device;
00063     int              m_baud;
00064     int              m_parity;
00065     int              m_dbits;
00066     int              m_sbits;
00067     int              m_flow;
00068     int              m_fd;
00069     bool             m_connected;
00070 
00071 };
00072 
00073 #endif /* OPIE_IO_SERIAL */

Generated on Sat Nov 5 16:16:50 2005 for OPIE by  doxygen 1.4.2