9#include <QtQml/QQmlEngine>
17 QQmlEngine::setObjectOwnership(
this, QQmlEngine::CppOwnership);
22 if (_vehicleReferenceCount != 0) {
23 qCWarning(LinkInterfaceLog) <<
"still have vehicle references:" << _vehicleReferenceCount;
32 qCWarning(LinkInterfaceLog) <<
"mavlinkChannelIsSet() == false";
35 return _mavlinkChannel;
48 qCWarning(LinkInterfaceLog) <<
"already have" << _mavlinkChannel;
55 qCWarning(LinkInterfaceLog) <<
"failed";
59 qCDebug(LinkInterfaceLog) <<
"_allocateMavlinkChannel" << _mavlinkChannel;
61 mavlink_set_proto_version(_mavlinkChannel, MAVLINK_VERSION);
63 _signingController = std::make_unique<SigningController>(
static_cast<mavlink_channel_t>(_mavlinkChannel));
64 _signingController->clearSigning();
66 qCDebug(LinkInterfaceLog) <<
"SigningController created for channel" << _mavlinkChannel
74 qCDebug(LinkInterfaceLog) << _mavlinkChannel;
81 _signingController.reset();
85 status->signing =
nullptr;
86 status->signing_streams =
nullptr;
87 mavlink_reset_channel_status(_mavlinkChannel);
95 const QByteArray data(bytes, length);
96 (void) QMetaObject::invokeMethod(
this,
"_writeBytes", Qt::AutoConnection, data);
101 if (_vehicleReferenceCount != 0) {
102 _vehicleReferenceCount--;
105 qCWarning(LinkInterfaceLog) <<
"called with no vehicle references";
111 if (_vehicleReferenceCount == 0) {
121 if (!_mavlinkV1TrafficReported) {
122 _mavlinkV1TrafficReported =
true;
125 const QString linkName = linkConfig ? linkConfig->name() : QStringLiteral(
"unknown");
126 qCWarning(LinkInterfaceLog) <<
"MAVLink v1 traffic detected on link" << linkName;
127 const QString message = tr(
"MAVLink v1 traffic detected on link '%1'. "
128 "%2 only supports MAVLink v2. "
129 "Please ensure your vehicle is configured to use MAVLink v2.")
130 .arg(linkName).arg(
qgcApp()->applicationName());
std::shared_ptr< LinkConfiguration > SharedLinkConfigurationPtr
mavlink_status_t * mavlink_get_channel_status(uint8_t chan)
#define QGC_LOGGING_CATEGORY(name, categoryStr)
The link interface defines the interface for all links used to communicate with the ground station ap...
uint8_t mavlinkChannel() const
virtual void _freeMavlinkChannel()
virtual Q_INVOKABLE void disconnect()=0
void reportMavlinkV1Traffic()
void _connectionRemoved()
bool mavlinkChannelIsSet() const
virtual bool _allocateMavlinkChannel()
void removeVehicleReference()
virtual bool isSecureConnection() const
Returns true if the connection is secure (e.g. USB, wired ethernet)
void writeBytesThreadSafe(const char *bytes, int length)
SharedLinkConfigurationPtr linkConfiguration()
SharedLinkConfigurationPtr _config
uint8_t allocateMavlinkChannel()
static LinkManager * instance()
void freeMavlinkChannel(uint8_t channel)
static constexpr uint8_t invalidMavlinkChannel()
void showAppMessage(const QString &message, const QString &title)
Modal application message. Queued if the UI isn't ready yet.