summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsebastien baudouin <sebastien.baudouin@windriver.com>2015-03-17 16:58:05 +0100
committerroot <sebastien.baudouin@windriver.com>2015-04-01 10:03:57 +0200
commit3955d0dd4a544577f812854ef333ddb80dbc177f (patch)
treeb388d6c9780adc99a7abfaa8ce91a3d8499ff2b6
parentd381c04defc530aff90977012895b48adf104f5f (diff)
downloadgenivi-demo-platform-hmi-3955d0dd4a544577f812854ef333ddb80dbc177f.tar.gz
gdp-hmi-launcher2: Add DLT support for launcher2baserock/jonathanmaw/genivi-demo-jetson
This commit enable under flag usage of DLT GENIVI Log and Trace tool. User needs to define USE_DLT flag for enabling output of traces using DLT tool and infrastructure.
-rw-r--r--app/gdp-hmi-launcher2/README12
-rw-r--r--app/gdp-hmi-launcher2/gdp-hmi-launcher2.bb2
-rw-r--r--app/gdp-hmi-launcher2/gdp-hmi-launcher2.cpp13
-rw-r--r--app/gdp-hmi-launcher2/gdp-hmi-launcher2.pro4
-rwxr-xr-xapp/gdp-hmi-launcher2/main.cpp25
5 files changed, 53 insertions, 3 deletions
diff --git a/app/gdp-hmi-launcher2/README b/app/gdp-hmi-launcher2/README
new file mode 100644
index 0000000..1aad4c0
--- /dev/null
+++ b/app/gdp-hmi-launcher2/README
@@ -0,0 +1,12 @@
+GENIVI is providing Diagnostic Log and Trace component also called DLT. It is a
+reusable open source software component for standardized logging and tracing in
+infotainement ECUs based on the AUTOSAR 4.0 standard. The goal of DLT is the
+consolidation of the existing variety of logging and tracing protocols on one
+format.
+
+Launcher2 is also a way for GENIVI to show how to use DLT in a client point of
+view. It is advised to read the wiki page built to help using DLT.
+http://projects.genivi.org/diagnostic-log-trace/sites/projects.genivi.org.diagnostic-log-trace/files/dlt_user_manual.html
+
+In the case of Launcher2 the traces can be configured to use DLT enabling in
+.pro file the flag USE_DLT
diff --git a/app/gdp-hmi-launcher2/gdp-hmi-launcher2.bb b/app/gdp-hmi-launcher2/gdp-hmi-launcher2.bb
index c38ee14..58f2645 100644
--- a/app/gdp-hmi-launcher2/gdp-hmi-launcher2.bb
+++ b/app/gdp-hmi-launcher2/gdp-hmi-launcher2.bb
@@ -6,7 +6,7 @@ HOMEPAGE = "http://projects.genivi.org/genivi-demo-platform/"
LICENSE = "MPL-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=815ca599c9df247a0c7f619bab123dad"
-DEPENDS = "qtbase qtdeclarative gdp-hmi-panel"
+DEPENDS = "qtbase qtdeclarative gdp-hmi-panel dlt-daemon"
inherit qmake5
inherit externalsrc
diff --git a/app/gdp-hmi-launcher2/gdp-hmi-launcher2.cpp b/app/gdp-hmi-launcher2/gdp-hmi-launcher2.cpp
index b626f9b..84bccff 100644
--- a/app/gdp-hmi-launcher2/gdp-hmi-launcher2.cpp
+++ b/app/gdp-hmi-launcher2/gdp-hmi-launcher2.cpp
@@ -25,7 +25,12 @@
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
+#ifdef USE_DLT
+#include <dlt/dlt.h>
+DLT_IMPORT_CONTEXT(launcherTraceCtx);
+#else
#include <systemd/sd-journal.h>
+#endif
#include "gdp-hmi-launcher2.h"
@@ -36,7 +41,11 @@ static const char *GDP_DBUS_SERVICE_PATH = "/org/genivi/gdp/hmi/controller";
GDPLauncherClass::GDPLauncherClass()
: m_hmiControllerPid(-1)
{
+#ifdef USE_DLT
+ DLT_LOG(launcherTraceCtx,DLT_LOG_INFO,DLT_STRING("Debug: GDPLauncherClass - dbus session.\n"));
+#else
sd_journal_print(LOG_DEBUG, "Debug: GDPLauncherClass - dbus session.\n");
+#endif
m_controller = new org::genivi::gdp::HMI_Controller(GDP_DBUS_SERVICE_NAME,
GDP_DBUS_SERVICE_PATH, QDBusConnection::sessionBus(), this);
m_timerId = startTimer(5000); // 5 second timer
@@ -50,6 +59,10 @@ void GDPLauncherClass::timerEvent(QTimerEvent *event)
{
Q_UNUSED(event);
if ( !(m_controller->isValid()) ) {
+#ifdef USE_DLT
+ DLT_LOG(launcherTraceCtx,DLT_LOG_INFO,DLT_STRING("Info: HMI Controller - disconnected.\n"));
+#else
sd_journal_print(LOG_INFO, "Info: HMI Controller - disconnected.\n");
+#endif
}
}
diff --git a/app/gdp-hmi-launcher2/gdp-hmi-launcher2.pro b/app/gdp-hmi-launcher2/gdp-hmi-launcher2.pro
index 109e690..a98ecc1 100644
--- a/app/gdp-hmi-launcher2/gdp-hmi-launcher2.pro
+++ b/app/gdp-hmi-launcher2/gdp-hmi-launcher2.pro
@@ -31,13 +31,15 @@ SOURCES += \
RESOURCES += qml.qrc
+DEFINES += USE_DLT=1
+
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# enable C standard as published in 2011 as ISO/IEC 9899:2011 (known as C11)
CONFIG += c++11
-LIBS += -lsystemd
+LIBS += -lsystemd -ldlt
target.path = /usr/bin
diff --git a/app/gdp-hmi-launcher2/main.cpp b/app/gdp-hmi-launcher2/main.cpp
index 3aea5bb..22099f3 100755
--- a/app/gdp-hmi-launcher2/main.cpp
+++ b/app/gdp-hmi-launcher2/main.cpp
@@ -17,18 +17,35 @@
#include <QGuiApplication>
#include <QQuickView>
#include <QtDBus>
+
+#ifdef USE_DLT
+#include <dlt/dlt.h>
+DLT_DECLARE_CONTEXT(launcherTraceCtx);
+#else
#include <systemd/sd-journal.h>
+#endif
#include "gdp-hmi-launcher2.h"
+
#define GDP_LAUNCHER2_SURFACE_ID 1
int main(int argc, char* argv[])
{
+ int ret;
+#ifdef USE_DLT
+ DLT_REGISTER_APP("LAUNCHER2","GENIVI Demo Platform - Launcher2");
+ DLT_REGISTER_CONTEXT(launcherTraceCtx,"LNCH2_CTX", "Launcher2 Log & Trace Context");
+#endif
+
setenv("QT_QPA_PLATFORM", "wayland", 1); // force to use wayland plugin
setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1);
+#ifdef USE_DLT
+ DLT_LOG(launcherTraceCtx,DLT_LOG_INFO,DLT_STRING("GDP: launcher2 surface id="),DLT_INT(GDP_LAUNCHER2_SURFACE_ID));
+#else
sd_journal_print(LOG_DEBUG, "GDP: launcher2 surface (id=%u)",
GDP_LAUNCHER2_SURFACE_ID);
+#endif
QObject *object;
QGuiApplication app(argc,argv);
@@ -47,5 +64,11 @@ int main(int argc, char* argv[])
view.setProperty("IVI-Surface-ID", GDP_LAUNCHER2_SURFACE_ID);
view.showFullScreen();
- return app.exec();
+ ret = app.exec();
+
+#ifdef USE_DLT
+ DLT_UNREGISTER_CONTEXT(launcherTraceCtx);
+ DLT_UNREGISTER_APP();
+#endif
+ return ret;
}