1#ifndef _QEXTSERIALBASE_H_
2#define _QEXTSERIALBASE_H_
9#ifdef QT_THREAD_SUPPORT
15#define _TTY_NOWARN_PORT_
27#ifdef QT_LARGE_FILE_SUPPORT
30 typedef Q_ULONG Offset;
36#ifdef QT_THREAD_SUPPORT
37#define LOCK_MUTEX() mutex->lock()
38#define UNLOCK_MUTEX() mutex->unlock()
45#ifdef _TTY_NOWARN_PORT_
46#define TTY_PORTABILITY_WARNING(s)
48#define TTY_PORTABILITY_WARNING(s) qWarning(s)
53#define TTY_WARNING(s) qWarning(s)
58#define MIN(a,b) (((a)<(b))?(a):(b))
61#define PORT_NAME_SIZE_LIMIT 80
77#define E_CAUGHT_NON_BLOCKED_SIGNAL 3
78#define E_PORT_TIMEOUT 4
79#define E_INVALID_DEVICE 5
80#define E_BREAK_CONDITION 6
81#define E_FRAMING_ERROR 7
83#define E_BUFFER_OVERRUN 9
84#define E_RECEIVE_OVERFLOW 10
85#define E_RECEIVE_PARITY_ERROR 11
86#define E_TRANSMIT_OVERFLOW 12
87#define E_READ_FAILED 13
88#define E_WRITE_FAILED 14
91typedef enum _NamingConvention {
100typedef enum _FlowType {
107typedef enum _ParityType {
116typedef enum _DataBitsType {
124typedef enum _StopBitsType {
131typedef enum _BaudRateType {
159 FlowType FlowControl;
161 DataBitsType DataBits;
162 StopBitsType StopBits;
163 BaudRateType BaudRate;
164 unsigned long Timeout_Sec;
165 unsigned long Timeout_Millisec;
174 virtual const char*
name()
const;
176 virtual bool open(
int mode=0)=0;
177 virtual bool open(
const char*
name);
178 virtual void close()=0;
179 virtual void flush()=0;
180 virtual Offset size()
const=0;
181 virtual Q_LONG
readLine(
char *data, Q_ULONG maxlen);
182 virtual int getch()=0;
183 virtual int putch(
int)=0;
185 virtual bool atEnd()
const;
186 virtual void setFlowControl(FlowType)=0;
188 virtual void setParity(ParityType)=0;
189 virtual ParityType
parity()
const;
190 virtual void setDataBits(DataBitsType)=0;
191 virtual DataBitsType
dataBits()
const;
192 virtual void setStopBits(StopBitsType)=0;
193 virtual StopBitsType
stopBits()
const;
194 virtual void setBaudRate(BaudRateType)=0;
195 virtual BaudRateType
baudRate()
const;
196 virtual bool isOpen()
const;
198 virtual void setDtr(
bool set=
true)=0;
199 virtual void setRts(
bool set=
true)=0;
200 virtual unsigned long lineStatus(
void)=0;
201 virtual int bytesWaiting()=0;
202 virtual void translateError(
unsigned long)=0;
203 virtual void setTimeout(
unsigned long,
unsigned long)=0;
204 virtual bool isOpen(
void);
207 virtual Q_LONG readBlock(
char *data, uint maxlen)=0;
208 virtual Q_LONG writeBlock(
const char *data, uint len)=0;
210 virtual Q_LONG readBlock(
char *data,
unsigned long maxlen)=0;
211 virtual Q_LONG writeBlock(
const char *data,
unsigned long len)=0;
216 unsigned long lastErr;
217 char portName[PORT_NAME_SIZE_LIMIT+1];
218 PortSettings Settings;
220#ifdef QT_THREAD_SUPPORT
221 static unsigned long refCount;
222 static QMutex* mutex;
virtual bool atEnd() const
Определения qextserialbase.cpp:86
virtual FlowType flowControl() const
Определения qextserialbase.cpp:141
virtual const char * name() const
Определения qextserialbase.cpp:243
virtual ParityType parity() const
Определения qextserialbase.cpp:150
virtual void setName(const char *name)
Определения qextserialbase.cpp:77
virtual Q_LONG readLine(char *data, Q_ULONG maxlen)
Определения qextserialbase.cpp:101
virtual StopBitsType stopBits() const
Определения qextserialbase.cpp:168
virtual BaudRateType baudRate() const
Определения qextserialbase.cpp:177
QextSerialBase()
Определения qextserialbase.cpp:21
virtual bool isOpen() const
Определения qextserialbase.cpp:185
virtual int ungetch(int)
Определения qextserialbase.cpp:129
virtual unsigned long lastError() const
Определения qextserialbase.cpp:235
virtual void construct(void)
Определения qextserialbase.cpp:253
virtual DataBitsType dataBits() const
Определения qextserialbase.cpp:159
Определения qextserialbase.h:158