mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
Ref T554, collect auto-publish data in simulator
This commit is contained in:
committed by
Mat Sutcliffe
parent
3023b0152f
commit
961afa531b
@@ -450,7 +450,7 @@ namespace BlackCore
|
||||
const CCallsign cs(parser.part(2));
|
||||
const bool changed = this->setInterpolationMode(part1, cs);
|
||||
CLogMessage(this).info(changed ? QStringLiteral("Changed interpolation mode for '%1'")
|
||||
: QStringLiteral("Unchanged interpolation mode for '%1'")) << cs.asString();
|
||||
: QStringLiteral("Unchanged interpolation mode for '%1'")) << cs.asString();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -459,7 +459,7 @@ namespace BlackCore
|
||||
const bool changed = setup.setInterpolatorMode(part1);
|
||||
if (changed) { this->setInterpolationSetupGlobal(setup); }
|
||||
CLogMessage(this).info(changed ? QStringLiteral("Changed interpolation mode globally")
|
||||
: QStringLiteral("Unchanged interpolation mode"));
|
||||
: QStringLiteral("Unchanged interpolation mode"));
|
||||
return true;
|
||||
}
|
||||
} // spline/linear
|
||||
@@ -793,7 +793,14 @@ namespace BlackCore
|
||||
this->setMaxElevationsRemembered(aircraftCount * 3); // at least 3 elevations per aircraft, even better as not all are requesting elevations
|
||||
this->rememberGroundElevation(callsign, elevation);
|
||||
}
|
||||
if (!cg.isNull() && !this->hasSameCG(cg, callsign)) { this->insertCG(cg, modelString, callsign); }
|
||||
if (!cg.isNull() && !this->hasSameCG(cg, callsign))
|
||||
{
|
||||
this->insertCG(cg, modelString, callsign);
|
||||
|
||||
// here we know we have a valid model and CG
|
||||
m_autoPublishing.insert(modelString, cg);
|
||||
m_autoPublishing.insert(modelString, this->getSimulatorInfo());
|
||||
}
|
||||
}
|
||||
|
||||
void ISimulator::emitSimulatorCombinedStatus(SimulatorStatus oldStatus)
|
||||
@@ -927,6 +934,8 @@ namespace BlackCore
|
||||
void ISimulator::unload()
|
||||
{
|
||||
this->disconnectFrom(); // disconnect from simulator
|
||||
m_autoPublishing.writeJsonToFile();
|
||||
m_autoPublishing.clear();
|
||||
m_remoteAircraftProviderConnections.disconnectAll(); // disconnect signals from provider
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "blackmisc/simulation/remoteaircraftprovider.h"
|
||||
#include "blackmisc/simulation/simulationenvironmentprovider.h"
|
||||
#include "blackmisc/simulation/interpolationsetupprovider.h"
|
||||
#include "blackmisc/simulation/autopublishdata.h"
|
||||
#include "blackmisc/aviation/airportlist.h"
|
||||
#include "blackmisc/aviation/callsignset.h"
|
||||
#include "blackmisc/network/clientprovider.h"
|
||||
@@ -282,6 +283,9 @@ namespace BlackCore
|
||||
//! Interpolation messages for callsign
|
||||
virtual BlackMisc::CStatusMessageList getInterpolationMessages(const BlackMisc::Aviation::CCallsign &callsign) const = 0;
|
||||
|
||||
//! Get the data for auto publishing
|
||||
const BlackMisc::Simulation::CAutoPublishData &getPublishData() const { return m_autoPublishing; }
|
||||
|
||||
//! Counter added aircraft
|
||||
int getStatisticsPhysicallyAddedAircraft() const { return m_statsPhysicallyAddedAircraft; }
|
||||
|
||||
@@ -423,7 +427,7 @@ namespace BlackCore
|
||||
//! \sa ISimulator::clearAllRemoteAircraftData
|
||||
virtual int physicallyRemoveAllRemoteAircraft();
|
||||
|
||||
//! Set elevation and CG in the providers
|
||||
//! Set elevation and CG in the providers and for auto publishing
|
||||
void rememberElevationAndCG(const BlackMisc::Aviation::CCallsign &callsign, const QString &modelString, const BlackMisc::Geo::CElevationPlane &elevation, const BlackMisc::PhysicalQuantities::CLength &cg);
|
||||
|
||||
//! Emit the combined status
|
||||
@@ -546,6 +550,7 @@ namespace BlackCore
|
||||
|
||||
BlackMisc::Simulation::CSimulatorInternals m_simulatorInternals; //!< setup object
|
||||
BlackMisc::Simulation::CInterpolationLogger m_interpolationLogger; //!< log.interpolation
|
||||
BlackMisc::Simulation::CAutoPublishData m_autoPublishing; //!< for the DB
|
||||
BlackMisc::Aviation::CAircraftSituationPerCallsign m_lastSentSituations; //!< last situations sent to simulator
|
||||
BlackMisc::Aviation::CAircraftPartsPerCallsign m_lastSentParts; //!< last parts sent to simulator
|
||||
|
||||
|
||||
Reference in New Issue
Block a user