mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 07:35:48 +08:00
Ref T260, changed elevation handling in provider, simulator and FSX common driver
* split functions, added findClosestElevationWithinRangeOrRequest * obtain elevation ids (separate ids are easier to track) * also added experimental "physicallyAddAITerrainProbe" (FSX) for the FSX elevation probing * callback / signal when requested elevation is received (async)
This commit is contained in:
committed by
Roland Winklmeier
parent
dcc348c9d9
commit
6061a61d50
@@ -267,6 +267,15 @@ namespace BlackSimPlugin
|
||||
return msgs;
|
||||
}
|
||||
|
||||
bool CSimulatorFsxCommon::requestElevation(const ICoordinateGeodetic &reference, const CCallsign &callsign)
|
||||
{
|
||||
Q_UNUSED(callsign);
|
||||
if (this->isShuttingDown()) { return false; }
|
||||
if (reference.isNull()) { return false; }
|
||||
this->physicallyAddAITerrainProbe(reference);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSimulatorFsxCommon::stillDisplayReceiveExceptions()
|
||||
{
|
||||
m_receiveExceptionCount++;
|
||||
@@ -359,7 +368,14 @@ namespace BlackSimPlugin
|
||||
SIMCONNECT_DATA_REQUEST_ID CSimulatorFsxCommon::obtainRequestIdForSimData()
|
||||
{
|
||||
const SIMCONNECT_DATA_REQUEST_ID id = m_requestIdSimData++;
|
||||
if (id > RequestSimDataEnd) { m_requestIdSimData = RequestSimDataStart; }
|
||||
if (id > RequestIdSimDataEnd) { m_requestIdSimData = RequestIdSimDataStart; }
|
||||
return id;
|
||||
}
|
||||
|
||||
SIMCONNECT_DATA_REQUEST_ID CSimulatorFsxCommon::obtainRequestIdForProbe()
|
||||
{
|
||||
const SIMCONNECT_DATA_REQUEST_ID id = m_requestIdProbe++;
|
||||
if (id > RequestIdTerrainProbeEnd) { m_requestIdProbe = RequestIdTerrainProbeStart; }
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -745,6 +761,7 @@ namespace BlackSimPlugin
|
||||
void CSimulatorFsxCommon::timerEvent(QTimerEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
if (this->isShuttingDown()) { return; }
|
||||
this->dispatch();
|
||||
}
|
||||
|
||||
@@ -768,6 +785,13 @@ namespace BlackSimPlugin
|
||||
CSimpleCommandParser::registerCommand({".drv sendid on|off", "Trace simConnect sendId on|off"});
|
||||
}
|
||||
|
||||
CCallsign CSimulatorFsxCommon::getCallsignForPendingProbeRequests(DWORD requestId, bool remove)
|
||||
{
|
||||
const CCallsign cs = m_pendingProbeRequests.value(requestId);
|
||||
if (remove) { m_pendingProbeRequests.remove(requestId); }
|
||||
return cs;
|
||||
}
|
||||
|
||||
const QString &CSimulatorFsxCommon::modeToString(CSimulatorFsxCommon::AircraftAddMode mode)
|
||||
{
|
||||
static const QString e("external call");
|
||||
@@ -789,7 +813,9 @@ namespace BlackSimPlugin
|
||||
|
||||
void CSimulatorFsxCommon::dispatch()
|
||||
{
|
||||
const HRESULT hr = SimConnect_CallDispatch(m_hSimConnect, SimConnectProc, this);
|
||||
// call CSimulatorFsxCommon::SimConnectProc or specialized P3D version
|
||||
Q_ASSERT_X(m_dispatchProc, Q_FUNC_INFO, "Missing DispatchProc");
|
||||
const HRESULT hr = SimConnect_CallDispatch(m_hSimConnect, m_dispatchProc, this);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
m_dispatchErrors++;
|
||||
@@ -899,6 +925,28 @@ namespace BlackSimPlugin
|
||||
return adding;
|
||||
}
|
||||
|
||||
bool CSimulatorFsxCommon::physicallyAddAITerrainProbe(const ICoordinateGeodetic &coordinate)
|
||||
{
|
||||
if (coordinate.isNull()) { return false; }
|
||||
return false;
|
||||
|
||||
// entry checks
|
||||
/**
|
||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "thread");
|
||||
|
||||
const SIMCONNECT_DATA_REQUEST_ID requestId = this->obtainRequestIdForProbe();
|
||||
const SIMCONNECT_DATA_INITPOSITION initialPosition = CSimulatorFsxCommon::coordinateToFsxPosition(coordinate);
|
||||
const HRESULT hr = SimConnect_AICreateNonATCAircraft(m_hSimConnect, qPrintable(""), qPrintable(""), initialPosition, requestId);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
const CStatusMessage msg = CStatusMessage(this).error("SimConnect, can not create terrain AI: '%1'") << requestId;
|
||||
CLogMessage::preformatted(msg);
|
||||
}
|
||||
|
||||
return hr == S_OK;
|
||||
**/
|
||||
}
|
||||
|
||||
bool CSimulatorFsxCommon::physicallyRemoveRemoteAircraft(const CCallsign &callsign)
|
||||
{
|
||||
// only remove from sim
|
||||
@@ -1278,10 +1326,7 @@ namespace BlackSimPlugin
|
||||
Q_ASSERT_X(!situation.isGeodeticHeightNull(), Q_FUNC_INFO, "Missing height");
|
||||
Q_ASSERT_X(!situation.isPositionNull(), Q_FUNC_INFO, "Missing position");
|
||||
|
||||
SIMCONNECT_DATA_INITPOSITION position;
|
||||
position.Latitude = situation.latitude().value(CAngleUnit::deg());
|
||||
position.Longitude = situation.longitude().value(CAngleUnit::deg());
|
||||
position.Altitude = situation.getAltitude().value(CLengthUnit::ft()); // already corrected in interpolator if there is an underflow
|
||||
SIMCONNECT_DATA_INITPOSITION position = CSimulatorFsxCommon::coordinateToFsxPosition(situation);
|
||||
position.Heading = situation.getHeading().value(CAngleUnit::deg());
|
||||
position.Airspeed = situation.getGroundSpeed().value(CSpeedUnit::kts());
|
||||
|
||||
@@ -1298,6 +1343,20 @@ namespace BlackSimPlugin
|
||||
return position;
|
||||
}
|
||||
|
||||
SIMCONNECT_DATA_INITPOSITION CSimulatorFsxCommon::coordinateToFsxPosition(const ICoordinateGeodetic &coordinate)
|
||||
{
|
||||
SIMCONNECT_DATA_INITPOSITION position;
|
||||
position.Latitude = coordinate.latitude().value(CAngleUnit::deg());
|
||||
position.Longitude = coordinate.longitude().value(CAngleUnit::deg());
|
||||
position.Altitude = coordinate.geodeticHeight().value(CLengthUnit::ft()); // already corrected in interpolator if there is an underflow
|
||||
position.Heading = 0;
|
||||
position.Airspeed = 0;
|
||||
position.Pitch = 0;
|
||||
position.Bank = 0;
|
||||
position.OnGround = 0;
|
||||
return position;
|
||||
}
|
||||
|
||||
void CSimulatorFsxCommon::synchronizeTime(const CTime &zuluTimeSim, const CTime &localTimeSim)
|
||||
{
|
||||
if (!m_simTimeSynced) { return; }
|
||||
@@ -1432,7 +1491,7 @@ namespace BlackSimPlugin
|
||||
m_syncDeferredCounter = 0;
|
||||
m_skipCockpitUpdateCycles = 0;
|
||||
m_interpolationRequest = 0;
|
||||
m_requestIdSimData = static_cast<SIMCONNECT_DATA_REQUEST_ID>(RequestSimDataStart);
|
||||
m_requestIdSimData = static_cast<SIMCONNECT_DATA_REQUEST_ID>(RequestIdSimDataStart);
|
||||
m_dispatchErrors = 0;
|
||||
m_receiveExceptionCount = 0;
|
||||
m_sendIdTraces.clear();
|
||||
|
||||
@@ -113,9 +113,6 @@ namespace BlackSimPlugin
|
||||
//! Destructor
|
||||
virtual ~CSimulatorFsxCommon();
|
||||
|
||||
//! SimConnect Callback
|
||||
static void CALLBACK SimConnectProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContext);
|
||||
|
||||
//! \name ISimulator implementations
|
||||
//! @{
|
||||
virtual bool connectTo() override;
|
||||
@@ -134,7 +131,13 @@ namespace BlackSimPlugin
|
||||
virtual BlackMisc::CStatusMessageList debugVerifyStateAfterAllAircraftRemoved() const override;
|
||||
//! @}
|
||||
|
||||
//! \copydoc BlackMisc::Simulation::ISimulationEnvironmentProvider::requestElevation
|
||||
virtual bool requestElevation(const BlackMisc::Geo::ICoordinateGeodetic &reference, const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
|
||||
protected:
|
||||
//! SimConnect Callback
|
||||
static void CALLBACK SimConnectProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContext);
|
||||
|
||||
//! \name Interface implementations
|
||||
//! @{
|
||||
virtual bool isConnected() const override;
|
||||
@@ -161,9 +164,31 @@ namespace BlackSimPlugin
|
||||
//! @}
|
||||
virtual bool parseDetails(const BlackMisc::CSimpleCommandParser &parser) override;
|
||||
|
||||
//! Get new request id, overflow safe
|
||||
SIMCONNECT_DATA_REQUEST_ID obtainRequestIdForSimData();
|
||||
|
||||
//! Get new request id, overflow safe
|
||||
SIMCONNECT_DATA_REQUEST_ID obtainRequestIdForProbe();
|
||||
|
||||
//! Request for sim data (request in range of sim data)?
|
||||
static bool isRequestForSimData(DWORD requestId) { return requestId >= (RequestIdSimDataStart + RequestSimDataOffset) && requestId < (RequestIdSimDataStart + RequestSimDataOffset + MaxSimObjects); }
|
||||
|
||||
//! Request for lights (request in range of lights)?
|
||||
static bool isRequestForLights(DWORD requestId) { return requestId >= (RequestIdSimDataStart + RequestLightsOffset) && requestId < (RequestIdSimDataStart + RequestLightsOffset + MaxSimObjects); }
|
||||
|
||||
//! Request for probe (elevation)?
|
||||
static bool isRequestForProbe(DWORD requestId) { return requestId >= RequestIdTerrainProbeStart && requestId <= RequestIdTerrainProbeEnd; }
|
||||
|
||||
//! Register help
|
||||
static void registerHelp();
|
||||
|
||||
//! Callsign for pending request
|
||||
BlackMisc::Aviation::CCallsign getCallsignForPendingProbeRequests(DWORD requestId, bool remove);
|
||||
|
||||
HANDLE m_hSimConnect = nullptr; //!< handle to SimConnect object
|
||||
DispatchProc m_dispatchProc = &CSimulatorFsxCommon::SimConnectProc; //!< called function for dispatch, can be overriden by specialized P3D function
|
||||
QMap<DWORD, BlackMisc::Aviation::CCallsign> m_pendingProbeRequests; //!< pending elevation requests
|
||||
|
||||
private:
|
||||
//! Reason for adding an aircraft
|
||||
enum AircraftAddMode
|
||||
@@ -182,10 +207,13 @@ namespace BlackSimPlugin
|
||||
void dispatch();
|
||||
|
||||
//! Implementation of add remote aircraft, which also handles FSX specific adding one by one
|
||||
//! \remark main purpose of this function is to only add one aircraft at a time,
|
||||
//! and only if simulator is not paused/stopped
|
||||
//! \remark main purpose of this function is to only add one aircraft at a time, and only if simulator is not paused/stopped
|
||||
bool physicallyAddRemoteAircraftImpl(const BlackMisc::Simulation::CSimulatedAircraft &newRemoteAircraft, AircraftAddMode addMode);
|
||||
|
||||
//! Add AI object for terrain probe
|
||||
//! \remark experimental
|
||||
bool physicallyAddAITerrainProbe(const BlackMisc::Geo::ICoordinateGeodetic &coordinate);
|
||||
|
||||
//! Remove aircraft no longer in provider
|
||||
//! \remark kind of cleanup function, in an ideal this should never need to cleanup something
|
||||
BlackMisc::Aviation::CCallsignSet physicallyRemoveAircraftNotInProvider();
|
||||
@@ -224,9 +252,6 @@ namespace BlackSimPlugin
|
||||
//! Simulator is going down
|
||||
void onSimExit();
|
||||
|
||||
//! Get new request id, overflow safe
|
||||
SIMCONNECT_DATA_REQUEST_ID obtainRequestIdForSimData();
|
||||
|
||||
//! Init when connected
|
||||
HRESULT initWhenConnected();
|
||||
|
||||
@@ -285,6 +310,9 @@ namespace BlackSimPlugin
|
||||
//! Format conversion
|
||||
SIMCONNECT_DATA_INITPOSITION aircraftSituationToFsxPosition(const BlackMisc::Aviation::CAircraftSituation &situation);
|
||||
|
||||
//! Format conversion
|
||||
SIMCONNECT_DATA_INITPOSITION coordinateToFsxPosition(const BlackMisc::Geo::ICoordinateGeodetic &coordinate);
|
||||
|
||||
//! Sync time with user's computer
|
||||
void synchronizeTime(const BlackMisc::PhysicalQuantities::CTime &zuluTimeSim, const BlackMisc::PhysicalQuantities::CTime &localTimeSim);
|
||||
|
||||
@@ -315,12 +343,6 @@ namespace BlackSimPlugin
|
||||
//! Insert an new SimConnect object
|
||||
CSimConnectObject insertNewSimConnectObject(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, DWORD requestId);
|
||||
|
||||
//! Request for sim data (request in range of sim data)?
|
||||
static bool isRequestForSimData(DWORD requestId) { return requestId >= (RequestSimDataStart + RequestSimDataOffset) && requestId < (RequestSimDataStart + RequestSimDataOffset + MaxSimObjects); }
|
||||
|
||||
//! Request for lights (request in range of lights)?
|
||||
static bool isRequestForLights(DWORD requestId) { return requestId >= (RequestSimDataStart + RequestLightsOffset) && requestId < (RequestSimDataStart + RequestLightsOffset + MaxSimObjects); }
|
||||
|
||||
//! Encapsulates creating QString from FSX string data
|
||||
static QString fsxCharToQString(const char *fsxChar, int size = -1);
|
||||
|
||||
@@ -329,10 +351,12 @@ namespace BlackSimPlugin
|
||||
static constexpr int IgnoreReceiveExceptions = 10; //!< skip exceptions when displayed more than x times
|
||||
static constexpr int MaxSimObjects = 10000; //!< max.number of SimObjects at the same time
|
||||
static constexpr int MaxSendIdTraces = 10000; //!< max.traces of send id
|
||||
static constexpr int RequestSimDataStart = static_cast<int>(CSimConnectDefinitions::RequestEndMarker);
|
||||
static constexpr int RequestSimDataEnd = RequestSimDataStart + MaxSimObjects - 1;
|
||||
static constexpr int RequestSimDataOffset = 0 * MaxSimObjects;
|
||||
static constexpr int RequestLightsOffset = 1 * MaxSimObjects;
|
||||
static constexpr int RequestIdSimDataStart = static_cast<int>(CSimConnectDefinitions::RequestEndMarker);
|
||||
static constexpr int RequestIdSimDataEnd = RequestIdSimDataStart + MaxSimObjects - 1;
|
||||
static constexpr int RequestSimDataOffset = 0 * MaxSimObjects; //!< range for sim data requests
|
||||
static constexpr int RequestLightsOffset = 1 * MaxSimObjects; //!< range for lights
|
||||
static constexpr int RequestIdTerrainProbeStart = 2 * MaxSimObjects + RequestIdSimDataEnd + 1; //!< range for terrain probe
|
||||
static constexpr int RequestIdTerrainProbeEnd = (RequestIdTerrainProbeStart + 1000) - 1;
|
||||
static constexpr int AddPendingAircraftIntervalMs = 20 * 1000;
|
||||
static constexpr int DispatchIntervalMs = 10; //!< how often with run the FSX event queue
|
||||
static constexpr int DeferSimulatingFlagMs = 1500; //!< simulating can jitter at startup (simulating->stopped->simulating, multiple start events), so we defer detection
|
||||
@@ -349,11 +373,11 @@ namespace BlackSimPlugin
|
||||
int m_interpolationRequest = 0; //!< current interpolation request
|
||||
int m_dispatchErrors = 0; //!< number of dispatched failed, \sa dispatch
|
||||
int m_receiveExceptionCount = 0; //!< exceptions
|
||||
HANDLE m_hSimConnect = nullptr; //!< handle to SimConnect object
|
||||
QList<TraceFsxSendId> m_sendIdTraces; //!< Send id traces for debugging
|
||||
CSimConnectObjects m_simConnectObjects; //!< AI objects and their object / request ids
|
||||
CSimConnectObjects m_simConnectObjectsPositionAndPartsTraces; //!< position/parts received, but object not yet added, excluded, disabled etc.
|
||||
SIMCONNECT_DATA_REQUEST_ID m_requestIdSimData = static_cast<SIMCONNECT_DATA_REQUEST_ID>(RequestSimDataStart); //!< request id, use obtainRequestId() to get id
|
||||
SIMCONNECT_DATA_REQUEST_ID m_requestIdSimData = static_cast<SIMCONNECT_DATA_REQUEST_ID>(RequestIdSimDataStart); //!< request id, use obtainRequestIdForSimData() to get id
|
||||
SIMCONNECT_DATA_REQUEST_ID m_requestIdProbe = static_cast<SIMCONNECT_DATA_REQUEST_ID>(RequestIdTerrainProbeStart); //!< request id, use obtainRequestIdForProbe() to get id
|
||||
BlackMisc::Simulation::CSimulatedAircraftList m_addPendingAircraft; //!< aircraft awaiting to be added
|
||||
QTimer m_addPendingAircraftTimer; //!< updating of aircraft awaiting to be added
|
||||
};
|
||||
|
||||
@@ -43,7 +43,6 @@ addStaticLibraryDependency(fsuipc)
|
||||
msvc: QMAKE_LFLAGS *= /ignore:4099
|
||||
|
||||
DISTFILES += simulatorp3d.json
|
||||
|
||||
DESTDIR = $$DestRoot/bin/plugins/simulator
|
||||
|
||||
win32 {
|
||||
|
||||
@@ -10,7 +10,10 @@
|
||||
#include "simulatorp3d.h"
|
||||
#include "blackcore/application.h"
|
||||
#include "blackmisc/threadutils.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
|
||||
using namespace BlackConfig;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
@@ -32,8 +35,96 @@ namespace BlackSimPlugin
|
||||
QObject *parent) :
|
||||
CSimulatorFsxCommon(info, ownAircraftProvider, remoteAircraftProvider, weatherGridProvider, parent)
|
||||
{
|
||||
if (CBuildConfig::isCompiledWithP3DSupport() && CBuildConfig::isRunningOnWindowsNtPlatform() && CBuildConfig::buildWordSize() == 64)
|
||||
{
|
||||
m_dispatchProc = &CSimulatorP3D::SimConnectProc;
|
||||
}
|
||||
this->setDefaultModel(CAircraftModel("LOCKHEED L049_2", CAircraftModel::TypeModelMatchingDefaultModel,
|
||||
"Constellation in TWA livery", CAircraftIcaoCode("CONI", "L4P")));
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN64
|
||||
void CSimulatorP3D::SimConnectProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContext)
|
||||
{
|
||||
CSimulatorP3D *simulatorP3D = static_cast<CSimulatorP3D *>(pContext);
|
||||
Q_ASSERT_X(simulatorP3D, Q_FUNC_INFO, "Cannot convert context to CSimulatorP3D");
|
||||
|
||||
switch (pData->dwID)
|
||||
{
|
||||
case SIMCONNECT_RECV_ID_GROUND_INFO:
|
||||
{
|
||||
// https://www.prepar3d.com/SDKv4/sdk/simconnect_api/references/structures_and_enumerations.html#SIMCONNECT_RECV_GROUND_INFO
|
||||
const SIMCONNECT_RECV_GROUND_INFO *pObjData = (SIMCONNECT_RECV_GROUND_INFO *) pData;
|
||||
const DWORD requestId = pObjData->dwRequestID;
|
||||
if (!CSimulatorFsxCommon::isRequestForProbe(requestId)) { break; }
|
||||
// valid elevation request
|
||||
// https://www.prepar3d.com/SDKv4/sdk/simconnect_api/references/structures_and_enumerations.html#SIMCONNECT_DATA_GROUND_INFO
|
||||
if (pObjData->dwArraySize != 1) { break; }
|
||||
const SIMCONNECT_DATA_GROUND_INFO gi = pObjData->rgData[0];
|
||||
if (!gi.bIsValid) { break; }
|
||||
const CLatitude lat(gi.fLat, CAngleUnit::deg());
|
||||
const CLongitude lng(gi.fLon, CAngleUnit::deg());
|
||||
const CAltitude alt(gi.fAlt, CAltitude::MeanSeaLevel, CAltitude::TrueAltitude, CLengthUnit::ft());
|
||||
const CCoordinateGeodetic coordinate(lat, lng, alt);
|
||||
const CElevationPlane ep(coordinate, CElevationPlane::singlePointRadius());
|
||||
|
||||
const CCallsign cs(simulatorP3D->getCallsignForPendingProbeRequests(requestId, true));
|
||||
simulatorP3D->callbackReceivedRequestedElevation(ep, cs);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
CSimulatorFsxCommon::SimConnectProc(pData, cbData, pContext);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// P3D version with new P3D simconnect functions
|
||||
bool CSimulatorP3D::requestElevation(const ICoordinateGeodetic &reference, const CCallsign &callsign)
|
||||
{
|
||||
if (reference.isNull()) { return false; }
|
||||
if (this->isShuttingDown()) { return false; }
|
||||
if (!this->isConnected()) { return false; }
|
||||
|
||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "thread");
|
||||
const double latDeg = reference.latitude().value(CAngleUnit::deg());
|
||||
const double lngDeg = reference.longitude().value(CAngleUnit::deg());
|
||||
const double maxAltFt = reference.geodeticHeight().value(CLengthUnit::ft());
|
||||
const DWORD dwGridWidth = 1.0;
|
||||
const DWORD dwGridHeight = 1.0;
|
||||
|
||||
const SIMCONNECT_DATA_REQUEST_ID requestId = this->obtainRequestIdForProbe();
|
||||
|
||||
// returns SIMCONNECT_RECV_GROUND_INFO -> SIMCONNECT_DATA_GROUND_INFO
|
||||
const HRESULT hr = SimConnect_RequestGroundInfo(
|
||||
m_hSimConnect, requestId, latDeg, lngDeg, 0, latDeg, lngDeg, maxAltFt,
|
||||
dwGridWidth, dwGridHeight,
|
||||
SIMCONNECT_GROUND_INFO_LATLON_FORMAT_DEGREES,
|
||||
SIMCONNECT_GROUND_INFO_ALT_FORMAT_FEET,
|
||||
SIMCONNECT_GROUND_INFO_SOURCE_FLAG_PLATFORMS);
|
||||
bool ok = false;
|
||||
if (hr == S_OK)
|
||||
{
|
||||
ok = true;
|
||||
m_pendingProbeRequests.insert(requestId, callsign);
|
||||
}
|
||||
else
|
||||
{
|
||||
const CStatusMessage msg = CStatusMessage(this).error("SimConnect, can not request ground info: '%1' '%2'") << requestId << callsign.asString();
|
||||
CLogMessage::preformatted(msg);
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
#else
|
||||
void CSimulatorP3D::SimConnectProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContext)
|
||||
{
|
||||
CSimulatorFsxCommon::SimConnectProc(pData, cbData, pContext);
|
||||
}
|
||||
|
||||
bool CSimulatorP3D::requestElevation(const ICoordinateGeodetic &reference, const CCallsign &callsign)
|
||||
{
|
||||
return CSimulatorFsxCommon::requestElevation(reference, callsign);
|
||||
}
|
||||
#endif
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -31,6 +31,13 @@ namespace BlackSimPlugin
|
||||
BlackMisc::Simulation::IRemoteAircraftProvider *remoteAircraftProvider,
|
||||
BlackMisc::Weather::IWeatherGridProvider *weatherGridProvider,
|
||||
QObject *parent = nullptr);
|
||||
|
||||
//! \copydoc BlackMisc::Simulation::ISimulationEnvironmentProvider::requestElevation
|
||||
virtual bool requestElevation(const BlackMisc::Geo::ICoordinateGeodetic &reference, const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
|
||||
protected:
|
||||
//! SimConnect Callback
|
||||
static void CALLBACK SimConnectProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContext);
|
||||
};
|
||||
|
||||
//! Listener for P3D
|
||||
|
||||
@@ -114,10 +114,10 @@ namespace BlackSimPlugin
|
||||
m_watcher = nullptr;
|
||||
}
|
||||
|
||||
bool CSimulatorXPlane::requestElevation(const Geo::ICoordinateGeodetic &reference) const
|
||||
bool CSimulatorXPlane::requestElevation(const ICoordinateGeodetic &reference, const CCallsign &callsign)
|
||||
{
|
||||
//! \todo KB 2018-04 implement a function fetching the probe value (async) and write it back to provider
|
||||
return ISimulator::requestElevation(reference);
|
||||
return ISimulator::requestElevation(reference, callsign);
|
||||
}
|
||||
|
||||
// convert xplane squawk mode to swift squawk mode
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace BlackSimPlugin
|
||||
//! @}
|
||||
|
||||
//! \copydoc BlackMisc::Simulation::ISimulationEnvironmentProvider::requestElevation
|
||||
virtual bool requestElevation(const BlackMisc::Geo::ICoordinateGeodetic &reference) const override;
|
||||
virtual bool requestElevation(const BlackMisc::Geo::ICoordinateGeodetic &reference, const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
|
||||
//! Creates an appropriate dbus connection from the string describing it
|
||||
static QDBusConnection connectionFromString(const QString &str);
|
||||
|
||||
Reference in New Issue
Block a user