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)
65 QList<SharedLinkInterfacePtr>
links();
74 void setConnectionsSuspended(
const QString &reason) { _connectionsSuspended =
true; _connectionsSuspendedReason = reason; }
116 void _linkDisconnected();
117 void _communicationError(
const QString &title,
const QString &
error);
122 bool _connectionsSuspendedMsg()
const;
123 void _updateAutoConnectLinks();
125 void _addUDPAutoConnectLink();
126 void _addMAVLinkForwardingLink();
127 void _createDynamicForwardLink(
const char *linkName,
const QString &hostName);
129 QTimer *_portListTimer =
nullptr;
133 bool _configUpdateSuspended =
false;
134 bool _configurationsLoaded =
false;
135 bool _connectionsSuspended =
false;
136 bool _mavlinkSupportForwardingEnabled =
false;
137 uint32_t _mavlinkChannelsUsedBitMask = 1;
138 QString _connectionsSuspendedReason;
141 QList<SharedLinkInterfacePtr> _rgLinks;
142 QList<SharedLinkConfigurationPtr> _rgLinkConfigs;
144 static constexpr const char *_defaultUDPLinkName =
"UDP Link (AutoConnect)";
145 static constexpr const char *_mavlinkForwardingLinkName =
"MAVLink Forwarding Link";
146 static constexpr const char *_mavlinkForwardingSupportLinkName =
"MAVLink Support Forwarding Link";
148 static constexpr int _autoconnectUpdateTimerMSecs = 1000;
151 static constexpr int _autoconnectConnectDelayMSecs = 6000;
153 static constexpr int _autoconnectConnectDelayMSecs = 1000;
156#ifndef QGC_NO_SERIAL_LINK
172 bool _isSerialPortConnected();
173 void _updateSerialPorts();
175 void _addSerialAutoConnectLink();
176 bool _portAlreadyConnected(
const QString &portName);
177 void _filterCompositePorts(QList<QGCSerialPortInfo> &portList);
179 QMap<QString, int> _autoconnectPortWaitList;
180 QList<SerialLink*> _activeLinkCheckList;
181 QStringList _commPortList;
182 QStringList _commPortDisplayList;
183 QString _autoConnectRTKPort;
184 QString _nmeaDeviceName;
185 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)
QList< SharedLinkInterfacePtr > links()
static constexpr uint8_t invalidMavlinkChannel()
void setConnectionsSuspended(const QString &reason)
Q_INVOKABLE LogReplayLink * startLogReplay(const QString &logFile)
QStringList serialPortStrings()
static QStringList serialBaudRates()
SharedLinkInterfacePtr mavlinkForwardingSupportLink()
Returns pointer to the mavlink support forwarding link, or nullptr if it does not exist.
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.