|
QGroundControl
Ground Control Station for MAVLink Drones
|
Manage communication links The Link Manager organizes the physical Links. It can manage arbitrary links and takes care of connecting them as well assigning the correct protocol instance to transport the link data into the application. More...
#include <LinkManager.h>
Inheritance diagram for LinkManager:
Collaboration diagram for LinkManager:Signals | |
| void | mavlinkSupportForwardingEnabledChanged () |
| void | isBluetoothAvailableChanged () |
| void | commPortStringsChanged () |
| void | commPortsChanged () |
Public Member Functions | |
| LinkManager (QObject *parent=nullptr) | |
| ~LinkManager () | |
| void | init () |
| Q_INVOKABLE LinkConfiguration * | createConfiguration (int type, const QString &name) |
| Create/Edit Link Configuration. | |
| Q_INVOKABLE LinkConfiguration * | startConfigurationEditing (LinkConfiguration *config) |
| Q_INVOKABLE void | cancelConfigurationEditing (LinkConfiguration *config) const |
| Q_INVOKABLE void | endConfigurationEditing (LinkConfiguration *config, LinkConfiguration *editedConfig) |
| Q_INVOKABLE void | endCreateConfiguration (LinkConfiguration *config) |
| Q_INVOKABLE void | removeConfiguration (LinkConfiguration *config) |
| Q_INVOKABLE void | createConnectedLink (const LinkConfiguration *config) |
| This should only be used by Qml code. | |
| Q_INVOKABLE void | disconnectLink (LinkInterface *link) |
| Q_INVOKABLE void | disconnectLinkConfiguration (LinkConfiguration *config) |
| Stop a link and suppress auto-reconnect, working whether or not a live link currently exists. | |
| Q_INVOKABLE void | createMavlinkForwardingSupportLink () |
| Q_INVOKABLE void | shutdown () |
| Called to signal app shutdown. Disconnects all links while turning off auto-connect. | |
| Q_INVOKABLE LogReplayLink * | startLogReplay (const QString &logFile) |
| QList< SharedLinkInterfacePtr > | links () |
| QStringList | linkTypeStrings () const |
| bool | mavlinkSupportForwardingEnabled () const |
| void | loadLinkConfigurationList () |
| void | saveLinkConfigurationList () |
| void | setConnectionsSuspended (const QString &reason) |
| void | setConnectionsAllowed () |
| Sets the flag to allow new connections to be made. | |
| bool | createConnectedLink (SharedLinkConfigurationPtr &config) |
| Creates, connects (and adds) a link based on the given configuration instance. | |
| SharedLinkInterfacePtr | mavlinkForwardingLink () |
| Returns pointer to the mavlink forwarding link, or nullptr if it does not exist. | |
| SharedLinkInterfacePtr | mavlinkForwardingSupportLink () |
| Returns pointer to the mavlink support forwarding link, or nullptr if it does not exist. | |
| void | disconnectAll () |
| uint8_t | allocateMavlinkChannel () |
| void | freeMavlinkChannel (uint8_t channel) |
| SharedLinkInterfacePtr | sharedLinkInterfacePointerForLink (const LinkInterface *link) |
| bool | containsLink (const LinkInterface *link) |
| SharedLinkConfigurationPtr | addConfiguration (LinkConfiguration *config) |
| void | startAutoConnectedLinks () |
| QStringList | serialPortStrings () |
| QStringList | serialPorts () |
Static Public Member Functions | |
| static LinkManager * | instance () |
| static bool | isBluetoothAvailable () |
| static bool | isLinkUSBDirect (const LinkInterface *link) |
| static constexpr uint8_t | invalidMavlinkChannel () |
| static QStringList | serialBaudRates () |
Friends | |
| class | LinkManagerTest |
Manage communication links The Link Manager organizes the physical Links. It can manage arbitrary links and takes care of connecting them as well assigning the correct protocol instance to transport the link data into the application.
Definition at line 31 of file LinkManager.h.
|
explicit |
Definition at line 38 of file LinkManager.cc.
| LinkManager::~LinkManager | ( | ) |
Definition at line 53 of file LinkManager.cc.
| SharedLinkConfigurationPtr LinkManager::addConfiguration | ( | LinkConfiguration * | config | ) |
Definition at line 681 of file LinkManager.cc.
References QmlObjectListModel::append(), and config.
Referenced by endCreateConfiguration(), loadLinkConfigurationList(), and startLogReplay().
| uint8_t LinkManager::allocateMavlinkChannel | ( | ) |
Allocates a mavlink channel for use
Definition at line 699 of file LinkManager.cc.
References invalidMavlinkChannel(), MAVLINK_COMM_NUM_BUFFERS, and mavlink_get_channel_status().
Referenced by LinkInterface::_allocateMavlinkChannel().
|
inline |
Definition at line 56 of file LinkManager.h.
References config.
|
signal |
|
signal |
| bool LinkManager::containsLink | ( | const LinkInterface * | link | ) |
Definition at line 668 of file LinkManager.cc.
| LinkConfiguration * LinkManager::createConfiguration | ( | int | type, |
| const QString & | name | ||
| ) |
Create/Edit Link Configuration.
Definition at line 598 of file LinkManager.cc.
References LinkConfiguration::createSettings(), and LinkConfiguration::TypeSerial.
| void LinkManager::createConnectedLink | ( | const LinkConfiguration * | config | ) |
This should only be used by Qml code.
Definition at line 84 of file LinkManager.cc.
References config, and createConnectedLink().
Referenced by createConnectedLink(), startAutoConnectedLinks(), and startLogReplay().
| bool LinkManager::createConnectedLink | ( | SharedLinkConfigurationPtr & | config | ) |
Creates, connects (and adds) a link based on the given configuration instance.
Definition at line 122 of file LinkManager.cc.
References LinkInterface::bytesReceived(), LinkInterface::bytesSent(), LinkInterface::communicationError(), config, LinkInterface::connected(), LinkInterface::disconnected(), MAVLinkProtocol::instance(), MAVLinkProtocol::logSentBytes(), MAVLinkProtocol::receiveBytes(), MAVLinkProtocol::resetMetadataForLink(), LinkConfiguration::TypeBluetooth, LinkConfiguration::TypeLast, LinkConfiguration::TypeLogReplay, LinkConfiguration::TypeSerial, LinkConfiguration::TypeTcp, and LinkConfiguration::TypeUdp.
| void LinkManager::createMavlinkForwardingSupportLink | ( | ) |
Definition at line 641 of file LinkManager.cc.
References SettingsManager::instance(), SettingsManager::mavlinkSettings(), and mavlinkSupportForwardingEnabledChanged().
| void LinkManager::disconnectAll | ( | ) |
Definition at line 245 of file LinkManager.cc.
References links().
Referenced by shutdown(), and FirmwareUpgradeController::startBoardSearch().
| void LinkManager::disconnectLink | ( | LinkInterface * | link | ) |
Definition at line 95 of file LinkManager.cc.
References config, LinkInterface::disconnect(), and LinkInterface::linkConfiguration().
| void LinkManager::disconnectLinkConfiguration | ( | LinkConfiguration * | config | ) |
Stop a link and suppress auto-reconnect, working whether or not a live link currently exists.
Definition at line 109 of file LinkManager.cc.
References config.
| void LinkManager::endConfigurationEditing | ( | LinkConfiguration * | config, |
| LinkConfiguration * | editedConfig | ||
| ) |
Definition at line 573 of file LinkManager.cc.
References config, and saveLinkConfigurationList().
| void LinkManager::endCreateConfiguration | ( | LinkConfiguration * | config | ) |
Definition at line 587 of file LinkManager.cc.
References addConfiguration(), config, and saveLinkConfigurationList().
| void LinkManager::freeMavlinkChannel | ( | uint8_t | channel | ) |
Definition at line 718 of file LinkManager.cc.
References invalidMavlinkChannel().
Referenced by LinkInterface::_freeMavlinkChannel().
| void LinkManager::init | ( | ) |
Definition at line 63 of file LinkManager.cc.
References SettingsManager::autoConnectSettings(), SettingsManager::instance(), and QGC::runningUnitTests().
|
static |
Definition at line 58 of file LinkManager.cc.
Referenced by LinkInterface::_allocateMavlinkChannel(), LinkInterface::_freeMavlinkChannel(), LogReplayWorker::pause(), LogReplayWorker::play(), MAVLinkProtocol::receiveBytes(), FirmwareUpgradeController::startBoardSearch(), QGroundControlQmlGlobal::stopOneMockLink(), and FirmwareUpgradeController::~FirmwareUpgradeController().
|
inlinestaticconstexpr |
Definition at line 114 of file LinkManager.h.
Referenced by LinkInterface::_freeMavlinkChannel(), allocateMavlinkChannel(), freeMavlinkChannel(), and LinkInterface::mavlinkChannelIsSet().
|
static |
Definition at line 663 of file LinkManager.cc.
References QGCNetworkHelper::isBluetoothAvailable().
|
signal |
|
static |
Definition at line 757 of file LinkManager.cc.
References config, LinkInterface::linkConfiguration(), and SerialConfiguration::usbDirect().
| QList< SharedLinkInterfacePtr > LinkManager::links | ( | ) |
Definition at line 73 of file LinkManager.cc.
Referenced by disconnectAll(), and QGroundControlQmlGlobal::stopOneMockLink().
| QStringList LinkManager::linkTypeStrings | ( | ) | const |
Definition at line 547 of file LinkManager.cc.
References LinkConfiguration::TypeLast.
| void LinkManager::loadLinkConfigurationList | ( | ) |
Definition at line 357 of file LinkManager.cc.
References addConfiguration(), LinkConfiguration::loadSettings(), LinkConfiguration::setAutoConnect(), LinkConfiguration::setHighLatency(), LinkConfiguration::settingsRoot(), LinkConfiguration::TypeBluetooth, LinkConfiguration::TypeLast, LinkConfiguration::TypeLogReplay, LinkConfiguration::TypeSerial, LinkConfiguration::TypeTcp, and LinkConfiguration::TypeUdp.
| SharedLinkInterfacePtr LinkManager::mavlinkForwardingLink | ( | ) |
Returns pointer to the mavlink forwarding link, or nullptr if it does not exist.
Definition at line 217 of file LinkManager.cc.
References LinkInterface::linkConfiguration(), and LinkConfiguration::TypeUdp.
| SharedLinkInterfacePtr LinkManager::mavlinkForwardingSupportLink | ( | ) |
Returns pointer to the mavlink support forwarding link, or nullptr if it does not exist.
Definition at line 231 of file LinkManager.cc.
References LinkInterface::linkConfiguration(), and LinkConfiguration::TypeUdp.
|
inline |
Definition at line 72 of file LinkManager.h.
|
signal |
Referenced by createMavlinkForwardingSupportLink().
| void LinkManager::removeConfiguration | ( | LinkConfiguration * | config | ) |
Definition at line 625 of file LinkManager.cc.
References config, LinkInterface::disconnect(), and saveLinkConfigurationList().
| void LinkManager::saveLinkConfigurationList | ( | ) |
Definition at line 328 of file LinkManager.cc.
References LinkConfiguration::settingsRoot().
Referenced by endConfigurationEditing(), endCreateConfiguration(), and removeConfiguration().
|
static |
Definition at line 1000 of file LinkManager.cc.
References SerialConfiguration::supportedBaudRates().
| QStringList LinkManager::serialPorts | ( | ) |
Definition at line 991 of file LinkManager.cc.
| QStringList LinkManager::serialPortStrings | ( | ) |
Definition at line 982 of file LinkManager.cc.
|
inline |
Sets the flag to allow new connections to be made.
Definition at line 82 of file LinkManager.h.
Referenced by LogReplayWorker::pause(), and FirmwareUpgradeController::~FirmwareUpgradeController().
|
inline |
Sets the flag to suspend the all new connections
| reason | User visible reason to suspend connections |
Definition at line 79 of file LinkManager.h.
Referenced by LogReplayWorker::play(), shutdown(), and FirmwareUpgradeController::startBoardSearch().
| SharedLinkInterfacePtr LinkManager::sharedLinkInterfacePointerForLink | ( | const LinkInterface * | link | ) |
If you are going to hold a reference to a LinkInterface* in your object you must reference count it by using this method to get access to the shared pointer.
Definition at line 302 of file LinkManager.cc.
Referenced by MAVLinkProtocol::receiveBytes().
| void LinkManager::shutdown | ( | ) |
Called to signal app shutdown. Disconnects all links while turning off auto-connect.
Definition at line 536 of file LinkManager.cc.
References disconnectAll(), MultiVehicleManager::instance(), and setConnectionsSuspended().
| void LinkManager::startAutoConnectedLinks | ( | ) |
Definition at line 689 of file LinkManager.cc.
References createConnectedLink().
| LinkConfiguration * LinkManager::startConfigurationEditing | ( | LinkConfiguration * | config | ) |
Definition at line 609 of file LinkManager.cc.
References config, LinkConfiguration::duplicateSettings(), and LinkConfiguration::TypeSerial.
| LogReplayLink * LinkManager::startLogReplay | ( | const QString & | logFile | ) |
Definition at line 729 of file LinkManager.cc.
References addConfiguration(), createConnectedLink(), LogReplayConfiguration::logFilenameShort(), LogReplayConfiguration::setLogFilename(), and LinkConfiguration::setName().
|
friend |
Definition at line 43 of file LinkManager.h.