|
QGroundControl
Ground Control Station for MAVLink Drones
|
#include <GPSDeviceTransport.h>
Inheritance diagram for GPSDeviceTransport:
Collaboration diagram for GPSDeviceTransport:Public Member Functions | |
| GPSReadResult | read (std::span< uint8_t > buffer, std::chrono::milliseconds timeout) override |
| GPSTransport (GPSCancelToken cancelToken) | |
Public Member Functions inherited from GPSTransport | |
| GPSTransport (GPSCancelToken cancelToken) | |
| virtual | ~GPSTransport () |
| virtual GPSOpenResult | open ()=0 |
| virtual bool | fatalError () const =0 |
| bool | isCancelled () const |
| const GPSCancelToken & | cancelToken () const |
| virtual unsigned | fixedBaudrate () const |
| Nonzero when the link cannot follow baud-rate changes (for example, a serial bridge). | |
| virtual std::chrono::milliseconds | configurationWriteTimeout () const |
| GPSWriteResult | write (QByteArrayView bytes, QDeadlineTimer deadline) |
| virtual bool | setBaudrate (unsigned baudrate) |
Protected Member Functions | |
| virtual QIODevice * | device () const =0 |
| The open device, or null before open(). | |
| virtual bool | readUnavailable () const |
| Whether read() fails without waiting; by default, when there is no device. | |
| virtual bool | waitReadable (QDeadlineTimer deadline) |
| Waits until input is buffered. Input reported buffered is delivered even after the link fails. | |
| virtual qint64 | take (std::span< uint8_t > buffer) |
| Takes buffered input. | |
| virtual GPSReadResult | readFailure () const |
| Describes a failed link; by default, a closed connection with the device's error. | |
| GPSWriteResult | writeData (QByteArrayView bytes, QDeadlineTimer deadline) override |
| Receives non-empty bytes and an unexpired, capped deadline that implementations must honor. | |
| virtual void | waitWritten (QDeadlineTimer &deadline) |
| Waits for queued bytes to drain. May expire deadline to end the write. | |
| virtual qint64 | confirmedWritten (int accepted, qint64 drained) |
| virtual void | retire () |
| Retires the connection after a failed write that accepted bytes; by default closes the device. | |
| bool | waitUntil (const std::function< bool()> &done, QDeadlineTimer deadline) |
| bool | waitForDevice (const std::function< bool()> &ready, QDeadlineTimer deadline) |
Additional Inherited Members | |
Static Public Attributes inherited from GPSTransport | |
| static constexpr unsigned | BRIDGE_BAUDRATE = 115200 |
| static constexpr qint64 | READ_BUFFER_BYTES = 64 * 1024 |
| static constexpr qint64 | WRITE_BUFFER_BYTES = 4 * 1024 |
| Bytes a link queues for writing at once. | |
GPSTransport over a QIODevice its subclass owns. Implements the bounded read and write contract once; subclasses adapt it through the protected hooks. Waits dispatch the owner thread's events and wake at once on a stop.
Definition at line 18 of file GPSDeviceTransport.h.
|
protectedvirtual |
Bytes of this write the link confirmed, given accepted bytes accepted and drained bytes reported by the device's bytesWritten() during the write; by default drained.
Reimplemented in SerialGPSTransport.
Definition at line 123 of file GPSDeviceTransport.cc.
Referenced by writeData().
|
protectedpure virtual |
The open device, or null before open().
Implemented in SerialGPSTransport, TCPGPSTransport, and UDPGPSTransport.
Referenced by readFailure(), readUnavailable(), retire(), take(), waitForDevice(), waitReadable(), waitUntil(), waitWritten(), and writeData().
|
explicit |
Definition at line 78 of file GPSTransport.cc.
|
overridevirtual |
A nonpositive timeout polls immediately available input. Failures never carry usable stream bytes. An empty buffer reports the failure of a failed link without reading.
Implements GPSTransport.
Definition at line 18 of file GPSDeviceTransport.cc.
References Cancelled, Data, GPSReadResult::detail, Error, GPSTransport::fatalError(), GPSTransport::isCancelled(), readFailure(), readUnavailable(), take(), TimedOut, and waitReadable().
|
protectedvirtual |
Describes a failed link; by default, a closed connection with the device's error.
Reimplemented in SerialGPSTransport.
Definition at line 62 of file GPSDeviceTransport.cc.
References Closed, and device().
Referenced by read(), and writeData().
|
protectedvirtual |
Whether read() fails without waiting; by default, when there is no device.
Reimplemented in SerialGPSTransport.
Definition at line 42 of file GPSDeviceTransport.cc.
References device().
Referenced by read().
|
protectedvirtual |
Retires the connection after a failed write that accepted bytes; by default closes the device.
Reimplemented in TCPGPSTransport.
Definition at line 129 of file GPSDeviceTransport.cc.
References device().
Referenced by writeData().
|
protectedvirtual |
Takes buffered input.
Reimplemented in UDPGPSTransport.
Definition at line 57 of file GPSDeviceTransport.cc.
References device().
Referenced by read().
|
protected |
waitUntil() for ready or a failed link. Short waitForConnected() calls would abort DNS and connection progress on timeout.
Definition at line 173 of file GPSDeviceTransport.cc.
References device(), GPSTransport::fatalError(), GPSTransport::isCancelled(), and waitUntil().
Referenced by TCPGPSTransport::open(), waitReadable(), UDPGPSTransport::waitReadable(), and waitWritten().
|
protectedvirtual |
Waits until input is buffered. Input reported buffered is delivered even after the link fails.
Reimplemented in SerialGPSTransport, and UDPGPSTransport.
Definition at line 47 of file GPSDeviceTransport.cc.
References device(), GPSTransport::fatalError(), and waitForDevice().
Referenced by read(), and SerialGPSTransport::waitReadable().
|
protected |
Dispatches events until done holds, deadline expires or a stop is requested, also woken by the device's input, output, error and state signals.
Definition at line 134 of file GPSDeviceTransport.cc.
References GPSTransport::cancelToken(), device(), QSerialPort::errorOccurred(), and GPSTransport::isCancelled().
Referenced by SerialGPSTransport::open(), and waitForDevice().
|
protectedvirtual |
Waits for queued bytes to drain. May expire deadline to end the write.
Reimplemented in SerialGPSTransport.
Definition at line 117 of file GPSDeviceTransport.cc.
References device(), and waitForDevice().
Referenced by writeData().
|
overrideprotectedvirtual |
Receives non-empty bytes and an unexpired, capped deadline that implementations must honor.
Implements GPSTransport.
Reimplemented in UDPGPSTransport.
Definition at line 67 of file GPSDeviceTransport.cc.
References Cancelled, Completed, confirmedWritten(), GPSReadResult::detail, device(), Error, GPSTransport::fatalError(), GPSTransport::isCancelled(), readFailure(), retire(), TimedOut, waitWritten(), and GPSTransport::WRITE_BUFFER_BYTES.