summaryrefslogtreecommitdiff
path: root/include/CommonAPI
diff options
context:
space:
mode:
authorJuergen Gehring <juergen.gehring@bmw.de>2018-01-25 01:02:22 -0800
committerJuergen Gehring <juergen.gehring@bmw.de>2018-01-25 01:02:22 -0800
commitc989150260f4327ce5704b6d617b2d6548d67d56 (patch)
tree4213f6809195a702e9671ab620e9df07db660883 /include/CommonAPI
parentf072e9bf03d8497ccfaff622b801968b14b30727 (diff)
downloadgenivi-common-api-dbus-runtime-c989150260f4327ce5704b6d617b2d6548d67d56.tar.gz
capicxx-dbus-runtime 3.1.12.33.1.12.3
Diffstat (limited to 'include/CommonAPI')
-rw-r--r--include/CommonAPI/DBus/DBusMainLoopContext.hpp8
-rw-r--r--include/CommonAPI/DBus/DBusStubAdapterHelper.hpp24
2 files changed, 27 insertions, 5 deletions
diff --git a/include/CommonAPI/DBus/DBusMainLoopContext.hpp b/include/CommonAPI/DBus/DBusMainLoopContext.hpp
index adf132f..ecb49ee 100644
--- a/include/CommonAPI/DBus/DBusMainLoopContext.hpp
+++ b/include/CommonAPI/DBus/DBusMainLoopContext.hpp
@@ -121,7 +121,11 @@ public:
void processQueueEntry(std::shared_ptr<QueueEntry> _queueEntry);
private:
+#ifdef _WIN32
int pipeFileDescriptors_[2];
+#else
+ int eventFd_;
+#endif
pollfd pollFileDescriptor_;
@@ -133,9 +137,11 @@ private:
std::weak_ptr<DBusConnection> connection_;
- const int pipeValue_;
#ifdef _WIN32
HANDLE wsaEvent_;
+ const int pipeValue_;
+#else
+ const std::uint64_t eventFdValue_;
#endif
};
diff --git a/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp b/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp
index 0d4e7a7..980d88e 100644
--- a/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp
+++ b/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp
@@ -871,6 +871,8 @@ class DBusGetAttributeStubDispatcher: public virtual StubDispatcher<StubClass_>
public:
typedef typename StubClass_::RemoteEventHandlerType RemoteEventHandlerType;
typedef const AttributeType_& (StubClass_::*GetStubFunctor)(std::shared_ptr<CommonAPI::ClientId>);
+ typedef typename StubClass_::StubAdapterType StubAdapterType;
+ typedef typename CommonAPI::Stub<StubAdapterType, typename StubClass_::RemoteEventType> StubType;
DBusGetAttributeStubDispatcher(GetStubFunctor _getStubFunctor, const char *_signature, AttributeDepl_ *_depl = nullptr):
getStubFunctor_(_getStubFunctor),
@@ -891,7 +893,13 @@ class DBusGetAttributeStubDispatcher: public virtual StubDispatcher<StubClass_>
std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSender()));
auto varDepl = CommonAPI::DBus::VariantDeployment<AttributeDepl_>(true, depl_); // presuming FreeDesktop variant deployment, as support for "legacy" service only
- _output << CommonAPI::Deployable<CommonAPI::Variant<AttributeType_>, CommonAPI::DBus::VariantDeployment<AttributeDepl_>>((stub.get()->*getStubFunctor_)(clientId), &varDepl);
+
+ auto stubAdapter = stub->StubType::getStubAdapter();
+ stubAdapter->lockAttributes();
+ auto deployable = CommonAPI::Deployable<CommonAPI::Variant<AttributeType_>, CommonAPI::DBus::VariantDeployment<AttributeDepl_>>((stub.get()->*getStubFunctor_)(clientId), &varDepl);
+ stubAdapter->unlockAttributes();
+
+ _output << deployable;
_output.flush();
}
@@ -902,8 +910,12 @@ class DBusGetAttributeStubDispatcher: public virtual StubDispatcher<StubClass_>
std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSender()));
- dbusOutputStream << CommonAPI::Deployable<AttributeType_, AttributeDepl_>((stub.get()->*getStubFunctor_)(clientId), depl_);
-
+ auto stubAdapter = stub->StubType::getStubAdapter();
+ stubAdapter->lockAttributes();
+ auto deployable = CommonAPI::Deployable<AttributeType_, AttributeDepl_>((stub.get()->*getStubFunctor_)(clientId), depl_);
+ stubAdapter->unlockAttributes();
+
+ dbusOutputStream << deployable;
dbusOutputStream.flush();
if (std::shared_ptr<DBusProxyConnection> connection = connection_.lock()) {
bool isSuccessful = connection->sendDBusMessage(dbusMessageReply);
@@ -1047,7 +1059,11 @@ protected:
RemoteEventHandlerType* _remoteEventHandler,
const std::shared_ptr<StubClass_> _stub) {
(void)_remoteEventHandler;
- (_stub->StubType::getStubAdapter().get()->*fireChangedFunctor_)(this->getAttributeValue(_client, _stub));
+
+ auto stubAdapter = _stub->StubType::getStubAdapter();
+ stubAdapter->lockAttributes();
+ (stubAdapter.get()->*fireChangedFunctor_)(this->getAttributeValue(_client, _stub));
+ stubAdapter->unlockAttributes();
}
const FireChangedFunctor fireChangedFunctor_;