9#include <QtQml/QQmlEngine>
23 _missingParametersTimer.setInterval(500);
24 _missingParametersTimer.setSingleShot(
true);
25 (void) connect(&_missingParametersTimer, &QTimer::timeout,
this, &FactPanelController::_checkForMissingParameters);
32 if (_rebootMessageSuppressedBy) {
33 _rebootMessageSuppressedBy->unsuppressRebootMessage();
47 _rebootMessageSuppressedBy =
_vehicle->parameterManager();
48 _rebootMessageSuppressedBy->suppressRebootMessage();
50 (void) connect(_rebootMessageSuppressedBy, &QObject::destroyed,
this,
53 (void) disconnect(_rebootMessageSuppressedBy, &QObject::destroyed,
this,
55 _rebootMessageSuppressedBy->unsuppressRebootMessage();
56 _rebootMessageSuppressedBy =
nullptr;
64 componentId =
_vehicle->defaultComponentId();
67 qgcApp()->reportMissingParameter(componentId, name);
68 qCWarning(FactPanelControllerLog) <<
"Missing parameter:" << componentId << name;
73 bool noMissingFacts =
true;
75 for (
const QString &name : names) {
76 if (
_vehicle && !
_vehicle->parameterManager()->parameterExists(componentId, name)) {
78 noMissingFacts =
false;
82 return noMissingFacts;
87 if (
_vehicle &&
_vehicle->parameterManager()->parameterExists(componentId, name)) {
88 Fact *
const fact =
_vehicle->parameterManager()->getParameter(componentId, name);
89 QQmlEngine::setObjectOwnership(fact, QQmlEngine::CppOwnership);
102 return (
_vehicle ?
_vehicle->parameterManager()->parameterExists(componentId, name) :
false);
107 for (
const QString &name: rgNames) {
108 _missingParameterWaitList.append(name);
109 _vehicle->parameterManager()->refreshParameter(MAV_COMP_ID_AUTOPILOT1, name);
112 _missingParametersTimer.start();
115void FactPanelController::_checkForMissingParameters()
117 const QStringList waitList = _missingParameterWaitList;
118 for (
const QString &name: waitList) {
120 (void) _missingParameterWaitList.removeOne(name);
124 if (_missingParameterWaitList.isEmpty()) {
127 _missingParametersTimer.start();
#define QGC_LOGGING_CATEGORY(name, categoryStr)
bool _allParametersExists(int componentId, const QStringList &names) const
void _reportMissingParameter(int componentId, const QString &name) const
Report a missing parameter.
void missingParametersAvailable()
Q_INVOKABLE Fact * getParameterFact(int componentId, const QString &name, bool reportMissing=true) const
Q_INVOKABLE void getMissingParameters(const QStringList &rgNames)
virtual ~FactPanelController()
FactPanelController(QObject *parent=nullptr)
void setSuppressRebootMessage(bool suppress)
void suppressRebootMessageChanged()
Q_INVOKABLE bool parameterExists(int componentId, const QString &name) const
bool suppressRebootMessage() const
A Fact is used to hold a single value within the system.
static MultiVehicleManager * instance()
Vehicle * offlineEditingVehicle() const
bool parameterExists(int componentId, const QString ¶mName) const
static constexpr int defaultComponentId
ParameterManager * parameterManager()