|
QGroundControl
Ground Control Station for MAVLink Drones
|
#include <GPSProtocolRuntime.h>
Inheritance diagram for GPSProtocolRuntime:
Collaboration diagram for GPSProtocolRuntime:Public Member Functions | |
| GPSProtocolRuntime (const GPSReceiverFamily &family, GPSRuntimeIO io, GPSRuntimeObserver observer={}) | |
| Creates the family's protocol with its factory. | |
| GPSProtocolRuntime (const GPSReceiverFamily &family, std::unique_ptr< GPSFamilyProtocol > protocol, GPSRuntimeIO io, GPSRuntimeObserver observer={}) | |
| Hosts protocol, for families configured by the caller such as test doubles. | |
| ~GPSProtocolRuntime () | |
| bool | configure (const GPSConfig &config, unsigned &baud) |
| bool | probe (std::chrono::milliseconds budget) |
| GPSReceiveUpdates | receive (std::chrono::milliseconds timeout) |
| bool | armDecodeOnly (const GPSConfig &config) |
| bool | armNavigationDecode (GPSNavigationDecode decode={}) |
| GPSEventBatch | decode (std::span< const uint8_t > bytes) |
| Decodes bytes without I/O or observer callbacks. | |
| GPSReceiveUpdates | consume (std::span< const uint8_t > bytes) |
| Decodes bytes and delivers their batch to the observer. An empty span flushes. | |
| GPSReceiveUpdates | consumeFrame (const GPSFrame &frame) |
| Decodes one frame another stream framed and delivers its batch to the observer, without flushing. | |
| bool | receiverReady () const |
| QString | identity () const |
| Model and firmware reported during configuration, trimmed; empty when unknown. | |
| GPSProtocolError | error () const |
| const QString & | errorDetail () const |
| const GPSReceiverFamily & | family () const |
| GPSFamilyProtocol & | protocol () |
| GPSStreamDemux & | stream () |
| GPSLogCategory | logCategory () const |
| The family's logging category, or the runtime's when the family has none. | |
Friends | |
| class | GPSCommandChannel |
Hosts one receiver family on a blocking transport. It owns the family protocol, the stream demultiplexer, the decode context that collects events, and the command channel with its deadlines, evidence and sticky failure. configure(), probe() and receive() run the family's code to completion on the caller thread; its channel operations block on GPSRuntimeIO.
Definition at line 47 of file GPSProtocolRuntime.h.
| GPSProtocolRuntime::GPSProtocolRuntime | ( | const GPSReceiverFamily & | family, |
| GPSRuntimeIO | io, | ||
| GPSRuntimeObserver | observer = {} |
||
| ) |
Creates the family's protocol with its factory.
Definition at line 13 of file GPSProtocolRuntime.cc.
| GPSProtocolRuntime::GPSProtocolRuntime | ( | const GPSReceiverFamily & | family, |
| std::unique_ptr< GPSFamilyProtocol > | protocol, | ||
| GPSRuntimeIO | io, | ||
| GPSRuntimeObserver | observer = {} |
||
| ) |
Hosts protocol, for families configured by the caller such as test doubles.
Definition at line 17 of file GPSProtocolRuntime.cc.
References GPSRuntimeIO::cancelToken, GPSRuntimeIO::clock, Error, logCategory(), GPSRuntimeIO::read, GPSRuntimeIO::setBaudrate, GPSReceiverFamily::type, Unsupported, GPSClock::wait, and GPSRuntimeIO::write.
|
default |
| bool GPSProtocolRuntime::armDecodeOnly | ( | const GPSConfig & | config | ) |
Prepares decode() and consume() for traffic from a receiver configured with config, without I/O (GPSFamilyProtocol::armDecodeOnly()). config is valid for the family, as GPSDriver::configure() requires.
Definition at line 101 of file GPSProtocolRuntime.cc.
References config.
| bool GPSProtocolRuntime::armNavigationDecode | ( | GPSNavigationDecode | decode = {} | ) |
Prepares decode() and consume() for the navigation output of a receiver configured elsewhere, without I/O (GPSFamilyProtocol::armNavigationDecode()).
Definition at line 109 of file GPSProtocolRuntime.cc.
References decode().
| bool GPSProtocolRuntime::configure | ( | const GPSConfig & | config, |
| unsigned & | baud | ||
| ) |
Configures the receiver after clearing any sticky failure. A zero baud requests detection and returns the detected rate. A command still pending at the end is retired as Written, and a successful configuration flushes once more so a fixed-base or survey-start event is delivered without another read.
Definition at line 59 of file GPSProtocolRuntime.cc.
References config, consume(), GPSCommandChannel::errorDetail(), GPSCommandChannel::failControl(), GPSCommandChannel::finishCommand(), and Written.
| GPSReceiveUpdates GPSProtocolRuntime::consume | ( | std::span< const uint8_t > | bytes | ) |
Decodes bytes and delivers their batch to the observer. An empty span flushes.
Definition at line 127 of file GPSProtocolRuntime.cc.
References decode().
Referenced by configure(), GPSCommandChannel::flush(), and GPSCommandChannel::receiveCycle().
| GPSReceiveUpdates GPSProtocolRuntime::consumeFrame | ( | const GPSFrame & | frame | ) |
Decodes one frame another stream framed and delivers its batch to the observer, without flushing.
Definition at line 132 of file GPSProtocolRuntime.cc.
| GPSEventBatch GPSProtocolRuntime::decode | ( | std::span< const uint8_t > | bytes | ) |
Decodes bytes without I/O or observer callbacks.
Definition at line 114 of file GPSProtocolRuntime.cc.
References GPSStreamDemux::push().
Referenced by armNavigationDecode(), and consume().
|
inline |
Definition at line 98 of file GPSProtocolRuntime.h.
References GPSCommandChannel::error().
|
inline |
Definition at line 100 of file GPSProtocolRuntime.h.
References GPSCommandChannel::errorDetail().
|
inline |
Definition at line 102 of file GPSProtocolRuntime.h.
Referenced by GPSCommandChannel::failNoAnswer(), and GPSCommandChannel::write().
| QString GPSProtocolRuntime::identity | ( | ) | const |
Model and firmware reported during configuration, trimmed; empty when unknown.
Definition at line 156 of file GPSProtocolRuntime.cc.
| GPSLogCategory GPSProtocolRuntime::logCategory | ( | ) | const |
The family's logging category, or the runtime's when the family has none.
Definition at line 54 of file GPSProtocolRuntime.cc.
References GPSReceiverFamily::logCategory.
Referenced by GPSProtocolRuntime(), and GPSCommandChannel::logCategory().
| bool GPSProtocolRuntime::probe | ( | std::chrono::milliseconds | budget | ) |
Runs the family's identity probe (GPSFamilyProtocol::probe()) within budget at the link's current rate, after clearing any sticky failure.
Definition at line 78 of file GPSProtocolRuntime.cc.
References GPSCommandChannel::deadlineScope(), GPSCommandChannel::finishCommand(), and Written.
Referenced by GPSReceiverDetector::detect().
|
inline |
Definition at line 104 of file GPSProtocolRuntime.h.
Referenced by GPSCommandChannel::receiveCycle(), GPSCommandChannel::receiveFor(), and GPSCommandChannel::serviceControls().
| GPSReceiveUpdates GPSProtocolRuntime::receive | ( | std::chrono::milliseconds | timeout | ) |
One streaming receive of up to timeout, including the family's streaming services. Failures are reported through error().
Definition at line 93 of file GPSProtocolRuntime.cc.
| bool GPSProtocolRuntime::receiverReady | ( | ) | const |
Definition at line 151 of file GPSProtocolRuntime.cc.
References GPSDecodeContext::failed().
|
inline |
Definition at line 106 of file GPSProtocolRuntime.h.
Referenced by GPSCommandChannel::stream().
|
friend |
Definition at line 112 of file GPSProtocolRuntime.h.