summaryrefslogtreecommitdiff
path: root/examples/example2
diff options
context:
space:
mode:
authorAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2014-05-15 10:47:05 +0200
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2014-05-16 08:37:42 +0200
commit7feddfe828414c876af27ba7e425ff4da989f4e2 (patch)
tree209b3e25e2d57462fef3bd2604fb09fe781b1051 /examples/example2
parent965e022b9d5375691763864658b3f0cf39ecf875 (diff)
downloadDLT-daemon-7feddfe828414c876af27ba7e425ff4da989f4e2.tar.gz
Added new examples which can be manually build against DLt library.
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'examples/example2')
-rwxr-xr-xexamples/example2/CMakeLists.txt56
-rw-r--r--examples/example2/dlt_id.h10
-rw-r--r--examples/example2/example2.c73
-rw-r--r--examples/example2/example2.xml167
4 files changed, 306 insertions, 0 deletions
diff --git a/examples/example2/CMakeLists.txt b/examples/example2/CMakeLists.txt
new file mode 100755
index 0000000..65efbce
--- /dev/null
+++ b/examples/example2/CMakeLists.txt
@@ -0,0 +1,56 @@
+#######
+# Dlt - Diagnostic Log and Trace
+# @licence make begin@
+#
+# Copyright (C) 2011-2014, BMW AG - Alexander Wenzel <alexander.aw.wenzel@bmw.de>
+#
+# Contributions are licensed to the GENIVI Alliance under one or more
+# Contribution License Agreements.
+#
+# This Source Code Form is subject to the terms of the
+# Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+# this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# @licence end@
+########
+
+#
+# DLT example implementation
+#
+
+cmake_minimum_required( VERSION 2.6 )
+project( automotive-dlt-example2 )
+
+#
+# set prefix
+#
+
+set( CMAKE_INSTALL_PREFIX "/usr" )
+
+#
+# find dependency packages
+#
+
+find_package(PkgConfig)
+pkg_check_modules(DLT REQUIRED automotive-dlt)
+
+#
+# include directories
+#
+
+include_directories(
+ ${DLT_INCLUDE_DIRS}
+)
+
+#
+# build project
+#
+
+set(dlt_example2_SRCS example2.c)
+add_executable(dlt-example2 ${dlt_example2_SRCS})
+target_link_libraries(dlt-example2 ${DLT_LIBRARIES})
+set_target_properties(dlt-example2 PROPERTIES LINKER_LANGUAGE C)
+
+install(TARGETS dlt-example2
+ RUNTIME DESTINATION bin
+ COMPONENT base)
diff --git a/examples/example2/dlt_id.h b/examples/example2/dlt_id.h
new file mode 100644
index 0000000..e5d1dbc
--- /dev/null
+++ b/examples/example2/dlt_id.h
@@ -0,0 +1,10 @@
+// generated file, do not edit
+
+#ifndef DLT_ID_H
+#define DLT_ID_H
+
+#define DLT_EXA2_CON_EXA2_ID1 1000
+#define DLT_EXA2_CON_EXA2_ID2 1001
+#define DLT_EXA2_CON_EXA2_ID3 1002
+
+#endif /* DLT_ID_H */
diff --git a/examples/example2/example2.c b/examples/example2/example2.c
new file mode 100644
index 0000000..7daa9a9
--- /dev/null
+++ b/examples/example2/example2.c
@@ -0,0 +1,73 @@
+/**
+ * @licence app begin@
+ * Copyright (C) 2014 BMW AG
+ *
+ * This file is part of GENIVI Project Dlt - Diagnostic Log and Trace console apps.
+ *
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ *
+ * \author Alexander Wenzel <alexander.aw.wenzel@bmw.de> BMW 2011-2012
+ *
+ * \file dlt-example-user.c
+ * For further information see http://www.genivi.org/.
+ * @licence end@
+ */
+
+
+/*******************************************************************************
+** **
+** SRC-MODULE: example2.c **
+** **
+** TARGET : linux **
+** **
+** PROJECT : DLT **
+** **
+** AUTHOR : Alexander Wenzel Alexander.AW.Wenzel@bmw.de **
+** **
+** PURPOSE : **
+** **
+** REMARKS : **
+** **
+** PLATFORM DEPENDANT [yes/no]: yes **
+** **
+** TO BE CHANGED BY USER [yes/no]: no **
+** **
+*******************************************************************************/
+
+#include <stdio.h> /* for printf() and fprintf() */
+#include <stdlib.h> /* for atoi() and exit() */
+
+#include <dlt.h>
+
+#include "dlt_id.h"
+
+DLT_DECLARE_CONTEXT(con_exa2);
+
+int main()
+{
+ int num;
+
+ DLT_REGISTER_APP("EXA2","Third Example");
+ DLT_REGISTER_CONTEXT(con_exa2,"CON","First context");
+
+ DLT_NONVERBOSE_MODE();
+
+ for(num=0;num<10;num++)
+ {
+ DLT_LOG_ID(con_exa2,DLT_LOG_INFO,DLT_EXA2_CON_EXA2_ID1,DLT_INT32(12345678),DLT_STRING("Hello world 1!"));
+ DLT_LOG_ID(con_exa2,DLT_LOG_ERROR,DLT_EXA2_CON_EXA2_ID2,DLT_INT32(87654321),DLT_STRING("Hello world 2!"));
+ DLT_LOG_ID(con_exa2,DLT_LOG_WARN,DLT_EXA2_CON_EXA2_ID3,DLT_INT32(11223344),DLT_STRING("Hello world 3!"));
+ usleep(1000);
+ }
+
+ DLT_UNREGISTER_CONTEXT(con_exa2);
+
+ DLT_UNREGISTER_APP();
+}
diff --git a/examples/example2/example2.xml b/examples/example2/example2.xml
new file mode 100644
index 0000000..4a6b15c
--- /dev/null
+++ b/examples/example2/example2.xml
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<fx:FIBEX xmlns:ho="http://www.asam.net/xml" xmlns:fx="http://www.asam.net/xml/fbx">
+ <fx:PROJECT ID="projectEntry">
+ <ho:SHORT-NAME>projectEntry</ho:SHORT-NAME>
+ </fx:PROJECT>
+ <fx:ELEMENTS>
+ <fx:ECUS>
+ <fx:ECU ID="Entry">
+ <ho:SHORT-NAME>Entry</ho:SHORT-NAME>
+ <fx:MANUFACTURER-EXTENSION>
+ <SW_VERSION>unknown</SW_VERSION>
+ <APPLICATIONS>
+ <APPLICATION>
+ <APPLICATION_ID>EXA2</APPLICATION_ID>
+ <APPLICATION_DESCRIPTION>Third Example</APPLICATION_DESCRIPTION>
+ <CONTEXTS>
+ <CONTEXT>
+ <CONTEXT_ID>CON</CONTEXT_ID>
+ <CONTEXT_DESCRIPTION>First context</CONTEXT_DESCRIPTION>
+ </CONTEXT>
+ </CONTEXTS>
+ </APPLICATION>
+ </APPLICATIONS>
+ </fx:MANUFACTURER-EXTENSION>
+ </fx:ECU>
+ </fx:ECUS>
+ <fx:PDUS>
+ <fx:PDU ID="PDU_1000_0">
+ <ho:SHORT-NAME>PDU_1000_0</ho:SHORT-NAME>
+ <fx:BYTE-LENGTH>4</fx:BYTE-LENGTH>
+ <fx:PDU-TYPE>OTHER</fx:PDU-TYPE>
+ <fx:SIGNAL-INSTANCES>
+ <fx:SIGNAL-INSTANCE ID="S_1000_0">
+ <fx:SEQUENCE-NUMBER>0</fx:SEQUENCE-NUMBER>
+ <fx:SIGNAL-REF ID-REF="S_SINT32"/>
+ </fx:SIGNAL-INSTANCE>
+ </fx:SIGNAL-INSTANCES>
+ </fx:PDU>
+ <fx:PDU ID="PDU_1000_1">
+ <ho:SHORT-NAME>PDU_1000_1</ho:SHORT-NAME>
+ <fx:BYTE-LENGTH>0</fx:BYTE-LENGTH>
+ <fx:PDU-TYPE>OTHER</fx:PDU-TYPE>
+ <fx:SIGNAL-INSTANCES>
+ <fx:SIGNAL-INSTANCE ID="S_1000_0">
+ <fx:SEQUENCE-NUMBER>0</fx:SEQUENCE-NUMBER>
+ <fx:SIGNAL-REF ID-REF="S_STRG_ASCII"/>
+ </fx:SIGNAL-INSTANCE>
+ </fx:SIGNAL-INSTANCES>
+ </fx:PDU>
+ <fx:PDU ID="PDU_1001_0">
+ <ho:SHORT-NAME>PDU_1001_0</ho:SHORT-NAME>
+ <fx:BYTE-LENGTH>4</fx:BYTE-LENGTH>
+ <fx:PDU-TYPE>OTHER</fx:PDU-TYPE>
+ <fx:SIGNAL-INSTANCES>
+ <fx:SIGNAL-INSTANCE ID="S_1001_0">
+ <fx:SEQUENCE-NUMBER>0</fx:SEQUENCE-NUMBER>
+ <fx:SIGNAL-REF ID-REF="S_SINT32"/>
+ </fx:SIGNAL-INSTANCE>
+ </fx:SIGNAL-INSTANCES>
+ </fx:PDU>
+ <fx:PDU ID="PDU_1001_1">
+ <ho:SHORT-NAME>PDU_1001_1</ho:SHORT-NAME>
+ <fx:BYTE-LENGTH>0</fx:BYTE-LENGTH>
+ <fx:PDU-TYPE>OTHER</fx:PDU-TYPE>
+ <fx:SIGNAL-INSTANCES>
+ <fx:SIGNAL-INSTANCE ID="S_1001_0">
+ <fx:SEQUENCE-NUMBER>0</fx:SEQUENCE-NUMBER>
+ <fx:SIGNAL-REF ID-REF="S_STRG_ASCII"/>
+ </fx:SIGNAL-INSTANCE>
+ </fx:SIGNAL-INSTANCES>
+ </fx:PDU>
+ <fx:PDU ID="PDU_1002_0">
+ <ho:SHORT-NAME>PDU_1002_0</ho:SHORT-NAME>
+ <fx:BYTE-LENGTH>4</fx:BYTE-LENGTH>
+ <fx:PDU-TYPE>OTHER</fx:PDU-TYPE>
+ <fx:SIGNAL-INSTANCES>
+ <fx:SIGNAL-INSTANCE ID="S_1002_0">
+ <fx:SEQUENCE-NUMBER>0</fx:SEQUENCE-NUMBER>
+ <fx:SIGNAL-REF ID-REF="S_SINT32"/>
+ </fx:SIGNAL-INSTANCE>
+ </fx:SIGNAL-INSTANCES>
+ </fx:PDU>
+ <fx:PDU ID="PDU_1002_1">
+ <ho:SHORT-NAME>PDU_1002_1</ho:SHORT-NAME>
+ <fx:BYTE-LENGTH>0</fx:BYTE-LENGTH>
+ <fx:PDU-TYPE>OTHER</fx:PDU-TYPE>
+ <fx:SIGNAL-INSTANCES>
+ <fx:SIGNAL-INSTANCE ID="S_1002_0">
+ <fx:SEQUENCE-NUMBER>0</fx:SEQUENCE-NUMBER>
+ <fx:SIGNAL-REF ID-REF="S_STRG_ASCII"/>
+ </fx:SIGNAL-INSTANCE>
+ </fx:SIGNAL-INSTANCES>
+ </fx:PDU>
+ </fx:PDUS>
+ <fx:FRAMES>
+ <fx:FRAME ID="ID_1000">
+ <ho:SHORT-NAME>ID_1000</ho:SHORT-NAME>
+ <fx:BYTE-LENGTH>4</fx:BYTE-LENGTH>
+ <fx:FRAME-TYPE>OTHER</fx:FRAME-TYPE>
+ <fx:PDU-INSTANCES>
+ <fx:PDU-INSTANCE ID="P_1000_0">
+ <fx:PDU-REF ID-REF="PDU_1000_0"/>
+ <fx:SEQUENCE-NUMBER>0</fx:SEQUENCE-NUMBER>
+ </fx:PDU-INSTANCE>
+ <fx:PDU-INSTANCE ID="P_1000_1">
+ <fx:PDU-REF ID-REF="PDU_1000_1"/>
+ <fx:SEQUENCE-NUMBER>1</fx:SEQUENCE-NUMBER>
+ </fx:PDU-INSTANCE>
+ </fx:PDU-INSTANCES>
+ <fx:MANUFACTURER-EXTENSION>
+ <MESSAGE_TYPE>DLT_TYPE_LOG</MESSAGE_TYPE>
+ <MESSAGE_INFO>DLT_LOG_INFO</MESSAGE_INFO>
+ <APPLICATION_ID>EXA2</APPLICATION_ID>
+ <CONTEXT_ID>CON</CONTEXT_ID>
+ <MESSAGE_SOURCE_FILE>/home/alex/workspace/ascgit/dlt-daemon/examples/example2/example2.c</MESSAGE_SOURCE_FILE>
+ <MESSAGE_LINE_NUMBER>64</MESSAGE_LINE_NUMBER>
+ </fx:MANUFACTURER-EXTENSION>
+ </fx:FRAME>
+ <fx:FRAME ID="ID_1001">
+ <ho:SHORT-NAME>ID_1001</ho:SHORT-NAME>
+ <fx:BYTE-LENGTH>4</fx:BYTE-LENGTH>
+ <fx:FRAME-TYPE>OTHER</fx:FRAME-TYPE>
+ <fx:PDU-INSTANCES>
+ <fx:PDU-INSTANCE ID="P_1001_0">
+ <fx:PDU-REF ID-REF="PDU_1001_0"/>
+ <fx:SEQUENCE-NUMBER>0</fx:SEQUENCE-NUMBER>
+ </fx:PDU-INSTANCE>
+ <fx:PDU-INSTANCE ID="P_1001_1">
+ <fx:PDU-REF ID-REF="PDU_1001_1"/>
+ <fx:SEQUENCE-NUMBER>1</fx:SEQUENCE-NUMBER>
+ </fx:PDU-INSTANCE>
+ </fx:PDU-INSTANCES>
+ <fx:MANUFACTURER-EXTENSION>
+ <MESSAGE_TYPE>DLT_TYPE_LOG</MESSAGE_TYPE>
+ <MESSAGE_INFO>DLT_LOG_ERROR</MESSAGE_INFO>
+ <APPLICATION_ID>EXA2</APPLICATION_ID>
+ <CONTEXT_ID>CON</CONTEXT_ID>
+ <MESSAGE_SOURCE_FILE>/home/alex/workspace/ascgit/dlt-daemon/examples/example2/example2.c</MESSAGE_SOURCE_FILE>
+ <MESSAGE_LINE_NUMBER>65</MESSAGE_LINE_NUMBER>
+ </fx:MANUFACTURER-EXTENSION>
+ </fx:FRAME>
+ <fx:FRAME ID="ID_1002">
+ <ho:SHORT-NAME>ID_1002</ho:SHORT-NAME>
+ <fx:BYTE-LENGTH>4</fx:BYTE-LENGTH>
+ <fx:FRAME-TYPE>OTHER</fx:FRAME-TYPE>
+ <fx:PDU-INSTANCES>
+ <fx:PDU-INSTANCE ID="P_1002_0">
+ <fx:PDU-REF ID-REF="PDU_1002_0"/>
+ <fx:SEQUENCE-NUMBER>0</fx:SEQUENCE-NUMBER>
+ </fx:PDU-INSTANCE>
+ <fx:PDU-INSTANCE ID="P_1002_1">
+ <fx:PDU-REF ID-REF="PDU_1002_1"/>
+ <fx:SEQUENCE-NUMBER>1</fx:SEQUENCE-NUMBER>
+ </fx:PDU-INSTANCE>
+ </fx:PDU-INSTANCES>
+ <fx:MANUFACTURER-EXTENSION>
+ <MESSAGE_TYPE>DLT_TYPE_LOG</MESSAGE_TYPE>
+ <MESSAGE_INFO>DLT_LOG_WARN</MESSAGE_INFO>
+ <APPLICATION_ID>EXA2</APPLICATION_ID>
+ <CONTEXT_ID>CON</CONTEXT_ID>
+ <MESSAGE_SOURCE_FILE>/home/alex/workspace/ascgit/dlt-daemon/examples/example2/example2.c</MESSAGE_SOURCE_FILE>
+ <MESSAGE_LINE_NUMBER>66</MESSAGE_LINE_NUMBER>
+ </fx:MANUFACTURER-EXTENSION>
+ </fx:FRAME>
+ </fx:FRAMES>
+ </fx:ELEMENTS>
+</fx:FIBEX>