|
QGroundControl
Ground Control Station for MAVLink Drones
|
Classes | |
| struct | KeyValidateInfo |
Functions | |
| bool | validateRequiredKeys (const QJsonObject &jsonObject, const QStringList &keys, QString &errorString) |
| Validates that all listed keys are present in the object. | |
| bool | validateKeyTypes (const QJsonObject &jsonObject, const QStringList &keys, const QList< QJsonValue::Type > &types, QString &errorString) |
| bool | isJsonFile (const QByteArray &bytes, QJsonDocument &jsonDoc, QString &errorString) |
| Determines whether an in-memory byte buffer contains parseable JSON content. | |
| bool | isJsonFile (const QString &fileName, QJsonDocument &jsonDoc, QString &errorString) |
| Determines whether a file path contains parseable JSON content. | |
| double | possibleNaNJsonValue (const QJsonValue &value) |
| Returns NaN if the value is null, or the value converted to double otherwise. | |
| bool | validateKeys (const QJsonObject &jsonObject, const QList< KeyValidateInfo > &keyInfo, QString &errorString) |
| Validates that all required keys are present and that listed keys have the expected type. | |
| bool | validateKeysStrict (const QJsonObject &jsonObject, const QList< KeyValidateInfo > &keyInfo, QString &errorString) |
Validates keys like validateKeys but also rejects any keys not listed in keyInfo. | |
| QTranslator * | translator () |
Translator used by openInternalQGCJsonFile for localized strings. | |
| void | saveQGCJsonFileHeader (QJsonObject &jsonObject, const QString &fileType, int version) |
| Saves the standard QGC file header (groundStation, fileType, version) into the json object. | |
| bool | validateInternalQGCJsonFile (const QJsonObject &jsonObject, const QString &expectedFileType, int minSupportedVersion, int maxSupportedVersion, int &version, QString &errorString) |
| bool | validateExternalQGCJsonFile (const QJsonObject &jsonObject, const QString &expectedFileType, int minSupportedVersion, int maxSupportedVersion, int &version, QString &errorString) |
| QJsonObject | openInternalQGCJsonFile (const QString &jsonFilename, const QString &expectedFileType, int minSupportedVersion, int maxSupportedVersion, int &version, QString &errorString, const QStringList &defaultTranslateKeys, const QStringList &defaultArrayIDKeys) |
Variables | |
| constexpr const char * | jsonVersionKey = "version" |
| constexpr const char * | jsonFileTypeKey = "fileType" |
| bool JsonParsing::isJsonFile | ( | const QByteArray & | bytes, |
| QJsonDocument & | jsonDoc, | ||
| QString & | errorString | ||
| ) |
Determines whether an in-memory byte buffer contains parseable JSON content.
Definition at line 97 of file JsonParsing.cc.
References errorString, and QGCCompression::parseCompressedJson().
Referenced by GeoJsonHelper::_loadFile(), isJsonFile(), PlanMasterController::loadFromFile(), ParameterMetaData::loadParameterFactMetaDataFile(), CompInfoGeneral::setJson(), CompInfoParam::setJson(), ComponentInformationTranslation::translateJsonUsingTS(), and ParameterMetaData::versionFromJsonData().
| bool JsonParsing::isJsonFile | ( | const QString & | fileName, |
| QJsonDocument & | jsonDoc, | ||
| QString & | errorString | ||
| ) |
Determines whether a file path contains parseable JSON content.
Definition at line 114 of file JsonParsing.cc.
References errorString, isJsonFile(), and QGCCompression::readFile().
| QJsonObject JsonParsing::openInternalQGCJsonFile | ( | const QString & | jsonFilename, |
| const QString & | expectedFileType, | ||
| int | minSupportedVersion, | ||
| int | maxSupportedVersion, | ||
| int & | version, | ||
| QString & | errorString, | ||
| const QStringList & | defaultTranslateKeys = {}, |
||
| const QStringList & | defaultArrayIDKeys = {} |
||
| ) |
Opens, validates, and translates an internal QGC json file.
| defaultTranslateKeys | Keys to translate when translateKeys is absent from the JSON. |
| defaultArrayIDKeys | Array ID keys to use when _arrayIDKeys is absent from the JSON. |
Definition at line 334 of file JsonParsing.cc.
References errorString, QGCCompression::parseCompressedJson(), QGCCompression::readFile(), and validateInternalQGCJsonFile().
Referenced by FactMetaData::createMapFromJsonFile(), CameraMetaData::parseCameraMetaData(), and PowerModulePresetController::powerModulePresets().
| double JsonParsing::possibleNaNJsonValue | ( | const QJsonValue & | value | ) |
Returns NaN if the value is null, or the value converted to double otherwise.
Definition at line 124 of file JsonParsing.cc.
Referenced by MissionItem::load(), SimpleMissionItem::load(), GeoJsonHelper::loadGeoCoordinate(), GeoJsonHelper::loadGeoJsonCoordinate(), and MissionCommandUIInfo::loadJsonInfo().
| void JsonParsing::saveQGCJsonFileHeader | ( | QJsonObject & | jsonObject, |
| const QString & | fileType, | ||
| int | version | ||
| ) |
Saves the standard QGC file header (groundStation, fileType, version) into the json object.
Definition at line 276 of file JsonParsing.cc.
References jsonFileTypeKey, and jsonVersionKey.
Referenced by PlanMasterController::saveToJson().
| QTranslator * JsonParsing::translator | ( | ) |
Translator used by openInternalQGCJsonFile for localized strings.
Definition at line 271 of file JsonParsing.cc.
Referenced by QGCApplication::setLanguage().
| bool JsonParsing::validateExternalQGCJsonFile | ( | const QJsonObject & | jsonObject, |
| const QString & | expectedFileType, | ||
| int | minSupportedVersion, | ||
| int | maxSupportedVersion, | ||
| int & | version, | ||
| QString & | errorString | ||
| ) |
Validates the standard parts of an external QGC json file (Plan file, ...). Checks groundStation, fileType, and version keys.
Definition at line 318 of file JsonParsing.cc.
References errorString, validateInternalQGCJsonFile(), and validateKeys().
Referenced by PlanMasterController::loadFromFile().
| bool JsonParsing::validateInternalQGCJsonFile | ( | const QJsonObject & | jsonObject, |
| const QString & | expectedFileType, | ||
| int | minSupportedVersion, | ||
| int | maxSupportedVersion, | ||
| int & | version, | ||
| QString & | errorString | ||
| ) |
Validates the standard parts of an internal QGC json file (FactMetaData, ...). Checks fileType and version keys.
Definition at line 283 of file JsonParsing.cc.
References errorString, jsonFileTypeKey, jsonVersionKey, and validateKeys().
Referenced by openInternalQGCJsonFile(), and validateExternalQGCJsonFile().
| bool JsonParsing::validateKeys | ( | const QJsonObject & | jsonObject, |
| const QList< KeyValidateInfo > & | keyInfo, | ||
| QString & | errorString | ||
| ) |
Validates that all required keys are present and that listed keys have the expected type.
Definition at line 133 of file JsonParsing.cc.
References errorString, validateKeyTypes(), and validateRequiredKeys().
Referenced by TransectStyleComplexItem::_load(), LandingComplexItem::_load(), FactMetaData::createFromJsonObject(), FactMetaData::createMapFromJsonFile(), TerrainTileCopernicus::getJsonFromData(), FixedWingLandingComplexItem::load(), StructureScanComplexItem::load(), SurveyComplexItem::load(), VTOLLandingComplexItem::load(), CameraCalc::load(), MissionItem::load(), SimpleMissionItem::load(), CameraSpec::load(), GeoFenceController::load(), RallyPointController::load(), PlanMasterController::loadFromFile(), QGCFencePolygon::loadFromJson(), QGCFenceCircle::loadFromJson(), QGCMapCircle::loadFromJson(), CameraMetaData::parseCameraMetaData(), TerrainTileCopernicus::serializeFromData(), CompInfoGeneral::setJson(), CompInfoParam::setJson(), validateExternalQGCJsonFile(), validateInternalQGCJsonFile(), and validateKeysStrict().
| bool JsonParsing::validateKeysStrict | ( | const QJsonObject & | jsonObject, |
| const QList< KeyValidateInfo > & | keyInfo, | ||
| QString & | errorString | ||
| ) |
Validates keys like validateKeys but also rejects any keys not listed in keyInfo.
Definition at line 156 of file JsonParsing.cc.
References errorString, and validateKeys().
Referenced by PowerModulePresetController::powerModulePresets().
| bool JsonParsing::validateKeyTypes | ( | const QJsonObject & | jsonObject, |
| const QStringList & | keys, | ||
| const QList< QJsonValue::Type > & | types, | ||
| QString & | errorString | ||
| ) |
Validates value types for listed keys that are present in the object. QJsonValue::Null as expected type means "double value with possible NaN".
Definition at line 68 of file JsonParsing.cc.
References errorString.
Referenced by MissionCommandUIInfo::loadJsonInfo(), and validateKeys().
| bool JsonParsing::validateRequiredKeys | ( | const QJsonObject & | jsonObject, |
| const QStringList & | keys, | ||
| QString & | errorString | ||
| ) |
Validates that all listed keys are present in the object.
Definition at line 47 of file JsonParsing.cc.
References errorString.
Referenced by QGCMapPolygon::loadFromJson(), QGCMapPolyline::loadFromJson(), MissionCommandUIInfo::loadJsonInfo(), and validateKeys().
|
constexpr |
Definition at line 13 of file JsonParsing.h.
Referenced by saveQGCJsonFileHeader(), and validateInternalQGCJsonFile().
|
constexpr |
Definition at line 12 of file JsonParsing.h.
Referenced by TransectStyleComplexItem::_load(), LandingComplexItem::_load(), TransectStyleComplexItem::_save(), FixedWingLandingComplexItem::load(), StructureScanComplexItem::load(), SurveyComplexItem::load(), VTOLLandingComplexItem::load(), CameraCalc::load(), GeoFenceController::load(), RallyPointController::load(), QGCFencePolygon::loadFromJson(), QGCFenceCircle::loadFromJson(), FixedWingLandingComplexItem::save(), StructureScanComplexItem::save(), VTOLLandingComplexItem::save(), CameraCalc::save(), GeoFenceController::save(), MissionController::save(), RallyPointController::save(), saveQGCJsonFileHeader(), QGCFenceCircle::saveToJson(), QGCFencePolygon::saveToJson(), CompInfoGeneral::setJson(), CompInfoParam::setJson(), and validateInternalQGCJsonFile().