diff options
author | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2015-05-14 12:30:31 +0000 |
---|---|---|
committer | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2015-05-14 12:30:31 +0000 |
commit | bb1545c28c472367fc6481f85fb89fc418140558 (patch) | |
tree | 483f03645971fee4b169ac9ea9e912374e05ffdd | |
parent | b8041b051cc43df0b1b339c45844369967ec99ab (diff) | |
download | automotive-message-broker-baserock/jonathanmaw/lbs-patched.tar.gz |
Apply patch amb_allow_sessionbus.patchbaserock/jonathanmaw/lbs-patched
-rw-r--r-- | RELEASE.md | 4 | ||||
-rw-r--r-- | plugins/common/bluetooth5.cpp | 10 | ||||
-rw-r--r-- | plugins/dbus/abstractdbusinterface.cpp | 3 | ||||
-rw-r--r-- | plugins/dbus/automotivemanager.cpp | 5 | ||||
-rw-r--r-- | plugins/dbus/dbusinterfacemanager.cpp | 2 | ||||
-rw-r--r-- | plugins/dbus/dbusplugin.cpp | 13 | ||||
-rw-r--r-- | plugins/dbus/dbusplugin.h | 4 | ||||
-rwxr-xr-x | tests/amb-get.py | 7 | ||||
-rw-r--r-- | xwalk/vehicle.cc | 2 |
9 files changed, 38 insertions, 12 deletions
@@ -15,8 +15,8 @@ Changes: - [websocket plugin] protocol changes: getSupportedEventTypes is getSupported. 'data' changed type to array of objects instead of array of strings. See plugins/websocket/protocol - Removed old ButtonEvent interface as it conflicted with the new ButtonEvent. -- Extensive documentation improvements. Plugin docs install to /usr/share/doc/packages/automotive-message-broker/0.13/plugins/. -- Bluemonkey JS API docs /usr/share/doc/packages/automotive-message-broker/0.13/plugins/bluemonkey/html/. +- Extensive documentation improvements. Plugin docs install to /usr/local/share/doc/packages/automotive-message-broker/0.13/plugins/. +- Bluemonkey JS API docs /usr/local/share/doc/packages/automotive-message-broker/0.13/plugins/bluemonkey/html/. Fixes: - [DBus plugin] Fix exporting properties in zones that really don't have support diff --git a/plugins/common/bluetooth5.cpp b/plugins/common/bluetooth5.cpp index f836b422..5bdbd2f1 100644 --- a/plugins/common/bluetooth5.cpp +++ b/plugins/common/bluetooth5.cpp @@ -6,6 +6,8 @@ #include <gio/gunixfdlist.h> #include <string> +GBusType bustype=G_BUS_TYPE_SYSTEM; + static const gchar introspection_xml[] = "<node>" " <interface name='org.bluez.Profile1'>" @@ -121,7 +123,7 @@ std::string findDevice(std::string address, std::string adapterPath="") std::string objectPath; GError * proxyError = nullptr; - auto managerProxy = amb::make_super(g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, NULL, + auto managerProxy = amb::make_super(g_dbus_proxy_new_for_bus_sync(bustype, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.bluez", "/", "org.freedesktop.DBus.ObjectManager", @@ -215,7 +217,7 @@ Bluetooth5::Bluetooth5() GDBusInterfaceInfo* mInterfaceInfo = g_dbus_node_info_lookup_interface(introspection, "org.bluez.Profile1"); - mConnection = amb::make_super(g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, &errorBus)); + mConnection = amb::make_super(g_bus_get_sync(bustype, nullptr, &errorBus)); auto errorBusPtr = amb::make_super(errorBus); @@ -308,7 +310,7 @@ void Bluetooth5::connect(ConnectedCallback onconnectedCallback) GError* error = nullptr; - auto deviceProxyPtr = amb::make_super(g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,G_DBUS_PROXY_FLAGS_NONE,NULL, + auto deviceProxyPtr = amb::make_super(g_dbus_proxy_new_for_bus_sync(bustype,G_DBUS_PROXY_FLAGS_NONE,NULL, "org.bluez", mPath.c_str(), "org.bluez.Device1", nullptr, &error)); auto errorPtr = amb::make_super(error); @@ -341,7 +343,7 @@ void Bluetooth5::disconnect() { GError* error = nullptr; - auto deviceProxyPtr = amb::make_super(g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,G_DBUS_PROXY_FLAGS_NONE,NULL, + auto deviceProxyPtr = amb::make_super(g_dbus_proxy_new_for_bus_sync(bustype,G_DBUS_PROXY_FLAGS_NONE,NULL, "org.bluez", mPath.c_str(), "org.bluez.Device1", nullptr, &error)); auto errorPtr = amb::make_super(error); diff --git a/plugins/dbus/abstractdbusinterface.cpp b/plugins/dbus/abstractdbusinterface.cpp index f4c575c1..684b8ff0 100644 --- a/plugins/dbus/abstractdbusinterface.cpp +++ b/plugins/dbus/abstractdbusinterface.cpp @@ -17,6 +17,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "abstractdbusinterface.h" +#include "dbusplugin.h" #include <abstractroutingengine.h> #include <debugout.h> @@ -37,7 +38,7 @@ PropertyList AbstractDBusInterface::mimplementedProperties; const uint getPid(const char *owner) { GError* error = nullptr; - GDBusProxy* dbus = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, NULL, + GDBusProxy* dbus = g_dbus_proxy_new_for_bus_sync(bustype, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.DBus", "/", "org.freedesktop.DBus", diff --git a/plugins/dbus/automotivemanager.cpp b/plugins/dbus/automotivemanager.cpp index a6b1ca25..d5c56b06 100644 --- a/plugins/dbus/automotivemanager.cpp +++ b/plugins/dbus/automotivemanager.cpp @@ -1,3 +1,4 @@ +#include "dbusplugin.h" #include "automotivemanager.h" #include "abstractdbusinterface.h" #include "listplusplus.h" @@ -380,7 +381,7 @@ static void signalCallback( GDBusConnection *connection, for(auto itr = i.second.begin(); itr != i.second.end(); itr++) { std::string n = *itr; - if(n == name) + if(n == name && !persistent) { DebugOut()<<"unreferencing "<<n<<" from the subscription of "<<iface->objectPath()<<endl; itr = manager->subscribedProcesses[iface].erase(itr); @@ -445,7 +446,7 @@ AutomotiveManager::AutomotiveManager(GDBusConnection *connection) g_assert(regId > 0); - g_dbus_connection_signal_subscribe(g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL,NULL), "org.freedesktop.DBus", "org.freedesktop.DBus", + g_dbus_connection_signal_subscribe(g_bus_get_sync(bustype, NULL,NULL), "org.freedesktop.DBus", "org.freedesktop.DBus", "NameOwnerChanged", "/org/freedesktop/DBus", NULL, G_DBUS_SIGNAL_FLAGS_NONE, signalCallback, this, NULL); } diff --git a/plugins/dbus/dbusinterfacemanager.cpp b/plugins/dbus/dbusinterfacemanager.cpp index 0fff219e..87976cfc 100644 --- a/plugins/dbus/dbusinterfacemanager.cpp +++ b/plugins/dbus/dbusinterfacemanager.cpp @@ -158,7 +158,7 @@ on_name_lost (GDBusConnection *connection, const gchar *name, gpointer user_data DBusInterfaceManager::DBusInterfaceManager(AbstractRoutingEngine* engine,std::map<std::string,std::string> config) :AbstractSink(engine,config),re(engine), connection(nullptr) { - ownerId = g_bus_own_name(G_BUS_TYPE_SYSTEM, + ownerId = g_bus_own_name(bustype, DBusServiceName, G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired, diff --git a/plugins/dbus/dbusplugin.cpp b/plugins/dbus/dbusplugin.cpp index ed950268..3bd10285 100644 --- a/plugins/dbus/dbusplugin.cpp +++ b/plugins/dbus/dbusplugin.cpp @@ -24,8 +24,21 @@ #include "debugout.h" #include "listplusplus.h" +bool persistent=false; +GBusType bustype=G_BUS_TYPE_SYSTEM; + extern "C" AbstractSinkManager * create(AbstractRoutingEngine* routingengine, map<string, string> config) { + if(config.find("sessionbus") != config.end()) + { + bustype=G_BUS_TYPE_SESSION; + } + + if(config.find("persistent") != config.end()) + { + persistent=true; + } + return new DBusSinkManager(routingengine, config); } diff --git a/plugins/dbus/dbusplugin.h b/plugins/dbus/dbusplugin.h index 74128dfe..11f8c0c4 100644 --- a/plugins/dbus/dbusplugin.h +++ b/plugins/dbus/dbusplugin.h @@ -27,6 +27,10 @@ #include <map> #include <type_traits> +extern GBusType bustype; +extern bool persistent; + + class DBusSink : public AbstractSink, public AbstractDBusInterface { diff --git a/tests/amb-get.py b/tests/amb-get.py index 352961b9..601ff18a 100755 --- a/tests/amb-get.py +++ b/tests/amb-get.py @@ -8,12 +8,17 @@ import json print "This application is deprecated. It will disappear in the future. Use ambctl" parser = argparse.ArgumentParser() +parser.add_argument("--sessionbus", help="use session bus", action='store_true') parser.add_argument("get", help="get {objectName}") args = parser.parse_args() objectName = args.get -bus = dbus.SystemBus() +if (args.sessionbus): + bus = dbus.SessionBus() +else: + bus = dbus.SystemBus() + managerObject = bus.get_object("org.automotive.message.broker", "/"); managerInterface = dbus.Interface(managerObject, "org.automotive.Manager") diff --git a/xwalk/vehicle.cc b/xwalk/vehicle.cc index cea84802..97083417 100644 --- a/xwalk/vehicle.cc +++ b/xwalk/vehicle.cc @@ -295,7 +295,7 @@ Vehicle::Vehicle(common::Instance* instance) GError* error = nullptr; - dbus_connection_ = amb::make_super(g_bus_get_sync(G_BUS_TYPE_SYSTEM, + dbus_connection_ = amb::make_super(g_bus_get_sync(bustype, nullptr, &error)); |