mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
Hint for simulator if network is connected (slightly related T307)
This commit is contained in:
@@ -414,6 +414,12 @@ namespace BlackCore
|
||||
|
||||
// try to connect to simulator
|
||||
const bool connected = simulator->connectTo();
|
||||
if (!connected)
|
||||
{
|
||||
CLogMessage(this).error("Simulator plugin connection to simulator '%1' failed") << simulatorPluginInfo.toQString(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
simulator->setWeatherActivated(m_isWeatherActivated);
|
||||
|
||||
// when everything is set up connected, update the current plugin info
|
||||
@@ -626,6 +632,10 @@ namespace BlackCore
|
||||
if (to == INetwork::Connected && this->getIContextNetwork())
|
||||
{
|
||||
m_networkSessionId = this->getIContextNetwork()->getConnectedServer().getServerSessionId();
|
||||
if (m_simulatorPlugin.second) // check in case the plugin has been unloaded
|
||||
{
|
||||
m_simulatorPlugin.second->setFlightNetworkConnected(true);
|
||||
}
|
||||
}
|
||||
else if (INetwork::isDisconnectedStatus(to))
|
||||
{
|
||||
@@ -637,6 +647,7 @@ namespace BlackCore
|
||||
{
|
||||
const CStatusMessageList verifyMessages = m_simulatorPlugin.second->debugVerifyStateAfterAllAircraftRemoved();
|
||||
m_simulatorPlugin.second->clearAllRemoteAircraftData();
|
||||
m_simulatorPlugin.second->setFlightNetworkConnected(false);
|
||||
if (!verifyMessages.isEmpty()) { emit this->driverMessages(verifyMessages); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +123,11 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
void ISimulator::setFlightNetworkConnected(bool connected)
|
||||
{
|
||||
m_networkConnected = connected;
|
||||
}
|
||||
|
||||
void ISimulator::reloadWeatherSettings()
|
||||
{
|
||||
if (!m_isWeatherActivated) { return; }
|
||||
|
||||
@@ -169,6 +169,14 @@ namespace BlackCore
|
||||
//! Activates or deactivates simulator weather
|
||||
virtual void setWeatherActivated(bool activated);
|
||||
|
||||
//! Flight network has been connected
|
||||
//! \remark hint if network connected and we expect any planes
|
||||
//! \sa ISimulator::isFlightNetworkConnected
|
||||
virtual void setFlightNetworkConnected(bool connected);
|
||||
|
||||
//! Is the flight network connected
|
||||
bool isFlightNetworkConnected() const { return m_networkConnected; }
|
||||
|
||||
//! Reload weather settings
|
||||
void reloadWeatherSettings();
|
||||
|
||||
@@ -538,18 +546,24 @@ namespace BlackCore
|
||||
//! Display a logged situation in simulator
|
||||
void displayLoggedSituationInSimulator(const BlackMisc::Aviation::CCallsign &cs, bool stopLogging, int times = 40);
|
||||
|
||||
bool m_blinkCycle = false; //!< used for highlighting
|
||||
qint64 m_highlightEndTimeMsEpoch = 0; //!< end highlighting
|
||||
int m_timerCounter = 0; //!< allows to calculate n seconds
|
||||
QTimer m_oneSecondTimer; //!< multi purpose timer with 1 sec. interval
|
||||
BlackMisc::Aviation::CCallsignSet m_callsignsToBeRendered; //!< callsigns which will be rendered
|
||||
BlackMisc::CConnectionGuard m_remoteAircraftProviderConnections; //!< connected signal/slots
|
||||
BlackMisc::Simulation::CSimulatedAircraftList m_highlightedAircraft; //!< all other aircraft are to be ignored
|
||||
|
||||
// statistics values of how often those functions are called
|
||||
// those are the added counters, overflow will not be an issue here (discussed in T171 review)
|
||||
int m_statsPhysicallyAddedAircraft = 0; //!< statistics, how many aircraft added
|
||||
int m_statsPhysicallyRemovedAircraft = 0; //!< statistics, how many aircraft removed
|
||||
|
||||
// highlighting
|
||||
bool m_blinkCycle = false; //!< used for highlighting
|
||||
qint64 m_highlightEndTimeMsEpoch = 0; //!< end highlighting
|
||||
BlackMisc::Simulation::CSimulatedAircraftList m_highlightedAircraft; //!< all other aircraft are to be ignored
|
||||
|
||||
// timer
|
||||
int m_timerCounter = 0; //!< allows to calculate n seconds
|
||||
QTimer m_oneSecondTimer; //!< multi purpose timer with 1 sec. interval
|
||||
|
||||
// misc. as callsigns
|
||||
bool m_networkConnected = false; //!< flight network connected
|
||||
BlackMisc::Aviation::CCallsignSet m_callsignsToBeRendered; //!< callsigns which will be rendered
|
||||
BlackMisc::CConnectionGuard m_remoteAircraftProviderConnections; //!< connected signal/slots
|
||||
};
|
||||
|
||||
//! \brief Interface to a simulator listener.
|
||||
|
||||
@@ -343,6 +343,17 @@ namespace BlackSimPlugin
|
||||
CSimulatorPluginCommon::resetAircraftStatistics();
|
||||
}
|
||||
|
||||
void CSimulatorFsxCommon::setFlightNetworkConnected(bool connected)
|
||||
{
|
||||
if (connected == !this->isFlightNetworkConnected())
|
||||
{
|
||||
// toggling, we trace for a while to better monitor those "critical" phases
|
||||
this->triggerAutoTraceSendId();
|
||||
}
|
||||
|
||||
ISimulator::setFlightNetworkConnected(connected);
|
||||
}
|
||||
|
||||
CSimConnectDefinitions::SimObjectRequest CSimulatorFsxCommon::requestToSimObjectRequest(DWORD requestId)
|
||||
{
|
||||
DWORD v = static_cast<DWORD>(CSimConnectDefinitions::SimObjectEndMarker);
|
||||
|
||||
@@ -132,6 +132,7 @@ namespace BlackSimPlugin
|
||||
virtual BlackMisc::CStatusMessageList debugVerifyStateAfterAllAircraftRemoved() const override;
|
||||
virtual QString getStatisticsSimulatorSpecific() const override;
|
||||
virtual void resetAircraftStatistics() override;
|
||||
virtual void setFlightNetworkConnected(bool connected) override;
|
||||
//! @}
|
||||
|
||||
//! \copydoc BlackMisc::Simulation::ISimulationEnvironmentProvider::requestElevation
|
||||
|
||||
Reference in New Issue
Block a user