QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
UDPGPSTransport Class Reference

#include <UDPGPSTransport.h>

+ Inheritance diagram for UDPGPSTransport:
+ Collaboration diagram for UDPGPSTransport:

Public Member Functions

 UDPGPSTransport (quint16 port, GPSCancelToken cancelToken, std::chrono::milliseconds peerIdleTimeout=PEER_IDLE_TIMEOUT)
 
 ~UDPGPSTransport () override
 
GPSOpenResult open () override
 
bool fatalError () const override
 
unsigned fixedBaudrate () const override
 Datagrams carry no line rate; drivers see the bridge rate.
 
- Public Member Functions inherited from GPSDeviceTransport
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 ()
 
bool isCancelled () const
 
const GPSCancelToken & cancelToken () const
 
virtual std::chrono::milliseconds configurationWriteTimeout () const
 
GPSWriteResult write (QByteArrayView bytes, QDeadlineTimer deadline)
 
virtual bool setBaudrate (unsigned baudrate)
 

Static Public Attributes

static constexpr std::chrono::milliseconds PEER_IDLE_TIMEOUT {5000}
 
- 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.
 

Protected Member Functions

QIODevice * device () const override
 The open device, or null before open().
 
bool waitReadable (QDeadlineTimer deadline) override
 Waits until input is buffered. Input reported buffered is delivered even after the link fails.
 
qint64 take (std::span< uint8_t > buffer) override
 Takes buffered input.
 
GPSWriteResult writeData (QByteArrayView bytes, QDeadlineTimer deadline) override
 Receives non-empty bytes and an unexpired, capped deadline that implementations must honor.
 
- Protected Member Functions inherited from GPSDeviceTransport
virtual bool readUnavailable () const
 Whether read() fails without waiting; by default, when there is no device.
 
virtual GPSReadResult readFailure () const
 Describes a failed link; by default, a closed connection with the device's error.
 
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)
 

Detailed Description

Receive-only GNSS stream from UDP datagrams, for receivers that QGroundControl does not configure. The first sender is selected; another sender replaces it only after the selected one stays silent for PEER_IDLE_TIMEOUT. Datagrams cannot be held back, so input beyond READ_BUFFER_BYTES drops the oldest buffered bytes, with a warning; the decoders' checksums reject the frames a drop cuts. Owns its socket on the receiver worker.

Definition at line 19 of file UDPGPSTransport.h.

Constructor & Destructor Documentation

◆ UDPGPSTransport()

UDPGPSTransport::UDPGPSTransport ( quint16  port,
GPSCancelToken  cancelToken,
std::chrono::milliseconds  peerIdleTimeout = PEER_IDLE_TIMEOUT 
)

Definition at line 14 of file UDPGPSTransport.cc.

◆ ~UDPGPSTransport()

UDPGPSTransport::~UDPGPSTransport ( )
overridedefault

Member Function Documentation

◆ device()

QIODevice * UDPGPSTransport::device ( ) const
overrideprotectedvirtual

The open device, or null before open().

Implements GPSDeviceTransport.

Definition at line 72 of file UDPGPSTransport.cc.

◆ fatalError()

bool UDPGPSTransport::fatalError ( ) const
overridevirtual

Implements GPSTransport.

Definition at line 36 of file UDPGPSTransport.cc.

◆ fixedBaudrate()

unsigned UDPGPSTransport::fixedBaudrate ( ) const
inlineoverridevirtual

Datagrams carry no line rate; drivers see the bridge rate.

Reimplemented from GPSTransport.

Definition at line 32 of file UDPGPSTransport.h.

References GPSTransport::BRIDGE_BAUDRATE.

◆ open()

GPSOpenResult UDPGPSTransport::open ( )
overridevirtual

Implements GPSTransport.

Definition at line 22 of file UDPGPSTransport.cc.

References Cancelled, Error, GPSTransport::isCancelled(), and Opened.

◆ take()

qint64 UDPGPSTransport::take ( std::span< uint8_t >  buffer)
overrideprotectedvirtual

Takes buffered input.

Returns
the bytes taken, or -1 on failure.

Reimplemented from GPSDeviceTransport.

Definition at line 86 of file UDPGPSTransport.cc.

◆ waitReadable()

bool UDPGPSTransport::waitReadable ( QDeadlineTimer  deadline)
overrideprotectedvirtual

Waits until input is buffered. Input reported buffered is delivered even after the link fails.

Reimplemented from GPSDeviceTransport.

Definition at line 77 of file UDPGPSTransport.cc.

References GPSDeviceTransport::waitForDevice().

◆ writeData()

GPSWriteResult UDPGPSTransport::writeData ( QByteArrayView  bytes,
QDeadlineTimer  deadline 
)
overrideprotectedvirtual

Receives non-empty bytes and an unexpired, capped deadline that implementations must honor.

Reimplemented from GPSDeviceTransport.

Definition at line 94 of file UDPGPSTransport.cc.

References Unsupported.

Member Data Documentation

◆ PEER_IDLE_TIMEOUT

constexpr std::chrono::milliseconds UDPGPSTransport::PEER_IDLE_TIMEOUT {5000}
staticconstexpr

Definition at line 22 of file UDPGPSTransport.h.


The documentation for this class was generated from the following files: