#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, and passing over one that QGC may not open while it may open another. 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 41 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.
References GPSReceiverConnectionPolicy().
Referenced by GPSReceiverConnectionPolicy(), and GPSReceiverConnectionPolicyTest.
| 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().
Referenced by GPSReceiverConnectionPolicyTest.
| 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 reset().
Referenced by GPSReceiverConnectionPolicyTest.
| void GPSReceiverConnectionPolicy::disconnectConfigured | ( | ) |
Disconnects at the user's request and pauses automatic connection.
Definition at line 82 of file GPSReceiverConnectionPolicy.cc.
References reset().
Referenced by GPSReceiverConnectionPolicyTest.
| void GPSReceiverConnectionPolicy::receiverReady | ( | ) |
Definition at line 89 of file GPSReceiverConnectionPolicy.cc.
|
inline |
The saved receiver is being connected automatically and is not connected yet.
Definition at line 66 of file GPSReceiverConnectionPolicy.h.
References reconnecting().
Referenced by reconnecting().
| 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(), disconnectConfigured(), and GPSReceiverConnectionPolicyTest.
|
nodiscard |
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.
Referenced by GPSReceiverConnectionPolicyTest.
|
friend |
Definition at line 45 of file GPSReceiverConnectionPolicy.h.
References configurationChanged(), connectConfigured(), disconnectConfigured(), GPSReceiverConnectionPolicy(), GPSReceiverConnectionPolicyTest, reset(), and update().
Referenced by GPSReceiverConnectionPolicyTest.