4#include <QtCore/QObject>
5#include <QtCore/QPointer>
7#include <QtCore/QStringList>
8#include <QtCore/QVariantList>
9#include <QtQmlIntegration/QtQmlIntegration>
23 QML_UNCREATABLE(
"Created by PX4SerialPortsController")
24 Q_MOC_INCLUDE(
"Fact.h")
53 int portId()
const {
return _portId; }
55 QString
label()
const {
return _label; }
57 QStringList
functionLabels()
const {
return _noneAvailable ? _functionLabels : _functionLabels.mid(1); }
59 bool shared()
const {
return _shared; }
111 const QString _label;
112 const QStringList _functionParamNames;
113 const QStringList _functionLabels;
114 bool _noneAvailable =
true;
116 int _functionIndex = 0;
117 QVariantList _functionEnabled;
118 QString _conflictText;
119 QStringList _assignments;
120 Fact* _baudFact =
nullptr;
121 bool _baudLoading =
false;
122 QVariantList _optionFacts;
123 bool _optionsLoading =
false;
124 bool _rebootRequired =
false;
133 Q_MOC_INCLUDE(
"QmlObjectListModel.h")
159 void _factAdded(
int componentId,
Fact* fact);
160 void _parameterReadFailed(
int componentId,
const QString& paramName);
163 Fact* _fact(
const QString& paramName);
164 void _watchFact(
Fact* fact);
165 void _requestParameter(
const QString& paramName);
166 bool _differsFromInitial(
const QString& paramName)
const;
167 void _writeParams(
const QList<PX4SerialPortConfig::ParamWrite>& writes);
170 QPointer<ParameterManager> _parameterManager;
172 QList<Fact*> _functionFacts;
173 QHash<QString, QVariant> _initialValues;
174 QSet<QString> _requestedParams;
175 QSet<QString> _pendingParams;
176 QSet<Fact*> _watchedFacts;
177 QHash<QString, int> _optionParamPorts;
179 int _changedPortCount = 0;
FactPanelController(QObject *parent=nullptr)
A Fact is used to hold a single value within the system.
One serial port row on the PX4 Ports page.
void setFunctionIndex(int functionIndex)
void assignmentsChanged()
void setRebootRequired(bool rebootRequired)
void optionsLoadingChanged()
QString functionParamName(int functionIndex) const
Function parameter for an index into functionLabels, empty for "None".
QString conflictText() const
QVariantList optionFacts() const
bool optionsLoading() const
void defaultFunctionOnPortChanged()
void baudLoadingChanged()
void optionFactsChanged()
void setOptionFacts(const QVariantList &optionFacts)
PX4SerialPortRow(int portId, const QString &label, const QStringList &functionParamNames, const QStringList &functionLabels, QObject *parent=nullptr)
true: several functions can run on the port at once, so each one is turned on or off separately
void rebootRequiredChanged()
QVariantList functionEnabled() const
int functionIndexOf(const QString &functionParamName) const
void setFunctionEnabled(const QVariantList &functionEnabled)
void functionLabelsChanged()
QStringList assignments() const
void setConflictText(const QString &conflictText)
QStringList functionLabels() const
void setNoneAvailable(bool noneAvailable)
bool defaultFunctionOnPort() const
void setBaudFact(Fact *baudFact)
bool rebootRequired() const
void setBaudLoading(bool baudLoading)
void functionEnabledChanged()
int functionIndex() const
void setOptionsLoading(bool optionsLoading)
void conflictTextChanged()
void setAssignments(const QStringList &assignments)
void functionIndexChanged()
Q_INVOKABLE void setPortFunctionEnabled(int portId, int functionIndex, bool enabled)
Turns the function at functionIndex on or off on a shared port, leaving the port's other functions al...
int changedPortCount() const
PX4SerialPortsController(QObject *parent=nullptr)
Q_INVOKABLE void revertChanges()
Writes back the values each parameter had when the page opened. Ignored while parameter writes are pe...
Q_INVOKABLE void setPortFunction(int portId, int functionIndex)
void changedPortCountChanged()
QmlObjectListModel * ports() const