mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +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.setSimulatorName(this->getSimulatorName());
|
||||||
m_simulatorInternals.setSwiftPluginName(this->getSimulatorPluginInfo().toQString());
|
m_simulatorInternals.setSwiftPluginName(this->getSimulatorPluginInfo().toQString());
|
||||||
|
|
||||||
|
// model changed
|
||||||
|
connect(this, &ISimulator::ownAircraftModelChanged, this, &ISimulator::onOwnModelChanged, Qt::QueuedConnection);
|
||||||
|
|
||||||
// info
|
// info
|
||||||
CLogMessage(this).info("Initialized simulator driver: '%1'") <<
|
CLogMessage(this).info("Initialized simulator driver: '%1'") <<
|
||||||
(this->getSimulatorInfo().isUnspecified() ?
|
(this->getSimulatorInfo().isUnspecified() ?
|
||||||
@@ -1026,6 +1029,12 @@ namespace BlackCore
|
|||||||
if (limited) { m_statsUpdateAircraftLimited++; }
|
if (limited) { m_statsUpdateAircraftLimited++; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ISimulator::onOwnModelChanged(const CAircraftModel &newModel)
|
||||||
|
{
|
||||||
|
Q_UNUSED(newModel);
|
||||||
|
// can be overridden
|
||||||
|
}
|
||||||
|
|
||||||
QString ISimulator::latestLoggedDataFormatted(const CCallsign &cs) const
|
QString ISimulator::latestLoggedDataFormatted(const CCallsign &cs) const
|
||||||
{
|
{
|
||||||
const SituationLog s = m_interpolationLogger.getLastSituationLog(cs);
|
const SituationLog s = m_interpolationLogger.getLastSituationLog(cs);
|
||||||
|
|||||||
@@ -523,6 +523,9 @@ namespace BlackCore
|
|||||||
//! Update stats and flags
|
//! Update stats and flags
|
||||||
void finishUpdateRemoteAircraftAndSetStatistics(qint64 startTime, bool limited = false);
|
void finishUpdateRemoteAircraftAndSetStatistics(qint64 startTime, bool limited = false);
|
||||||
|
|
||||||
|
//! Own model has been changed
|
||||||
|
virtual void onOwnModelChanged(const BlackMisc::Simulation::CAircraftModel &newModel);
|
||||||
|
|
||||||
//! Lookup against DB data
|
//! Lookup against DB data
|
||||||
static BlackMisc::Simulation::CAircraftModel reverseLookupModel(const BlackMisc::Simulation::CAircraftModel &model);
|
static BlackMisc::Simulation::CAircraftModel reverseLookupModel(const BlackMisc::Simulation::CAircraftModel &model);
|
||||||
|
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return; }
|
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return; }
|
||||||
const CSimulatorInternals internals = sGui->getIContextSimulator()->getSimulatorInternals();
|
const CSimulatorInternals internals = sGui->getIContextSimulator()->getSimulatorInternals();
|
||||||
const CSimulatorInfo simulatorInfo = sGui->getIContextSimulator()->getSimulatorPluginInfo().getSimulatorInfo();
|
const CSimulatorInfo simulatorInfo = sGui->getIContextSimulator()->getSimulatorPluginInfo().getSimulatorInfo();
|
||||||
m_simulator = simulatorInfo;
|
m_simulator = simulatorInfo;
|
||||||
|
|
||||||
const QStringList names(internals.getSortedNames());
|
const QStringList names(internals.getSortedNames());
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ namespace BlackMisc
|
|||||||
m_data.addOrReplaceValue(name, value);
|
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
|
CVariant CSimulatorInternals::getVariantValue(const QString &name) const
|
||||||
{
|
{
|
||||||
return m_data.getVariantValue(name);
|
return m_data.getVariantValue(name);
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ namespace BlackMisc
|
|||||||
//! Set value
|
//! Set value
|
||||||
void setValue(const QString &name, const QString &value);
|
void setValue(const QString &name, const QString &value);
|
||||||
|
|
||||||
|
//! Set value
|
||||||
|
void setValue(const QString &name, int value);
|
||||||
|
|
||||||
//! Get value
|
//! Get value
|
||||||
CVariant getVariantValue(const QString &name) const;
|
CVariant getVariantValue(const QString &name) const;
|
||||||
|
|
||||||
|
|||||||
@@ -696,6 +696,10 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
this->physicallyInitAITerrainProbes(position, 2);
|
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
|
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)
|
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");
|
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
|
//! Use SB offset values
|
||||||
void setUsingSbOffsetValues(bool use) { m_useSbOffsets = use; }
|
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)?
|
//! Request for sim data (request in range of sim data)?
|
||||||
static bool isRequestForSimObjAircraft(DWORD requestId) { return requestId >= RequestSimObjAircraftStart && requestId <= RequestSimObjAircraftRangeEnd; }
|
static bool isRequestForSimObjAircraft(DWORD requestId) { return requestId >= RequestSimObjAircraftStart && requestId <= RequestSimObjAircraftRangeEnd; }
|
||||||
|
|
||||||
@@ -217,6 +221,7 @@ namespace BlackSimPlugin
|
|||||||
virtual void initSimulatorInternals() override;
|
virtual void initSimulatorInternals() override;
|
||||||
virtual void injectWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid) override;
|
virtual void injectWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid) override;
|
||||||
virtual void clearAllRemoteAircraftData() override;
|
virtual void clearAllRemoteAircraftData() override;
|
||||||
|
virtual void onOwnModelChanged(const BlackMisc::Simulation::CAircraftModel &newModel) override;
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
//! Timer event (our SimConnect event loop), runs dispatch
|
//! Timer event (our SimConnect event loop), runs dispatch
|
||||||
|
|||||||
Reference in New Issue
Block a user