From 7017d4f847b2ce243540c5554dd72661a4a02865 Mon Sep 17 00:00:00 2001 From: Nedeljko Miljevic Date: Mon, 2 Nov 2015 10:24:38 +0100 Subject: Added AMB (automotive-message-broker) to meta-ivi-common layer v3:(Tadao Tanikawa) - Remove 'qtbase' from dependencies. v2:(Tadao Tanikawa) - Remove 'gpsd' dependency temporarily to complete bitbake without error. v1:(Nedeljko Miljevic) Change-Id: Ieebf982751486167482a303e53cd1ed834b55b3e Signed-off-by: Nedeljko Miljevic Signed-off-by: Tadao Tanikawa --- .../amb_allow_sessionbus.patch | 124 +++++++++++++++++++++ .../automotive-message-broker/ambd.service | 15 +++ 2 files changed, 139 insertions(+) create mode 100644 meta-ivi-common/recipes-automotive/automotive-message-broker/automotive-message-broker/amb_allow_sessionbus.patch create mode 100644 meta-ivi-common/recipes-automotive/automotive-message-broker/automotive-message-broker/ambd.service (limited to 'meta-ivi-common/recipes-automotive/automotive-message-broker/automotive-message-broker') diff --git a/meta-ivi-common/recipes-automotive/automotive-message-broker/automotive-message-broker/amb_allow_sessionbus.patch b/meta-ivi-common/recipes-automotive/automotive-message-broker/automotive-message-broker/amb_allow_sessionbus.patch new file mode 100644 index 000000000..d9b77c8f5 --- /dev/null +++ b/meta-ivi-common/recipes-automotive/automotive-message-broker/automotive-message-broker/amb_allow_sessionbus.patch @@ -0,0 +1,124 @@ +diff --git a/plugins/dbus/abstractdbusinterface.cpp b/plugins/dbus/abstractdbusinterface.cpp +index 9dd8566..19ef606 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 + #include +@@ -37,7 +38,7 @@ list 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 b5fb149..edbe1bd 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" +@@ -341,7 +342,7 @@ static void signalCallback( GDBusConnection *connection, + AbstractDBusInterface* iface = i.first; + for(auto n : i.second) + { +- if(n == name) ++ if(n == name && !persistent) + { + DebugOut()<<"unreferencing "<objectPath()<subscribedProcesses[iface].remove(n); +@@ -398,7 +399,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 0c8a645..07e6786 100644 +--- a/plugins/dbus/dbusinterfacemanager.cpp ++++ b/plugins/dbus/dbusinterfacemanager.cpp +@@ -236,7 +236,7 @@ on_name_lost (GDBusConnection *connection, const gchar *name, gpointer user_data + DBusInterfaceManager::DBusInterfaceManager(AbstractRoutingEngine* engine,std::map 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 7fa31c1..0b75d69 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 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 337f2f6..92e6255 100644 +--- a/plugins/dbus/dbusplugin.h ++++ b/plugins/dbus/dbusplugin.h +@@ -29,6 +29,9 @@ + + typedef std::map PropertyDBusMap; + ++extern GBusType bustype; ++extern bool persistent; ++ + class DBusSink : public AbstractSink, public AbstractDBusInterface + { + +diff --git a/tests/amb-get b/tests/amb-get +index 0835a64..7fb48ea 100755 +--- a/tests/amb-get ++++ b/tests/amb-get +@@ -5,12 +5,17 @@ import sys + import argparse + + 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/meta-ivi-common/recipes-automotive/automotive-message-broker/automotive-message-broker/ambd.service b/meta-ivi-common/recipes-automotive/automotive-message-broker/automotive-message-broker/ambd.service new file mode 100644 index 000000000..e06e2427f --- /dev/null +++ b/meta-ivi-common/recipes-automotive/automotive-message-broker/automotive-message-broker/ambd.service @@ -0,0 +1,15 @@ +# +# ambd systemd service unit file +# + +[Unit] +Description=Automotive Message Broker +After=syslog.target + +[Service] +Type=dbus +BusName=org.automotive.message.broker +ExecStart=/usr/bin/ambd + +[Install] +WantedBy=multi-user.target -- cgit 1.2.3-korg