21 Q_PROPERTY(qint32 baudRate READ baudRate WRITE setBaudRate NOTIFY baudRateChanged)
22 Q_PROPERTY(
DataBits dataBits READ dataBits WRITE setDataBits NOTIFY dataBitsChanged BINDABLE bindableDataBits)
23 Q_PROPERTY(
Parity parity READ parity WRITE setParity NOTIFY parityChanged BINDABLE bindableParity)
24 Q_PROPERTY(
StopBits stopBits READ stopBits WRITE setStopBits NOTIFY stopBitsChanged BINDABLE bindableStopBits)
25 Q_PROPERTY(
FlowControl flowControl READ flowControl WRITE setFlowControl NOTIFY flowControlChanged BINDABLE
28 bool dataTerminalReady READ isDataTerminalReady WRITE setDataTerminalReady NOTIFY dataTerminalReadyChanged)
29 Q_PROPERTY(
bool requestToSend READ isRequestToSend WRITE setRequestToSend NOTIFY requestToSendChanged)
31 Q_PROPERTY(
bool breakEnabled READ isBreakEnabled WRITE setBreakEnabled NOTIFY breakEnabledChanged BINDABLE
32 bindableIsBreakEnabled)
41 AllDirections = Input | Output
44 Q_DECLARE_FLAGS(Directions, Direction)
97 DataTerminalReadySignal = 0x04,
98 DataCarrierDetectSignal = 0x08,
99 DataSetReadySignal = 0x10,
100 RingIndicatorSignal = 0x20,
101 RequestToSendSignal = 0x40,
102 ClearToSendSignal = 0x80,
103 SecondaryTransmittedDataSignal = 0x100,
104 SecondaryReceivedDataSignal = 0x200
107 Q_DECLARE_FLAGS(PinoutSignals, PinoutSignal)
123 Q_ENUM(SerialPortError)
126 explicit QSerialPort(
const QString& name, QObject* parent =
nullptr);
130 void setPortName(
const QString& name);
131 QString portName()
const;
135 bool open(OpenMode mode)
override;
136 void close()
override;
138 bool setBaudRate(qint32 baudRate, Directions directions = AllDirections);
139 qint32 baudRate(Directions directions = AllDirections)
const;
141 bool setDataBits(DataBits dataBits);
142 DataBits dataBits()
const;
143 QBindable<DataBits> bindableDataBits();
145 bool setParity(Parity parity);
146 Parity parity()
const;
147 QBindable<Parity> bindableParity();
149 bool setStopBits(StopBits stopBits);
150 StopBits stopBits()
const;
151 QBindable<StopBits> bindableStopBits();
153 bool setFlowControl(FlowControl flowControl);
154 FlowControl flowControl()
const;
155 QBindable<FlowControl> bindableFlowControl();
157 bool setDataTerminalReady(
bool set);
158 bool isDataTerminalReady();
160 bool setRequestToSend(
bool set);
161 bool isRequestToSend();
163 PinoutSignals pinoutSignals();
166 bool clear(Directions directions = AllDirections);
168 SerialPortError
error()
const;
170 QBindable<SerialPortError> bindableError()
const;
172 qint64 readBufferSize()
const;
173 void setReadBufferSize(qint64 size);
175 bool isSequential()
const override;
177 qint64 bytesAvailable()
const override;
178 qint64 bytesToWrite()
const override;
179 bool canReadLine()
const override;
181 bool waitForReadyRead(
int msecs = 30000)
override;
182 bool waitForBytesWritten(
int msecs = 30000)
override;
184 bool setBreakEnabled(
bool set =
true);
185 bool isBreakEnabled()
const;
186 QBindable<bool> bindableIsBreakEnabled();
188 Handle handle()
const;
202 qint64 readData(
char* data, qint64 maxSize)
override;
203 qint64 readLineData(
char* data, qint64 maxSize)
override;
204 qint64 writeData(
const char* data, qint64 maxSize)
override;