[1317] | 1 |
|
---|
| 2 | #ifndef _POSIX_QEXTSERIALPORT_H_
|
---|
| 3 | #define _POSIX_QEXTSERIALPORT_H_
|
---|
| 4 |
|
---|
| 5 | #include <stdio.h>
|
---|
| 6 | #include <termios.h>
|
---|
| 7 | #include <errno.h>
|
---|
[9952] | 8 | #ifndef WIN32
|
---|
[1317] | 9 | #include <unistd.h>
|
---|
[9955] | 10 | #else
|
---|
[9957] | 11 | #include <Windows.h>
|
---|
[9952] | 12 | #endif
|
---|
[1317] | 13 | #include <sys/time.h>
|
---|
| 14 | #include <sys/ioctl.h>
|
---|
| 15 | #include <sys/select.h>
|
---|
| 16 | #include "qextserialbase.h"
|
---|
| 17 |
|
---|
| 18 | class Posix_QextSerialPort:public QextSerialBase {
|
---|
| 19 | public:
|
---|
| 20 | Posix_QextSerialPort();
|
---|
| 21 | Posix_QextSerialPort(const Posix_QextSerialPort& s);
|
---|
| 22 | Posix_QextSerialPort(const QString & name);
|
---|
| 23 | Posix_QextSerialPort(const PortSettings& settings);
|
---|
| 24 | Posix_QextSerialPort(const QString & name, const PortSettings& settings);
|
---|
| 25 | Posix_QextSerialPort& operator=(const Posix_QextSerialPort& s);
|
---|
| 26 | virtual ~Posix_QextSerialPort();
|
---|
| 27 |
|
---|
| 28 | virtual void setBaudRate(BaudRateType);
|
---|
| 29 | virtual void setDataBits(DataBitsType);
|
---|
| 30 | virtual void setParity(ParityType);
|
---|
| 31 | virtual void setStopBits(StopBitsType);
|
---|
| 32 | virtual void setFlowControl(FlowType);
|
---|
| 33 | virtual void setTimeout(ulong, ulong);
|
---|
| 34 |
|
---|
| 35 | virtual bool open(OpenMode mode=0);
|
---|
| 36 | virtual void close();
|
---|
| 37 | virtual void flush();
|
---|
| 38 |
|
---|
| 39 | virtual qint64 size() const;
|
---|
| 40 | virtual qint64 bytesAvailable();
|
---|
| 41 |
|
---|
| 42 | virtual void ungetChar(char c);
|
---|
| 43 |
|
---|
| 44 | virtual void translateError(ulong error);
|
---|
| 45 |
|
---|
| 46 | virtual void setDtr(bool set=true);
|
---|
| 47 | virtual void setRts(bool set=true);
|
---|
| 48 | virtual ulong lineStatus();
|
---|
| 49 |
|
---|
| 50 | protected:
|
---|
| 51 | QFile* Posix_File;
|
---|
| 52 | struct termios Posix_CommConfig;
|
---|
| 53 | struct timeval Posix_Timeout;
|
---|
| 54 | struct timeval Posix_Copy_Timeout;
|
---|
| 55 |
|
---|
| 56 | virtual qint64 readData(char * data, qint64 maxSize);
|
---|
| 57 | virtual qint64 writeData(const char * data, qint64 maxSize);
|
---|
| 58 | };
|
---|
| 59 |
|
---|
| 60 | #endif
|
---|