mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-03 16:11:00 +08:00
Round trip protection as described in (4)
https://dev.vatsim-germany.org/boards/22/topics/1792?r=1801#message-1801 * Individual context id * Allows to connect >1 GUIs with core, works for cockpit so far
This commit is contained in:
@@ -201,7 +201,8 @@ void MainWindow::toggleNetworkConnection()
|
|||||||
this->m_ownAircraft.setIcaoInfo(icao);
|
this->m_ownAircraft.setIcaoInfo(icao);
|
||||||
|
|
||||||
// set latest aircraft
|
// set latest aircraft
|
||||||
this->getIContextOwnAircraft()->updateOwnAircraft(this->m_ownAircraft, MainWindow::ownAircraftContextOriginator());
|
this->getIContextOwnAircraft()->updateOwnAircraft(this->m_ownAircraft, MainWindow::sampleBlackGuiOriginator());
|
||||||
|
|
||||||
|
|
||||||
// Login is based on setting current server
|
// Login is based on setting current server
|
||||||
INetwork::LoginMode mode = INetwork::LoginNormal;
|
INetwork::LoginMode mode = INetwork::LoginNormal;
|
||||||
|
|||||||
@@ -207,9 +207,9 @@ private:
|
|||||||
void setHotkeys();
|
void setHotkeys();
|
||||||
|
|
||||||
//! Originator for aircraft context
|
//! Originator for aircraft context
|
||||||
static const QString &ownAircraftContextOriginator()
|
static const QString &sampleBlackGuiOriginator()
|
||||||
{
|
{
|
||||||
static const QString o("GUISAMPLE1");
|
static const QString o = QString("GUISAMPLE1:").append(QString::number(QDateTime::currentMSecsSinceEpoch()));
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,5 +45,5 @@ void MainWindow::setTestPosition(const QString &wgsLatitude, const QString &wgsL
|
|||||||
|
|
||||||
this->m_ownAircraft.setPosition(coordinate);
|
this->m_ownAircraft.setPosition(coordinate);
|
||||||
this->m_ownAircraft.setAltitude(altitude);
|
this->m_ownAircraft.setAltitude(altitude);
|
||||||
this->getIContextOwnAircraft()->updateOwnPosition(coordinate, altitude, MainWindow::ownAircraftContextOriginator());
|
this->getIContextOwnAircraft()->updateOwnPosition(coordinate, altitude, MainWindow::sampleBlackGuiOriginator());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,9 @@ namespace BlackCore
|
|||||||
//! Simulator
|
//! Simulator
|
||||||
IContextSimulator *getIContextSimulator();
|
IContextSimulator *getIContextSimulator();
|
||||||
|
|
||||||
|
//! Id and path name for round trip protection
|
||||||
|
virtual QString getPathAndContextId() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CContext(CRuntimeConfig::ContextMode mode, QObject *parent) :
|
CContext(CRuntimeConfig::ContextMode mode, QObject *parent) :
|
||||||
@@ -91,6 +94,15 @@ namespace BlackCore
|
|||||||
|
|
||||||
CRuntimeConfig::ContextMode m_mode; //!< How context is used
|
CRuntimeConfig::ContextMode m_mode; //!< How context is used
|
||||||
qint64 m_contextId; //!< unique identifer, avoid redirection rountrips
|
qint64 m_contextId; //!< unique identifer, avoid redirection rountrips
|
||||||
|
|
||||||
|
//! Path and context id
|
||||||
|
QString buildPathAndContextId(const QString &path) const
|
||||||
|
{
|
||||||
|
return QString(path).
|
||||||
|
append(':').
|
||||||
|
append(QString::number(this->getUniqueId()));
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
@@ -66,6 +66,9 @@ namespace BlackCore
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \copydoc CContext::getPathAndContextId()
|
||||||
|
virtual QString getPathAndContextId() const { return this->buildPathAndContextId(ObjectPath()); }
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~IContextApplication() {}
|
virtual ~IContextApplication() {}
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ namespace BlackCore
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \copydoc CContext::getPathAndContextId()
|
||||||
|
virtual QString getPathAndContextId() const { return this->buildPathAndContextId(ObjectPath()); }
|
||||||
|
|
||||||
//! \brief Destructor
|
//! \brief Destructor
|
||||||
virtual ~IContextAudio() {}
|
virtual ~IContextAudio() {}
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ namespace BlackCore
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \copydoc CContext::getPathAndContextId()
|
||||||
|
virtual QString getPathAndContextId() const { return this->buildPathAndContextId(ObjectPath()); }
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~IContextNetwork() {}
|
virtual ~IContextNetwork() {}
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,9 @@ namespace BlackCore
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \copydoc CContext::getPathAndContextId()
|
||||||
|
virtual QString getPathAndContextId() const { return this->buildPathAndContextId(ObjectPath()); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Path for network settings
|
* \brief Path for network settings
|
||||||
* \remarks no to be confused with DBus paths
|
* \remarks no to be confused with DBus paths
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ namespace BlackCore
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \copydoc CContext::getPathAndContextId()
|
||||||
|
virtual QString getPathAndContextId() const { return this->buildPathAndContextId(ObjectPath()); }
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~IContextSimulator() {}
|
virtual ~IContextSimulator() {}
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
const QString &CCockpitV1Component::cockpitOriginator()
|
const QString &CCockpitV1Component::cockpitOriginator()
|
||||||
{
|
{
|
||||||
static const QString o("cockpit v1");
|
static const QString o = QString("COCKPITV1:").append(QString::number(QDateTime::currentMSecsSinceEpoch()));
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user