summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Rauwolf <rauwolf@itestra.de>2013-02-28 19:05:47 +0100
committerPhilip Rauwolf <rauwolf@itestra.de>2013-02-28 19:05:47 +0100
commit5106e7bb3948c996cf78d9f4c9f9de442f211f9e (patch)
treedcaeeefb707a0bca1d685c4929d8b337adf091f6
parentb554b2fa3cf080cee9dd4a80430a582f0253722f (diff)
downloadgenivi-common-api-dbus-runtime-5106e7bb3948c996cf78d9f4c9f9de442f211f9e.tar.gz
Added a way to deinitialize running services
-rw-r--r--src/CommonAPI/DBus/DBusStubAdapter.cpp5
-rw-r--r--src/CommonAPI/DBus/DBusStubAdapter.h1
-rw-r--r--src/CommonAPI/DBus/DBusStubAdapterHelper.h9
-rw-r--r--src/test/commonapi/tests/TestInterfaceStubDefault.cpp4
-rw-r--r--src/test/commonapi/tests/TestInterfaceStubDefault.h1
5 files changed, 18 insertions, 2 deletions
diff --git a/src/CommonAPI/DBus/DBusStubAdapter.cpp b/src/CommonAPI/DBus/DBusStubAdapter.cpp
index 27a10fe..67cfacd 100644
--- a/src/CommonAPI/DBus/DBusStubAdapter.cpp
+++ b/src/CommonAPI/DBus/DBusStubAdapter.cpp
@@ -41,10 +41,13 @@ DBusStubAdapter::DBusStubAdapter(const std::string& commonApiAddress,
}
DBusStubAdapter::~DBusStubAdapter() {
+}
+
+void DBusStubAdapter::deinit() {
assert(dbusConnection_);
assert(isInitialized_);
- dbusConnection_->getDBusObjectManager()->unregisterInterfaceHandler(dbusIntrospectionInterfaceHandlerToken_);
+ dbusConnection_->getDBusObjectManager()->unregisterInterfaceHandler(dbusIntrospectionInterfaceHandlerToken_);
dbusConnection_->getDBusObjectManager()->unregisterInterfaceHandler(dbusInterfaceHandlerToken_);
}
diff --git a/src/CommonAPI/DBus/DBusStubAdapter.h b/src/CommonAPI/DBus/DBusStubAdapter.h
index 7b8e98a..fafea2e 100644
--- a/src/CommonAPI/DBus/DBusStubAdapter.h
+++ b/src/CommonAPI/DBus/DBusStubAdapter.h
@@ -29,6 +29,7 @@ class DBusStubAdapter: virtual public CommonAPI::StubAdapter {
virtual ~DBusStubAdapter();
virtual void init();
+ virtual void deinit();
virtual const std::string getAddress() const;
virtual const std::string& getDomain() const;
diff --git a/src/CommonAPI/DBus/DBusStubAdapterHelper.h b/src/CommonAPI/DBus/DBusStubAdapterHelper.h
index 1da9349..a88eeb2 100644
--- a/src/CommonAPI/DBus/DBusStubAdapterHelper.h
+++ b/src/CommonAPI/DBus/DBusStubAdapterHelper.h
@@ -43,13 +43,20 @@ class DBusStubAdapterHelper: public DBusStubAdapter, public std::enable_shared_f
stub_(stub) {
}
- virtual ~DBusStubAdapterHelper() { }
+ virtual ~DBusStubAdapterHelper() {
+ stub_->deinitStubAdapter();
+ }
virtual void init() {
DBusStubAdapter::init();
remoteEventHandler_ = stub_->initStubAdapter(getStubAdapter());
}
+ virtual void deinit() {
+ DBusStubAdapter::deinit();
+ stub_->deinitStubAdapter();
+ }
+
inline std::shared_ptr<StubAdapterType> getStubAdapter() {
return this->shared_from_this();
}
diff --git a/src/test/commonapi/tests/TestInterfaceStubDefault.cpp b/src/test/commonapi/tests/TestInterfaceStubDefault.cpp
index 30e7e24..c5e7e35 100644
--- a/src/test/commonapi/tests/TestInterfaceStubDefault.cpp
+++ b/src/test/commonapi/tests/TestInterfaceStubDefault.cpp
@@ -15,6 +15,10 @@ TestInterfaceStubRemoteEvent* TestInterfaceStubDefault::initStubAdapter(const st
return &remoteEventHandler_;
}
+void TestInterfaceStubDefault::deinitStubAdapter() {
+ stubAdapter_.reset();
+}
+
const uint32_t& TestInterfaceStubDefault::getTestPredefinedTypeAttributeAttribute() {
return testPredefinedTypeAttributeAttributeValue_;
}
diff --git a/src/test/commonapi/tests/TestInterfaceStubDefault.h b/src/test/commonapi/tests/TestInterfaceStubDefault.h
index 50c803e..bc5cdff 100644
--- a/src/test/commonapi/tests/TestInterfaceStubDefault.h
+++ b/src/test/commonapi/tests/TestInterfaceStubDefault.h
@@ -14,6 +14,7 @@ class TestInterfaceStubDefault : public TestInterfaceStub {
TestInterfaceStubDefault();
TestInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<TestInterfaceStubAdapter>& stubAdapter);
+ void deinitStubAdapter();
virtual const uint32_t& getTestPredefinedTypeAttributeAttribute();
virtual void setTestPredefinedTypeAttributeAttribute(uint32_t value);