8#include <QtCore/QMutex>
9#include <QtCore/QMutexLocker>
10#include <QtCore/QStringList>
11#include <QtQmlIntegration/QtQmlIntegration>
34 Q_MOC_INCLUDE(
"QmlObjectListModel.h")
35 Q_MOC_INCLUDE(
"LogReplayLink.h")
37 Q_PROPERTY(
QmlObjectListModel *linkConfigurations READ _qmlLinkConfigurations CONSTANT)
68 QList<SharedLinkInterfacePtr>
links();
77 void setConnectionsSuspended(
const QString &reason) { _connectionsSuspended =
true; _connectionsSuspendedReason = reason; }
122 void _linkConnected();
123 void _linkDisconnected();
124 void _communicationError(
const QString &title,
const QString &
error);
129 bool _connectionsSuspendedMsg()
const;
130 void _updateAutoConnectLinks();
132 void _addUDPAutoConnectLink();
133 void _addMAVLinkForwardingLink();
134 void _reconnectAutoConnectLinks();
136 void _retryDynamicUdpLink(
const QString& name,
const std::function<
void(
UDPConfiguration&)>& configure);
139 QTimer *_portListTimer =
nullptr;
143 bool _configUpdateSuspended =
false;
144 bool _configurationsLoaded =
false;
145 bool _connectionsSuspended =
false;
146 bool _mavlinkSupportForwardingEnabled =
false;
147 uint32_t _mavlinkChannelsUsedBitMask = 1;
148 QString _connectionsSuspendedReason;
151 QList<SharedLinkInterfacePtr> _rgLinks;
152 QList<SharedLinkConfigurationPtr> _rgLinkConfigs;
154 static constexpr const char *_defaultUDPLinkName =
"UDP Link (AutoConnect)";
155 static constexpr const char *_mavlinkForwardingLinkName =
"MAVLink Forwarding Link";
156 static constexpr const char *_mavlinkForwardingSupportLinkName =
"MAVLink Support Forwarding Link";
158 static constexpr int _autoconnectUpdateTimerMSecs = 1000;
159#ifndef QGC_NO_SERIAL_LINK
175 void _updateSerialPorts();
176 std::unique_ptr<SerialAutoConnect> _serialAutoConnect;
177 QStringList _commPortList;
178 QStringList _commPortDisplayList;
std::shared_ptr< LinkConfiguration > SharedLinkConfigurationPtr
std::shared_ptr< LinkInterface > SharedLinkInterfacePtr
Interface holding link specific settings.
The link interface defines the interface for all links used to communicate with the ground station ap...
Manage communication links The Link Manager organizes the physical Links. It can manage arbitrary lin...
void commPortStringsChanged()
Q_INVOKABLE void createConnectedLink(const LinkConfiguration *config)
This should only be used by Qml code.
SharedLinkInterfacePtr sharedLinkInterfacePointerForLink(const LinkInterface *link)
QStringList serialPorts()
bool containsConfiguration(const QString &name) const
Q_INVOKABLE void endConfigurationEditing(LinkConfiguration *config, LinkConfiguration *editedConfig)
Q_INVOKABLE void cancelConfigurationEditing(LinkConfiguration *config) const
SharedLinkConfigurationPtr addConfiguration(LinkConfiguration *config)
QStringList linkTypeStrings() const
void isBluetoothAvailableChanged()
void loadLinkConfigurationList()
bool connectionsSuspended() const
static bool isLinkUSBDirect(const LinkInterface *link)
uint8_t allocateMavlinkChannel()
Q_INVOKABLE void createMavlinkForwardingSupportLink()
Q_INVOKABLE LinkConfiguration * createConfiguration(int type, const QString &name)
Create/Edit Link Configuration.
void startAutoConnectedLinks()
Q_INVOKABLE void endCreateConfiguration(LinkConfiguration *config)
void setConnectionsAllowed()
Sets the flag to allow new connections to be made.
Q_INVOKABLE void shutdown()
Called to signal app shutdown. Disconnects all links while turning off auto-connect.
static LinkManager * instance()
void freeMavlinkChannel(uint8_t channel)
Q_INVOKABLE void removeConfiguration(LinkConfiguration *config)
friend class LinkManagerTest
QList< SharedLinkInterfacePtr > links()
static constexpr uint8_t invalidMavlinkChannel()
void setConnectionsSuspended(const QString &reason)
Q_INVOKABLE LogReplayLink * startLogReplay(const QString &logFile)
QStringList serialPortStrings()
Q_INVOKABLE void disconnectLink(LinkInterface *link)
static QStringList serialBaudRates()
SharedLinkInterfacePtr mavlinkForwardingSupportLink()
Returns pointer to the mavlink support forwarding link, or nullptr if it does not exist.
Q_INVOKABLE void disconnectLinkConfiguration(LinkConfiguration *config)
Stop a link and suppress auto-reconnect, working whether or not a live link currently exists.
Q_INVOKABLE LinkConfiguration * startConfigurationEditing(LinkConfiguration *config)
bool containsLink(const LinkInterface *link)
SharedLinkInterfacePtr mavlinkForwardingLink()
Returns pointer to the mavlink forwarding link, or nullptr if it does not exist.
static bool isBluetoothAvailable()
void saveLinkConfigurationList()
void mavlinkSupportForwardingEnabledChanged()
bool mavlinkSupportForwardingEnabled() const
MAVLink micro air vehicle protocol reference implementation.
Application-thread MAVLink serial discovery. LinkManager owns creation and live links.