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 +++ .../automotive-message-broker_git.bb | 43 +++++++ .../packagegroup-ivi-common-core-automotive.bb | 1 + 4 files changed, 183 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 create mode 100644 meta-ivi-common/recipes-automotive/automotive-message-broker/automotive-message-broker_git.bb (limited to 'meta-ivi-common') 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 diff --git a/meta-ivi-common/recipes-automotive/automotive-message-broker/automotive-message-broker_git.bb b/meta-ivi-common/recipes-automotive/automotive-message-broker/automotive-message-broker_git.bb new file mode 100644 index 000000000..b921b99c8 --- /dev/null +++ b/meta-ivi-common/recipes-automotive/automotive-message-broker/automotive-message-broker_git.bb @@ -0,0 +1,43 @@ +SUMMARY = "automotive message broker" +DESCRIPTION = "Automotive-message-broker abstracts the details of the network \ +away from applications and provides a standard API for applications to easily \ +get the required information" + +HOMEPAGE = "https://github.com/otcshare/automotive-message-broker/wiki" +LICENSE = "LGPL-2.1" +LIC_FILES_CHKSUM = "file://COPYING;md5=b42382de5d854b9bb598acf2e8827de3" + +inherit cmake systemd + +PV = "0.12+git${SRCPV}" + +# The 'gpsd' cause conflict bluez4 and bluez5 because +# meta-openembedded/meta-oe/recipes-navigation/gpsd/gpsd_3.10.bb is able to +# select bluez4 only instead AGL Distro choosed bluez5 at Changes 4141. +# +# +# As temporary treatment, removing 'gpsd' from DEPENDS will let bitbake to build correctly. +# +#DEPENDS = "glib-2.0 util-linux sqlite3 qtbase boost json-c libtool gpsd" +DEPENDS = "glib-2.0 util-linux sqlite3 boost json-c libtool" + +SRC_URI = "git://github.com/otcshare/automotive-message-broker.git" +SRCREV = "ac3fe53327a13afc571efe079a31a0472ea285a3" + +SRC_URI += "file://amb_allow_sessionbus.patch \ + file://ambd.service \ + " + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN} = "ambd.service" + +S = "${WORKDIR}/git" + +do_install_append() { + mv ${D}/usr/include/amb/* ${D}/usr/include + + install -d ${D}${systemd_unitdir}/system/ + install -m 0644 ${WORKDIR}/ambd.service ${D}${systemd_unitdir}/system +} + +FILES_${PN} += "${systemd_unitdir}/ambd.service" diff --git a/meta-ivi-common/recipes-core/packagegroups/packagegroup-ivi-common-core-automotive.bb b/meta-ivi-common/recipes-core/packagegroups/packagegroup-ivi-common-core-automotive.bb index a623abded..98ff7cab0 100644 --- a/meta-ivi-common/recipes-core/packagegroups/packagegroup-ivi-common-core-automotive.bb +++ b/meta-ivi-common/recipes-core/packagegroups/packagegroup-ivi-common-core-automotive.bb @@ -12,4 +12,5 @@ PACKAGES = "\ ALLOW_EMPTY_${PN} = "1" RDEPENDS_${PN} += "\ + automotive-message-broker \ " -- cgit 1.2.3-korg