mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-02 15:15:39 +08:00
Ref T410, show number of SB4 packets received under simulator/information
This commit is contained in:
@@ -652,6 +652,9 @@ namespace BlackCore
|
||||
m_simulatorInternals.setSimulatorName(this->getSimulatorName());
|
||||
m_simulatorInternals.setSwiftPluginName(this->getSimulatorPluginInfo().toQString());
|
||||
|
||||
// model changed
|
||||
connect(this, &ISimulator::ownAircraftModelChanged, this, &ISimulator::onOwnModelChanged, Qt::QueuedConnection);
|
||||
|
||||
// info
|
||||
CLogMessage(this).info("Initialized simulator driver: '%1'") <<
|
||||
(this->getSimulatorInfo().isUnspecified() ?
|
||||
@@ -1026,6 +1029,12 @@ namespace BlackCore
|
||||
if (limited) { m_statsUpdateAircraftLimited++; }
|
||||
}
|
||||
|
||||
void ISimulator::onOwnModelChanged(const CAircraftModel &newModel)
|
||||
{
|
||||
Q_UNUSED(newModel);
|
||||
// can be overridden
|
||||
}
|
||||
|
||||
QString ISimulator::latestLoggedDataFormatted(const CCallsign &cs) const
|
||||
{
|
||||
const SituationLog s = m_interpolationLogger.getLastSituationLog(cs);
|
||||
|
||||
@@ -523,6 +523,9 @@ namespace BlackCore
|
||||
//! Update stats and flags
|
||||
void finishUpdateRemoteAircraftAndSetStatistics(qint64 startTime, bool limited = false);
|
||||
|
||||
//! Own model has been changed
|
||||
virtual void onOwnModelChanged(const BlackMisc::Simulation::CAircraftModel &newModel);
|
||||
|
||||
//! Lookup against DB data
|
||||
static BlackMisc::Simulation::CAircraftModel reverseLookupModel(const BlackMisc::Simulation::CAircraftModel &model);
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace BlackGui
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return; }
|
||||
const CSimulatorInternals internals = sGui->getIContextSimulator()->getSimulatorInternals();
|
||||
const CSimulatorInfo simulatorInfo = sGui->getIContextSimulator()->getSimulatorPluginInfo().getSimulatorInfo();
|
||||
const CSimulatorInfo simulatorInfo = sGui->getIContextSimulator()->getSimulatorPluginInfo().getSimulatorInfo();
|
||||
m_simulator = simulatorInfo;
|
||||
|
||||
const QStringList names(internals.getSortedNames());
|
||||
|
||||
@@ -22,6 +22,11 @@ namespace BlackMisc
|
||||
m_data.addOrReplaceValue(name, value);
|
||||
}
|
||||
|
||||
void CSimulatorInternals::setValue(const QString &name, int value)
|
||||
{
|
||||
this->setValue(name, QString::number(value));
|
||||
}
|
||||
|
||||
CVariant CSimulatorInternals::getVariantValue(const QString &name) const
|
||||
{
|
||||
return m_data.getVariantValue(name);
|
||||
|
||||
@@ -53,6 +53,9 @@ namespace BlackMisc
|
||||
//! Set value
|
||||
void setValue(const QString &name, const QString &value);
|
||||
|
||||
//! Set value
|
||||
void setValue(const QString &name, int value);
|
||||
|
||||
//! Get value
|
||||
CVariant getVariantValue(const QString &name) const;
|
||||
|
||||
|
||||
@@ -696,6 +696,10 @@ namespace BlackSimPlugin
|
||||
{
|
||||
this->physicallyInitAITerrainProbes(position, 2);
|
||||
}
|
||||
|
||||
// SB4 offsets
|
||||
m_simulatorInternals.setValue(QStringLiteral("fsx/sb4"), boolToEnabledDisabled(m_useSbOffsets));
|
||||
m_simulatorInternals.setValue(QStringLiteral("fsx/sb4packets"), m_useSbOffsets ? QString::number(m_sbDataReceived) : QStringLiteral("disabled"));
|
||||
}
|
||||
|
||||
m_ownAircraftUpdate++; // with 50updates/sec long enough even for 32bit
|
||||
@@ -2242,6 +2246,12 @@ namespace BlackSimPlugin
|
||||
}
|
||||
}
|
||||
|
||||
void CSimulatorFsxCommon::onOwnModelChanged(const CAircraftModel &newModel)
|
||||
{
|
||||
m_sbDataReceived = 0;
|
||||
CSimulatorFsCommon::onOwnModelChanged(newModel);
|
||||
}
|
||||
|
||||
QString CSimulatorFsxCommon::fsxPositionToString(const SIMCONNECT_DATA_INITPOSITION &position)
|
||||
{
|
||||
static const QString positionStr("Lat: %1deg lng: %2deg alt: %3ft pitch: %4deg bank: %5deg hdg: %6deg airspeed: %7kts onGround: %8");
|
||||
|
||||
@@ -178,6 +178,10 @@ namespace BlackSimPlugin
|
||||
//! Use SB offset values
|
||||
void setUsingSbOffsetValues(bool use) { m_useSbOffsets = use; }
|
||||
|
||||
//! Number of received SB4 packets
|
||||
//! \remark if this is increasing, SB4 is supported
|
||||
int receivedSB4Packets() const { return m_sbDataReceived; }
|
||||
|
||||
//! Request for sim data (request in range of sim data)?
|
||||
static bool isRequestForSimObjAircraft(DWORD requestId) { return requestId >= RequestSimObjAircraftStart && requestId <= RequestSimObjAircraftRangeEnd; }
|
||||
|
||||
@@ -217,6 +221,7 @@ namespace BlackSimPlugin
|
||||
virtual void initSimulatorInternals() override;
|
||||
virtual void injectWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid) override;
|
||||
virtual void clearAllRemoteAircraftData() override;
|
||||
virtual void onOwnModelChanged(const BlackMisc::Simulation::CAircraftModel &newModel) override;
|
||||
//! @}
|
||||
|
||||
//! Timer event (our SimConnect event loop), runs dispatch
|
||||
|
||||
Reference in New Issue
Block a user