mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-06 02:16:04 +08:00
refs #199 , fail safe method to register contexts with DBus server, easer way to initialize in runtime
This commit is contained in:
@@ -27,13 +27,13 @@ namespace BlackCore
|
|||||||
//! Constructor
|
//! Constructor
|
||||||
CContextApplication(CRuntimeConfig::ContextMode mode, CRuntime *runtime);
|
CContextApplication(CRuntimeConfig::ContextMode mode, CRuntime *runtime);
|
||||||
|
|
||||||
//! Register myself in DBus
|
//! Register myself in DBus, fail safe
|
||||||
CContextApplication *registerWithDBus(CDBusServer *server)
|
CContextApplication *registerWithDBus(CDBusServer *server)
|
||||||
{
|
{
|
||||||
|
if (!server || this->m_mode != CRuntimeConfig::LocalInDbusServer) return this;
|
||||||
server->addObject(IContextApplication::ObjectPath(), this);
|
server->addObject(IContextApplication::ObjectPath(), this);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CContextApplication() {}
|
virtual ~CContextApplication() {}
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ namespace BlackCore
|
|||||||
//! \brief Register myself in DBus
|
//! \brief Register myself in DBus
|
||||||
CContextAudio *registerWithDBus(CDBusServer *server)
|
CContextAudio *registerWithDBus(CDBusServer *server)
|
||||||
{
|
{
|
||||||
Q_ASSERT(server);
|
if (!server || this->m_mode != CRuntimeConfig::LocalInDbusServer) return this;
|
||||||
server->addObject(IContextAudio::ObjectPath(), this);
|
server->addObject(IContextAudio::ObjectPath(), this);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ namespace BlackCore
|
|||||||
//! Register myself in DBus
|
//! Register myself in DBus
|
||||||
CContextNetwork *registerWithDBus(CDBusServer *server)
|
CContextNetwork *registerWithDBus(CDBusServer *server)
|
||||||
{
|
{
|
||||||
Q_ASSERT(server);
|
if (!server || this->m_mode != CRuntimeConfig::LocalInDbusServer) return this;
|
||||||
server->addObject(IContextNetwork::ObjectPath(), this);
|
server->addObject(IContextNetwork::ObjectPath(), this);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ namespace BlackCore
|
|||||||
//! \brief Register myself in DBus
|
//! \brief Register myself in DBus
|
||||||
CContextSettings *registerWithDBus(CDBusServer *server)
|
CContextSettings *registerWithDBus(CDBusServer *server)
|
||||||
{
|
{
|
||||||
|
if (!server || this->m_mode != CRuntimeConfig::LocalInDbusServer) return this;
|
||||||
server->addObject(IContextSettings::ObjectPath(), this);
|
server->addObject(IContextSettings::ObjectPath(), this);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace BlackCore
|
|||||||
//! Register myself in DBus
|
//! Register myself in DBus
|
||||||
CContextSimulator *registerWithDBus(CDBusServer *server)
|
CContextSimulator *registerWithDBus(CDBusServer *server)
|
||||||
{
|
{
|
||||||
Q_ASSERT(server);
|
if (!server || this->m_mode != CRuntimeConfig::LocalInDbusServer) return this;
|
||||||
server->addObject(CContextSimulator::ObjectPath(), this);
|
server->addObject(CContextSimulator::ObjectPath(), this);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user