mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 02:06:08 +08:00
Delay setting the DBusConnection for a DBusObject
Previously, the DBusconnection had to be set at construction time and could not be changed over the DBusObject life time. Now a new connection can be set anytime and as often as required. The shared ownership is now also properly implemented by shared pointers. ref T291
This commit is contained in:
committed by
Klaus Basan
parent
01085f24b3
commit
59da68da5e
@@ -22,11 +22,19 @@ namespace XSwiftBus
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
CDBusObject(CDBusConnection *dbusConnection);
|
||||
CDBusObject();
|
||||
|
||||
//! Destructor
|
||||
virtual ~CDBusObject();
|
||||
|
||||
//! Set the assigned DBus connection.
|
||||
//! \remark Currently one object can only manage one connection at a time
|
||||
void setDBusConnection(const std::shared_ptr<CDBusConnection> &dbusConnection);
|
||||
|
||||
//! Register itself with interfaceName and objectPath
|
||||
//! \warning Before calling this method, make sure that a valid DBus connection was set.
|
||||
void registerDBusObjectPath(const std::string &interfaceName, const std::string &objectPath);
|
||||
|
||||
//! Process DBus messages. Needs to be implemented by deriving classes
|
||||
virtual int processDBus() = 0;
|
||||
|
||||
@@ -34,9 +42,6 @@ namespace XSwiftBus
|
||||
//! DBus message handler
|
||||
virtual DBusHandlerResult dbusMessageHandler(const CDBusMessage &message) = 0;
|
||||
|
||||
//! Register itself with interfaceName and objectPath
|
||||
void registerDBusObjectPath(const std::string &interfaceName, const std::string &objectPath);
|
||||
|
||||
//! Send DBus signal
|
||||
void sendDBusSignal(const std::string &name);
|
||||
|
||||
@@ -76,7 +81,7 @@ namespace XSwiftBus
|
||||
static void dbusObjectPathUnregisterFunction(DBusConnection *connection, void *data);
|
||||
static DBusHandlerResult dbusObjectPathMessageFunction(DBusConnection *connection, DBusMessage *message, void *data);
|
||||
|
||||
CDBusConnection *m_dbusConnection;
|
||||
std::shared_ptr<CDBusConnection> m_dbusConnection;
|
||||
std::string m_interfaceName;
|
||||
std::string m_objectPath;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user