diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/CommonAPI/DBus/DBusConnection.hpp | 17 | ||||
-rw-r--r-- | include/CommonAPI/DBus/DBusEvent.hpp | 4 | ||||
-rw-r--r-- | include/CommonAPI/DBus/DBusInputStream.hpp | 2 | ||||
-rw-r--r-- | include/CommonAPI/DBus/DBusProxy.hpp | 3 | ||||
-rw-r--r-- | include/CommonAPI/DBus/DBusProxyConnection.hpp | 3 | ||||
-rw-r--r-- | include/CommonAPI/DBus/DBusProxyManager.hpp | 1 | ||||
-rw-r--r-- | include/CommonAPI/DBus/DBusSelectiveEvent.hpp | 4 | ||||
-rw-r--r-- | include/CommonAPI/DBus/DBusStubAdapterHelper.hpp | 1 |
8 files changed, 29 insertions, 6 deletions
diff --git a/include/CommonAPI/DBus/DBusConnection.hpp b/include/CommonAPI/DBus/DBusConnection.hpp index e3608da..f2fd516 100644 --- a/include/CommonAPI/DBus/DBusConnection.hpp +++ b/include/CommonAPI/DBus/DBusConnection.hpp @@ -57,12 +57,16 @@ class DBusConnection : public DBusProxyConnection, public std::enable_shared_from_this<DBusConnection> { public: - COMMONAPI_EXPORT static std::shared_ptr<DBusConnection> getBus(const DBusType_t &_type); - COMMONAPI_EXPORT static std::shared_ptr<DBusConnection> wrap(::DBusConnection *_connection); + COMMONAPI_EXPORT static std::shared_ptr<DBusConnection> getBus( + const DBusType_t &_type, const ConnectionId_t& _connectionId); + COMMONAPI_EXPORT static std::shared_ptr<DBusConnection> wrap( + ::DBusConnection *_connection, const ConnectionId_t& _connectionId); - COMMONAPI_EXPORT DBusConnection(DBusType_t _type); + COMMONAPI_EXPORT DBusConnection(DBusType_t _type, + const ConnectionId_t& _connectionId); COMMONAPI_EXPORT DBusConnection(const DBusConnection&) = delete; - COMMONAPI_EXPORT DBusConnection(::DBusConnection* libDbusConnection); + COMMONAPI_EXPORT DBusConnection(::DBusConnection* libDbusConnection, + const ConnectionId_t& _connectionId); COMMONAPI_EXPORT virtual ~DBusConnection(); COMMONAPI_EXPORT DBusConnection& operator=(const DBusConnection&) = delete; @@ -135,6 +139,8 @@ public: COMMONAPI_EXPORT virtual bool hasDispatchThread(); + COMMONAPI_EXPORT virtual const ConnectionId_t& getConnectionId() const; + #ifdef COMMONAPI_DBUS_TEST inline std::weak_ptr<DBusMainloop> getLoop() { return loop_; } #endif @@ -199,6 +205,8 @@ public: COMMONAPI_EXPORT void enforceAsynchronousTimeouts() const; COMMONAPI_EXPORT static const DBusObjectPathVTable* getDBusObjectPathVTable(); + COMMONAPI_EXPORT bool sendPendingSelectiveSubscription(DBusProxy* proxy, std::string methodName); + ::DBusConnection* connection_; mutable std::mutex connectionGuard_; @@ -268,6 +276,7 @@ public: mutable std::shared_ptr<std::thread> enforcerThread_; mutable std::mutex enforcerThreadMutex_; bool enforcerThreadCancelled_; + ConnectionId_t connectionId_; std::shared_ptr<DBusMainLoop> loop_; diff --git a/include/CommonAPI/DBus/DBusEvent.hpp b/include/CommonAPI/DBus/DBusEvent.hpp index 550f4da..2637acf 100644 --- a/include/CommonAPI/DBus/DBusEvent.hpp +++ b/include/CommonAPI/DBus/DBusEvent.hpp @@ -77,6 +77,10 @@ public: handleSignalDBusMessage(tag, _message, typename make_sequence<sizeof...(Arguments_)>::type()); } + virtual void onError(const CommonAPI::CallStatus status) { + (void) status; + } + protected: virtual void onFirstListenerAdded(const Listener &_listener) { (void)_listener; diff --git a/include/CommonAPI/DBus/DBusInputStream.hpp b/include/CommonAPI/DBus/DBusInputStream.hpp index b4c81d1..9a3f74d 100644 --- a/include/CommonAPI/DBus/DBusInputStream.hpp +++ b/include/CommonAPI/DBus/DBusInputStream.hpp @@ -174,7 +174,7 @@ public: Types_... >::visit(visitor, _value, _depl, _value.valueType_); if (!success) { - _value.valueType_ = _value.maxSize + 1; + _value.valueType_ = 0; // Invalid index setError(); return (*this); } diff --git a/include/CommonAPI/DBus/DBusProxy.hpp b/include/CommonAPI/DBus/DBusProxy.hpp index ad5439e..04f2ca9 100644 --- a/include/CommonAPI/DBus/DBusProxy.hpp +++ b/include/CommonAPI/DBus/DBusProxy.hpp @@ -134,6 +134,9 @@ private: std::list<SignalMemberHandlerTuple> signalMemberHandlerQueue_; CallInfo signalMemberHandlerInfo_; mutable std::mutex signalMemberHandlerQueueMutex_; + + std::map<std::string, DBusProxyConnection::DBusSignalHandler*> selectiveBroadcastHandlers; + mutable std::mutex selectiveBroadcastHandlersMutex_; }; diff --git a/include/CommonAPI/DBus/DBusProxyConnection.hpp b/include/CommonAPI/DBus/DBusProxyConnection.hpp index 0dc7cf2..bec052b 100644 --- a/include/CommonAPI/DBus/DBusProxyConnection.hpp +++ b/include/CommonAPI/DBus/DBusProxyConnection.hpp @@ -62,6 +62,7 @@ class DBusProxyConnection { virtual ~DBusSignalHandler() {} virtual void onSignalDBusMessage(const DBusMessage&) = 0; virtual void onInitialValueSignalDBusMessage(const DBusMessage&, const uint32_t) {}; + virtual void onError(const CommonAPI::CallStatus status) { (void) status; }; }; // objectPath, interfaceName, interfaceMemberName, interfaceMemberSignature @@ -132,6 +133,8 @@ class DBusProxyConnection { virtual bool isObjectPathMessageHandlerSet() = 0; virtual bool hasDispatchThread() = 0; + + virtual bool sendPendingSelectiveSubscription(DBusProxy* proxy, std::string methodName) = 0; }; } // namespace DBus diff --git a/include/CommonAPI/DBus/DBusProxyManager.hpp b/include/CommonAPI/DBus/DBusProxyManager.hpp index 15ed474..9540ead 100644 --- a/include/CommonAPI/DBus/DBusProxyManager.hpp +++ b/include/CommonAPI/DBus/DBusProxyManager.hpp @@ -21,6 +21,7 @@ #include <CommonAPI/DBus/DBusFactory.hpp> #include <CommonAPI/DBus/DBusObjectManagerStub.hpp> #include <CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp> +#include <CommonAPI/DBus/DBusConnection.hpp> namespace CommonAPI { namespace DBus { diff --git a/include/CommonAPI/DBus/DBusSelectiveEvent.hpp b/include/CommonAPI/DBus/DBusSelectiveEvent.hpp index 05f2f5f..961063a 100644 --- a/include/CommonAPI/DBus/DBusSelectiveEvent.hpp +++ b/include/CommonAPI/DBus/DBusSelectiveEvent.hpp @@ -36,6 +36,10 @@ public: virtual ~DBusSelectiveEvent() {} + virtual void onError(const CommonAPI::CallStatus status) { + this->notifyError(status); + } + protected: void onFirstListenerAdded(const Listener &) { bool success; diff --git a/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp b/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp index b533a2e..0084360 100644 --- a/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp +++ b/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp @@ -327,7 +327,6 @@ class DBusMethodStubDispatcher<StubClass_, In_<InArgs_...>, DeplIn_<DeplIn_Args. DBusStubAdapterHelperType& dbusStubAdapterHelper, index_sequence<InArgIndices_...>) { (void)dbusStubAdapterHelper; - std::tuple<InArgs_...> argTuple; if (sizeof...(InArgs_) > 0) { DBusInputStream dbusInputStream(dbusMessage); |