mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-24 09:54:16 +08:00
refs #324 Remove timeout implementation from MSFS plugins
This commit is contained in:
@@ -94,12 +94,6 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
QMutexLocker locker(&m_mutexInterpolator);
|
QMutexLocker locker(&m_mutexInterpolator);
|
||||||
|
|
||||||
if (m_interpolator.getTimeOfLastReceivedSituation().secsTo(QDateTime::currentDateTimeUtc()) > 15)
|
|
||||||
{
|
|
||||||
emit clientTimedOut(m_callsign);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_interpolator.hasEnoughAircraftSituations())
|
if (m_interpolator.hasEnoughAircraftSituations())
|
||||||
{
|
{
|
||||||
CAircraftSituation situation = m_interpolator.getCurrentSituation();
|
CAircraftSituation situation = m_interpolator.getCurrentSituation();
|
||||||
|
|||||||
@@ -65,9 +65,6 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
//! Client timed out
|
|
||||||
void clientTimedOut(const QString &callsign);
|
|
||||||
|
|
||||||
//! Client status changed
|
//! Client status changed
|
||||||
void statusChanged(const QString &callsign, BlackSimPlugin::Fs9::CFs9Client::ClientStatus);
|
void statusChanged(const QString &callsign, BlackSimPlugin::Fs9::CFs9Client::ClientStatus);
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,6 @@ namespace BlackSimPlugin
|
|||||||
client->moveToThread(clientThread);
|
client->moveToThread(clientThread);
|
||||||
|
|
||||||
connect(clientThread, &QThread::started, client, &CFs9Client::init);
|
connect(clientThread, &QThread::started, client, &CFs9Client::init);
|
||||||
connect(client, &CFs9Client::clientTimedOut, this, &CSimulatorFs9::ps_removeAircraft);
|
|
||||||
connect(client, &CFs9Client::statusChanged, this, &CSimulatorFs9::ps_changeClientStatus);
|
connect(client, &CFs9Client::statusChanged, this, &CSimulatorFs9::ps_changeClientStatus);
|
||||||
m_fs9ClientThreads.insert(client, clientThread);
|
m_fs9ClientThreads.insert(client, clientThread);
|
||||||
m_hashFs9Clients.insert(callsign, client);
|
m_hashFs9Clients.insert(callsign, client);
|
||||||
@@ -155,7 +154,12 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
void CSimulatorFs9::removeRemoteAircraft(const CCallsign &callsign)
|
void CSimulatorFs9::removeRemoteAircraft(const CCallsign &callsign)
|
||||||
{
|
{
|
||||||
ps_removeAircraft(callsign.toQString());
|
if(!m_hashFs9Clients.contains(callsign)) return;
|
||||||
|
|
||||||
|
CFs9Client *fs9Client = m_hashFs9Clients.value(callsign);
|
||||||
|
|
||||||
|
// Send an async disconnect signal. When finished we will clean up
|
||||||
|
QMetaObject::invokeMethod(fs9Client, "disconnectFrom");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSimulatorFs9::updateOwnSimulatorCockpit(const CAircraft &ownAircraft)
|
bool CSimulatorFs9::updateOwnSimulatorCockpit(const CAircraft &ownAircraft)
|
||||||
@@ -342,16 +346,6 @@ namespace BlackSimPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorFs9::ps_removeAircraft(const QString &callsign)
|
|
||||||
{
|
|
||||||
if(!m_hashFs9Clients.contains(callsign)) return;
|
|
||||||
|
|
||||||
CFs9Client *fs9Client = m_hashFs9Clients.value(callsign);
|
|
||||||
|
|
||||||
// Send an async disconnect signal. When finished we will clean up
|
|
||||||
QMetaObject::invokeMethod(fs9Client, "disconnectFrom");
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSimulatorFs9::updateOwnAircraftFromSim(const CAircraft &ownAircraft)
|
void CSimulatorFs9::updateOwnAircraftFromSim(const CAircraft &ownAircraft)
|
||||||
{
|
{
|
||||||
m_ownAircraft.setCom1System(ownAircraft.getCom1System());
|
m_ownAircraft.setCom1System(ownAircraft.getCom1System());
|
||||||
|
|||||||
@@ -140,9 +140,6 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
void ps_changeClientStatus(const QString &callsign, BlackSimPlugin::Fs9::CFs9Client::ClientStatus status);
|
void ps_changeClientStatus(const QString &callsign, BlackSimPlugin::Fs9::CFs9Client::ClientStatus status);
|
||||||
|
|
||||||
//! Remove client by callsign QString
|
|
||||||
void ps_removeAircraft(const QString &callsign);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//! Called when data about our own aircraft are received
|
//! Called when data about our own aircraft are received
|
||||||
|
|||||||
@@ -482,12 +482,6 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
foreach(CSimConnectObject simObj, m_simConnectObjects)
|
foreach(CSimConnectObject simObj, m_simConnectObjects)
|
||||||
{
|
{
|
||||||
if (simObj.getInterpolator()->getTimeOfLastReceivedSituation().secsTo(QDateTime::currentDateTimeUtc()) > 15)
|
|
||||||
{
|
|
||||||
removeRemoteAircraft(simObj);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (simObj.getInterpolator()->hasEnoughAircraftSituations())
|
if (simObj.getInterpolator()->hasEnoughAircraftSituations())
|
||||||
{
|
{
|
||||||
SIMCONNECT_DATA_INITPOSITION position;
|
SIMCONNECT_DATA_INITPOSITION position;
|
||||||
|
|||||||
Reference in New Issue
Block a user