QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
VehicleSigningController.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QBindable>
4#include <QtCore/QByteArrayView>
5#include <QtCore/QObject>
6#include <QtCore/QObjectBindableProperty>
7#include <QtCore/QPointer>
8#include <QtCore/QString>
9#include <QtCore/QTimer>
10#include <QtQmlIntegration/QtQmlIntegration>
11
12#include "LinkInterface.h"
13#include "MAVLinkSigning.h"
14#include "SigningFailure.h"
15#include "SigningStatus.h"
16
18class Vehicle;
19
22
23class VehicleSigningController : public QObject
24{
25 Q_OBJECT
26 QML_ELEMENT
27 QML_UNCREATABLE("")
28
29public:
30 Q_PROPERTY(
32
33 explicit VehicleSigningController(Vehicle* vehicle);
35
36 SigningStatus signingStatus() const { return _signingStatus.value(); }
37
38 QBindable<SigningStatus> bindableSigningStatus() { return &_signingStatus; }
39
40 Q_INVOKABLE void enable(const QString& keyName);
41 Q_INVOKABLE void disable();
42
43signals:
46
47private slots:
48 void _onPrimaryLinkChanged();
49 void _onSigningStateChanged();
50 void _onSigningAlertRaised(const QString& detail);
51 void _onSigningConfirmed(const QString& confirmedKey);
52 void _onSigningFailed(const SigningFailure& failure);
53 void _onRetryTimer();
54
55private:
56 void _connect(SigningController* ctrl);
57 void _disconnect(SigningController* ctrl);
58 bool _sendSetupSigning(const SharedLinkInterfacePtr& sharedLink, QByteArrayView keyView);
59 void _refreshStatus();
60 void _startRetransmit();
61 void _stopRetransmit();
62
63 static constexpr int kRetransmitIntervalMs = 1500;
64
65 Vehicle* _vehicle;
66 QPointer<SigningController> _active;
67 QTimer _retryTimer;
68 MAVLinkSigning::SigningKey _pendingKey{};
69 bool _pendingHasKey = false;
70 Q_OBJECT_BINDABLE_PROPERTY(VehicleSigningController, SigningStatus, _signingStatus,
72};
std::shared_ptr< LinkInterface > SharedLinkInterfacePtr
Owns MAVLink signing state and the deferred-confirmation state machine for one LinkInterface.
Reason a signing operation failed. Used by SigningController error path and Vehicle::signingFailed.
Per-vehicle signing facade. Owns the wiring between Vehicle and the active SigningController (which l...
Q_INVOKABLE void enable(const QString &keyName)
SigningStatus signingStatus() const
void signingFailed(SigningFailure info)
QBindable< SigningStatus > bindableSigningStatus()
std::array< uint8_t, kSigningKeySize > SigningKey
std::array avoids QByteArray COW detach so secureZero() actually wipes the bytes.