|
QGroundControl
Ground Control Station for MAVLink Drones
|
Shared serial inventory and exclusive claims. Called on the application thread. More...
#include <SerialPortManager.h>
Inheritance diagram for SerialPortManager:
Collaboration diagram for SerialPortManager:Classes | |
| struct | Port |
| struct | Reservation |
Public Types | |
| using | ReservationPtr = std::shared_ptr< const Reservation > |
| using | Enumerator = std::function< QList< Port >()> |
Signals | |
| void | serialPortsChanged () |
| void | portsEnumerated (const QStringList &availablePorts) |
| Emitted only after a fresh scan, never for a retained Android snapshot. Includes native names and paths. | |
Public Member Functions | |
| SerialPortManager (QObject *parent=nullptr, Enumerator enumerator={}) | |
| QList< Port > | availablePorts () |
| void | rescan () |
| As availablePorts(), without reusing a scan made less than a second ago. | |
| QString | displayName (const QString &systemLocation) |
| QStringList | serialPorts () const |
| ReservationPtr | reservePort (const QString &systemLocation) |
| bool | canReservePort (const QString &systemLocation) const |
| bool | isPortReserved (const QString &systemLocation) const |
| bool | anyPortReserved () const |
| ReservationPtr | excludeFromAutoConnect (const QString &systemLocation) |
| Routing exclusions survive reconnects without marking the hardware occupied. | |
| bool | canAutoConnectPort (const QString &systemLocation) const |
| bool | isAutoConnectExcluded (const QString &systemLocation) const |
| void | setSinglePortOnly (bool enabled) |
Static Public Member Functions | |
| static SerialPortManager * | instance () |
| static bool | isPrimaryInterface (const Port &port, QSet< QString > &seenDevices) |
| static QStringList | supportedBaudRates () |
Static Public Attributes | |
| static constexpr std::chrono::milliseconds | NEW_PORT_SETTLE_DELAY {1000} |
| How long a newly listed port settles before automatic connection opens it. | |
Shared serial inventory and exclusive claims. Called on the application thread.
Definition at line 18 of file SerialPortManager.h.
| using SerialPortManager::Enumerator = std::function<QList<Port>()> |
Definition at line 47 of file SerialPortManager.h.
| using SerialPortManager::ReservationPtr = std::shared_ptr<const Reservation> |
Definition at line 46 of file SerialPortManager.h.
|
explicit |
Definition at line 15 of file SerialPortManager.cc.
| bool SerialPortManager::anyPortReserved | ( | ) | const |
Definition at line 125 of file SerialPortManager.cc.
Referenced by availablePorts(), and canReservePort().
| QList< SerialPortManager::Port > SerialPortManager::availablePorts | ( | ) |
Definition at line 63 of file SerialPortManager.cc.
References anyPortReserved(), portsEnumerated(), serialPorts(), and serialPortsChanged().
Referenced by SerialConfiguration::connectionSettings(), displayName(), and rescan().
| bool SerialPortManager::canAutoConnectPort | ( | const QString & | systemLocation | ) | const |
Definition at line 158 of file SerialPortManager.cc.
References canReservePort(), and isAutoConnectExcluded().
Referenced by SerialAutoConnect::update().
| bool SerialPortManager::canReservePort | ( | const QString & | systemLocation | ) | const |
Definition at line 135 of file SerialPortManager.cc.
References anyPortReserved(), and isPortReserved().
Referenced by canAutoConnectPort(), and reservePort().
| QString SerialPortManager::displayName | ( | const QString & | systemLocation | ) |
Definition at line 94 of file SerialPortManager.cc.
References availablePorts().
Referenced by SerialConfiguration::cleanPortDisplayName().
| SerialPortManager::ReservationPtr SerialPortManager::excludeFromAutoConnect | ( | const QString & | systemLocation | ) |
Routing exclusions survive reconnects without marking the hardware occupied.
Definition at line 141 of file SerialPortManager.cc.
|
static |
Definition at line 19 of file SerialPortManager.cc.
Referenced by SerialConfiguration::cleanPortDisplayName(), SerialConfiguration::connectionSettings(), LinkManager::createConnectedLink(), LinkManager::init(), LinkManager::LinkManager(), Q_APPLICATION_STATIC(), SerialLink::SerialLink(), and QGroundControlQmlGlobal::serialPortManager().
| bool SerialPortManager::isAutoConnectExcluded | ( | const QString & | systemLocation | ) | const |
Definition at line 218 of file SerialPortManager.cc.
Referenced by canAutoConnectPort(), and SerialAutoConnect::update().
| bool SerialPortManager::isPortReserved | ( | const QString & | systemLocation | ) | const |
Definition at line 120 of file SerialPortManager.cc.
Referenced by canReservePort().
|
static |
Whether port is the first interface listed of its physical device, which this records in seenDevices. A port without a device identity is always primary.
Definition at line 24 of file SerialPortManager.cc.
Referenced by SerialAutoConnect::update().
|
signal |
Emitted only after a fresh scan, never for a retained Android snapshot. Includes native names and paths.
Referenced by availablePorts(), GPSReceiver::GPSReceiver(), LinkManager::LinkManager(), and SerialLink::SerialLink().
| void SerialPortManager::rescan | ( | ) |
As availablePorts(), without reusing a scan made less than a second ago.
Definition at line 88 of file SerialPortManager.cc.
References availablePorts().
| SerialPortManager::ReservationPtr SerialPortManager::reservePort | ( | const QString & | systemLocation | ) |
Definition at line 106 of file SerialPortManager.cc.
References canReservePort().
Referenced by LinkManager::createConnectedLink().
|
inline |
Definition at line 69 of file SerialPortManager.h.
Referenced by availablePorts().
|
signal |
Referenced by availablePorts().
|
inline |
Definition at line 82 of file SerialPortManager.h.
Referenced by LinkManager::init().
|
static |
Definition at line 163 of file SerialPortManager.cc.
References QSerialPortInfo::standardBaudRates().
Referenced by GPSReceiver::serialBaudRates(), and SerialConfiguration::supportedBaudRates().
|
staticconstexpr |
How long a newly listed port settles before automatic connection opens it.
Definition at line 54 of file SerialPortManager.h.
Referenced by SerialPortSettleTracker::settled().