mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 18:55:38 +08:00
refs #250, helper methods
* in aircraft class to compare COM * in context / runtime component to check vitality of core
This commit is contained in:
@@ -398,6 +398,20 @@ namespace BlackCore
|
|||||||
m_init = true;
|
m_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CRuntime::hasRemoteApplicationContext() const
|
||||||
|
{
|
||||||
|
Q_ASSERT(this->m_contextApplication);
|
||||||
|
return !this->m_contextApplication->usingLocalObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRuntime::canPingApplicationContext() const
|
||||||
|
{
|
||||||
|
Q_ASSERT(this->m_contextApplication);
|
||||||
|
if (this->m_contextApplication->usingLocalObjects()) return true;
|
||||||
|
qint64 token = QDateTime::currentMSecsSinceEpoch();
|
||||||
|
return (token == this->m_contextApplication->ping(token));
|
||||||
|
}
|
||||||
|
|
||||||
void CRuntime::initDBusServer(const QString &dBusAddress)
|
void CRuntime::initDBusServer(const QString &dBusAddress)
|
||||||
{
|
{
|
||||||
if (this->m_dbusServer) return;
|
if (this->m_dbusServer) return;
|
||||||
|
|||||||
@@ -187,6 +187,11 @@ namespace BlackCore
|
|||||||
//! Init
|
//! Init
|
||||||
void init(const CRuntimeConfig &config);
|
void init(const CRuntimeConfig &config);
|
||||||
|
|
||||||
|
//! Remote application context, indicates distributed environment
|
||||||
|
bool hasRemoteApplicationContext() const;
|
||||||
|
|
||||||
|
//! Is application context available?
|
||||||
|
bool canPingApplicationContext() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_init; /*!< flag */
|
bool m_init; /*!< flag */
|
||||||
|
|||||||
@@ -88,6 +88,12 @@ namespace BlackGui
|
|||||||
//! \remarks use this methods to hook up signal/slots with runtime
|
//! \remarks use this methods to hook up signal/slots with runtime
|
||||||
virtual void runtimeHasBeenSet() {}
|
virtual void runtimeHasBeenSet() {}
|
||||||
|
|
||||||
|
//! \copydoc CRuntime::hasRemoteApplicationContext
|
||||||
|
bool hasRemoteApplicationContext() const { return this->m_runtime->hasRemoteApplicationContext(); }
|
||||||
|
|
||||||
|
//! \copydoc CRuntime::canPingApplicationContext
|
||||||
|
bool canPingApplicationContext() const { return this->m_runtime->canPingApplicationContext(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BlackCore::CRuntime *m_runtime;
|
BlackCore::CRuntime *m_runtime;
|
||||||
bool m_runtimeOwner;
|
bool m_runtimeOwner;
|
||||||
|
|||||||
@@ -55,6 +55,14 @@ namespace BlackMisc
|
|||||||
return this->m_distanceToPlane;
|
return this->m_distanceToPlane;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Same COM system data
|
||||||
|
*/
|
||||||
|
bool CAircraft::hasSameComData(const CComSystem &com1, const CComSystem &com2, const CTransponder &transponder)
|
||||||
|
{
|
||||||
|
return this->getCom1System() == com1 && this->getCom2System() == com2 && this->getTransponder() == transponder;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Valid for login
|
* Valid for login
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -138,6 +138,9 @@ namespace BlackMisc
|
|||||||
//! \brief Set COM2 system
|
//! \brief Set COM2 system
|
||||||
void setCom2System(const CComSystem &comSystem) { this->m_com2system = comSystem; }
|
void setCom2System(const CComSystem &comSystem) { this->m_com2system = comSystem; }
|
||||||
|
|
||||||
|
//! Identical COM system?
|
||||||
|
bool hasSameComData(const CComSystem &com1, const CComSystem &com2, const CTransponder &transponder);
|
||||||
|
|
||||||
//! \brief Is any (COM1/2) active frequency within 8.3383kHz channel?
|
//! \brief Is any (COM1/2) active frequency within 8.3383kHz channel?
|
||||||
bool isActiveFrequencyWithin8_33kHzChannel(const BlackMisc::PhysicalQuantities::CFrequency &comFrequency) const
|
bool isActiveFrequencyWithin8_33kHzChannel(const BlackMisc::PhysicalQuantities::CFrequency &comFrequency) const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user