|
QGroundControl
Ground Control Station for MAVLink Drones
|
#include <GPSReceiverConnectionPolicy.h>
Public Member Functions | |
| GPSReceiverConnectionPolicy (GPSReceiverConnector &receiver, const GPSReceiverConfiguration &configuration, RuntimeScheduler *scheduler) | |
| void | configurationChanged (const GPSReceiverConfiguration &previous) |
| The receiver's configuration changed from previous. | |
| bool | connectConfigured (bool allowPersistentChanges) |
| Connects the saved receiver at the user's request and resumes automatic connection. | |
| void | disconnectConfigured () |
| Disconnects at the user's request and pauses automatic connection. | |
| void | update () |
| Periodic tick: due automatic connections and USB discovery. | |
| void | reset () |
| Forgets connection ownership and pending retries, before another connection replaces it. | |
| bool | reconnecting () const |
| The saved receiver is being connected automatically and is not connected yet. | |
| void | receiverReady () |
| GPSReceiverSessionOutcome | sessionEnded (bool portRemoved) |
Friends | |
| class | GPSReceiverConnectionPolicyTest |
Decides when the receiver connects. With Configuration::autoConnect on, it keeps the saved receiver connected: it connects it at startup and when the setting is turned on, reconnects it with backoff after a lost connection, and reconnects an unplugged serial receiver as soon as its port returns. A connection the user starts is kept once it reaches the receiver. A configured base without a saved serial device is discovered on USB instead, trying only ports whose USB identity is a known RTK receiver adapter, with the saved manufacturer. The user's Disconnect pauses both until the user connects again or turns the setting back on. With the setting off, receivers connect only when the user asks, and a lost connection is reported. Automatic attempts never pass flash-save consent. The policy reports why a connection cannot start or is waiting for its port; the receiver words how a session ended.
Definition at line 40 of file GPSReceiverConnectionPolicy.h.
| GPSReceiverConnectionPolicy::GPSReceiverConnectionPolicy | ( | GPSReceiverConnector & | receiver, |
| const GPSReceiverConfiguration & | configuration, | ||
| RuntimeScheduler * | scheduler | ||
| ) |
Drives receiver as configuration, the receiver's, selects; all three must outlive the policy, and scheduler times the retries.
Definition at line 16 of file GPSReceiverConnectionPolicy.cc.
| void GPSReceiverConnectionPolicy::configurationChanged | ( | const GPSReceiverConfiguration & | previous | ) |
The receiver's configuration changed from previous.
Definition at line 24 of file GPSReceiverConnectionPolicy.cc.
References GPSReceiverConfiguration::autoConnect, and GPSReceiverConfiguration::sameConnection().
| bool GPSReceiverConnectionPolicy::connectConfigured | ( | bool | allowPersistentChanges | ) |
Connects the saved receiver at the user's request and resumes automatic connection.
Definition at line 66 of file GPSReceiverConnectionPolicy.cc.
References GPSReceiverConnector::hasReceiver(), reset(), and GPSReceiverConnector::setConnectionError().
| void GPSReceiverConnectionPolicy::disconnectConfigured | ( | ) |
Disconnects at the user's request and pauses automatic connection.
Definition at line 82 of file GPSReceiverConnectionPolicy.cc.
References GPSReceiverConnector::endConnection(), and reset().
| void GPSReceiverConnectionPolicy::receiverReady | ( | ) |
Definition at line 89 of file GPSReceiverConnectionPolicy.cc.
References GPSReceiverConfiguration::autoConnect, and ExponentialBackoff::reset().
|
inline |
The saved receiver is being connected automatically and is not connected yet.
Definition at line 65 of file GPSReceiverConnectionPolicy.h.
References GPSReceiverConnector::hasReceiver().
| void GPSReceiverConnectionPolicy::reset | ( | ) |
Forgets connection ownership and pending retries, before another connection replaces it.
Definition at line 59 of file GPSReceiverConnectionPolicy.cc.
Referenced by connectConfigured(), and disconnectConfigured().
| GPSReceiverSessionOutcome GPSReceiverConnectionPolicy::sessionEnded | ( | bool | portRemoved | ) |
Definition at line 99 of file GPSReceiverConnectionPolicy.cc.
References AutoRetrying, None, Retrying, Unplugged, and WaitingForPort.
| void GPSReceiverConnectionPolicy::update | ( | ) |
Periodic tick: due automatic connections and USB discovery.
Definition at line 131 of file GPSReceiverConnectionPolicy.cc.
References GPSReceiverConfiguration::autoConnect, and GPSReceiverConnector::hasReceiver().
|
friend |
Definition at line 44 of file GPSReceiverConnectionPolicy.h.