/** * Structures defined in the ETS Tetra ICD * $Id$ * $HeadURL$ * $Author$ * Created by Christian Ehrlicher, SLSE, 2016-04-14 */ #include "training_area_telegrams.h" #include #include #include namespace TrainingAreaBase { namespace TetraIcd { JsonException::JsonException(const QJsonObject &obj, const QString &key) : m_obj(obj) , m_key(key) , m_what("Could not find key '" + key.toUtf8() + "' in json ('" + QJsonDocument(obj).toJson(QJsonDocument::Compact) + "')") {} template QJsonValue enumToJson(E e) { static_assert(std::is_enum::value, "Only useable with enumerations"); return static_cast(e); } template QJsonValue arrayToJson(const std::vector &cont) { QJsonArray arr; for (const A &s : cont) arr += s.toJson(); return arr; } template <> QJsonValue arrayToJson(const std::vector &cont) { QJsonArray arr; for (const int i : cont) arr += i; return arr; } template <> QJsonValue arrayToJson(const std::vector &cont) { // we treat it as QByteArray / hex string return QString::fromLatin1(QByteArray::fromRawData(reinterpret_cast(cont.data()), cont.size()).toHex()); } template bool get(const QJsonObject &obj, const QString &key, T &val, bool bOptional = false) { if (bOptional) { try { val = T::fromJson(obj[key].toObject()); } catch (const JsonException &e) { Q_UNUSED(e); return false; } } else val = T::fromJson(obj[key].toObject()); return true; } template <> bool get(const QJsonObject &obj, const QString &key, QJsonArray &val, bool bOptional) { const auto jVal = obj[key]; if (!jVal.isArray()) { if (bOptional) return false; throw JsonException(obj, key); } val = jVal.toArray(); return true; } template <> bool get(const QJsonObject &obj, const QString &key, bool &val, bool bOptional) { const auto jVal = obj[key]; if (!jVal.isBool()) { if (bOptional) return false; throw JsonException(obj, key); } val = jVal.toBool(); return true; } template <> bool get(const QJsonObject &obj, const QString &key, qint32 &val, bool bOptional) { const auto jVal = obj[key]; if (!jVal.isDouble()) { if (bOptional) return false; throw JsonException(obj, key); } val = jVal.toInt(); return true; } template <> bool get(const QJsonObject &obj, const QString &key, quint32 &val, bool bOptional) { const auto jVal = obj[key]; if (!jVal.isDouble()) { if (bOptional) return false; throw JsonException(obj, key); } val = uint32_t(jVal.toDouble()); return true; } template <> bool get(const QJsonObject &obj, const QString &key, qint64 &val, bool bOptional) { const auto jVal = obj[key]; if (!jVal.isDouble()) { if (bOptional) return false; throw JsonException(obj, key); } val = int64_t(jVal.toDouble()); return true; } template <> bool get(const QJsonObject &obj, const QString &key, double &val, bool bOptional) { const auto jVal = obj[key]; if (!jVal.isDouble()) { if (bOptional) return false; throw JsonException(obj, key); } val = jVal.toDouble(); return true; } template <> bool get(const QJsonObject &obj, const QString &key, QString &val, bool bOptional) { const auto jVal = obj[key]; if (!jVal.isString()) { if (bOptional) return false; throw JsonException(obj, key); } val = jVal.toString(); return true; } template <> bool get(const QJsonObject &obj, const QString &key, std::string &val, bool bOptional) { const auto jVal = obj[key]; if (!jVal.isString()) { if (bOptional) return false; throw JsonException(obj, key); } val = jVal.toString().toStdString(); return true; } template bool get(const QJsonObject &obj, const QString &key, std::vector &val, bool bOptional = false) { const QJsonValue jVal = obj[key]; if (!jVal.isNull() && !jVal.isArray()) { if (bOptional) return false; throw JsonException(obj, key); } if (jVal.isNull()) return false; const QJsonArray arr = jVal.toArray(); val.clear(); val.reserve(arr.size()); for (const auto &ele : arr) val.push_back(T::fromJson(ele.toObject())); return true; } template <> bool get(const QJsonObject &obj, const QString &key, std::vector &val, bool bOptional) { const auto jVal = obj[key]; if (!jVal.isArray()) { if (bOptional) return false; throw JsonException(obj, key); } const QJsonArray arr = jVal.toArray(); val.clear(); val.reserve(arr.size()); for (const auto &v : arr) { if (!v.isDouble()) throw JsonException(obj, key); val.push_back(v.toInt()); } return true; } template <> bool get(const QJsonObject &obj, const QString &key, std::vector &val, bool bOptional) { QString sPayload; if (!get(obj, key, sPayload, bOptional)) return false; const QByteArray ba = QByteArray::fromHex(sPayload.toLatin1()); val.clear(); val.reserve(ba.size()); std::copy(ba.begin(), ba.end(), std::back_inserter(val)); return true; } template <> bool get(const QJsonObject &obj, const QString &key, VulnerabilityState &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); // this check is done later and an error telegram is created if an invalid state is received val = static_cast(iVal); return true; /* switch (static_cast(iVal)) { case VulnerabilityState::CombatReady: case VulnerabilityState::LightDamage: case VulnerabilityState::MediumDamage: case VulnerabilityState::HeavyDamage: case VulnerabilityState::MobilityKill: case VulnerabilityState::VisibleMobilityKill: case VulnerabilityState::WeaponSystemDamage: case VulnerabilityState::VisibleWeaponSystemDamage: case VulnerabilityState::CatastrophicKill: case VulnerabilityState::TemporarySeverance: case VulnerabilityState::NearMiss: case VulnerabilityState::HitWithNoEffect: case VulnerabilityState::VulnerabilityBitsChanged: case VulnerabilityState::NContamination: case VulnerabilityState::BContamination: case VulnerabilityState::CContamination: val = static_cast(iVal); return true; } throw JsonException(obj, key); */ } template <> bool get(const QJsonObject &obj, const QString &key, OriginatorType &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case OriginatorType::Initialisation: case OriginatorType::ObserverController: case OriginatorType::ExerciseControl: case OriginatorType::FunctionalArea: case OriginatorType::MedicTimeout: case OriginatorType::Sanitation: case OriginatorType::MedicDecontamination: case OriginatorType::MaintainanceRepair: case OriginatorType::MaintainanceDecontamination: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, FunctionalAreaOperatingMode &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case FunctionalAreaOperatingMode::NotUsed: case FunctionalAreaOperatingMode::OperatedByOC: case FunctionalAreaOperatingMode::WaitForTimeout: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, Language &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case Language::NoChange: case Language::German: case Language::English: case Language::French: case Language::Arabic: case Language::Spanish: case Language::Russian: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, ParticipantLicenseState &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case ParticipantLicenseState::Unknown: case ParticipantLicenseState::Licensed: case ParticipantLicenseState::Rejected: case ParticipantLicenseState::Unlicense: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, EquipmentConfigurationReport::MineHandgrenadeSensorMode &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case EquipmentConfigurationReport::MineHandgrenadeSensorMode::PersonellMode: case EquipmentConfigurationReport::MineHandgrenadeSensorMode::NormalVehicleMode: case EquipmentConfigurationReport::MineHandgrenadeSensorMode::OcVehicleMode: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, EquipmentConfigurationReport::FirMode &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case EquipmentConfigurationReport::FirMode::NoFir: case EquipmentConfigurationReport::FirMode::Fir: case EquipmentConfigurationReport::FirMode::FirSpzMarder: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, EquipmentConfigurationReport::MineLayerMode &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case EquipmentConfigurationReport::MineLayerMode::NoMineLayerDevice: case EquipmentConfigurationReport::MineLayerMode::MinLayerTrailer: case EquipmentConfigurationReport::MineLayerMode::MineLayerThrower: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, EquipmentConfigurationReport::SpecialSensorStandardMode &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case EquipmentConfigurationReport::SpecialSensorStandardMode::NoSpecialSensorStandard: case EquipmentConfigurationReport::SpecialSensorStandardMode::ZABC: case EquipmentConfigurationReport::SpecialSensorStandardMode::CSF: case EquipmentConfigurationReport::SpecialSensorStandardMode::PzBr: case EquipmentConfigurationReport::SpecialSensorStandardMode::MRF: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, EquipmentConfigurationReport::AgdusHwMode &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case EquipmentConfigurationReport::AgdusHwMode::WithoutHelmetWithoutVest: case EquipmentConfigurationReport::AgdusHwMode::WithHelmetWithoutVest: case EquipmentConfigurationReport::AgdusHwMode::WithHelmetWithVest: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, EquipmentConfigurationReport::PositionUpdateInterval &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case EquipmentConfigurationReport::PositionUpdateInterval::Vehicle: case EquipmentConfigurationReport::PositionUpdateInterval::Personnell: case EquipmentConfigurationReport::PositionUpdateInterval::Aircraft: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, CtaDataError::Reason &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case CtaDataError::Reason::WrongParameter: case CtaDataError::Reason::TelegramOutdated: case CtaDataError::Reason::InvalidByteCount: case CtaDataError::Reason::InvalidData: case CtaDataError::Reason::FragmentationError: case CtaDataError::Reason::Unknown: case CtaDataError::Reason::AdditionalDemandTimeout: case CtaDataError::Reason::ErrorLoginEquipmentNumber: case CtaDataError::Reason::ErrorLoginTetraId: case CtaDataError::Reason::InfoLoginMasteringFlag: case CtaDataError::Reason::ErrorSendingNamelist: case CtaDataError::Reason::ErrorSendingToExerciseControl: case CtaDataError::Reason::ErrorNotLoggedIn: case CtaDataError::Reason::ErrorNotLicensed: case CtaDataError::Reason::ErrorConfigSelfTest: case CtaDataError::Reason::JsonDecodeFailure: case CtaDataError::Reason::WrongCrc: case CtaDataError::Reason::BroadcastCounterOverflow: case CtaDataError::Reason::InvalidTime: case CtaDataError::Reason::InvalidPosition: case CtaDataError::Reason::InvalidTacticalState: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, CreateCContamination::Volatiliy &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case CreateCContamination::Volatiliy::Floating: case CreateCContamination::Volatiliy::Resident: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, AreaEffectSimulationType &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case AreaEffectSimulationType::Unknown: case AreaEffectSimulationType::MineArea: case AreaEffectSimulationType::ExplosionArea: case AreaEffectSimulationType::ExplosionSingle: case AreaEffectSimulationType::NContamination: case AreaEffectSimulationType::CContamination: case AreaEffectSimulationType::FunctionalArea: case AreaEffectSimulationType::TechnicalArea: case AreaEffectSimulationType::DusSingleMineSimulator: case AreaEffectSimulationType::GasPipeDetonation: case AreaEffectSimulationType::SpecialArea: case AreaEffectSimulationType::BeStillWarning: case AreaEffectSimulationType::DangerZoneExplosion: case AreaEffectSimulationType::AirSupport: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, IedType &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case IedType::SuicideIed: case IedType::IedSmallPyro: case IedType::IedBigPyro: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, IedPairingState &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case IedPairingState::NotPaired: case IedPairingState::PairedToParticipant: case IedPairingState::PairedToOps: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, IedTacticalState &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case IedTacticalState::NotActive: case IedTacticalState::Active: case IedTacticalState::Defused: case IedTacticalState::TriggeredBySwitch: case IedTacticalState::TriggeredByRemote: case IedTacticalState::TriggeredByLightBarrier: case IedTacticalState::TriggeredByTautWire: case IedTacticalState::TriggeredByControlDevice: case IedTacticalState::Unknown: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, IedError &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case IedError::NoError: case IedError::DeviceMissing: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, MinelayerThrowerData::ThrowingType &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case MinelayerThrowerData::ThrowingType::Straight: case MinelayerThrowerData::ThrowingType::Right: case MinelayerThrowerData::ThrowingType::Left: case MinelayerThrowerData::ThrowingType::LeftAndRight: case MinelayerThrowerData::ThrowingType::SingleRight: case MinelayerThrowerData::ThrowingType::SingleLeft: case MinelayerThrowerData::ThrowingType::SingleLeftAndRight: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, OpaquePayloadDataBase::Type &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case OpaquePayloadDataBase::Type::FireSmokeMarker: case OpaquePayloadDataBase::Type::Geopairing: case OpaquePayloadDataBase::Type::Target: case OpaquePayloadDataBase::Type::OC: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, TechnicalArea::Type &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case TechnicalArea::Type::Reserved: case TechnicalArea::Type::RemoveArea: case TechnicalArea::Type::MoutArea: case TechnicalArea::Type::RestingAreaPersonnel: case TechnicalArea::Type::RestingAreaVehicle: case TechnicalArea::Type::RestingAreaPersonnelAndVehicle: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, ParticipantModeBase::OperationMode &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case ParticipantModeBase::OperationMode::NoChange: case ParticipantModeBase::OperationMode::Normal: case ParticipantModeBase::OperationMode::BeStill: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, BiteReport::LoginType &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case BiteReport::LoginType::NoLogin: case BiteReport::LoginType::NewLogin: case BiteReport::LoginType::Relogin: case BiteReport::LoginType::InvalidLogin: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, ParticipantModeBase::WphMode &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case ParticipantModeBase::WphMode::NoChange: case ParticipantModeBase::WphMode::Without: case ParticipantModeBase::WphMode::With: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, ParticipantModeBase::PersonellProtection &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case ParticipantModeBase::PersonellProtection::NoChange: case ParticipantModeBase::PersonellProtection::Without: case ParticipantModeBase::PersonellProtection::Suit: case ParticipantModeBase::PersonellProtection::SuitAndGloves: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, ParticipantModeBase::ProtectionLevel &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case ParticipantModeBase::ProtectionLevel::NoChange: case ParticipantModeBase::ProtectionLevel::IdzBs: case ParticipantModeBase::ProtectionLevel::IdzEs: case ParticipantModeBase::ProtectionLevel::Ksk: case ParticipantModeBase::ProtectionLevel::SoldierWithBodyArmor: case ParticipantModeBase::ProtectionLevel::SoldierActor: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, ParticipantModeBase::HandgrenadeSearchMode &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case ParticipantModeBase::HandgrenadeSearchMode::NoChange: case ParticipantModeBase::HandgrenadeSearchMode::On: case ParticipantModeBase::HandgrenadeSearchMode::Off: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, ParticipantModeBase::InternationalMode &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case ParticipantModeBase::InternationalMode::NoChange: case ParticipantModeBase::InternationalMode::On: case ParticipantModeBase::InternationalMode::Off: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, ParticipantModeBase::ABCProtectionMode &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case ParticipantModeBase::ABCProtectionMode::NoChange: case ParticipantModeBase::ABCProtectionMode::On: case ParticipantModeBase::ABCProtectionMode::Off: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, ParticipantConfigurationBase::FaultPositionHandling &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case ParticipantConfigurationBase::FaultPositionHandling::NoChange: case ParticipantConfigurationBase::FaultPositionHandling::NoPositions: case ParticipantConfigurationBase::FaultPositionHandling::InvalidPositionValue: case ParticipantConfigurationBase::FaultPositionHandling::EstimatedPosition: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, ParticipantConfigurationBase::SwitchingPositionIntervall &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case ParticipantConfigurationBase::SwitchingPositionIntervall::NoChange: case ParticipantConfigurationBase::SwitchingPositionIntervall::On: case ParticipantConfigurationBase::SwitchingPositionIntervall::Off: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, ParticipantConfigurationBase::OpticalCode &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case ParticipantConfigurationBase::OpticalCode::NoChange: case ParticipantConfigurationBase::OpticalCode::Osag10: case ParticipantConfigurationBase::OpticalCode::Osag20Basic: case ParticipantConfigurationBase::OpticalCode::SisoStandard: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, SanitationResult &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case SanitationResult::NoEffect: case SanitationResult::Unhandled: case SanitationResult::Insufficient: case SanitationResult::Sufficient: case SanitationResult::Optimal: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, SanitationEvaluation &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case SanitationEvaluation::NotApplicable: case SanitationEvaluation::Okay: case SanitationEvaluation::PartlyWrong: case SanitationEvaluation::Wrong: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, Qualification &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case Qualification::NotDefined: case Qualification::SANPers: case Qualification::FAB: case Qualification::FAA: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, SanitationRepair::TreatmentResult &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case SanitationRepair::TreatmentResult::None: case SanitationRepair::TreatmentResult::Success: case SanitationRepair::TreatmentResult::Failure: case SanitationRepair::TreatmentResult::Stabilized: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, ExerciseStateData::ExerciseState &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case ExerciseStateData::ExerciseState::Unknown: case ExerciseStateData::ExerciseState::Created: case ExerciseStateData::ExerciseState::Started: case ExerciseStateData::ExerciseState::Paused: case ExerciseStateData::ExerciseState::Stopped: case ExerciseStateData::ExerciseState::Terminated: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, ServiceControlEnum &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case ServiceControlEnum::PRESHUTDOWN: case ServiceControlEnum::SHUTDOWN: case ServiceControlEnum::STOP: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, PowerMethod &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case PowerMethod::Unknown: case PowerMethod::PowerOn: case PowerMethod::PowerOff: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, UAVActionTask &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case UAVActionTask::Undefined: case UAVActionTask::Disarm: case UAVActionTask::Arm: case UAVActionTask::Takeoff: case UAVActionTask::Connect: case UAVActionTask::Loiter: case UAVActionTask::Return: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, UAVRadioLinkConnectionStatusType &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case UAVRadioLinkConnectionStatusType::Connected: case UAVRadioLinkConnectionStatusType::Disconnected: case UAVRadioLinkConnectionStatusType::Connecting: case UAVRadioLinkConnectionStatusType::Error: case UAVRadioLinkConnectionStatusType::Undefined: case UAVRadioLinkConnectionStatusType::Diconnecting: val = static_cast(iVal); return true; } throw JsonException(obj, key); } template <> bool get(const QJsonObject &obj, const QString &key, UAVState &val, bool bOptional) { int iVal; get(obj, key, iVal, bOptional); switch (static_cast(iVal)) { case UAVState::Auto: case UAVState::Calibrating: case UAVState::Init: case UAVState::Maintenance: case UAVState::Undefined: case UAVState::Manual: case UAVState::Normal: case UAVState::Off: case UAVState::On: case UAVState::Shutdown: case UAVState::Standby: val = static_cast(iVal); return true; } throw JsonException(obj, key); } // Header Header Header::fromJson(const QJsonObject &obj) { Header ret; get(obj, QStringLiteral("equipmentNumber"), ret.equipmentNumber); get(obj, QStringLiteral("timeStamp"), ret.timeStamp); return ret; } QJsonObject Header::toJson() const { return QJsonObject({{QStringLiteral("equipmentNumber"), equipmentNumber}, {QStringLiteral("timeStamp"), qint64(timeStamp)} }); } // RelativePosition RelativePosition RelativePosition::fromJson(const QJsonObject &obj) { RelativePosition ret; get(obj, QStringLiteral("offsetX"), ret.offsetX); get(obj, QStringLiteral("offsetY"), ret.offsetY); get(obj, QStringLiteral("offsetZ"), ret.offsetZ); return ret; } QJsonObject RelativePosition::toJson() const { return QJsonObject({{QStringLiteral("offsetX"), offsetX}, {QStringLiteral("offsetY"), offsetY}, {QStringLiteral("offsetZ"), offsetZ} }); } // AbsolutePosition AbsolutePosition AbsolutePosition::fromJson(const QJsonObject &obj) { AbsolutePosition ret; get(obj, QStringLiteral("lon"), ret.lon); get(obj, QStringLiteral("lat"), ret.lat); get(obj, QStringLiteral("z"), ret.z); return ret; } QJsonObject AbsolutePosition::toJson() const { return QJsonObject({{QStringLiteral("lon"), lon}, {QStringLiteral("lat"), lat}, {QStringLiteral("z"), z} }); } // OpsPosition OpsPosition OpsPosition::fromJson(const QJsonObject &obj) { OpsPosition ret; get(obj, QStringLiteral("opsId"), ret.opsId); get(obj, QStringLiteral("moutObjectId"), ret.moutObjectId, true); get(obj, QStringLiteral("moutRoomId"), ret.moutRoomId, true); return ret; } QJsonObject OpsPosition::toJson() const { return QJsonObject({{QStringLiteral("opsId"), opsId}, {QStringLiteral("moutObjectId"), moutObjectId}, {QStringLiteral("moutRoomId"), moutRoomId} }); } // GpsQuality GpsQuality GpsQuality::fromJson(const QJsonObject &obj) { GpsQuality ret; get(obj, QStringLiteral("moreThan4SatellitesAvailable"), ret.moreThan4SatellitesAvailable); get(obj, QStringLiteral("dgpsModeAvailable"), ret.dgpsModeAvailable); get(obj, QStringLiteral("pdopValue"), ret.pdopValue); return ret; } QJsonObject GpsQuality::toJson() const { return QJsonObject({{QStringLiteral("moreThan4SatellitesAvailable"), moreThan4SatellitesAvailable}, {QStringLiteral("dgpsModeAvailable"), dgpsModeAvailable}, {QStringLiteral("pdopValue"), pdopValue} }); } // Gear Gear Gear::fromJson(const QJsonObject &obj) { Gear ret; get(obj, QStringLiteral("gearTasCode"), ret.gearTasCode); get(obj, QStringLiteral("gearSerialNumber"), ret.gearSerialNumber); get(obj, QStringLiteral("chargeCounting"), ret.chargeCounting); return ret; } QJsonObject Gear::toJson() const { return QJsonObject({{QStringLiteral("gearTasCode"), gearTasCode}, {QStringLiteral("gearSerialNumber"), gearSerialNumber}, {QStringLiteral("chargeCounting"), chargeCounting} }); } // GearCharge GearCharge GearCharge::fromJson(const QJsonObject &obj) { GearCharge ret; get(obj, QStringLiteral("gearTasCode"), ret.gearTasCode); get(obj, QStringLiteral("gearSerialNumber"), ret.gearSerialNumber); get(obj, QStringLiteral("chargeTypeId"), ret.chargeTypeId); get(obj, QStringLiteral("remain"), ret.remain); get(obj, QStringLiteral("location"), ret.location); return ret; } QJsonObject GearCharge::toJson() const { return QJsonObject({{QStringLiteral("gearTasCode"), gearTasCode}, {QStringLiteral("gearSerialNumber"), gearSerialNumber}, {QStringLiteral("chargeTypeId"), chargeTypeId}, {QStringLiteral("remain"), remain}, {QStringLiteral("location"), location} }); } // WlsPosition WlsPosition WlsPosition::fromJson(const QJsonObject &obj) { WlsPosition ret; get(obj, QStringLiteral("x"), ret.x); get(obj, QStringLiteral("y"), ret.y); get(obj, QStringLiteral("z"), ret.z); get(obj, QStringLiteral("wlsAreaId"), ret.wlsAreaId); get(obj, QStringLiteral("wlsZone"), ret.wlsZone); get(obj, QStringLiteral("wlsBuildingId"), ret.wlsBuildingId); get(obj, QStringLiteral("wlsRoomNumber"), ret.wlsRoomNumber); get(obj, QStringLiteral("playerOrientation"), ret.playerOrientation); get(obj, QStringLiteral("weaponOrientation"), ret.weaponOrientation); get(obj, QStringLiteral("isValid"), ret.isValid); return ret; } QJsonObject WlsPosition::toJson() const { return QJsonObject({{QStringLiteral("x"), x}, {QStringLiteral("y"), y}, {QStringLiteral("z"), z}, {QStringLiteral("wlsAreaId"), wlsAreaId}, {QStringLiteral("wlsZone"), wlsZone}, {QStringLiteral("wlsBuildingId"), wlsBuildingId}, {QStringLiteral("wlsRoomNumber"), wlsRoomNumber}, {QStringLiteral("playerOrientation"), playerOrientation}, {QStringLiteral("weaponOrientation"), weaponOrientation}, {QStringLiteral("isValid"), isValid} }); } // WlsParticipantState WlsParticipantState WlsParticipantState::fromJson(const QJsonObject &obj) { WlsParticipantState ret; get(obj, QStringLiteral("tagId"), ret.tagId); get(obj, QStringLiteral("lastSeen"), ret.lastSeen); get(obj, QStringLiteral("voltage"), ret.voltage); get(obj, QStringLiteral("equipmentNumber"), ret.equipmentNumber); get(obj, QStringLiteral("tacticalState"), ret.tacticalState); get(obj, QStringLiteral("gpsOn"), ret.gpsOn); get(obj, QStringLiteral("inBlockedArea"), ret.inBlockedArea); get(obj, QStringLiteral("relativePosition"), ret.relativePosition); return ret; } QJsonObject WlsParticipantState::toJson() const { return QJsonObject({{QStringLiteral("tagId"), tagId}, {QStringLiteral("lastSeen"), lastSeen}, {QStringLiteral("voltage"), voltage}, {QStringLiteral("equipmentNumber"), equipmentNumber}, {QStringLiteral("tacticalState"), tacticalState}, {QStringLiteral("gpsOn"), gpsOn}, {QStringLiteral("inBlockedArea"), inBlockedArea}, {QStringLiteral("relativePosition"), relativePosition.toJson()} }); } // BatteryState BatteryState BatteryState::fromJson(const QJsonObject &obj) { BatteryState ret; get(obj, QStringLiteral("batteryPort"), ret.batteryPort); get(obj, QStringLiteral("battery"), ret.batteryPercent); get(obj, QStringLiteral("voltage"), ret.voltage); get(obj, QStringLiteral("temperature"), ret.temperature); get(obj, QStringLiteral("frequency"), ret.frequency); get(obj, QStringLiteral("generic"), ret.generic); get(obj, QStringLiteral("current"), ret.current); get(obj, QStringLiteral("switchOrValue"), ret.switchOrValue); get(obj, QStringLiteral("serialNumber"), ret.serialNumber); return ret; } QJsonObject BatteryState::toJson() const { return QJsonObject({{QStringLiteral("batteryPort"), batteryPort}, {QStringLiteral("battery"), batteryPercent}, {QStringLiteral("voltage"), voltage}, {QStringLiteral("temperature"), temperature}, {QStringLiteral("frequency"), frequency}, {QStringLiteral("generic"), generic}, {QStringLiteral("current"), current}, {QStringLiteral("switchOrValue"), switchOrValue}, {QStringLiteral("serialNumber"), serialNumber} }); } // Acknowledge Acknowledge Acknowledge::fromJson(const QJsonObject &obj) { Acknowledge ret; get(obj, QStringLiteral("timeStamp"), ret.timeStamp); get(obj, QStringLiteral("ackCounter"), ret.ackCounter); return ret; } QJsonObject Acknowledge::toJson() const { return QJsonObject({{QStringLiteral("timeStamp"), timeStamp}, {QStringLiteral("ackCounter"), ackCounter} }); } // Init Init Init::fromJson(const QJsonObject &obj) { Init ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("workstationId"), ret.workstationId); get(obj, QStringLiteral("restockCharges"), ret.restockCharges); get(obj, QStringLiteral("resetManipulation"), ret.resetManipulation); get(obj, QStringLiteral("resetVulnerabilityState"), ret.resetVulnerabilityState); get(obj, QStringLiteral("restockSanitationMaterial"), ret.restockSanitationMaterial); return ret; } QJsonObject Init::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("workstationId"), workstationId}, {QStringLiteral("restockCharges"), restockCharges}, {QStringLiteral("resetManipulation"), resetManipulation}, {QStringLiteral("resetVulnerabilityState"), resetVulnerabilityState}, {QStringLiteral("restockSanitationMaterial"), restockSanitationMaterial} }); } // ManipulationReport ManipulationReport ManipulationReport::fromJson(const QJsonObject &obj) { ManipulationReport ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("isManipulation"), ret.isManipulation); get(obj, QStringLiteral("equipmentFunctionId"), ret.equipmentFunctionId); return ret; } QJsonObject ManipulationReport::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("isManipulation"), isManipulation}, {QStringLiteral("equipmentFunctionId"), equipmentFunctionId} }); } // DemandBite DemandBite DemandBite::fromJson(const QJsonObject &obj) { DemandBite ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("withSelfTest"), ret.withSelfTest); return ret; } QJsonObject DemandBite::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("withSelfTest"), withSelfTest} }); } // EquipmentOperationalState EquipmentOperationalState EquipmentOperationalState::fromJson(const QJsonObject &obj) { EquipmentOperationalState ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("nbcProtectionActive"), ret.nbcProtectionActive); return ret; } QJsonObject EquipmentOperationalState::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("nbcProtectionActive"), nbcProtectionActive} }); } // VulnerabilityModelBase void VulnerabilityModelBase::fromJson(const QJsonObject &obj, VulnerabilityModelBase &ret) { get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("vulnerabilityModelMineIed"), ret.vulnerabilityModelMineIed); get(obj, QStringLiteral("vulnerabilityModelAreaFire"), ret.vulnerabilityModelAreaFire); get(obj, QStringLiteral("vulnerabilityModelOperatingResource"), ret.vulnerabilityModelOperatingResource); get(obj, QStringLiteral("vulnerabilityModelAcWeaponry"), ret.vulnerabilityModelAcWeaponry); } QJsonObject VulnerabilityModelBase::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("vulnerabilityModelMineIed"), vulnerabilityModelMineIed}, {QStringLiteral("vulnerabilityModelAreaFire"), vulnerabilityModelAreaFire}, {QStringLiteral("vulnerabilityModelOperatingResource"), vulnerabilityModelOperatingResource}, {QStringLiteral("vulnerabilityModelAcWeaponry"), vulnerabilityModelAcWeaponry} }); } // SetVulnerabilityModel SetVulnerabilityModel SetVulnerabilityModel::fromJson(const QJsonObject &obj) { SetVulnerabilityModel ret; VulnerabilityModelBase::fromJson(obj, ret); return ret; } QJsonObject SetVulnerabilityModel::toJson() const { return VulnerabilityModelBase::toJson(); } // SetVulnerabilityModel DemandEquipmentConfigurationReport DemandEquipmentConfigurationReport::fromJson(const QJsonObject &obj) { DemandEquipmentConfigurationReport ret; get(obj, QStringLiteral("header"), ret.header); return ret; } QJsonObject DemandEquipmentConfigurationReport::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}}); } // EquipmentConfigurationReport EquipmentConfigurationReport EquipmentConfigurationReport::fromJson(const QJsonObject &obj) { EquipmentConfigurationReport ret; VulnerabilityModelBase::fromJson(obj, ret); get(obj, QStringLiteral("equipmentNumber"), ret.equipmentNumber); get(obj, QStringLiteral("canStartUpTime"), ret.canStartUpTime); get(obj, QStringLiteral("equipmentType"), ret.equipmentType); get(obj, QStringLiteral("loginWaittimeBitweenTrys"), ret.loginWaittimeBitweenTrys); get(obj, QStringLiteral("loginMaxRetryCnt"), ret.loginMaxRetryCnt); get(obj, QStringLiteral("loginMasteringFlag"), ret.loginMasteringFlag); get(obj, QStringLiteral("canDeviceConfiguration"), ret.canDeviceConfiguration); get(obj, QStringLiteral("displayDeviceVoiceOutput"), ret.displayDeviceVoiceOutput); get(obj, QStringLiteral("displayDeviceLanguage"), ret.displayDeviceLanguage); get(obj, QStringLiteral("pyrotechnics"), ret.pyrotechnics); get(obj, QStringLiteral("mhgrsMode"), ret.mhgrsMode); get(obj, QStringLiteral("mhgrsEnergySaving"), ret.mhgrsEnergySaving); get(obj, QStringLiteral("specialSensorFir"), ret.specialSensorFir); get(obj, QStringLiteral("specialSensorMinelayer"), ret.specialSensorMinelayer); get(obj, QStringLiteral("specialSensorStandard"), ret.specialSensorStandard); get(obj, QStringLiteral("agdusHwMode"), ret.agdusHwMode); get(obj, QStringLiteral("positionUpdateInterval"), ret.positionUpdateInterval); get(obj, QStringLiteral("displayTextMainGroup"), ret.displayTextMainGroup); get(obj, QStringLiteral("displayTextSubGroup"), ret.displayTextSubGroup); get(obj, QStringLiteral("vulnerabilityModelAgdus"), ret.vulnerabilityModelAgdus); return ret; } QJsonObject EquipmentConfigurationReport::toJson() const { QJsonObject obj = VulnerabilityModelBase::toJson(); obj[QStringLiteral("header")] = header.toJson(); obj[QStringLiteral("equipmentNumber")] = equipmentNumber; obj[QStringLiteral("canStartUpTime")] = canStartUpTime; obj[QStringLiteral("equipmentType")] = equipmentType; obj[QStringLiteral("loginWaittimeBitweenTrys")] = loginWaittimeBitweenTrys; obj[QStringLiteral("loginMaxRetryCnt")] = loginMaxRetryCnt; obj[QStringLiteral("loginMasteringFlag")] = loginMasteringFlag; obj[QStringLiteral("canDeviceConfiguration")] = canDeviceConfiguration; obj[QStringLiteral("displayDeviceVoiceOutput")] = displayDeviceVoiceOutput; obj[QStringLiteral("displayDeviceLanguage")] = enumToJson(displayDeviceLanguage); obj[QStringLiteral("pyrotechnics")] = pyrotechnics; obj[QStringLiteral("mhgrsMode")] = enumToJson(mhgrsMode); obj[QStringLiteral("mhgrsEnergySaving")] = mhgrsEnergySaving; obj[QStringLiteral("specialSensorFir")] = enumToJson(specialSensorFir); obj[QStringLiteral("specialSensorMinelayer")] = enumToJson(specialSensorMinelayer); obj[QStringLiteral("specialSensorStandard")] = enumToJson(specialSensorStandard); obj[QStringLiteral("agdusHwMode")] = enumToJson(agdusHwMode); obj[QStringLiteral("positionUpdateInterval")] = enumToJson(positionUpdateInterval); obj[QStringLiteral("displayTextMainGroup")] = displayTextMainGroup; obj[QStringLiteral("displayTextSubGroup")] = displayTextSubGroup; obj[QStringLiteral("vulnerabilityModelAgdus")] = vulnerabilityModelAgdus; return obj; } // CtaDataError CtaDataError CtaDataError::fromJson(const QJsonObject &obj) { CtaDataError ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("reason"), ret.reason); get(obj, QStringLiteral("originTelegramId"), ret.originTelegramId); return ret; } QJsonObject CtaDataError::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("reason"), enumToJson(reason)}, {QStringLiteral("originTelegramId"), originTelegramId} }); } // PositionReportBase void PositionReportBase::fromJson(const QJsonObject &obj, PositionReportBase &ret) { get(obj, QStringLiteral("header"), ret.header); bool bAtLeastOneFound = false; if (get(obj, QStringLiteral("relPosition"), ret.relPosition, true)) bAtLeastOneFound = true; if (get(obj, QStringLiteral("geoPosition"), ret.geoPosition, true)) bAtLeastOneFound = true; // if none yet found, this one is *not* optional get(obj, QStringLiteral("opsPosition"), ret.opsPosition, bAtLeastOneFound); get(obj, QStringLiteral("gpsQuality"), ret.gpsQuality, true); } QJsonObject PositionReportBase::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("relPosition"), relPosition.toJson()}, {QStringLiteral("geoPosition"), geoPosition.toJson()}, {QStringLiteral("opsPosition"), opsPosition.toJson()}, {QStringLiteral("gpsQuality"), gpsQuality.toJson()} }); } // PositionReport PositionReport PositionReport::fromJson(const QJsonObject &obj) { PositionReport ret; PositionReportBase::fromJson(obj, ret); return ret; } QJsonObject PositionReport::toJson() const { return PositionReportBase::toJson(); } // PositionReport PositionReportWithMountedEquipments PositionReportWithMountedEquipments::fromJson(const QJsonObject &obj) { PositionReportWithMountedEquipments ret; PositionReportBase::fromJson(obj, ret); get(obj, QStringLiteral("mountedEquipments"), ret.mountedEquipments); return ret; } QJsonObject PositionReportWithMountedEquipments::toJson() const { QJsonObject obj = PositionReportBase::toJson(); obj[QStringLiteral("mountedEquipments")] = arrayToJson(mountedEquipments); return obj; } // CreateAreaEffectSimulationBase void CreateAreaEffectSimulationBase::fromJson(const QJsonObject &obj, CreateAreaEffectSimulationBase &ret) { get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("aesDdsId"), ret.aesDdsId); get(obj, QStringLiteral("name"), ret.name); get(obj, QStringLiteral("partyId"), ret.partyId); get(obj, QStringLiteral("relEffectPosition"), ret.relEffectPosition); } QJsonObject CreateAreaEffectSimulationBase::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("aesDdsId"), aesDdsId}, {QStringLiteral("name"), QString::fromStdString(name)}, {QStringLiteral("partyId"), partyId}, {QStringLiteral("relEffectPosition"), relEffectPosition.toJson()} }); } // CreateCombatAreaEffectSimulationBase void CreateCombatAreaEffectSimulationBase::fromJson(const QJsonObject &obj, CreateCombatAreaEffectSimulationBase &ret) { CreateAreaEffectSimulationBase::fromJson(obj, ret); get(obj, QStringLiteral("chargeTypeId"), ret.chargeTypeId); get(obj, QStringLiteral("effectStart"), ret.effectStart); get(obj, QStringLiteral("effectDuration"), ret.effectDuration); } QJsonObject CreateCombatAreaEffectSimulationBase::toJson() const { QJsonObject obj = CreateAreaEffectSimulationBase::toJson(); obj[QStringLiteral("chargeTypeId")] = chargeTypeId; obj[QStringLiteral("effectStart")] = effectStart; obj[QStringLiteral("effectDuration")] = effectDuration; return obj; } // OcCommand OcCommand OcCommand::fromJson(const QJsonObject &obj) { OcCommand ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("action"), ret.action); return ret; } QJsonObject OcCommand::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("action"), action} }); } // CreateSingleExplosion CreateSingleExplosion CreateSingleExplosion::fromJson(const QJsonObject &obj) { CreateSingleExplosion ret; CreateCombatAreaEffectSimulationBase::fromJson(obj, ret); get(obj, QStringLiteral("effectDiameter"), ret.effectDiameter); return ret; } QJsonObject CreateSingleExplosion::toJson() const { QJsonObject obj = CreateCombatAreaEffectSimulationBase::toJson(); obj[QStringLiteral("effectDiameter")] = effectDiameter; return obj; } // CreateAreaExplosion CreateAreaExplosion CreateAreaExplosion::fromJson(const QJsonObject &obj) { CreateAreaExplosion ret; CreateCombatAreaEffectSimulationBase::fromJson(obj, ret); get(obj, QStringLiteral("relCorner"), ret.relCorner); get(obj, QStringLiteral("height"), ret.height); get(obj, QStringLiteral("width"), ret.width); get(obj, QStringLiteral("rotationAngle"), ret.rotationAngle); get(obj, QStringLiteral("impactCount"), ret.impactCount); get(obj, QStringLiteral("impactEdgeLength"), ret.impactEdgeLength); get(obj, QStringLiteral("impactRadius"), ret.impactRadius); get(obj, QStringLiteral("hazardDistance"), ret.hazardDistance); get(obj, QStringLiteral("mhpLength"), ret.mhpLength); get(obj, QStringLiteral("mhpWidth"), ret.mhpWidth); get(obj, QStringLiteral("mhpRotation"), ret.mhpRotation); get(obj, QStringLiteral("mhPoints"), ret.mhPoints); return ret; } QJsonObject CreateAreaExplosion::toJson() const { QJsonObject obj = CreateCombatAreaEffectSimulationBase::toJson(); obj[QStringLiteral("relCorner")] = relCorner.toJson(); obj[QStringLiteral("height")] = height; obj[QStringLiteral("width")] = width; obj[QStringLiteral("rotationAngle")] = rotationAngle; obj[QStringLiteral("impactCount")] = impactCount; obj[QStringLiteral("impactEdgeLength")] = impactEdgeLength; obj[QStringLiteral("impactRadius")] = impactRadius; obj[QStringLiteral("hazardDistance")] = hazardDistance; obj[QStringLiteral("mhpLength")] = mhpLength; obj[QStringLiteral("mhpWidth")] = mhpWidth; obj[QStringLiteral("mhpRotation")] = mhpRotation; obj[QStringLiteral("mhPoints")] = arrayToJson(mhPoints); return obj; } // PauseEffectSimulation PauseEffectSimulation PauseEffectSimulation::fromJson(const QJsonObject &obj) { PauseEffectSimulation ret; get(obj, QStringLiteral("aesDdsId"), ret.aesDdsId); return ret; } QJsonObject PauseEffectSimulation::toJson() const { return QJsonObject({{QStringLiteral("aesDdsId"), aesDdsId}}); } // ResumeEffectSimulation ResumeEffectSimulation ResumeEffectSimulation::fromJson(const QJsonObject &obj) { ResumeEffectSimulation ret; get(obj, QStringLiteral("aesDdsId"), ret.aesDdsId); get(obj, QStringLiteral("sequelNumber"), ret.sequelNumber); get(obj, QStringLiteral("nextImpact"), ret.nextImpact); get(obj, QStringLiteral("resumeTime"), ret.resumeTime); get(obj, QStringLiteral("remainDuration"), ret.remainDuration); return ret; } QJsonObject ResumeEffectSimulation::toJson() const { return QJsonObject({{QStringLiteral("aesDdsId"), aesDdsId}, {QStringLiteral("sequelNumber"), sequelNumber}, {QStringLiteral("nextImpact"), nextImpact}, {QStringLiteral("resumeTime"), resumeTime}, {QStringLiteral("remainDuration"), remainDuration} }); } // MineAreaSegment MineAreaSegment MineAreaSegment::fromJson(const QJsonObject &obj) { MineAreaSegment ret; get(obj, QStringLiteral("relStart"), ret.relStart); get(obj, QStringLiteral("relEnd"), ret.relEnd); return ret; } QJsonObject MineAreaSegment::toJson() const { return QJsonObject({{QStringLiteral("relStart"), relStart.toJson()}, {QStringLiteral("relEnd"), relEnd.toJson()} }); } // CreateMineArea CreateMineArea CreateMineArea::fromJson(const QJsonObject &obj) { CreateMineArea ret; CreateCombatAreaEffectSimulationBase::fromJson(obj, ret); // get(obj, QStringLiteral("areaWidth"), ret.areaWidth); // get(obj, QStringLiteral("areaHeight"), ret.areaHeight); get(obj, QStringLiteral("layingDepth"), ret.layingDepth); get(obj, QStringLiteral("layingDensity"), ret.layingDensity); get(obj, QStringLiteral("segments"), ret.segments); return ret; } QJsonObject CreateMineArea::toJson() const { QJsonObject obj = CreateCombatAreaEffectSimulationBase::toJson(); // obj[QStringLiteral("areaWidth")] = areaWidth; // obj[QStringLiteral("areaHeight")] = areaHeight; obj[QStringLiteral("layingDepth")] = layingDepth; obj[QStringLiteral("layingDensity")] = layingDensity; obj[QStringLiteral("segments")] = arrayToJson(segments); return obj; } // MineAreaSegment MineAreaSingleMineState MineAreaSingleMineState::fromJson(const QJsonObject &obj) { MineAreaSingleMineState ret; get(obj, QStringLiteral("aesDdsId"), ret.aesDdsId); get(obj, QStringLiteral("mineCount"), ret.mineCount); get(obj, QStringLiteral("mineState"), ret.mineState); return ret; } QJsonObject MineAreaSingleMineState::toJson() const { return QJsonObject({{QStringLiteral("aesDdsId"), aesDdsId}, {QStringLiteral("mineCount"), mineCount}, {QStringLiteral("mineState"), arrayToJson(mineState)}, }); } // CreateNContamination CreateNContamination CreateNContamination::fromJson(const QJsonObject &obj) { CreateNContamination ret; CreateCombatAreaEffectSimulationBase::fromJson(obj, ret); get(obj, QStringLiteral("innerRadius"), ret.innerRadius); get(obj, QStringLiteral("borderLengthInner"), ret.borderLengthInner); get(obj, QStringLiteral("borderLengthOuter"), ret.borderLengthOuter); get(obj, QStringLiteral("spanAngle"), ret.spanAngle); get(obj, QStringLiteral("rotationAngle"), ret.rotationAngle); return ret; } QJsonObject CreateNContamination::toJson() const { QJsonObject obj = CreateCombatAreaEffectSimulationBase::toJson(); obj[QStringLiteral("innerRadius")] = innerRadius; obj[QStringLiteral("borderLengthInner")] = borderLengthInner; obj[QStringLiteral("borderLengthOuter")] = borderLengthOuter; obj[QStringLiteral("spanAngle")] = spanAngle; obj[QStringLiteral("rotationAngle")] = rotationAngle; return obj; } // CreateCContamination CreateCContamination CreateCContamination::fromJson(const QJsonObject &obj) { CreateCContamination ret; CreateCombatAreaEffectSimulationBase::fromJson(obj, ret); get(obj, QStringLiteral("effectRadius"), ret.effectRadius); get(obj, QStringLiteral("expansionFactor"), ret.expansionFactor); get(obj, QStringLiteral("propagationDirection"), ret.propagationDirection); get(obj, QStringLiteral("windSpeed"), ret.windSpeed); get(obj, QStringLiteral("validityTimeWind"), ret.validityTimeWind); get(obj, QStringLiteral("relPositionValidityTimeWind"), ret.relPositionValidityTimeWind); get(obj, QStringLiteral("volatility"), ret.volatility); return ret; } QJsonObject CreateCContamination::toJson() const { QJsonObject obj = CreateCombatAreaEffectSimulationBase::toJson(); obj[QStringLiteral("effectRadius")] = effectRadius; obj[QStringLiteral("expansionFactor")] = expansionFactor; obj[QStringLiteral("propagationDirection")] = propagationDirection; obj[QStringLiteral("windSpeed")] = windSpeed; obj[QStringLiteral("validityTimeWind")] = validityTimeWind; obj[QStringLiteral("relPositionValidityTimeWind")] = relPositionValidityTimeWind.toJson(); obj[QStringLiteral("volatility")] = enumToJson(volatility); return obj; } // DeactivateEffectSimulation DeactivateEffectSimulation DeactivateEffectSimulation::fromJson(const QJsonObject &obj) { DeactivateEffectSimulation ret; get(obj, QStringLiteral("aesType"), ret.aesType); get(obj, QStringLiteral("aesDdsId"), ret.aesDdsId); return ret; } QJsonObject DeactivateEffectSimulation::toJson() const { return QJsonObject({{QStringLiteral("aesType"), enumToJson(aesType)}, {QStringLiteral("aesDdsId"), aesDdsId} }); } // ModifyAreaEffectSimulationName ModifyAreaEffectSimulationName ModifyAreaEffectSimulationName::fromJson(const QJsonObject &obj) { ModifyAreaEffectSimulationName ret; get(obj, QStringLiteral("aesType"), ret.aesType); get(obj, QStringLiteral("aesDdsId"), ret.aesDdsId); get(obj, QStringLiteral("name"), ret.name); return ret; } QJsonObject ModifyAreaEffectSimulationName::toJson() const { return QJsonObject({{QStringLiteral("aesType"), enumToJson(aesType)}, {QStringLiteral("aesDdsId"), aesDdsId}, {QStringLiteral("name"), QString::fromStdString(name)} }); } // MineTriggered MineTriggered MineTriggered::fromJson(const QJsonObject &obj) { MineTriggered ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("mineAreaId"), ret.mineAreaId); get(obj, QStringLiteral("mineIndex"), ret.mineIndex); get(obj, QStringLiteral("chargeTypeId"), ret.chargeTypeId); get(obj, QStringLiteral("relPosition"), ret.relPosition); get(obj, QStringLiteral("relPositionValid"), ret.relPositionValid); return ret; } QJsonObject MineTriggered::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("mineAreaId"), mineAreaId}, {QStringLiteral("mineIndex"), mineIndex}, {QStringLiteral("chargeTypeId"), chargeTypeId}, {QStringLiteral("relPosition"), relPosition.toJson()}, {QStringLiteral("relPositionValid"), relPositionValid} }); } // DusMineReactivation DusMineReactivation DusMineReactivation::fromJson(const QJsonObject &obj) { DusMineReactivation ret; get(obj, QStringLiteral("dusSerialNumbers"), ret.dusSerialNumbers); return ret; } QJsonObject DusMineReactivation::toJson() const { return QJsonObject({{QStringLiteral("dusSerialNumbers"), arrayToJson(dusSerialNumbers)}}); } // IedBaseData void IedBaseData::fromJson(const QJsonObject &obj, IedBaseData &ret) { get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("iedId"), ret.iedId); get(obj, QStringLiteral("tacticalState"), ret.tacticalState); get(obj, QStringLiteral("statePyrotechnics"), ret.statePyrotechnics); } QJsonObject IedBaseData::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("iedId"), iedId}, {QStringLiteral("tacticalState"), enumToJson(tacticalState)}, {QStringLiteral("statePyrotechnics"), statePyrotechnics} }); } // DefinitionIed DefinitionIed DefinitionIed::fromJson(const QJsonObject &obj) { DefinitionIed ret; IedBaseData::fromJson(obj, ret); get(obj, QStringLiteral("relPosition"), ret.relPosition); get(obj, QStringLiteral("iedType"), ret.iedType); get(obj, QStringLiteral("trigger"), ret.trigger); get(obj, QStringLiteral("explosiveForce"), ret.explosiveForce); get(obj, QStringLiteral("pairingState"), ret.pairingState); get(obj, QStringLiteral("pairedId"), ret.pairedId); get(obj, QStringLiteral("partyId"), ret.partyId); return ret; } QJsonObject DefinitionIed::toJson() const { QJsonObject obj = IedBaseData::toJson(); obj[QStringLiteral("relPosition")] = relPosition.toJson(); obj[QStringLiteral("iedType")] = enumToJson(iedType); obj[QStringLiteral("trigger")] = trigger; obj[QStringLiteral("explosiveForce")] = explosiveForce; obj[QStringLiteral("pairingState")] = enumToJson(pairingState); obj[QStringLiteral("pairedId")] = pairedId; obj[QStringLiteral("partyId")] = partyId; return obj; } // StateIed StateIed StateIed::fromJson(const QJsonObject &obj) { StateIed ret; IedBaseData::fromJson(obj, ret); get(obj, QStringLiteral("batteryWarnings"), ret.batteryWarnings); get(obj, QStringLiteral("errorStateElectronics"), ret.errorStateElectronics); get(obj, QStringLiteral("errorStatePyrotechnics1"), ret.errorStatePyrotechnics1); get(obj, QStringLiteral("errorStatePyrotechnics2"), ret.errorStatePyrotechnics2); get(obj, QStringLiteral("errorStatePyrotechnics3"), ret.errorStatePyrotechnics3); return ret; } QJsonObject StateIed::toJson() const { QJsonObject obj = IedBaseData::toJson(); obj[QStringLiteral("batteryWarnings")] = batteryWarnings; obj[QStringLiteral("errorStateElectronics")] = enumToJson(errorStateElectronics); obj[QStringLiteral("errorStatePyrotechnics1")] = enumToJson(errorStatePyrotechnics1); obj[QStringLiteral("errorStatePyrotechnics2")] = enumToJson(errorStatePyrotechnics2); obj[QStringLiteral("errorStatePyrotechnics3")] = enumToJson(errorStatePyrotechnics3); return obj; } // ActivationDusSingleMine DusSingleMineState DusSingleMineState::fromJson(const QJsonObject &obj) { DusSingleMineState ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("mineId"), ret.mineId); get(obj, QStringLiteral("effectStart"), ret.effectStart); get(obj, QStringLiteral("relPosition"), ret.relPosition); get(obj, QStringLiteral("chargeTypeId"), ret.chargeTypeId); get(obj, QStringLiteral("state"), ret.state); return ret; } QJsonObject DusSingleMineState::toJson() const { QJsonObject obj; obj[QStringLiteral("header")] = header.toJson(); obj[QStringLiteral("mineId")] = mineId; obj[QStringLiteral("effectStart")] = effectStart; obj[QStringLiteral("relPosition")] = relPosition.toJson(); obj[QStringLiteral("chargeTypeId")] = chargeTypeId; obj[QStringLiteral("state")] = state; return obj; } // CreateDusSingleMine CreateDusSingleMine CreateDusSingleMine::fromJson(const QJsonObject &obj) { CreateDusSingleMine ret; CreateCombatAreaEffectSimulationBase::fromJson(obj, ret); get(obj, QStringLiteral("mineId"), ret.mineId); return ret; } QJsonObject CreateDusSingleMine::toJson() const { QJsonObject obj = CreateCombatAreaEffectSimulationBase::toJson(); obj[QStringLiteral("mineId")] = mineId; return obj; } // StateChangeBase void StateChangeBase::fromJson(const QJsonObject &obj, StateChangeBase &ret) { get(obj, QStringLiteral("header"), ret.header); bool bAtLeastOneFound = false; if (get(obj, QStringLiteral("relPosition"), ret.relPosition, true)) bAtLeastOneFound = true; if (get(obj, QStringLiteral("geoPosition"), ret.geoPosition, true)) bAtLeastOneFound = true; // if none yet found, this one is *not* optional get(obj, QStringLiteral("opsPosition"), ret.opsPosition, bAtLeastOneFound); get(obj, QStringLiteral("vulnerabilityState"), ret.vulnerabilityState); get(obj, QStringLiteral("tasVulnerabilityKindId"), ret.tasVulnerabilityKindId); get(obj, QStringLiteral("tasVitality"), ret.tasVitality, true); get(obj, QStringLiteral("vulnerabilityBits"), ret.vulnerabilityBits); get(obj, QStringLiteral("originatorId"), ret.originatorId); } QJsonObject StateChangeBase::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("relPosition"), relPosition.toJson()}, {QStringLiteral("geoPosition"), geoPosition.toJson()}, {QStringLiteral("opsPosition"), opsPosition.toJson()}, {QStringLiteral("vulnerabilityState"), enumToJson(vulnerabilityState)}, {QStringLiteral("tasVulnerabilityKindId"), tasVulnerabilityKindId}, {QStringLiteral("tasVitality"), tasVitality}, {QStringLiteral("vulnerabilityBits"), vulnerabilityBits}, {QStringLiteral("originatorId"), originatorId} }); } // StateChangeDirect StateChangeDirect StateChangeDirect::fromJson(const QJsonObject &obj) { StateChangeDirect ret; StateChangeBase::fromJson(obj, ret); get(obj, QStringLiteral("chargeTypeId"), ret.chargeTypeId); return ret; } QJsonObject StateChangeDirect::toJson() const { QJsonObject obj = StateChangeBase::toJson(); obj[QStringLiteral("chargeTypeId")] = chargeTypeId; return obj; } // StateChangeIndirect StateChangeIndirect StateChangeIndirect::fromJson(const QJsonObject &obj) { StateChangeIndirect ret; StateChangeBase::fromJson(obj, ret); get(obj, QStringLiteral("isSecondaryEffect"), ret.isSecondaryEffect); return ret; } QJsonObject StateChangeIndirect::toJson() const { QJsonObject obj = StateChangeBase::toJson(); obj[QStringLiteral("isSecondaryEffect")] = isSecondaryEffect; return obj; } // DemandVulnerabilityStateChange DemandVulnerabilityStateChange DemandVulnerabilityStateChange::fromJson(const QJsonObject &obj) { DemandVulnerabilityStateChange ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("workstationId"), ret.workstationId); get(obj, QStringLiteral("reqestedState"), ret.reqestedState); get(obj, QStringLiteral("vulnerabilityVitalityIndex"), ret.vulnerabilityVitalityIndex); return ret; } QJsonObject DemandVulnerabilityStateChange::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("workstationId"), workstationId}, {QStringLiteral("reqestedState"), enumToJson(reqestedState)}, {QStringLiteral("vulnerabilityVitalityIndex"), vulnerabilityVitalityIndex} }); } // OperatorAction OperatorAction OperatorAction::fromJson(const QJsonObject &obj) { OperatorAction ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("relPosition"), ret.relPosition); get(obj, QStringLiteral("operatorId"), ret.operatorId); get(obj, QStringLiteral("action"), ret.action); return ret; } QJsonObject OperatorAction::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("relPosition"), relPosition.toJson()}, {QStringLiteral("operatorId"), operatorId}, {QStringLiteral("action"), action} }); } // Reammunition Reammunition Reammunition::fromJson(const QJsonObject &obj) { Reammunition ret; get(obj, QStringLiteral("chargeTypeId"), ret.chargeTypeId); get(obj, QStringLiteral("newStock"), ret.newStock); get(obj, QStringLiteral("newDefaultStock"), ret.newDefaultStock); get(obj, QStringLiteral("tracerRatio"), ret.tracerRatio); return ret; } QJsonObject Reammunition::toJson() const { return QJsonObject({{QStringLiteral("chargeTypeId"), chargeTypeId}, {QStringLiteral("newStock"), newStock}, {QStringLiteral("newDefaultStock"), newDefaultStock}, {QStringLiteral("tracerRatio"), tracerRatio} }); } // SelectiveReammunition SelectiveReammunition SelectiveReammunition::fromJson(const QJsonObject &obj) { SelectiveReammunition ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("gearId"), ret.gearId); get(obj, QStringLiteral("reammunitions"), ret.reammunitions); return ret; } QJsonObject SelectiveReammunition::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("gearId"), gearId}, {QStringLiteral("reammunitions"), arrayToJson(reammunitions)} }); } // StateChange StateChange StateChange::fromJson(const QJsonObject &obj) { StateChange ret; StateChangeBase::fromJson(obj, ret); get(obj, QStringLiteral("originatorType"), ret.originatorType); return ret; } QJsonObject StateChange::toJson() const { QJsonObject obj = StateChangeBase::toJson(); obj[QStringLiteral("originatorType")] = enumToJson(originatorType); return obj; } // CreateFunctionalArea CreateFunctionalArea CreateFunctionalArea::fromJson(const QJsonObject &obj) { CreateFunctionalArea ret; CreateAreaEffectSimulationBase::fromJson(obj, ret); get(obj, QStringLiteral("relEffectPosition"), ret.relEffectPosition); get(obj, QStringLiteral("width"), ret.width); get(obj, QStringLiteral("height"), ret.height); get(obj, QStringLiteral("deconTimeout"), ret.deconTimeout); get(obj, QStringLiteral("maintenanceTimeout"), ret.maintenanceTimeout); get(obj, QStringLiteral("medicalTimeout"), ret.medicalTimeout); get(obj, QStringLiteral("deconMode"), ret.deconMode); get(obj, QStringLiteral("maintenanceMode"), ret.maintenanceMode); get(obj, QStringLiteral("medicalMode"), ret.medicalMode); return ret; } QJsonObject CreateFunctionalArea::toJson() const { QJsonObject obj = CreateAreaEffectSimulationBase::toJson(); obj[QStringLiteral("relEffectPosition")] = relEffectPosition.toJson(); obj[QStringLiteral("width")] = width; obj[QStringLiteral("height")] = height; obj[QStringLiteral("deconTimeout")] = qint64(deconTimeout); obj[QStringLiteral("maintenanceTimeout")] = qint64(maintenanceTimeout); obj[QStringLiteral("medicalTimeout")] = qint64(medicalTimeout); obj[QStringLiteral("deconMode")] = enumToJson(deconMode); obj[QStringLiteral("maintenanceMode")] = enumToJson(maintenanceMode); obj[QStringLiteral("medicalMode")] = enumToJson(medicalMode); return obj; } // FunctionalAreaEntry FunctionalAreaEntry FunctionalAreaEntry::fromJson(const QJsonObject &obj) { FunctionalAreaEntry ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("relPosition"), ret.relPosition); get(obj, QStringLiteral("aesDdsId"), ret.aesDdsId); return ret; } QJsonObject FunctionalAreaEntry::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("relPosition"), relPosition.toJson()}, {QStringLiteral("aesDdsId"), aesDdsId} }); } // RequestBroadcastTelegrams RequestBroadcastTelegrams RequestBroadcastTelegrams::fromJson(const QJsonObject &obj) { RequestBroadcastTelegrams ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("resetCounter"), ret.resetCounter); get(obj, QStringLiteral("broadcastIndex"), ret.broadcastIndex); return ret; } QJsonObject RequestBroadcastTelegrams::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("resetCounter"), resetCounter}, {QStringLiteral("broadcastIndex"), broadcastIndex} }); } // SpecialSensorData SpecialSensorData SpecialSensorData::fromJson(const QJsonObject &obj) { SpecialSensorData ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("relPosition"), ret.relPosition); get(obj, QStringLiteral("operationalState"), ret.operationalState); get(obj, QStringLiteral("airSensor"), ret.airSensor); get(obj, QStringLiteral("tireSensor"), ret.tireSensor); get(obj, QStringLiteral("pointSensor"), ret.pointSensor); get(obj, QStringLiteral("solidMatterSampleExtractor"), ret.solidMatterSampleExtractor); get(obj, QStringLiteral("type"), ret.type); get(obj, QStringLiteral("nbcType"), ret.nbcType); return ret; } QJsonObject SpecialSensorData::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("relPosition"), relPosition.toJson()}, {QStringLiteral("operationalState"), operationalState}, {QStringLiteral("airSensor"), airSensor}, {QStringLiteral("tireSensor"), tireSensor}, {QStringLiteral("pointSensor"), pointSensor}, {QStringLiteral("solidMatterSampleExtractor"), solidMatterSampleExtractor}, {QStringLiteral("type"), type}, {QStringLiteral("nbcType"), nbcType} }); } // MinelayerTrailerDataBase void MinelayerTrailerDataBase::fromJson(const QJsonObject &obj, MinelayerTrailerDataBase &ret) { get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("relPosition"), ret.relPosition); get(obj, QStringLiteral("barrierId"), ret.barrierId); get(obj, QStringLiteral("layingDensity"), ret.layingDensity); get(obj, QStringLiteral("effectStart"), ret.effectStart); get(obj, QStringLiteral("effectDuration"), ret.effectDuration); get(obj, QStringLiteral("indirectChargeTasCode"), ret.indirectChargeTasCode); get(obj, QStringLiteral("mineCount"), ret.mineCount); } QJsonObject MinelayerTrailerDataBase::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("relPosition"), relPosition.toJson()}, {QStringLiteral("barrierId"), barrierId}, {QStringLiteral("layingDensity"), layingDensity}, {QStringLiteral("effectStart"), qint64(effectStart)}, {QStringLiteral("effectDuration"), effectDuration}, {QStringLiteral("indirectChargeTasCode"), indirectChargeTasCode}, {QStringLiteral("mineCount"), mineCount} }); } // MinelayerTrailerData MinelayerTrailerData MinelayerTrailerData::fromJson(const QJsonObject &obj) { MinelayerTrailerData ret; MinelayerTrailerDataBase::fromJson(obj, ret); return ret; } QJsonObject MinelayerTrailerData::toJson() const { return MinelayerTrailerDataBase::toJson(); } // MinelayerThrowerData MinelayerThrowerData MinelayerThrowerData::fromJson(const QJsonObject &obj) { MinelayerThrowerData ret; MinelayerTrailerDataBase::fromJson(obj, ret); get(obj, QStringLiteral("throwingType"), ret.throwingType); return ret; } QJsonObject MinelayerThrowerData::toJson() const { QJsonObject obj = MinelayerTrailerDataBase::toJson(); obj[QStringLiteral("throwingType")] = enumToJson(throwingType); return obj; } MinelayerTrailerPosition MinelayerTrailerPosition::fromJson(const QJsonObject &obj) { MinelayerTrailerPosition ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("relPosition"), ret.relPosition); get(obj, QStringLiteral("indirectChargeTasCode"), ret.indirectChargeTasCode); get(obj, QStringLiteral("dusSerialNo"), ret.dusSerialNo); return ret; } QJsonObject MinelayerTrailerPosition::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("relPosition"), relPosition.toJson()}, {QStringLiteral("indirectChargeTasCode"), indirectChargeTasCode}, {QStringLiteral("dusSerialNo"), qint64(dusSerialNo)} }); } // LanguageSelection LanguageSelection LanguageSelection::fromJson(const QJsonObject &obj) { LanguageSelection ret; get(obj, QStringLiteral("aesDdsId"), ret.header); get(obj, QStringLiteral("languageSelection"), ret.languageSelection); return ret; } QJsonObject LanguageSelection::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("languageSelection"), enumToJson(languageSelection)} }); } // EquipmentMessage EquipmentMessage EquipmentMessage::fromJson(const QJsonObject &obj) { EquipmentMessage ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("message"), ret.message); get(obj, QStringLiteral("msgId"), ret.msgId); return ret; } QJsonObject EquipmentMessage::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("message"), QString::fromStdString(message)}, {QStringLiteral("msgId"), msgId} }); } // EquipmentMessageOC EquipmentMessageOC EquipmentMessageOC::fromJson(const QJsonObject &obj) { EquipmentMessageOC ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("subject"), ret.subject); get(obj, QStringLiteral("message"), ret.message); get(obj, QStringLiteral("senderId"), ret.senderId); get(obj, QStringLiteral("receiverId"), ret.receiverId); return ret; } QJsonObject EquipmentMessageOC::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("subject"), QString::fromStdString(subject)}, {QStringLiteral("message"), QString::fromStdString(message)}, {QStringLiteral("senderId"), senderId}, {QStringLiteral("receiverId"), receiverId} }); } // OpaquePayloadDataBase void OpaquePayloadDataBase::fromJson(const QJsonObject &obj, OpaquePayloadDataBase &ret) { get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("payload"), ret.payload); get(obj, QStringLiteral("payloadType"), ret.payloadType); } QJsonObject OpaquePayloadDataBase::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("payload"), arrayToJson(payload)}, {QStringLiteral("payloadType"), enumToJson(payloadType)} }); } // OpaquePayloadDataOut OpaquePayloadDataOut OpaquePayloadDataOut::fromJson(const QJsonObject &obj) { OpaquePayloadDataOut ret; OpaquePayloadDataBase::fromJson(obj, ret); get(obj, QStringLiteral("header"), ret.header); return ret; } QJsonObject OpaquePayloadDataOut::toJson() const { QJsonObject obj = OpaquePayloadDataBase::toJson(); obj[QStringLiteral("header")] = header.toJson(); return obj; } // OpaquePayloadDataIn OpaquePayloadDataIn OpaquePayloadDataIn::fromJson(const QJsonObject &obj) { OpaquePayloadDataIn ret; OpaquePayloadDataBase::fromJson(obj, ret); get(obj, QStringLiteral("relPosition"), ret.relPosition); return ret; } QJsonObject OpaquePayloadDataIn::toJson() const { QJsonObject obj = OpaquePayloadDataBase::toJson(); obj[QStringLiteral("relPosition")] = relPosition.toJson(); return obj; } // EquipmentEvent EquipmentEvent EquipmentEvent::fromJson(const QJsonObject &obj) { EquipmentEvent ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("relPosition"), ret.relPosition); get(obj, QStringLiteral("equipmentFunctionId"), ret.equipmentFunctionId); get(obj, QStringLiteral("subDeviceId"), ret.subDeviceId); get(obj, QStringLiteral("uniqueId"), ret.uniqueId); get(obj, QStringLiteral("code"), ret.code); get(obj, QStringLiteral("payload"), ret.payload); return ret; } QJsonObject EquipmentEvent::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("relPosition"), relPosition.toJson()}, {QStringLiteral("equipmentFunctionId"), equipmentFunctionId}, {QStringLiteral("subDeviceId"), subDeviceId}, {QStringLiteral("uniqueId"), uniqueId}, {QStringLiteral("code"), code}, {QStringLiteral("payload"), arrayToJson(payload)} }); } // EquipmentGearAssignment EquipmentGearAssignment EquipmentGearAssignment::fromJson(const QJsonObject &obj) { EquipmentGearAssignment ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("gears"), ret.gears, true); return ret; } QJsonObject EquipmentGearAssignment::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("gears"), arrayToJson(gears)} }); } // EquipmentGearChargeState EquipmentGearChargeState EquipmentGearChargeState::fromJson(const QJsonObject &obj) { EquipmentGearChargeState ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("charges"), ret.charges); return ret; } QJsonObject EquipmentGearChargeState::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("charges"), arrayToJson(charges)} }); } // ExerciseEnvironmentData ExerciseEnvironmentData ExerciseEnvironmentData::fromJson(const QJsonObject &obj) { ExerciseEnvironmentData ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("exerciseId"), ret.exerciseId); int tz; get(obj, QStringLiteral("timeZone"), tz); ret.timeZone = tz; get(obj, QStringLiteral("utmZone"), ret.utmZone); get(obj, QStringLiteral("utmBand"), ret.utmBand); get(obj, QStringLiteral("grid"), ret.grid); return ret; } QJsonObject ExerciseEnvironmentData::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("exerciseId"), exerciseId}, {QStringLiteral("timeZone"), timeZone}, {QStringLiteral("utmZone"), utmZone}, {QStringLiteral("utmBand"), utmBand}, {QStringLiteral("grid"), QString::fromStdString(grid)} }); } // BiteError BiteError BiteError::fromJson(const QJsonObject &obj) { BiteError ret; get(obj, QStringLiteral("errorNumber"), ret.errorNumber); get(obj, QStringLiteral("canDeviceNumber"), ret.canDeviceNumber); get(obj, QStringLiteral("subdeviceNumber"), ret.subdeviceNumber); get(obj, QStringLiteral("uniqueId"), ret.uniqueId); return ret; } QJsonObject BiteError::toJson() const { return QJsonObject({{QStringLiteral("errorNumber"), errorNumber}, {QStringLiteral("canDeviceNumber"), canDeviceNumber}, {QStringLiteral("subdeviceNumber"), subdeviceNumber}, {QStringLiteral("uniqueId"), uniqueId} }); } // BiteReport BiteReport BiteReport::fromJson(const QJsonObject &obj) { BiteReport ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("loginType"), ret.loginType); get(obj, QStringLiteral("biteState"), ret.biteState); get(obj, QStringLiteral("configState"), ret.configState); get(obj, QStringLiteral("batteryState"), ret.batteryState); get(obj, QStringLiteral("configError"), ret.configError); get(obj, QStringLiteral("biteErrors"), ret.biteErrors, true); return ret; } QJsonObject BiteReport::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("loginType"), enumToJson(loginType)}, {QStringLiteral("biteState"), biteState}, {QStringLiteral("configState"), configState}, {QStringLiteral("batteryState"), batteryState}, {QStringLiteral("configError"), configError}, {QStringLiteral("biteErrors"), arrayToJson(biteErrors)} }); } // EquipmentGearEvent EquipmentGearEvent EquipmentGearEvent::fromJson(const QJsonObject &obj) { EquipmentGearEvent ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("charge"), ret.charge); get(obj, QStringLiteral("chargeAmount"), ret.chargeAmount); return ret; } QJsonObject EquipmentGearEvent::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("charge"), charge.toJson()}, {QStringLiteral("chargeAmount"), chargeAmount} }); } // CesHitInformation CesHitInformation CesHitInformation::fromJson(const QJsonObject &obj) { CesHitInformation ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("chargeTasCodeDirect"), ret.chargeTasCodeDirect); get(obj, QStringLiteral("chargeTasCodeIndirect"), ret.chargeTasCodeIndirect); get(obj, QStringLiteral("originatorEquipmentNumber"), ret.originatorEquipmentNumber); get(obj, QStringLiteral("directionDegree"), ret.directionDegree); get(obj, QStringLiteral("distance"), ret.distance); get(obj, QStringLiteral("effectPercent"), ret.effectPercent); return ret; } QJsonObject CesHitInformation::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("chargeTasCodeDirect"), chargeTasCodeDirect}, {QStringLiteral("chargeTasCodeIndirect"), chargeTasCodeIndirect}, {QStringLiteral("originatorEquipmentNumber"), originatorEquipmentNumber}, {QStringLiteral("directionDegree"), directionDegree}, {QStringLiteral("distance"), distance}, {QStringLiteral("effectPercent"), effectPercent} }); } // ParticipantSwVersionsRequest ParticipantSwVersionsRequest ParticipantSwVersionsRequest::fromJson(const QJsonObject &obj) { ParticipantSwVersionsRequest ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("charge"), ret.equipmentFunctionId); return ret; } QJsonObject ParticipantSwVersionsRequest::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("chargeAmount"), equipmentFunctionId} }); } // EquipmentSwVersion EquipmentSwVersion EquipmentSwVersion::fromJson(const QJsonObject &obj) { EquipmentSwVersion ret; get(obj, QStringLiteral("equipmentFunctionId"), ret.equipmentFunctionId); get(obj, QStringLiteral("subDeviceId"), ret.subDeviceId); get(obj, QStringLiteral("uniqueId"), ret.uniqueId); get(obj, QStringLiteral("swVersion"), ret.swVersion); return ret; } QJsonObject EquipmentSwVersion::toJson() const { return QJsonObject({{QStringLiteral("equipmentFunctionId"), equipmentFunctionId}, {QStringLiteral("subDeviceId"), subDeviceId}, {QStringLiteral("uniqueId"), uniqueId}, {QStringLiteral("swVersion"), swVersion} }); } // ParticipantSwVersions ParticipantSwVersions ParticipantSwVersions::fromJson(const QJsonObject &obj) { ParticipantSwVersions ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("subDeviceId"), ret.equipments); return ret; } QJsonObject ParticipantSwVersions::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("subDeviceId"), arrayToJson(equipments)} }); } // CesHitRequest CesHitRequest CesHitRequest::fromJson(const QJsonObject &obj) { CesHitRequest ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("chargeTasCodeDirect"), ret.chargeTasCodeDirect); get(obj, QStringLiteral("chargeTasCodeIndirect"), ret.chargeTasCodeIndirect); get(obj, QStringLiteral("originatorEquipmentNumber"), ret.originatorEquipmentNumber); get(obj, QStringLiteral("aesDdsId"), ret.aesDdsId); get(obj, QStringLiteral("aesType"), ret.aesType); get(obj, QStringLiteral("mineId"), ret.mineId); get(obj, QStringLiteral("remainEffectPercent"), ret.remainEffectPercent); get(obj, QStringLiteral("remainEffectTasCodeDirect"), ret.remainEffectTasCodeDirect); get(obj, QStringLiteral("buildingId"), ret.buildingId); get(obj, QStringLiteral("roomId"), ret.roomId); get(obj, QStringLiteral("relPosition"), ret.relPosition); get(obj, QStringLiteral("reserve1"), ret.reserve1); get(obj, QStringLiteral("reserve2"), ret.reserve2); return ret; } QJsonObject CesHitRequest::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("chargeTasCodeDirect"), chargeTasCodeDirect}, {QStringLiteral("chargeTasCodeIndirect"), chargeTasCodeIndirect}, {QStringLiteral("originatorEquipmentNumber"), originatorEquipmentNumber}, {QStringLiteral("aesDdsId"), aesDdsId}, {QStringLiteral("aesType"), enumToJson(aesType)}, {QStringLiteral("mineId"), mineId}, {QStringLiteral("remainEffectPercent"), remainEffectPercent}, {QStringLiteral("remainEffectTasCodeDirect"), remainEffectTasCodeDirect}, {QStringLiteral("buildingId"), buildingId}, {QStringLiteral("roomId"), roomId}, {QStringLiteral("relPosition"), relPosition.toJson()}, {QStringLiteral("reserve1"), reserve1}, {QStringLiteral("reserve2"), reserve2} }); } // TechnicalArea TechnicalArea TechnicalArea::fromJson(const QJsonObject &obj) { TechnicalArea ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("aesDdsId"), ret.aesDdsId); get(obj, QStringLiteral("taType"), ret.taType); get(obj, QStringLiteral("name"), ret.name); get(obj, QStringLiteral("relCorner"), ret.relCorner); get(obj, QStringLiteral("width"), ret.width); get(obj, QStringLiteral("height"), ret.height); return ret; } QJsonObject TechnicalArea::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("aesDdsId"), aesDdsId}, {QStringLiteral("taType"), enumToJson(taType)}, {QStringLiteral("name"), QString::fromStdString(name)}, {QStringLiteral("relCorner"), relCorner.toJson()}, {QStringLiteral("width"), width}, {QStringLiteral("height"), height} }); } // ParticipantModeBase void ParticipantModeBase::fromJson(const QJsonObject &obj, ParticipantModeBase &ret) { get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("language"), ret.language); get(obj, QStringLiteral("operationMode"), ret.operationMode); get(obj, QStringLiteral("reactivationDetoxication"), ret.reactivationDetoxication); get(obj, QStringLiteral("reactivationMaintenance"), ret.reactivationMaintenance); get(obj, QStringLiteral("reactivationMedic"), ret.reactivationMedic); get(obj, QStringLiteral("modeVest"), ret.modeVest); get(obj, QStringLiteral("modeHelmet"), ret.modeHelmet); get(obj, QStringLiteral("personellProtectionMode"), ret.personellProtectionMode); get(obj, QStringLiteral("protectionLevel"), ret.protectionLevel); get(obj, QStringLiteral("handgrenadeSearchMode"), ret.handgrenadeSearchMode); get(obj, QStringLiteral("internationalMode"), ret.internationalMode); get(obj, QStringLiteral("abcProtectionMode"), ret.abcProtectionMode); } QJsonObject ParticipantModeBase::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("language"), enumToJson(language)}, {QStringLiteral("operationMode"), enumToJson(operationMode)}, {QStringLiteral("reactivationDetoxication"), reactivationDetoxication}, {QStringLiteral("reactivationMaintenance"), reactivationMaintenance}, {QStringLiteral("reactivationMedic"), reactivationMedic}, {QStringLiteral("modeVest"), enumToJson(modeVest)}, {QStringLiteral("modeHelmet"), enumToJson(modeHelmet)}, {QStringLiteral("personellProtectionMode"), enumToJson(personellProtectionMode)}, {QStringLiteral("protectionLevel"), enumToJson(protectionLevel)}, {QStringLiteral("handgrenadeSearchMode"), enumToJson(handgrenadeSearchMode)}, {QStringLiteral("internationalMode"), enumToJson(internationalMode)}, {QStringLiteral("abcProtectionMode"), enumToJson(abcProtectionMode)} }); } // ParticipantMode ParticipantMode ParticipantMode::fromJson(const QJsonObject &obj) { ParticipantMode ret; ParticipantModeBase::fromJson(obj, ret); return ret; } QJsonObject ParticipantMode::toJson() const { return ParticipantModeBase::toJson(); } // ParticipantModeReport ParticipantModeReport ParticipantModeReport::fromJson(const QJsonObject &obj) { ParticipantModeReport ret; ParticipantModeBase::fromJson(obj, ret); return ret; } QJsonObject ParticipantModeReport::toJson() const { return ParticipantModeBase::toJson(); } // DemandParticipantMode DemandParticipantMode DemandParticipantMode::fromJson(const QJsonObject &obj) { DemandParticipantMode ret; get(obj, QStringLiteral("header"), ret.header); return ret; } QJsonObject DemandParticipantMode::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}}); } // ParticipantModeBase void ParticipantConfigurationBase::fromJson(const QJsonObject &obj, ParticipantConfigurationBase &ret) { get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("positionIntervallVehicle"), ret.positionIntervallVehicle); get(obj, QStringLiteral("positionIntervallPersonell"), ret.positionIntervallPersonell); get(obj, QStringLiteral("positionIntervallAircraft"), ret.positionIntervallAircraft); get(obj, QStringLiteral("positionTransmissionIntervall"), ret.positionTransmissionIntervall); get(obj, QStringLiteral("heightbarrier"), ret.heightbarrier); get(obj, QStringLiteral("faultPositionHandling"), ret.faultPositionHandling); get(obj, QStringLiteral("switchingPositionIntervall"), ret.switchingPositionIntervall); get(obj, QStringLiteral("waittimeAdditionalBroadcastDemand"), ret.waittimeAdditionalBroadcastDemand); get(obj, QStringLiteral("factorWaittimeIncreaseAtHighload"), ret.factorWaittimeIncreaseAtHighload); get(obj, QStringLiteral("waittimeAutomaticVulnerabilityIncreaseLevel1"), ret.waittimeAutomaticVulnerabilityIncreaseLevel1); get(obj, QStringLiteral("waittimeAutomaticVulnerabilityIncreaseLevel2"), ret.waittimeAutomaticVulnerabilityIncreaseLevel2); get(obj, QStringLiteral("waittimeAutomaticVulnerabilityIncreaseLevel3"), ret.waittimeAutomaticVulnerabilityIncreaseLevel3); get(obj, QStringLiteral("opticalCode"), ret.opticalCode); get(obj, QStringLiteral("vulnerabilityModel"), ret.vulnerabilityModel); get(obj, QStringLiteral("validTimeOps"), ret.validTimeOps); } QJsonObject ParticipantConfigurationBase::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("positionIntervallVehicle"), positionIntervallVehicle}, {QStringLiteral("positionIntervallPersonell"), positionIntervallPersonell}, {QStringLiteral("positionIntervallAircraft"), positionIntervallAircraft}, {QStringLiteral("positionTransmissionIntervall"), positionTransmissionIntervall}, {QStringLiteral("heightbarrier"), heightbarrier}, {QStringLiteral("faultPositionHandling"), enumToJson(faultPositionHandling)}, {QStringLiteral("switchingPositionIntervall"), enumToJson(switchingPositionIntervall)}, {QStringLiteral("waittimeAdditionalBroadcastDemand"), waittimeAdditionalBroadcastDemand}, {QStringLiteral("factorWaittimeIncreaseAtHighload"), factorWaittimeIncreaseAtHighload}, {QStringLiteral("waittimeAutomaticVulnerabilityIncreaseLevel1"), waittimeAutomaticVulnerabilityIncreaseLevel1}, {QStringLiteral("waittimeAutomaticVulnerabilityIncreaseLevel2"), waittimeAutomaticVulnerabilityIncreaseLevel2}, {QStringLiteral("waittimeAutomaticVulnerabilityIncreaseLevel3"), waittimeAutomaticVulnerabilityIncreaseLevel3}, {QStringLiteral("opticalCode"), enumToJson(opticalCode)}, {QStringLiteral("vulnerabilityModel"), vulnerabilityModel}, {QStringLiteral("validTimeOps"), validTimeOps} }); } // ParticipantConfigurationReport ParticipantConfigurationReport ParticipantConfigurationReport::fromJson(const QJsonObject &obj) { ParticipantConfigurationReport ret; ParticipantConfigurationBase::fromJson(obj, ret); return ret; } QJsonObject ParticipantConfigurationReport::toJson() const { return ParticipantConfigurationBase::toJson(); } // ParticipantConfiguration ParticipantConfiguration ParticipantConfiguration::fromJson(const QJsonObject &obj) { ParticipantConfiguration ret; ParticipantConfigurationBase::fromJson(obj, ret); return ret; } QJsonObject ParticipantConfiguration::toJson() const { return ParticipantConfigurationBase::toJson(); } // DemandParticipantConfiguration DemandParticipantConfiguration DemandParticipantConfiguration::fromJson(const QJsonObject &obj) { DemandParticipantConfiguration ret; get(obj, QStringLiteral("header"), ret.header); return ret; } QJsonObject DemandParticipantConfiguration::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}}); } // ExerciseStateData ExerciseStateData ExerciseStateData::fromJson(const QJsonObject &obj) { ExerciseStateData ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("exerciseState"), ret.exerciseState); get(obj, QStringLiteral("exerciseId"), ret.exerciseId); return ret; } QJsonObject ExerciseStateData::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("exerciseState"), enumToJson(exerciseState)}, {QStringLiteral("exerciseId"), exerciseId} }); } // EmergencyCall EmergencyCall EmergencyCall::fromJson(const QJsonObject &obj) { EmergencyCall ret; get(obj, QStringLiteral("issi"), ret.issi); get(obj, QStringLiteral("absPosition"), ret.absPosition); get(obj, QStringLiteral("timeStamp"), ret.timeStamp); return ret; } QJsonObject EmergencyCall::toJson() const { return QJsonObject({{QStringLiteral("issi"), issi}, {QStringLiteral("absPosition"), absPosition.toJson()}, {QStringLiteral("timeStamp"), timeStamp} }); } // RequestBroadcastStatistics RequestBroadcastStatistics RequestBroadcastStatistics::fromJson(const QJsonObject &obj) { RequestBroadcastStatistics ret; get(obj, QStringLiteral("header"), ret.header); return ret; } QJsonObject RequestBroadcastStatistics::toJson() const { return QJsonObject({{QStringLiteral("issi"), header.toJson()}}); } // BroadcastInformation BroadcastInformation BroadcastInformation::fromJson(const QJsonObject &obj) { BroadcastInformation ret; get(obj, QStringLiteral("equipmentNumber"), ret.equipmentNumber); get(obj, QStringLiteral("broadcastRequests"), ret.broadcastRequests); return ret; } QJsonObject BroadcastInformation::toJson() const { return QJsonObject({{QStringLiteral("equipmentNumber"), equipmentNumber}, {QStringLiteral("broadcastRequests"), broadcastRequests} }); } // BroadcastStatistics BroadcastStatistics BroadcastStatistics::fromJson(const QJsonObject &obj) { BroadcastStatistics ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("information"), ret.information); return ret; } QJsonObject BroadcastStatistics::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("information"), arrayToJson(information)} }); } // GroupIssiInformation GroupIssiInformation GroupIssiInformation::fromJson(const QJsonObject &obj) { GroupIssiInformation ret; get(obj, QStringLiteral("exerciseId"), ret.exerciseId); get(obj, QStringLiteral("serverIssi"), ret.serverIssi); get(obj, QStringLiteral("broadcastIssi1"), ret.broadcastIssi1); get(obj, QStringLiteral("broadcastIssi2"), ret.broadcastIssi2); return ret; } QJsonObject GroupIssiInformation::toJson() const { return QJsonObject({{QStringLiteral("exerciseId"), exerciseId}, {QStringLiteral("serverIssi"), serverIssi}, {QStringLiteral("broadcastIssi1"), broadcastIssi1}, {QStringLiteral("broadcastIssi2"), broadcastIssi2} }); } // ExerciseEquipmentAssignmentComplete ExerciseEquipmentAssignmentComplete ExerciseEquipmentAssignmentComplete::fromJson(const QJsonObject &obj) { ExerciseEquipmentAssignmentComplete ret; QJsonArray arrExercise; get(obj, QStringLiteral("exerciseEquipmentAssignments"), arrExercise); for (const auto &ele : qAsConst(arrExercise)) { const QJsonObject elem = ele.toObject(); int exerciseId; QJsonArray equipmentNumbers; get(elem, QStringLiteral("exerciseId"), exerciseId); get(elem, QStringLiteral("equipmentNumbers"), equipmentNumbers); auto &cont = ret.exerciseEquipmentAssignments[exerciseId]; for (const auto &eq : qAsConst(equipmentNumbers)) cont.insert(eq.toInt()); } get(obj, QStringLiteral("groupIssiInformation"), ret.groupIssiInformation); return ret; } QJsonObject ExerciseEquipmentAssignmentComplete::toJson() const { QJsonArray arrExercise; for (const auto &it : exerciseEquipmentAssignments) { QJsonArray equipmentNumbers; for (const int equipmentNumber : it.second) equipmentNumbers += equipmentNumber; arrExercise += QJsonObject({{QStringLiteral("exerciseId"), it.first}, {QStringLiteral("equipmentNumbers"), equipmentNumbers} }); } return QJsonObject({{QStringLiteral("exerciseEquipmentAssignments"), arrExercise}, {QStringLiteral("groupIssiInformation"), arrayToJson(groupIssiInformation)} }); } // ProxyConnectionState ProxyConnectionState ProxyConnectionState::fromJson(const QJsonObject &obj) { ProxyConnectionState ret; get(obj, QStringLiteral("connectedToSystem"), ret.connectedToSystem); return ret; } QJsonObject ProxyConnectionState::toJson() const { return QJsonObject({{QStringLiteral("connectedToSystem"), connectedToSystem}}); } // ParticipantLicenseChange ParticipantLicenseChange ParticipantLicenseChange::fromJson(const QJsonObject &obj) { ParticipantLicenseChange ret; get(obj, QStringLiteral("equipmentNumber"), ret.equipmentNumber); get(obj, QStringLiteral("licenseState"), ret.licenseState); return ret; } QJsonObject ParticipantLicenseChange::toJson() const { return QJsonObject({{QStringLiteral("equipmentNumber"), equipmentNumber}, {QStringLiteral("licenseState"), enumToJson(licenseState)} }); } // WlsParticipantsStateRequest WlsParticipantsStateRequest WlsParticipantsStateRequest::fromJson(const QJsonObject &obj) { Q_UNUSED(obj); return WlsParticipantsStateRequest(); } QJsonObject WlsParticipantsStateRequest::toJson() const { return QJsonObject(); } // WlsParticipantsStateReport WlsParticipantsStateReport WlsParticipantsStateReport::fromJson(const QJsonObject &obj) { WlsParticipantsStateReport ret; get(obj, QStringLiteral("participantStates"), ret.participantStates); return ret; } QJsonObject WlsParticipantsStateReport::toJson() const { return QJsonObject({{QStringLiteral("participantStates"), arrayToJson(participantStates)}}); } // WlsBinarySfmData WlsBinarySfmData WlsBinarySfmData::fromJson(const QJsonObject &obj) { WlsBinarySfmData ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("payload"), ret.payload); return ret; } QJsonObject WlsBinarySfmData::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("payload"), arrayToJson(payload)} }); } // WlsParticipantsConnectionState WlsParticipantsConnectionState WlsParticipantsConnectionState::fromJson(const QJsonObject &obj) { WlsParticipantsConnectionState ret; get(obj, QStringLiteral("equipmentNumber"), ret.equipmentNumber); get(obj, QStringLiteral("dataCommunicationPossible"), ret.dataCommunicationPossible); return ret; } QJsonObject WlsParticipantsConnectionState::toJson() const { return QJsonObject({{QStringLiteral("equipmentNumber"), equipmentNumber}, {QStringLiteral("dataCommunicationPossible"), dataCommunicationPossible} }); } SanitationRepair SanitationRepair::fromJson(const QJsonObject &obj) { SanitationRepair ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("originatorType"), ret.originatorType); get(obj, QStringLiteral("equipmentNumberOrigin"), ret.equipmentNumberOrigin); get(obj, QStringLiteral("stateStart"), ret.stateStart); get(obj, QStringLiteral("typeOfTreatment"), ret.typeOfTreatment); get(obj, QStringLiteral("triage"), ret.triage); get(obj, QStringLiteral("tyeOfDamage"), ret.tyeOfDamage); get(obj, QStringLiteral("stateResult"), ret.stateResult); get(obj, QStringLiteral("treatmentResult"), ret.treatmentResult); get(obj, QStringLiteral("triagePriority"), ret.triagePriority); get(obj, QStringLiteral("fullState"), ret.fullState); get(obj, QStringLiteral("timeOfTreatment"), ret.timeOfTreatment); get(obj, QStringLiteral("timeOfRecovery"), ret.timeOfRecovery); return ret; } QJsonObject SanitationRepair::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("originatorType"), enumToJson(originatorType)}, {QStringLiteral("equipmentNumberOrigin"), equipmentNumberOrigin}, {QStringLiteral("stateStart"), enumToJson(stateStart)}, {QStringLiteral("typeOfTreatment"), typeOfTreatment}, {QStringLiteral("triage"), triage}, {QStringLiteral("tyeOfDamage"), tyeOfDamage}, {QStringLiteral("stateResult"), enumToJson(stateResult)}, {QStringLiteral("treatmentResult"), enumToJson(treatmentResult)}, {QStringLiteral("triagePriority"), triagePriority}, {QStringLiteral("fullState"), fullState}, {QStringLiteral("timeOfTreatment"), timeOfTreatment}, {QStringLiteral("timeOfRecovery"), timeOfRecovery} }); } SanitaryMaterialStockReport SanitaryMaterialStockReport::fromJson(const QJsonObject &obj) { SanitaryMaterialStockReport ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("originatorEquipmentNumber"), ret.originatorEquipmentNumber); get(obj, QStringLiteral("qualification"), ret.qualification); get(obj, QStringLiteral("uniqueId"), ret.uniqueId); get(obj, QStringLiteral("sanitaryMaterialCount"), ret.sanitaryMaterialCount); get(obj, QStringLiteral("sanitaryMaterialStock"), ret.sanitaryMaterialStock); return ret; } QJsonObject SanitaryMaterialStockReport::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("sanitaryMaterialCount"), sanitaryMaterialCount}, {QStringLiteral("uniqueId"), uniqueId}, {QStringLiteral("sanitaryMaterialStock"), arrayToJson(sanitaryMaterialStock)}, {QStringLiteral("qualification"), enumToJson(qualification)}, {QStringLiteral("originatorEquipmentNumber"), originatorEquipmentNumber} }); } ApacheLaserDesignation ApacheLaserDesignation::fromJson(const QJsonObject &obj) { ApacheLaserDesignation ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("gearId"), ret.gearId); get(obj, QStringLiteral("code"), ret.code); get(obj, QStringLiteral("outputPower"), ret.outputPower); get(obj, QStringLiteral("spotLocation"), ret.spotLocation); return ret; } QJsonObject ApacheLaserDesignation::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("gearId"), gearId}, {QStringLiteral("code"), code}, {QStringLiteral("outputPower"), outputPower}, {QStringLiteral("spotLocation"), spotLocation.toJson()} }); } Sanitation Sanitation::fromJson(const QJsonObject &obj) { Sanitation ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("originatorEquipmentNumber"), ret.originatorEquipmentNumber); get(obj, QStringLiteral("uniqeId"), ret.uniqeId); get(obj, QStringLiteral("proceduresTaken"), ret.proceduresTaken); get(obj, QStringLiteral("sanitationResult"), ret.sanitationResult); get(obj, QStringLiteral("sanitationEvaluation"), ret.sanitationEvaluation); get(obj, QStringLiteral("qualification"), ret.qualification); return ret; } QJsonObject Sanitation::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("originatorEquipmentNumber"), originatorEquipmentNumber}, {QStringLiteral("uniqeId"), uniqeId}, {QStringLiteral("proceduresTaken"), proceduresTaken}, {QStringLiteral("sanitationResult"), enumToJson(sanitationResult)}, {QStringLiteral("sanitationEvaluation"), enumToJson(sanitationEvaluation)}, {QStringLiteral("qualification"), enumToJson(qualification)} }); } BatteryInfo BatteryInfo::fromJson(const QJsonObject &obj) { BatteryInfo ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("batteryStates"), ret.batteryStates); return ret; } QJsonObject BatteryInfo::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("batteryStates"), arrayToJson(batteryStates)} }); } BatteryAlarm BatteryAlarm::fromJson(const QJsonObject &obj) { BatteryAlarm ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("id"), ret.id); get(obj, QStringLiteral("description"), ret.description); get(obj, QStringLiteral("acknowledge"), ret.acknowledge); get(obj, QStringLiteral("condition"), ret.condition); get(obj, QStringLiteral("uniqueAlarmNumber"), ret.uniqueAlarmNumber); get(obj, QStringLiteral("alarmTime"), ret.alarmTime); return ret; } QJsonObject BatteryAlarm::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("id"), id}, {QStringLiteral("description"), description}, {QStringLiteral("acknowledge"), acknowledge}, {QStringLiteral("condition"), condition}, {QStringLiteral("uniqueAlarmNumber"), uniqueAlarmNumber}, {QStringLiteral("alarmTime"), alarmTime} }); } ServiceControl ServiceControl::fromJson(const QJsonObject &obj) { ServiceControl ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("serviceControlState"), ret.serviceControlState); return ret; } QJsonObject ServiceControl::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("serviceControlState"), enumToJson(serviceControlState)} }); } SetDevicePowerRequest SetDevicePowerRequest::fromJson(const QJsonObject &obj) { SetDevicePowerRequest ret; get(obj, QStringLiteral("header"), ret.header); get(obj, QStringLiteral("powerType"), ret.powerType); get(obj, QStringLiteral("subdeviceId"), ret.subdeviceId); return ret; } QJsonObject SetDevicePowerRequest::toJson() const { return QJsonObject({{QStringLiteral("header"), header.toJson()}, {QStringLiteral("powerType"), enumToJson(powerType)}, {QStringLiteral("subdeviceId"), subdeviceId} }); } RestoreRadioReadiness RestoreRadioReadiness::fromJson(const QJsonObject &obj) { RestoreRadioReadiness ret; get(obj, HEADER(), ret.header); get(obj, READINESS_LOSS_POSITION(), ret.readinessLossPosition); get(obj, READINESS_LOSS_TIME(), ret.readinessLossTime); get(obj, READINESS_RESTORE_POSITION(), ret.readinessRestorePosition); get(obj, READINESS_RESTORE_TIME(), ret.readinessRestoreTime); return ret; } QJsonObject RestoreRadioReadiness::toJson() const { return QJsonObject({{HEADER(), header.toJson()}, {READINESS_LOSS_POSITION(), readinessLossPosition.toJson()}, {READINESS_LOSS_TIME(), readinessLossTime}, {READINESS_RESTORE_POSITION(), readinessRestorePosition.toJson()}, {READINESS_RESTORE_TIME(), readinessRestoreTime} }); } // UAVAction UAVAction UAVAction::fromJson(const QJsonObject &obj) { UAVAction ret; get(obj, TASK(), ret.task); get(obj, POSITION(), ret.absPosition); return ret; } QJsonObject UAVAction::toJson() const { return QJsonObject({ {TASK(), enumToJson(task)}, {POSITION(), absPosition.toJson()}, }); } // UAVPerformMission UAVPerformMission UAVPerformMission::fromJson(const QJsonObject &obj) { UAVPerformMission ret; get(obj, HEADER(), ret.header); get(obj, ACTIONS(), ret.actions); get(obj, MISSION_NAME(), ret.missionName); get(obj, MISSION_ID(), ret.missionId); return ret; } QJsonObject UAVPerformMission::toJson() const { return QJsonObject({ {HEADER(), header.toJson()}, {ACTIONS(), arrayToJson(actions)}, {MISSION_NAME(), missionName}, {MISSION_ID(), missionId}, }); } // UAVStatus UAVStatus UAVStatus::fromJson(const QJsonObject &obj) { UAVStatus ret; get(obj, HEADER(), ret.header); get(obj, UAVSTATE(), ret.uavState); return ret; } QJsonObject UAVStatus::toJson() const { return QJsonObject({ {HEADER(), header.toJson()}, {UAVSTATE(), enumToJson(uavState)}, }); } // UAVRadioLinkConnectionStatus UAVRadioLinkConnectionStatus UAVRadioLinkConnectionStatus::fromJson(const QJsonObject &obj) { UAVRadioLinkConnectionStatus ret; get(obj, HEADER(), ret.header); get(obj, UAVCONNECTIONSTATE(), ret.uavConnectionState); return ret; } QJsonObject UAVRadioLinkConnectionStatus::toJson() const { return QJsonObject({ {HEADER(), header.toJson()}, {UAVCONNECTIONSTATE(), enumToJson(uavConnectionState)}, }); } // UAVMissionStatus UAVMissionStatus UAVMissionStatus::fromJson(const QJsonObject &obj) { UAVMissionStatus ret; get(obj, HEADER(), ret.header); get(obj, CURRENT_ACTION(), ret.currentAction); get(obj, CURRENT_MISSION_NAME(), ret.currentMissionName); get(obj, MISSION_ENDED(), ret.missionEnded); return ret; } QJsonObject UAVMissionStatus::toJson() const { return QJsonObject({ {HEADER(), header.toJson()}, {CURRENT_ACTION(), enumToJson(currentAction)}, {CURRENT_MISSION_NAME(), currentMissionName}, {MISSION_ENDED(), missionEnded}, }); } // UAVChangeState UAVChangeState UAVChangeState::fromJson(const QJsonObject &obj) { UAVChangeState ret; get(obj, HEADER(), ret.header); get(obj, REQUESTED_STATE(), ret.requestedState); return ret; } QJsonObject UAVChangeState::toJson() const { return QJsonObject({ {HEADER(), header.toJson()}, {REQUESTED_STATE(), enumToJson(requestedState)} }); } ExFireReadiness ExFireReadiness::fromJson(const QJsonObject &obj) { ExFireReadiness ret; get(obj, HEADER(), ret.header); get(obj, PARTY_ID(), ret.partyId); get(obj, REFERENCE(), ret.reference); return ret; } QJsonObject ExFireReadiness::toJson() const { return QJsonObject({ {HEADER(), header.toJson()}, {PARTY_ID(), partyId}, {REFERENCE(), reference} }); } ExFiredReport ExFiredReport::fromJson(const QJsonObject &obj) { ExFiredReport ret; get(obj, HEADER(), ret.header); get(obj, PARTY_ID(), ret.partyId); get(obj, REFERENCE(), ret.reference); get(obj, UNIT_IDENTIFIER(), ret.unitIdentifier); get(obj, IDENTIFIER(), ret.identifier); return ret; } QJsonObject ExFiredReport::toJson() const { return QJsonObject({ {HEADER(), header.toJson()}, {PARTY_ID(), partyId}, {REFERENCE(), reference}, {UNIT_IDENTIFIER(), unitIdentifier}, {IDENTIFIER(), identifier} }); } ExConfirmationReport ExConfirmationReport::fromJson(const QJsonObject &obj) { ExConfirmationReport ret; get(obj, HEADER(), ret.header); get(obj, PARTY_ID(), ret.partyId); get(obj, REFERENCE(), ret.reference); get(obj, UNIT_IDENTIFIER(), ret.unitIdentifier); get(obj, IDENTIFIER(), ret.identifier); return ret; } QJsonObject ExConfirmationReport::toJson() const { return QJsonObject({ {HEADER(), header.toJson()}, {PARTY_ID(), partyId}, {REFERENCE(), reference}, {UNIT_IDENTIFIER(), unitIdentifier}, {IDENTIFIER(), identifier} }); } } // namespace TetraIcd } // namespace TrainingAreaBase