Ref T260, adjusted context/remote provider

* signal from simulator -> context
* return number of updated situations
This commit is contained in:
Klaus Basan
2018-04-14 06:56:01 +02:00
committed by Roland Winklmeier
parent b706a4adbe
commit e97de13545
6 changed files with 38 additions and 23 deletions

View File

@@ -337,26 +337,26 @@ namespace BlackMisc
return c > 0;
}
bool CRemoteAircraftProvider::updateAircraftGroundElevation(const CCallsign &callsign, const CElevationPlane &elevation)
int CRemoteAircraftProvider::updateAircraftGroundElevation(const CCallsign &callsign, const CElevationPlane &elevation)
{
if (!this->isAircraftInRange(callsign)) { return false; }
if (!this->isAircraftInRange(callsign)) { return 0; }
// update aircraft situation
CAircraftSituationList situations = this->remoteAircraftSituations(callsign);
const int updated = situations.setGroundElevationChecked(elevation);
if (updated < 1) { return false; }
const qint64 ts = QDateTime::currentMSecsSinceEpoch();
int updated = 0;
{
QWriteLocker l(&m_lockSituations);
m_situationsByCallsign[callsign] = situations;
updated = m_situationsByCallsign[callsign].setGroundElevationChecked(elevation);
if (updated < 1) { return 0; }
m_situationsLastModified[callsign] = ts;
}
// aircraft updates
QWriteLocker l(&m_lockAircraft);
const int c = m_aircraftInRange.setGroundElevationChecked(callsign, elevation);
return c > 0;
Q_UNUSED(c); // just for info, expect 1
return updated; // updated situations
}
void CRemoteAircraftProvider::updateMarkAllAsNotRendered()
@@ -608,7 +608,7 @@ namespace BlackMisc
return this->provider()->updateAircraftRendered(callsign, rendered);
}
bool CRemoteAircraftAware::updateAircraftGroundElevation(const CCallsign &callsign, const CElevationPlane &elevation)
int CRemoteAircraftAware::updateAircraftGroundElevation(const CCallsign &callsign, const CElevationPlane &elevation)
{
Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
return this->provider()->updateAircraftGroundElevation(callsign, elevation);

View File

@@ -147,7 +147,7 @@ namespace BlackMisc
//! Ground elevation of aircraft
//! \threadsafe
virtual bool updateAircraftGroundElevation(const Aviation::CCallsign &callsign, const Geo::CElevationPlane &elevation) = 0;
virtual int updateAircraftGroundElevation(const Aviation::CCallsign &callsign, const Geo::CElevationPlane &elevation) = 0;
//! Get reverse lookup meesages
//! \threadsafe
@@ -252,7 +252,7 @@ namespace BlackMisc
virtual bool updateAircraftNetworkModel(const Aviation::CCallsign &callsign, const CAircraftModel &model, const CIdentifier &originator) override;
virtual bool updateFastPositionEnabled(const Aviation::CCallsign &callsign, bool enableFastPositonUpdates) override;
virtual bool updateAircraftRendered(const Aviation::CCallsign &callsign, bool rendered) override;
virtual bool updateAircraftGroundElevation(const Aviation::CCallsign &callsign, const Geo::CElevationPlane &elevation) override;
virtual int updateAircraftGroundElevation(const Aviation::CCallsign &callsign, const Geo::CElevationPlane &elevation) override;
virtual void updateMarkAllAsNotRendered() override;
virtual CStatusMessageList getAircraftPartsHistory(const Aviation::CCallsign &callsign) const override;
virtual bool isAircraftPartsHistoryEnabled() const override;
@@ -443,7 +443,7 @@ namespace BlackMisc
bool updateAircraftRendered(const Aviation::CCallsign &callsign, bool rendered);
//! \copydoc IRemoteAircraftProvider::updateAircraftGroundElevation
bool updateAircraftGroundElevation(const Aviation::CCallsign &callsign, const Geo::CElevationPlane &elevation);
int updateAircraftGroundElevation(const Aviation::CCallsign &callsign, const Geo::CElevationPlane &elevation);
//! \copydoc IRemoteAircraftProvider::updateMarkAllAsNotRendered
void updateMarkAllAsNotRendered();