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

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 connectionsSuspended () const
 
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)
 
bool containsConfiguration (const QString &name) const
 
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
 

Detailed Description

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 29 of file LinkManager.h.

Constructor & Destructor Documentation

◆ LinkManager()

LinkManager::LinkManager ( QObject *  parent = nullptr)
explicit

◆ ~LinkManager()

LinkManager::~LinkManager ( )

Definition at line 57 of file LinkManager.cc.

Member Function Documentation

◆ addConfiguration()

◆ allocateMavlinkChannel()

uint8_t LinkManager::allocateMavlinkChannel ( )

Allocates a mavlink channel for use

Returns
Mavlink channel index, invalidMavlinkChannel() for no channels available

Definition at line 777 of file LinkManager.cc.

References invalidMavlinkChannel(), MAVLINK_COMM_NUM_BUFFERS, and mavlink_get_channel_status().

Referenced by LinkInterface::_allocateMavlinkChannel().

◆ cancelConfigurationEditing()

Q_INVOKABLE void LinkManager::cancelConfigurationEditing ( LinkConfiguration *  config) const
inline

Definition at line 54 of file LinkManager.h.

References config.

◆ commPortsChanged

void LinkManager::commPortsChanged ( )
signal

◆ commPortStringsChanged

void LinkManager::commPortStringsChanged ( )
signal

◆ connectionsSuspended()

bool LinkManager::connectionsSuspended ( ) const
inline

Definition at line 82 of file LinkManager.h.

Referenced by GPSManager::init().

◆ containsConfiguration()

bool LinkManager::containsConfiguration ( const QString &  name) const

Definition at line 760 of file LinkManager.cc.

References config.

◆ containsLink()

bool LinkManager::containsLink ( const LinkInterface *  link)

Definition at line 739 of file LinkManager.cc.

◆ createConfiguration()

LinkConfiguration * LinkManager::createConfiguration ( int  type,
const QString &  name 
)

Create/Edit Link Configuration.

Definition at line 649 of file LinkManager.cc.

References LinkConfiguration::createSettings(), and LinkConfiguration::TypeSerial.

◆ createConnectedLink() [1/2]

void LinkManager::createConnectedLink ( const LinkConfiguration *  config)

This should only be used by Qml code.

Definition at line 102 of file LinkManager.cc.

References config, and createConnectedLink().

Referenced by createConnectedLink(), createMavlinkForwardingSupportLink(), init(), startAutoConnectedLinks(), and startLogReplay().

◆ createConnectedLink() [2/2]

◆ createMavlinkForwardingSupportLink()

◆ disconnectAll()

void LinkManager::disconnectAll ( )

Definition at line 279 of file LinkManager.cc.

References links().

Referenced by shutdown(), and FirmwareUpgradeController::startBoardSearch().

◆ disconnectLink()

void LinkManager::disconnectLink ( LinkInterface *  link)

◆ disconnectLinkConfiguration()

void LinkManager::disconnectLinkConfiguration ( LinkConfiguration *  config)

Stop a link and suppress auto-reconnect, working whether or not a live link currently exists.

Definition at line 127 of file LinkManager.cc.

References config.

◆ endConfigurationEditing()

void LinkManager::endConfigurationEditing ( LinkConfiguration *  config,
LinkConfiguration *  editedConfig 
)

Definition at line 624 of file LinkManager.cc.

References config, and saveLinkConfigurationList().

◆ endCreateConfiguration()

void LinkManager::endCreateConfiguration ( LinkConfiguration *  config)

Definition at line 638 of file LinkManager.cc.

References addConfiguration(), config, and saveLinkConfigurationList().

◆ freeMavlinkChannel()

void LinkManager::freeMavlinkChannel ( uint8_t  channel)

Definition at line 796 of file LinkManager.cc.

References invalidMavlinkChannel().

Referenced by LinkInterface::_freeMavlinkChannel().

◆ init()

◆ instance()

◆ invalidMavlinkChannel()

static constexpr uint8_t LinkManager::invalidMavlinkChannel ( )
inlinestaticconstexpr

◆ isBluetoothAvailable()

bool LinkManager::isBluetoothAvailable ( )
static

