QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
CompInfoParam.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QHash>
4#include <QtCore/QJsonObject>
5#include <QtCore/QRegularExpression>
6
7#include "CompInfo.h"
8#include "FactMetaData.h"
9
11
12class CompInfoParam : public CompInfo
13{
14 Q_OBJECT
15
16public:
17 CompInfoParam(uint8_t compId_, Vehicle *vehicle_, QObject *parent = nullptr);
18
19 FactMetaData *factMetaDataForName(const QString &name, FactMetaData::ValueType_t valueType);
20
21 void setJson(const QString &metadataJsonFileName) override;
22
23private:
24 ParameterMetaData *_getParameterMetaData();
25 FactMetaData *_resolveMetaData(const QString &name, FactMetaData::ValueType_t valueType);
26 FactMetaData *_lookupJsonMetaData(const QString &name);
27
28 struct IndexedParamEntry {
29 QRegularExpression regex;
30 FactMetaData *templateMeta;
31 };
32
33 bool _noJsonMetadata = true;
34 FactMetaData::NameToMetaDataMap_t _nameToMetaDataMap;
36 QHash<QString, QJsonObject> _paramJsonByName;
37 QList<IndexedParamEntry> _indexedNameMetaDataList;
38 ParameterMetaData *_parameterMetaData = nullptr;
39
40 static constexpr const char *kJsonParametersKey = "parameters";
41 static constexpr const char *kIndexedNameTag = "{n}";
42};
void setJson(const QString &metadataJsonFileName) override
CompInfoParam(uint8_t compId_, Vehicle *vehicle_, QObject *parent=nullptr)
FactMetaData * factMetaDataForName(const QString &name, FactMetaData::ValueType_t valueType)
CompInfo(COMP_METADATA_TYPE type_, uint8_t compId_, Vehicle *vehicle_, QObject *parent=nullptr)
Definition CompInfo.cc:3
Holds the meta data associated with a Fact.
QHash< QString, FactMetaData * > NameToMetaDataMap_t