summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schanda <schanda@itestra.de>2013-04-04 11:37:27 +0200
committerJohannes Schanda <schanda@itestra.de>2013-04-04 11:37:27 +0200
commit6a65706da08aa44e995a4a8fb92c2d2687ffebfc (patch)
tree126ca26582ff08080152392ad358c3f5e0581d0b
parent8a43e74f7ec16df338a2ce1707ec1c3fb97368fa (diff)
downloadgenivi-common-api-dbus-runtime-6a65706da08aa44e995a4a8fb92c2d2687ffebfc.tar.gz
Move objectpath functions to proxy connection, make objectmanager use it
instead of connection
-rw-r--r--src/CommonAPI/DBus/DBusObjectManager.cpp8
-rw-r--r--src/CommonAPI/DBus/DBusObjectManager.h4
-rw-r--r--src/CommonAPI/DBus/DBusProxyConnection.h3
3 files changed, 9 insertions, 6 deletions
diff --git a/src/CommonAPI/DBus/DBusObjectManager.cpp b/src/CommonAPI/DBus/DBusObjectManager.cpp
index 0f5b484..22bac66 100644
--- a/src/CommonAPI/DBus/DBusObjectManager.cpp
+++ b/src/CommonAPI/DBus/DBusObjectManager.cpp
@@ -12,7 +12,7 @@
namespace CommonAPI {
namespace DBus {
-DBusObjectManager::DBusObjectManager(const std::shared_ptr<DBusConnection>& dbusConnection):
+DBusObjectManager::DBusObjectManager(const std::shared_ptr<DBusProxyConnection>& dbusConnection):
dbusConnection_(dbusConnection) {
registerInterfaceHandler("/",
@@ -33,7 +33,7 @@ DBusInterfaceHandlerToken DBusObjectManager::registerInterfaceHandler(const std:
dbusRegisteredObjectsTable_.insert({handlerPath, dbusMessageInterfaceHandler});
objectPathLock_.unlock();
- std::shared_ptr<DBusConnection> lockedConnection = dbusConnection_.lock();
+ std::shared_ptr<DBusProxyConnection> lockedConnection = dbusConnection_.lock();
if(lockedConnection) {
lockedConnection->registerObjectPath(objectPath);
}
@@ -45,7 +45,7 @@ void DBusObjectManager::unregisterInterfaceHandler(const DBusInterfaceHandlerTok
objectPathLock_.lock();
const std::string& objectPath = dbusInterfaceHandlerToken.first;
- std::shared_ptr<DBusConnection> lockedConnection = dbusConnection_.lock();
+ std::shared_ptr<DBusProxyConnection> lockedConnection = dbusConnection_.lock();
if(lockedConnection) {
lockedConnection->unregisterObjectPath(objectPath);
}
@@ -111,7 +111,7 @@ bool DBusObjectManager::onGetDBusObjectManagerData(const DBusMessage& callMessag
outStream << dictToSend;
outStream.flush();
- std::shared_ptr<DBusConnection> lockedConnection = dbusConnection_.lock();
+ std::shared_ptr<DBusProxyConnection> lockedConnection = dbusConnection_.lock();
if(lockedConnection) {
return lockedConnection->sendDBusMessage(replyMessage);
}
diff --git a/src/CommonAPI/DBus/DBusObjectManager.h b/src/CommonAPI/DBus/DBusObjectManager.h
index 6c3f1b2..5a0e171 100644
--- a/src/CommonAPI/DBus/DBusObjectManager.h
+++ b/src/CommonAPI/DBus/DBusObjectManager.h
@@ -22,7 +22,7 @@ class DBusConnection;
class DBusObjectManager {
public:
- DBusObjectManager(const std::shared_ptr<DBusConnection>&);
+ DBusObjectManager(const std::shared_ptr<DBusProxyConnection>&);
void init();
@@ -48,7 +48,7 @@ class DBusObjectManager {
typedef std::unordered_map<DBusInterfaceHandlerPath, DBusMessageInterfaceHandler> DBusRegisteredObjectsTable;
DBusRegisteredObjectsTable dbusRegisteredObjectsTable_;
- std::weak_ptr<DBusConnection> dbusConnection_;
+ std::weak_ptr<DBusProxyConnection> dbusConnection_;
std::recursive_mutex objectPathLock_;
};
diff --git a/src/CommonAPI/DBus/DBusProxyConnection.h b/src/CommonAPI/DBus/DBusProxyConnection.h
index e5dc24a..e6ab1a5 100644
--- a/src/CommonAPI/DBus/DBusProxyConnection.h
+++ b/src/CommonAPI/DBus/DBusProxyConnection.h
@@ -90,6 +90,9 @@ class DBusProxyConnection {
virtual const std::shared_ptr<DBusServiceRegistry> getDBusServiceRegistry() = 0;
virtual const std::shared_ptr<DBusObjectManager> getDBusObjectManager() = 0;
+
+ virtual void registerObjectPath(const std::string& objectPath) = 0;
+ virtual void unregisterObjectPath(const std::string& objectPath) = 0;
};