5#include <QtCore/QIODevice>
6#include <QtCore/QString>
13class AndroidSerialBackendHost
28 bool newDataArrived(
const char* bytes,
int length) {
return _port._newDataArrived(bytes, length); }
56 explicit AndroidSerialBackendHost(
QSerialPort& port)
74 virtual bool open(QIODevice::OpenMode mode) = 0;
93 virtual qint64
startWrite(
const char* data, qint64 maxSize) = 0;
102 virtual bool clear(QSerialPort::Directions directions) = 0;
std::unique_ptr< AndroidSerialBackend > createPosixSerialBackend(AndroidSerialBackendHost port)
A serial device node, such as /dev/ttyS1.
std::unique_ptr< AndroidSerialBackend > createUsbSerialBackend(AndroidSerialBackendHost port)
A USB serial adapter, which Java drives (AndroidSerial).
A QSerialPort as its backend sees it: what the backend asks of the port and reports to it.
void waitForArrivedInput(const QDeadlineTimer &deadline)
void setError(QSerialPort::SerialPortError error, const QString &text=QString())
bool newDataArrived(const char *bytes, int length)
void writeCompleted(qint64 bytes)
bool hasRoomForInput()
Returns whether the port has room for more input, on any thread.
void waitForWriteProgress(const QDeadlineTimer &deadline)
bool inputArrived()
Returns whether input has arrived that the port's owner has not been told of and can be told of now.
QSerialPort & serialPort() const
The port itself, for its settings, its error and its thread.
QString systemLocation() const
virtual bool waitForInput(const QDeadlineTimer &deadline)=0
virtual qint64 startWrite(const char *data, qint64 maxSize)=0
virtual bool setBreakEnabled(bool set)=0
virtual ~AndroidSerialBackend()=default
virtual bool startReading()=0
virtual void close()=0
Closes the device, after which no more of its input reaches the port. Does nothing if it is closed.
virtual int descriptor() const =0
The file descriptor of the open device, or -1.
virtual bool open(QIODevice::OpenMode mode)=0
Opens the device. The port applies its settings afterwards.
virtual bool setRequestToSend(bool set)=0
AndroidSerialBackend()=default
virtual bool setFlowControl(QSerialPort::FlowControl flowControl)=0
virtual bool waitForWritable(const QDeadlineTimer &deadline)=0
Blocks until the port's writeCompleted() may have been called, or the deadline has passed.
virtual bool clear(QSerialPort::Directions directions)=0
virtual bool setParameters(qint32 baudRate, QSerialPort::DataBits dataBits, QSerialPort::StopBits stopBits, QSerialPort::Parity parity, const QString &failureText)=0
A backend that cannot tell why the device refused describes the failure by failureText.
virtual bool setDataTerminalReady(bool set)=0
virtual QSerialPort::PinoutSignals pinoutSignals()=0