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