Ref T167, allow to re-init facade

(a first approach to reconnect with DBus core)

* Changes are supposed to be backward compliant. Maybe re-init fails, but there should be no regression for the 1st init
* keep config as member to allow restart
* disconnect from DBus before connecting (allows reconnect)
* delete contexts if they are re-created
* function CCoreFacade::tryToReconnectWithDBus
This commit is contained in:
Klaus Basan
2017-09-28 21:08:28 +02:00
committed by Mathew Sutcliffe
parent 9748b5a442
commit ed51d3c5dd
2 changed files with 41 additions and 21 deletions

View File

@@ -12,6 +12,7 @@
#ifndef BLACKCORE_COREFACADE_H
#define BLACKCORE_COREFACADE_H
#include "corefacadeconfig.h"
#include "blackcore/blackcoreexport.h"
#include "blackcore/data/launchersetup.h"
#include "blackcore/vatsim/vatsimsettings.h"
@@ -24,12 +25,8 @@
#include <QString>
namespace BlackMisc { class CDBusServer; }
namespace BlackCore
{
// forward declaration, see review
// https://dev.vatsim-germany.org/boards/22/topics/1350?r=1359#message-1359
class CCoreFacadeConfig;
namespace Context
{
class CContextApplication;
@@ -66,6 +63,9 @@ namespace BlackCore
//! DBus server (if applicable)
const BlackMisc::CDBusServer *getDBusServer() const { return this->m_dbusServer; }
//! In case connection between DBus parties is lost, try to reconnect
bool tryToReconnectWithDBus();
//! DBus connection (if applicable)
const QDBusConnection &getDBusConnection() const { return this->m_dbusConnection; }
@@ -150,7 +150,7 @@ namespace BlackCore
const Context::CContextSimulator *getCContextSimulator() const;
//! Init
void init(const CCoreFacadeConfig &config);
void init();
//! Remote application context, indicates distributed environment
bool hasRemoteApplicationContext() const;
@@ -165,7 +165,8 @@ namespace BlackCore
private:
bool m_initalized = false; //!< flag if already initialized
bool m_shuttingDown = false; //!< flag if shutting down
BlackMisc::CData<Data::TLauncherSetup> m_launcherSetup { this };
const CCoreFacadeConfig m_config; //!< used config
BlackMisc::CData<Data::TLauncherSetup> m_launcherSetup { this }; //!< updating DBus
// DBus
BlackMisc::CDBusServer *m_dbusServer = nullptr;