#include <AndroidSerialPort.h>
Signals | |
| void | baudRateChanged (qint32 baudRate, QSerialPort::Directions directions) |
| void | dataBitsChanged (QSerialPort::DataBits dataBits) |
| void | parityChanged (QSerialPort::Parity parity) |
| void | stopBitsChanged (QSerialPort::StopBits stopBits) |
| void | flowControlChanged (QSerialPort::FlowControl flowControl) |
| void | dataTerminalReadyChanged (bool set) |
| void | requestToSendChanged (bool set) |
| void | errorOccurred (QSerialPort::SerialPortError error) |
| Emitted whenever the error is set, also to NoError. | |
| void | breakEnabledChanged (bool set) |
Public Member Functions | |
| QSerialPort (QObject *parent=nullptr) | |
| QSerialPort (const QString &name, QObject *parent=nullptr) | |
| QSerialPort (const QSerialPortInfo &info, QObject *parent=nullptr) | |
| ~QSerialPort () override | |
| void | setPortName (const QString &name) |
| QString | portName () const |
| void | setPort (const QSerialPortInfo &info) |
| bool | open (OpenMode mode) override |
| void | close () override |
| bool | setBaudRate (qint32 baudRate, Directions directions=AllDirections) |
| qint32 | baudRate (Directions directions=AllDirections) const |
| bool | setDataBits (DataBits dataBits) |
| DataBits | dataBits () const |
| bool | setParity (Parity parity) |
| Parity | parity () const |
| bool | setStopBits (StopBits stopBits) |
| StopBits | stopBits () const |
| bool | setFlowControl (FlowControl flowControl) |
| FlowControl | flowControl () const |
| bool | setDataTerminalReady (bool set) |
| bool | isDataTerminalReady () |
| bool | setRequestToSend (bool set) |
| bool | isRequestToSend () |
| PinoutSignals | pinoutSignals () |
| bool | setBreakEnabled (bool set=true) |
| bool | isBreakEnabled () const |
| bool | flush () |
| Hands buffered output to the device, as far as it takes it now, and returns whether it took any. | |
| bool | clear (Directions directions=AllDirections) |
| SerialPortError | error () const |
| void | clearError () |
| void | setReadBufferSize (qint64 size) |
| qint64 | readBufferSize () const |
| int | handle () const |
| The file descriptor of the open device, or -1. | |
| bool | isSequential () const override |
| qint64 | bytesAvailable () const override |
| qint64 | bytesToWrite () const override |
| bool | canReadLine () const override |
| bool | waitForReadyRead (int msecs=30000) override |
| Returns true only for input that was not announced before. | |
| bool | waitForBytesWritten (int msecs=30000) override |
Protected Member Functions | |
| qint64 | readData (char *data, qint64 maxSize) override |
| qint64 | writeData (const char *data, qint64 maxSize) override |
Friends | |
| class | AndroidSerialBackendHost |
The serial port of QGC on Android. Qt Serial Port's own opens device nodes only, and Android lets an app reach a USB serial adapter through its USB API alone. This class has the name and the interface of Qt Serial Port's, so that code which uses a serial port is the same on every platform and includes <QtSerialPort/QSerialPort>. Of that interface it leaves out the properties and their bindables, and a baud rate for one direction only.
The port's name decides what it opens (AndroidSerialBackend): a USB serial adapter, which Java drives, or a serial device node. Input arrives on other threads and is announced on the port's own, which is the only one that may call the port.
Definition at line 28 of file AndroidSerialPort.h.
| Enumerator | |
|---|---|
| Baud1200 | |
| Baud2400 | |
| Baud4800 | |
| Baud9600 | |
| Baud19200 | |
| Baud38400 | |
| Baud57600 | |
| Baud115200 | |
Definition at line 47 of file AndroidSerialPort.h.
| Enumerator | |
|---|---|
| Data5 | |
| Data6 | |
| Data7 | |
| Data8 | |
Definition at line 60 of file AndroidSerialPort.h.
| Enumerator | |
|---|---|
| Input | |
| Output | |
| AllDirections | |
Definition at line 38 of file AndroidSerialPort.h.
| Enumerator | |
|---|---|
| NoFlowControl | |
| HardwareControl | |
| SoftwareControl | |
Definition at line 87 of file AndroidSerialPort.h.
| enum QSerialPort::Parity |
| Enumerator | |
|---|---|
| NoParity | |
| EvenParity | |
| OddParity | |
| SpaceParity | |
| MarkParity | |
Definition at line 69 of file AndroidSerialPort.h.
Definition at line 95 of file AndroidSerialPort.h.
| Enumerator | |
|---|---|
| NoError | |
| DeviceNotFoundError | |
| PermissionError | |
| OpenError | |
| WriteError | |
| ReadError | |
| ResourceError | |
| UnsupportedOperationError | |
| UnknownError | |
| TimeoutError | |
| NotOpenError | |
Definition at line 110 of file AndroidSerialPort.h.
| Enumerator | |
|---|---|
| OneStop | |
| OneAndHalfStop | |
| TwoStop | |
Definition at line 79 of file AndroidSerialPort.h.
|
explicit |
Definition at line 62 of file AndroidSerialPort.cc.
|
explicit |
Definition at line 66 of file AndroidSerialPort.cc.
References setPortName().
|
explicit |
Definition at line 72 of file AndroidSerialPort.cc.
References setPort().
|
override |
Definition at line 78 of file AndroidSerialPort.cc.
References close().
| qint32 QSerialPort::baudRate | ( | Directions | directions = AllDirections | ) | const |
Definition at line 262 of file AndroidSerialPort.cc.
Referenced by baudRateChanged(), and setBaudRate().
|
signal |
References baudRate().
Referenced by setBaudRate().
|
signal |
Referenced by setBreakEnabled().
|
override |
Definition at line 416 of file AndroidSerialPort.cc.
|
override |
Definition at line 422 of file AndroidSerialPort.cc.
Referenced by waitForBytesWritten().
|
override |
Definition at line 428 of file AndroidSerialPort.cc.
| bool QSerialPort::clear | ( | Directions | directions = AllDirections | ) |
Definition at line 821 of file AndroidSerialPort.cc.
| void QSerialPort::clearError | ( | ) |
|
override |
Definition at line 155 of file AndroidSerialPort.cc.
References NotOpenError, ResourceError, and WriteError.
Referenced by ~QSerialPort().
|
inline |
Definition at line 139 of file AndroidSerialPort.h.
Referenced by dataBitsChanged(), and setDataBits().
|
signal |
References dataBits().
Referenced by setDataBits().
|
signal |
Referenced by setDataTerminalReady().
|
inline |
Definition at line 168 of file AndroidSerialPort.h.
Referenced by AndroidSerialBackendHost, and errorOccurred().
|
signal |
Emitted whenever the error is set, also to NoError.
References error().
Referenced by SerialWorker::setupPort(), and GPSDeviceTransport::waitUntil().
|
inline |
Definition at line 151 of file AndroidSerialPort.h.
Referenced by flowControlChanged(), and setFlowControl().
|
signal |
References flowControl().
Referenced by setFlowControl().
| bool QSerialPort::flush | ( | ) |
Hands buffered output to the device, as far as it takes it now, and returns whether it took any.
Definition at line 811 of file AndroidSerialPort.cc.
| int QSerialPort::handle | ( | ) | const |
The file descriptor of the open device, or -1.
Definition at line 393 of file AndroidSerialPort.cc.
|
inline |
Definition at line 162 of file AndroidSerialPort.h.
| bool QSerialPort::isDataTerminalReady | ( | ) |
Definition at line 338 of file AndroidSerialPort.cc.
References DataTerminalReadySignal, and pinoutSignals().
| bool QSerialPort::isRequestToSend | ( | ) |
Definition at line 367 of file AndroidSerialPort.cc.
References pinoutSignals(), and RequestToSendSignal.
|
override |
Definition at line 411 of file AndroidSerialPort.cc.
|
override |
Definition at line 100 of file AndroidSerialPort.cc.
References clearError(), OpenError, and UnsupportedOperationError.
|
inline |
Definition at line 143 of file AndroidSerialPort.h.
Referenced by parityChanged(), and setParity().
|
signal |
References parity().
Referenced by setParity().
| QSerialPort::PinoutSignals QSerialPort::pinoutSignals | ( | ) |
Definition at line 372 of file AndroidSerialPort.cc.
References NoSignal, and AndroidSerialBackend::pinoutSignals().
Referenced by isDataTerminalReady(), and isRequestToSend().
| QString QSerialPort::portName | ( | ) | const |
Definition at line 90 of file AndroidSerialPort.cc.
References QSerialPortInfo::portNameFromSystemLocation().
|
inline |
Definition at line 177 of file AndroidSerialPort.h.
|
overrideprotected |
Definition at line 438 of file AndroidSerialPort.cc.
|
signal |
Referenced by setRequestToSend().
| bool QSerialPort::setBaudRate | ( | qint32 | baudRate, |
| Directions | directions = AllDirections ) |
A closed port keeps the settings it is given and applies them when it opens. An open port keeps a setting only if the device took it.
Definition at line 234 of file AndroidSerialPort.cc.
References AllDirections, baudRate(), baudRateChanged(), and UnsupportedOperationError.
| bool QSerialPort::setBreakEnabled | ( | bool | set = true | ) |
Definition at line 378 of file AndroidSerialPort.cc.
References breakEnabledChanged(), and AndroidSerialBackend::setBreakEnabled().
| bool QSerialPort::setDataBits | ( | DataBits | dataBits | ) |
Definition at line 267 of file AndroidSerialPort.cc.
References dataBits(), and dataBitsChanged().
| bool QSerialPort::setDataTerminalReady | ( | bool | set | ) |
Does not ask the device how the line is: it signals a change from what the port itself last set since it opened, and the first set counts as one. Likewise setRequestToSend().
Definition at line 323 of file AndroidSerialPort.cc.
References dataTerminalReadyChanged(), and AndroidSerialBackend::setDataTerminalReady().
| bool QSerialPort::setFlowControl | ( | FlowControl | flowControl | ) |
Definition at line 309 of file AndroidSerialPort.cc.
References flowControl(), and flowControlChanged().
| bool QSerialPort::setParity | ( | Parity | parity | ) |
Definition at line 281 of file AndroidSerialPort.cc.
References parity(), and parityChanged().
| void QSerialPort::setPort | ( | const QSerialPortInfo & | info | ) |
Definition at line 95 of file AndroidSerialPort.cc.
References QSerialPortInfo::systemLocation().
Referenced by QSerialPort().
| void QSerialPort::setPortName | ( | const QString & | name | ) |
Definition at line 85 of file AndroidSerialPort.cc.
References QSerialPortInfo::portNameToSystemLocation().
Referenced by QSerialPort().
| void QSerialPort::setReadBufferSize | ( | qint64 | size | ) |
How much input the port lets its owner see at a time: bytesAvailable() does not exceed it. What arrives beyond it waits, hidden, for a read to make room, and when that alone reaches the limit the device is read no further, so the port holds up to twice the limit. 0 or less is no limit.
Definition at line 398 of file AndroidSerialPort.cc.
| bool QSerialPort::setRequestToSend | ( | bool | set | ) |
Definition at line 343 of file AndroidSerialPort.cc.
References HardwareControl, requestToSendChanged(), AndroidSerialBackend::setRequestToSend(), and UnsupportedOperationError.
| bool QSerialPort::setStopBits | ( | StopBits | stopBits | ) |
Definition at line 295 of file AndroidSerialPort.cc.
References stopBits(), and stopBitsChanged().
|
inline |
Definition at line 147 of file AndroidSerialPort.h.
Referenced by setStopBits(), and stopBitsChanged().
|
signal |
References stopBits().
Referenced by setStopBits().
|
override |
Definition at line 678 of file AndroidSerialPort.cc.
References bytesToWrite(), and TimeoutError.
|
override |
Returns true only for input that was not announced before.
Definition at line 645 of file AndroidSerialPort.cc.
References TimeoutError.
|
overrideprotected |
Definition at line 697 of file AndroidSerialPort.cc.
References WriteError.
|
friend |
Definition at line 208 of file AndroidSerialPort.h.
References AndroidSerialBackendHost, Baud9600, Data8, error(), NoError, NoFlowControl, NoParity, and OneStop.
Referenced by AndroidSerialBackendHost.