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

#include <GPSReceiverDetector.h>

Public Member Functions

 GPSReceiverDetector (std::span< const GPSReceiverFamily *const > families, GPSRuntimeIO io, std::function< void(const GPSConfigurationEvidence &)> commandFinished={})
 
GPSReceiverDetection detect (unsigned baud=0)
 Identifies the receiver at baud, which then every family is probed at, or else at each baudCandidates() rate.
 

Static Public Member Functions

static std::vector< unsigned > baudCandidates (std::span< const GPSReceiverFamily *const > families)
 The rates detection tries without a fixed rate: every candidate rate of families, in likelihood order.
 

Static Public Attributes

static constexpr std::chrono::milliseconds LISTEN_WINDOW {1000}
 
static constexpr std::chrono::milliseconds TIMEOUT {45000}
 
static constexpr std::array< unsigned, 8 > BAUD_PRIORITY {115200, 38400, 460800, 9600, 230400, 921600, 57600, 19200}
 

Detailed Description

Identifies the receiver family on a link, without changing receiver settings. At each rate it first listens for LISTEN_WINDOW with every framer enabled and stops at the first family signature. Otherwise it sends the read-only identity probe of each family that supports the rate, in table order, and stops at the first answer, or at a signature in the replies. Standard NMEA or RTCM3 at a rate means the receiver runs at it, so detection ends there. Detection never runs longer than TIMEOUT.

Rates follow BAUD_PRIORITY, the likeliest receiver defaults first: 115200 (Septentrio, Femtomes, Trimble, Unicore and u-blox after QGroundControl configured it), 38400 (u-blox F9), 460800 (Quectel LG290P), 9600 (older u-blox), then 230400, 921600, 57600 and 19200. Rates no family lists are skipped; a rate only some family lists but BAUD_PRIORITY does not follows in ascending order.

Definition at line 78 of file GPSReceiverDetector.h.

Constructor & Destructor Documentation

◆ GPSReceiverDetector()

GPSReceiverDetector::GPSReceiverDetector ( std::span< const GPSReceiverFamily *const >  families,
GPSRuntimeIO  io,
std::function< void(const GPSConfigurationEvidence &)>  commandFinished = {} 
)

families are the candidates, in probe order; a family without baud candidates is never detected. Probe commands reach commandFinished. Decoded events are never published.

Definition at line 65 of file GPSReceiverDetector.cc.

References GPSReadResult::bytesRead, Data, Error, GPSReceiverSignatures::push(), GPSRuntimeIO::read, and GPSReadResult::status.

Member Function Documentation

◆ baudCandidates()

std::vector< unsigned > GPSReceiverDetector::baudCandidates ( std::span< const GPSReceiverFamily *const >  families)
static

The rates detection tries without a fixed rate: every candidate rate of families, in likelihood order.

Definition at line 83 of file GPSReceiverDetector.cc.

References BAUD_PRIORITY.

Referenced by detect().

◆ detect()

Member Data Documentation

◆ BAUD_PRIORITY

constexpr std::array<unsigned, 8> GPSReceiverDetector::BAUD_PRIORITY {115200, 38400, 460800, 9600, 230400, 921600, 57600, 19200}
staticconstexpr

Definition at line 85 of file GPSReceiverDetector.h.

Referenced by baudCandidates().

◆ LISTEN_WINDOW

constexpr std::chrono::milliseconds GPSReceiverDetector::LISTEN_WINDOW {1000}
staticconstexpr

Definition at line 81 of file GPSReceiverDetector.h.

◆ TIMEOUT

constexpr std::chrono::milliseconds GPSReceiverDetector::TIMEOUT {45000}
staticconstexpr

A safety net above the worst case, a silent link at all eight rates: 8 s of listening plus 35.4 s of probe timeouts, 6.3 s of them at 115200. One fixed rate takes at most 7.3 s.

Definition at line 84 of file GPSReceiverDetector.h.

Referenced by detect().


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