Definition at line 734 of file LinkManager.cc.

References QGCNetworkHelper::isBluetoothAvailable().

◆ isBluetoothAvailableChanged

void LinkManager::isBluetoothAvailableChanged ( )
signal

◆ isLinkUSBDirect()

bool LinkManager::isLinkUSBDirect ( const LinkInterface *  link)
static

◆ links()

QList< SharedLinkInterfacePtr > LinkManager::links ( )

Definition at line 91 of file LinkManager.cc.

Referenced by disconnectAll(), and QGroundControlQmlGlobal::stopOneMockLink().

◆ linkTypeStrings()

QStringList LinkManager::linkTypeStrings ( ) const

Definition at line 598 of file LinkManager.cc.

References LinkConfiguration::TypeLast.

◆ loadLinkConfigurationList()

◆ mavlinkForwardingLink()

SharedLinkInterfacePtr LinkManager::mavlinkForwardingLink ( )

Returns pointer to the mavlink forwarding link, or nullptr if it does not exist.

Definition at line 251 of file LinkManager.cc.

References LinkInterface::linkConfiguration(), and LinkConfiguration::TypeUdp.

◆ mavlinkForwardingSupportLink()

SharedLinkInterfacePtr LinkManager::mavlinkForwardingSupportLink ( )

Returns pointer to the mavlink support forwarding link, or nullptr if it does not exist.

Definition at line 265 of file LinkManager.cc.

References LinkInterface::linkConfiguration(), and LinkConfiguration::TypeUdp.

◆ mavlinkSupportForwardingEnabled()

bool LinkManager::mavlinkSupportForwardingEnabled ( ) const
inline

Definition at line 70 of file LinkManager.h.

◆ mavlinkSupportForwardingEnabledChanged

void LinkManager::mavlinkSupportForwardingEnabledChanged ( )
signal

◆ removeConfiguration()

void LinkManager::removeConfiguration ( LinkConfiguration *  config)

Definition at line 676 of file LinkManager.cc.

References config, LinkInterface::disconnect(), and saveLinkConfigurationList().

◆ saveLinkConfigurationList()

void LinkManager::saveLinkConfigurationList ( )

◆ serialBaudRates()

QStringList LinkManager::serialBaudRates ( )
static

Definition at line 885 of file LinkManager.cc.

References SerialConfiguration::supportedBaudRates().

◆ serialPorts()

QStringList LinkManager::serialPorts ( )

Definition at line 876 of file LinkManager.cc.

◆ serialPortStrings()

QStringList LinkManager::serialPortStrings ( )

Definition at line 867 of file LinkManager.cc.

◆ setConnectionsAllowed()

void LinkManager::setConnectionsAllowed ( )
inline

Sets the flag to allow new connections to be made.

Definition at line 80 of file LinkManager.h.

Referenced by LogReplayWorker::pause(), and FirmwareUpgradeController::~FirmwareUpgradeController().

◆ setConnectionsSuspended()

void LinkManager::setConnectionsSuspended ( const QString &  reason)
inline

Sets the flag to suspend the all new connections

Parameters
reasonUser visible reason to suspend connections

Definition at line 77 of file LinkManager.h.

Referenced by LogReplayWorker::play(), shutdown(), and FirmwareUpgradeController::startBoardSearch().

◆ sharedLinkInterfacePointerForLink()

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 342 of file LinkManager.cc.

Referenced by MAVLinkProtocol::receiveBytes().

◆ shutdown()

void LinkManager::shutdown ( )

Called to signal app shutdown. Disconnects all links while turning off auto-connect.

Definition at line 587 of file LinkManager.cc.

References disconnectAll(), MultiVehicleManager::instance(), and setConnectionsSuspended().

◆ startAutoConnectedLinks()

void LinkManager::startAutoConnectedLinks ( )

Definition at line 767 of file LinkManager.cc.

References createConnectedLink().

◆ startConfigurationEditing()

LinkConfiguration * LinkManager::startConfigurationEditing ( LinkConfiguration *  config)

◆ startLogReplay()

Friends And Related Symbol Documentation

◆ LinkManagerTest

friend class LinkManagerTest
friend

Definition at line 41 of file LinkManager.h.


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