1 diff --git a/plugins/dbus/abstractdbusinterface.cpp b/plugins/dbus/abstractdbusinterface.cpp
2 index 9dd8566..19ef606 100644
3 --- a/plugins/dbus/abstractdbusinterface.cpp
4 +++ b/plugins/dbus/abstractdbusinterface.cpp
5 @@ -17,6 +17,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
8 #include "abstractdbusinterface.h"
9 +#include "dbusplugin.h"
11 #include <abstractroutingengine.h>
13 @@ -37,7 +38,7 @@ list<string> AbstractDBusInterface::mimplementedProperties;
14 const uint getPid(const char *owner)
16 GError* error = nullptr;
17 - GDBusProxy* dbus = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, NULL,
18 + GDBusProxy* dbus = g_dbus_proxy_new_for_bus_sync(bustype, G_DBUS_PROXY_FLAGS_NONE, NULL,
19 "org.freedesktop.DBus",
21 "org.freedesktop.DBus",
22 diff --git a/plugins/dbus/automotivemanager.cpp b/plugins/dbus/automotivemanager.cpp
23 index b5fb149..edbe1bd 100644
24 --- a/plugins/dbus/automotivemanager.cpp
25 +++ b/plugins/dbus/automotivemanager.cpp
27 +#include "dbusplugin.h"
28 #include "automotivemanager.h"
29 #include "abstractdbusinterface.h"
30 #include "listplusplus.h"
31 @@ -341,7 +342,7 @@ static void signalCallback( GDBusConnection *connection,
32 AbstractDBusInterface* iface = i.first;
33 for(auto n : i.second)
36 + if(n == name && !persistent)
38 DebugOut()<<"unreferencing "<<n<<" from the subscription of "<<iface->objectPath()<<endl;
39 manager->subscribedProcesses[iface].remove(n);
40 @@ -398,7 +399,7 @@ AutomotiveManager::AutomotiveManager(GDBusConnection *connection)
44 - g_dbus_connection_signal_subscribe(g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL,NULL), "org.freedesktop.DBus", "org.freedesktop.DBus",
45 + g_dbus_connection_signal_subscribe(g_bus_get_sync(bustype, NULL,NULL), "org.freedesktop.DBus", "org.freedesktop.DBus",
46 "NameOwnerChanged", "/org/freedesktop/DBus", NULL, G_DBUS_SIGNAL_FLAGS_NONE,
47 signalCallback, this, NULL);
49 diff --git a/plugins/dbus/dbusinterfacemanager.cpp b/plugins/dbus/dbusinterfacemanager.cpp
50 index 0c8a645..07e6786 100644
51 --- a/plugins/dbus/dbusinterfacemanager.cpp
52 +++ b/plugins/dbus/dbusinterfacemanager.cpp
53 @@ -236,7 +236,7 @@ on_name_lost (GDBusConnection *connection, const gchar *name, gpointer user_data
54 DBusInterfaceManager::DBusInterfaceManager(AbstractRoutingEngine* engine,std::map<std::string,std::string> config)
55 :AbstractSink(engine,config),re(engine), connection(nullptr)
57 - ownerId = g_bus_own_name(G_BUS_TYPE_SYSTEM,
58 + ownerId = g_bus_own_name(bustype,
60 G_BUS_NAME_OWNER_FLAGS_NONE,
62 diff --git a/plugins/dbus/dbusplugin.cpp b/plugins/dbus/dbusplugin.cpp
63 index 7fa31c1..0b75d69 100644
64 --- a/plugins/dbus/dbusplugin.cpp
65 +++ b/plugins/dbus/dbusplugin.cpp
68 #include "listplusplus.h"
70 +bool persistent=false;
71 +GBusType bustype=G_BUS_TYPE_SYSTEM;
73 extern "C" AbstractSinkManager * create(AbstractRoutingEngine* routingengine, map<string, string> config)
75 + if(config.find("sessionbus") != config.end())
77 + bustype=G_BUS_TYPE_SESSION;
80 + if(config.find("persistent") != config.end())
85 return new DBusSinkManager(routingengine, config);
88 diff --git a/plugins/dbus/dbusplugin.h b/plugins/dbus/dbusplugin.h
89 index 337f2f6..92e6255 100644
90 --- a/plugins/dbus/dbusplugin.h
91 +++ b/plugins/dbus/dbusplugin.h
94 typedef std::map<VehicleProperty::Property, VariantType*> PropertyDBusMap;
96 +extern GBusType bustype;
97 +extern bool persistent;
99 class DBusSink : public AbstractSink, public AbstractDBusInterface
102 diff --git a/tests/amb-get b/tests/amb-get
103 index 0835a64..7fb48ea 100755
106 @@ -5,12 +5,17 @@ import sys
109 parser = argparse.ArgumentParser()
110 +parser.add_argument("--sessionbus", help="use session bus", action='store_true')
111 parser.add_argument("get", help="get {objectName}")
112 args = parser.parse_args()
114 objectName = args.get
116 -bus = dbus.SystemBus()
117 +if (args.sessionbus):
118 + bus = dbus.SessionBus()
120 + bus = dbus.SystemBus()
122 managerObject = bus.get_object("org.automotive.message.broker", "/");
123 managerInterface = dbus.Interface(managerObject, "org.automotive.Manager")