4#include <QtCore/QMutex>
5#include <QtCore/QMutexLocker>
6#include <QtCore/QStringList>
7#include <QtQmlIntegration/QtQmlIntegration>
13#ifndef QGC_NO_SERIAL_LINK
36 Q_MOC_INCLUDE(
"QmlObjectListModel.h")
37 Q_MOC_INCLUDE(
"LogReplayLink.h")
39 Q_PROPERTY(
QmlObjectListModel *linkConfigurations READ _qmlLinkConfigurations CONSTANT)
70 QList<SharedLinkInterfacePtr>
links();
79 void setConnectionsSuspended(
const QString &reason) { _connectionsSuspended =
true; _connectionsSuspendedReason = reason; }
121 void _linkConnected();
122 void _linkDisconnected();
123 void _communicationError(
const QString &title,
const QString &
error);
128 bool _connectionsSuspendedMsg()
const;
129 void _updateAutoConnectLinks();
131 void _addUDPAutoConnectLink();
132 void _addMAVLinkForwardingLink();
133 void _reconnectAutoConnectLinks();
134 void _createDynamicForwardLink(
const char *linkName,
const QString &hostName);
136 QTimer *_portListTimer =
nullptr;
140 bool _configUpdateSuspended =
false;
141 bool _configurationsLoaded =
false;
142 bool _connectionsSuspended =
false;
143 bool _mavlinkSupportForwardingEnabled =
false;
144 uint32_t _mavlinkChannelsUsedBitMask = 1;
145 QString _connectionsSuspendedReason;
148 QList<SharedLinkInterfacePtr> _rgLinks;
149 QList<SharedLinkConfigurationPtr> _rgLinkConfigs;
151 static constexpr const char *_defaultUDPLinkName =
"UDP Link (AutoConnect)";
152 static constexpr const char *_mavlinkForwardingLinkName =
"MAVLink Forwarding Link";
153 static constexpr const char *_mavlinkForwardingSupportLinkName =
"MAVLink Support Forwarding Link";
155 static constexpr int _autoconnectUpdateTimerMSecs = 1000;
158 static constexpr int _autoconnectConnectDelayMSecs = 6000;
160 static constexpr int _autoconnectConnectDelayMSecs = 1000;
163#ifndef QGC_NO_SERIAL_LINK
179 bool _isSerialPortConnected();
180 void _updateSerialPorts();
182 void _addSerialAutoConnectLink();
183 bool _portAlreadyConnected(
const QString &portName);
184 void _filterCompositePorts(QList<QGCSerialPortInfo> &portList);
186 QMap<QString, int> _autoconnectPortWaitList;
187 QList<SerialLink*> _activeLinkCheckList;
188 QStringList _commPortList;
189 QStringList _commPortDisplayList;
190 QString _autoConnectRTKPort;
191 QString _nmeaDeviceName;
192 uint32_t _nmeaBaud = 0;
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()
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()
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.
Provides functions to access serial ports.
UdpIODevice provides a QIODevice interface over a QUdpSocket in server mode.