mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 08:36:52 +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
|
||||
CContextApplication(CRuntimeConfig::ContextMode mode, CRuntime *runtime);
|
||||
|
||||
//! Register myself in DBus
|
||||
//! Register myself in DBus, fail safe
|
||||
CContextApplication *registerWithDBus(CDBusServer *server)
|
||||
{
|
||||
if (!server || this->m_mode != CRuntimeConfig::LocalInDbusServer) return this;
|
||||
server->addObject(IContextApplication::ObjectPath(), this);
|
||||
return this;
|
||||
}
|
||||
|
||||
public:
|
||||
//! Destructor
|
||||
virtual ~CContextApplication() {}
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace BlackCore
|
||||
//! \brief Register myself in DBus
|
||||
CContextAudio *registerWithDBus(CDBusServer *server)
|
||||
{
|
||||
Q_ASSERT(server);
|
||||
if (!server || this->m_mode != CRuntimeConfig::LocalInDbusServer) return this;
|
||||
server->addObject(IContextAudio::ObjectPath(), this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace BlackCore
|
||||
//! Register myself in DBus
|
||||
CContextNetwork *registerWithDBus(CDBusServer *server)
|
||||
{
|
||||
Q_ASSERT(server);
|
||||
if (!server || this->m_mode != CRuntimeConfig::LocalInDbusServer) return this;
|
||||
server->addObject(IContextNetwork::ObjectPath(), this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace BlackCore
|
||||
//! \brief Register myself in DBus
|
||||
CContextSettings *registerWithDBus(CDBusServer *server)
|
||||
{
|
||||
if (!server || this->m_mode != CRuntimeConfig::LocalInDbusServer) return this;
|
||||
server->addObject(IContextSettings::ObjectPath(), this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace BlackCore
|
||||
//! Register myself in DBus
|
||||
CContextSimulator *registerWithDBus(CDBusServer *server)
|
||||
{
|
||||
Q_ASSERT(server);
|
||||
if (!server || this->m_mode != CRuntimeConfig::LocalInDbusServer) return this;
|
||||
server->addObject(CContextSimulator::ObjectPath(), this);
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user