From 7a70b6939a3988e05f9f186b31864383a0089ff2 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sat, 12 Apr 2014 02:52:05 +0200 Subject: [PATCH] refs #205, added DBus address for bootstrapping --- src/blackcore/context_runtime_config.h | 31 ++++++++++++++++---------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/blackcore/context_runtime_config.h b/src/blackcore/context_runtime_config.h index bf81c5ef3..936a7230e 100644 --- a/src/blackcore/context_runtime_config.h +++ b/src/blackcore/context_runtime_config.h @@ -1,6 +1,8 @@ #ifndef BLACKCORE_CONTEXT_RUNTIME_CONFIG_H #define BLACKCORE_CONTEXT_RUNTIME_CONFIG_H +#include + namespace BlackCore { //! Helper to correctly run a context @@ -23,17 +25,17 @@ namespace BlackCore ContextMode m_network; ContextMode m_simulator; ContextMode m_application; + QString m_dbusAddress; //!< for boot strapping public: - //! Constructor - CRuntimeConfig(ContextMode allTheSame): - m_settings(allTheSame), m_audio(allTheSame), m_network(allTheSame), m_simulator(allTheSame), m_application(allTheSame) + CRuntimeConfig(ContextMode allTheSame = NotUsed, const QString &dbusBootstrapAddress = ""): + m_settings(allTheSame), m_audio(allTheSame), m_network(allTheSame), m_simulator(allTheSame), m_application(allTheSame), m_dbusAddress(dbusBootstrapAddress) {} //! Constructor - CRuntimeConfig(ContextMode settings, ContextMode audio, ContextMode network, ContextMode simulator, ContextMode application): - m_settings(settings), m_audio(audio), m_network(network), m_simulator(simulator), m_application(application) + CRuntimeConfig(ContextMode settings, ContextMode audio, ContextMode network, ContextMode simulator, ContextMode application, const QString &dbusBootstrapAddress = ""): + m_settings(settings), m_audio(audio), m_network(network), m_simulator(simulator), m_application(application), m_dbusAddress(dbusBootstrapAddress) {} //! settings mode @@ -50,17 +52,22 @@ namespace BlackCore bool hasLocalSettings() const { return this->m_settings == Local || this->m_settings == LocalInDbusServer; } //! requires server (at least one in server)? bool requiresDBusSever() const; - //! requires DBus connection (at least one remote)? + //! requires DBus connection (at least one remote)? bool requiresDBusConnection() const; - + //! DBus address + QString getDBusAddress() const { return this->m_dbusAddress; } + //! DBus address? + bool hasDBusAddress() const { return !this->m_dbusAddress.isEmpty(); } //! predefined for Core - static const CRuntimeConfig &forCore(); - + static const CRuntimeConfig &forCoreAllLocalInDBus(const QString &dbusBootstrapAddress = ""); + //! predefined for Core + static const CRuntimeConfig &forCoreAllLocalInDBusNoAudio(const QString &dbusBootstrapAddress = ""); //! predefined, completely local (e.g. for unit tests) - static const CRuntimeConfig &local(); - + static const CRuntimeConfig &local(const QString &dbusBootstrapAddress = ""); //! predefined, completely remote (e.g. for GUI with core) - static const CRuntimeConfig &remote(); + static const CRuntimeConfig &remote(const QString &dbusBootstrapAddress = ""); + //! predefined, remote with local audio (e.g. Aduio in GUI) + static const CRuntimeConfig &remoteLocalAudio(const QString &dbusBootstrapAddress = ""); }; } #endif // guard