summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Maw <jonathan.maw@codethink.co.uk>2015-12-10 13:18:54 +0000
committerJonathan Maw <jonathan.maw@codethink.co.uk>2015-12-10 13:18:54 +0000
commit4591c6bbc3cd3fe0176ce038d28a8643dd3f3841 (patch)
tree3d57fa836fbc11d1367b95c5b31c25fdc067d6df
parentc8ce960bd2862b58d394d02b1d49f1d097665adf (diff)
downloadgenivi-demo-platform-hmi-4591c6bbc3cd3fe0176ce038d28a8643dd3f3841.tar.gz
Move communication entirely to the system bus
-rw-r--r--app/gdp-hmi-launcher2/gdp-hmi-launcher2.cpp6
-rw-r--r--src/gdp-dbus-service.cpp9
-rw-r--r--src/gdp-dbus-systemd.cpp4
-rw-r--r--src/gdp-hmi-controller.cpp15
4 files changed, 12 insertions, 22 deletions
diff --git a/app/gdp-hmi-launcher2/gdp-hmi-launcher2.cpp b/app/gdp-hmi-launcher2/gdp-hmi-launcher2.cpp
index a79172a..eb3665e 100644
--- a/app/gdp-hmi-launcher2/gdp-hmi-launcher2.cpp
+++ b/app/gdp-hmi-launcher2/gdp-hmi-launcher2.cpp
@@ -50,12 +50,12 @@ GDPLauncherClass::GDPLauncherClass()
{
int pcl_return;
#ifdef USE_DLT
- DLT_LOG(launcherTraceCtx,DLT_LOG_INFO,DLT_STRING("Debug: GDPLauncherClass - dbus session.\n"));
+ DLT_LOG(launcherTraceCtx,DLT_LOG_INFO,DLT_STRING("Debug: GDPLauncherClass - dbus connection.\n"));
#else
- sd_journal_print(LOG_DEBUG, "Debug: GDPLauncherClass - dbus session.\n");
+ sd_journal_print(LOG_DEBUG, "Debug: GDPLauncherClass - dbus connection.\n");
#endif
m_controller = new org::genivi::gdp::HMI_Controller(GDP_DBUS_SERVICE_NAME,
- GDP_DBUS_SERVICE_PATH, QDBusConnection::sessionBus(), this);
+ GDP_DBUS_SERVICE_PATH, QDBusConnection::systemBus(), this);
m_timerId = startTimer(5000); // 5 second timer
/* Initialize Persistence Client Library */
diff --git a/src/gdp-dbus-service.cpp b/src/gdp-dbus-service.cpp
index 2c74951..02cdca7 100644
--- a/src/gdp-dbus-service.cpp
+++ b/src/gdp-dbus-service.cpp
@@ -20,7 +20,7 @@
* \brief HMI controller service API on D-Bus for the GENIVI Demo Platform
*
* This component implements the HMI controller service API and makes it
- * available on the D-Bus session bus.
+ * available on the D-Bus system bus.
*/
#include <stdio.h>
@@ -32,7 +32,6 @@
#include "gdp-dbus-service.h"
#include "gdp-dbus-systemd.h"
-extern SystemdService *gSystemdSession; // systemd on session bus (d-bus)
extern SystemdService *gSystemd; // systemd on system bus (d-bus)
HmiService::HmiService(DBus::Connection &connection)
@@ -53,7 +52,7 @@ std::string HmiService::Show(const std::string &unit)
if (0 == unit.compare(0, 16, "PowerOff.service")) {
sd_journal_print(LOG_DEBUG, "HmiService::Show() - %s (match)\n",
unit.c_str());
- std::string path = gSystemdSession->StartUnit(unit, "replace");
+ std::string path = gSystemd->StartUnit(unit, "replace");
} else {
sd_journal_print(LOG_DEBUG, "HmiService::Show() - %s\n",
unit.c_str());
@@ -68,9 +67,9 @@ std::string HmiService::Show(const std::string &unit)
unit.c_str(), gdp_surfaces[count].id_surface);
} else {
// request systemd to start the unit
- std::string path = gSystemdSession->StartUnit(unit, "replace");
+ std::string path = gSystemd->StartUnit(unit, "replace");
sd_journal_print(LOG_DEBUG,
- "systemd(session)::StartUnit() - %s\n", path.c_str());
+ "systemd::StartUnit() - %s\n", path.c_str());
}
break; // for-loop
}
diff --git a/src/gdp-dbus-systemd.cpp b/src/gdp-dbus-systemd.cpp
index 2f971c7..bfa0ae0 100644
--- a/src/gdp-dbus-systemd.cpp
+++ b/src/gdp-dbus-systemd.cpp
@@ -19,8 +19,8 @@
* \brief HMI controller interface with systemd via D-Bus
*
* This component implements the HMI controller interface with systemd via
- * D-Bus. Using the session bus to query application status and using the
- * system bus for calling the systemd 'PowerOff' method.
+ * D-Bus. Using the system bus to query application status and for calling
+ * the systemd 'PowerOff' method.
*/
#include <stdio.h>
diff --git a/src/gdp-hmi-controller.cpp b/src/gdp-hmi-controller.cpp
index 63afa7d..86b8b60 100644
--- a/src/gdp-hmi-controller.cpp
+++ b/src/gdp-hmi-controller.cpp
@@ -71,7 +71,6 @@ static unsigned int* surfacesArray = NULL;
static const char *GDP_HMI_PID_FILENAME = "/var/run/gdp-hmi-controller.pid";
DBus::Glib::BusDispatcher dispatcher; // dbus-c++ bus dispatcher (glib)
-SystemdService *gSystemdSession; // systemd on session bus (d-bus)
SystemdService *gSystemd; // systemd on system bus (d-bus)
// database of well known surface and layer IDs as well as unit names
@@ -733,7 +732,7 @@ int main(int argc, char * const* argv)
fd = create_pid_file(argv[0], GDP_HMI_PID_FILENAME);
/*
- * make ourselves available on the d-bus session bus
+ * make ourselves available on the d-bus system bus
*
* currently this interface is only used by the launcher to tell the
* controller (us), to power off, which application (systemd unit) to
@@ -744,25 +743,17 @@ int main(int argc, char * const* argv)
DBus::default_dispatcher = &dispatcher;
dispatcher.attach(NULL);
- DBus::Connection conn = DBus::Connection::SessionBus();
+ DBus::Connection conn = DBus::Connection::SystemBus();
conn.request_name(GDP_DBUS_SERVICE_NAME);
HmiService service(conn);
sd_journal_print(LOG_INFO, "GDP HMI Controller (dbus) - %s\n",
GDP_DBUS_SERVICE_NAME);
- // make a connection to systemd on the session bus
- DBus::Connection sessionBus = DBus::Connection::SessionBus();
- SystemdService systemdSession(sessionBus,
- SYSTEMD_DBUS_SERVICE_PATH, SYSTEMD_DBUS_SERVICE_NAME);
- gSystemdSession = &systemdSession;
- std::string systemdVersion = systemdSession.Version();
- sd_journal_print(LOG_INFO, "GDP HMI Control -> systemd (session)"
- " systemd version: %s\n", systemdVersion.c_str());
// make a connection to systemd on the system bus
DBus::Connection systemBus = DBus::Connection::SystemBus();
SystemdService systemd(systemBus,
SYSTEMD_DBUS_SERVICE_PATH, SYSTEMD_DBUS_SERVICE_NAME);
gSystemd = &systemd;
- systemdVersion = systemd.Version();
+ std::string systemdVersion = systemd.Version();
sd_journal_print(LOG_INFO, "GDP HMI Control -> systemd (system)"
" systemd version: %s\n", systemdVersion.c_str());