diff options
Diffstat (limited to 'src/CommonAPI/DBus/DBusDaemonProxy.h')
-rw-r--r-- | src/CommonAPI/DBus/DBusDaemonProxy.h | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/src/CommonAPI/DBus/DBusDaemonProxy.h b/src/CommonAPI/DBus/DBusDaemonProxy.h index b785f29..14f7799 100644 --- a/src/CommonAPI/DBus/DBusDaemonProxy.h +++ b/src/CommonAPI/DBus/DBusDaemonProxy.h @@ -37,24 +37,27 @@ class StaticInterfaceVersionAttribute: public InterfaceVersionAttribute { class DBusDaemonProxy: public DBusProxyBase { public: - typedef Event<std::string, std::string, std::string> NameOwnerChangedEvent; + typedef Event<std::string, std::string, std::string> NameOwnerChangedEvent; - typedef std::unordered_map<std::string, int> PropertyDictStub; - typedef std::unordered_map<std::string, PropertyDictStub> InterfaceToPropertyDict; - typedef std::unordered_map<std::string, InterfaceToPropertyDict> DBusObjectToInterfaceDict; + typedef std::unordered_map<std::string, int> PropertyDictStub; + typedef std::unordered_map<std::string, PropertyDictStub> InterfaceToPropertyDict; + typedef std::unordered_map<std::string, InterfaceToPropertyDict> DBusObjectToInterfaceDict; - typedef std::function<void(const CommonAPI::CallStatus&, std::vector<std::string>)> ListNamesAsyncCallback; - typedef std::function<void(const CommonAPI::CallStatus&, bool)> NameHasOwnerAsyncCallback; - typedef std::function<void(const CommonAPI::CallStatus&, DBusObjectToInterfaceDict)> GetManagedObjectsAsyncCallback; + typedef std::function<void(const CommonAPI::CallStatus&, std::vector<std::string>)> ListNamesAsyncCallback; + typedef std::function<void(const CommonAPI::CallStatus&, bool)> NameHasOwnerAsyncCallback; + typedef std::function<void(const CommonAPI::CallStatus&, DBusObjectToInterfaceDict)> GetManagedObjectsAsyncCallback; + typedef std::function<void(const CommonAPI::CallStatus&, std::string)> GetNameOwnerAsyncCallback; + DBusDaemonProxy(const std::shared_ptr<DBusProxyConnection>& dbusConnection); - DBusDaemonProxy(const std::shared_ptr<DBusProxyConnection>& dbusConnection); + virtual bool isAvailable() const; + virtual bool isAvailableBlocking() const; + virtual ProxyStatusEvent& getProxyStatusEvent(); + virtual InterfaceVersionAttribute& getInterfaceVersionAttribute(); - virtual bool isAvailable() const; - virtual ProxyStatusEvent& getProxyStatusEvent(); - virtual InterfaceVersionAttribute& getInterfaceVersionAttribute(); + void init(); - static inline const char* getInterfaceId(); + static inline const char* getInterfaceId(); NameOwnerChangedEvent& getNameOwnerChangedEvent(); @@ -62,9 +65,21 @@ class DBusDaemonProxy: public DBusProxyBase { std::future<CallStatus> listNamesAsync(ListNamesAsyncCallback listNamesAsyncCallback) const; void nameHasOwner(const std::string& busName, CommonAPI::CallStatus& callStatus, bool& hasOwner) const; - std::future<CallStatus> nameHasOwnerAsync(const std::string& busName, NameHasOwnerAsyncCallback nameHasOwnerAsyncCallback) const; - - std::future<CallStatus> getManagedObjectsAsync(const std::string& forDBusServiceName, GetManagedObjectsAsyncCallback) const; + std::future<CallStatus> nameHasOwnerAsync(const std::string& busName, + NameHasOwnerAsyncCallback nameHasOwnerAsyncCallback) const; + + std::future<CallStatus> getManagedObjectsAsync(const std::string& forDBusServiceName, + GetManagedObjectsAsyncCallback) const; + + /** + * Get the unique connection/bus name of the primary owner of the name given + * + * @param busName Name to get the owner of + * @param getNameOwnerAsyncCallback callback functor + * + * @return CallStatus::REMOTE_ERROR if the name is unknown, otherwise CallStatus::SUCCESS and the uniq name of the owner + */ + std::future<CallStatus> getNameOwnerAsync(const std::string& busName, GetNameOwnerAsyncCallback getNameOwnerAsyncCallback) const; virtual std::string getAddress() const; virtual const std::string& getDomain() const; |