summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaya Sugiura <ssugiura@jp.adit-jv.com>2019-06-28 10:35:58 +0900
committerSaya Sugiura <39760799+ssugiura@users.noreply.github.com>2019-07-19 14:46:29 +0900
commit5de77ee6df44b219a086051d9f2faa46d724192a (patch)
tree842e96ed7f668f5a4d64e4ea27160e8d689bb5c2
parentb59d7946d4863b3b939e384ff2c14eacb69530ad (diff)
downloadDLT-daemon-5de77ee6df44b219a086051d9f2faa46d724192a.tar.gz
doc: Documentation update
As written in README, following documents are removed and necessary information is moved to dlt_for_developers.md: - doc/dlt_user_manual.txt - doc/dlt_cheatsheet.txt - doc/dlt_book.txt Also following documents are removed: - doc/dlt_howto_debug.txt - doc/dlt_loglevel_explained.txt TODO: Update doc/dlt_design_specification.txt Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
-rw-r--r--doc/CMakeLists.txt12
-rw-r--r--doc/dlt_book.txt81
-rw-r--r--doc/dlt_cheatsheet.txt283
-rw-r--r--doc/dlt_for_developers.md74
-rw-r--r--doc/dlt_howto_debug.txt246
-rw-r--r--doc/dlt_loglevel_explained.txt135
-rw-r--r--doc/dlt_user_manual.txt390
7 files changed, 80 insertions, 1141 deletions
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 3fe41db..5d39e8d 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -40,11 +40,15 @@ if(WITH_DOC)
COMMAND mkdir -p ${PROJECT_BINARY_DIR}/doc/manuals/images
COMMAND cp ${PROJECT_SOURCE_DIR}/doc/images/* ${PROJECT_BINARY_DIR}/doc/manuals/images
COMMAND ${ASCIIDOC_TOOL} -a TOC1 -o ${PROJECT_BINARY_DIR}/doc/manuals/README.html ${PROJECT_SOURCE_DIR}/README.md
- COMMAND ${ASCIIDOC_TOOL} -a TOC1 -o ${PROJECT_BINARY_DIR}/doc/manuals/dlt_user_manual.html ${PROJECT_SOURCE_DIR}/doc/dlt_user_manual.txt
- COMMAND ${ASCIIDOC_TOOL} -a TOC1 -o ${PROJECT_BINARY_DIR}/doc/manuals/dlt_cheatsheet.html ${PROJECT_SOURCE_DIR}/doc/dlt_cheatsheet.txt
+ COMMAND ${ASCIIDOC_TOOL} -a TOC1 -o ${PROJECT_BINARY_DIR}/doc/manuals/dlt_glossary.html ${CMAKE_SOURCE_DIR}/doc/dlt_glossary.md
+ COMMAND ${ASCIIDOC_TOOL} -a TOC1 -o ${PROJECT_BINARY_DIR}/doc/manuals/dlt_for_developers.html ${CMAKE_SOURCE_DIR}/doc/dlt_for_developers.md
+ COMMAND ${ASCIIDOC_TOOL} -a TOC1 -o ${PROJECT_BINARY_DIR}/doc/manuals/dlt_offline_logstorage.html ${CMAKE_SOURCE_DIR}/doc/dlt_offline_logstorage.md
+ COMMAND ${ASCIIDOC_TOOL} -a TOC1 -o ${PROJECT_BINARY_DIR}/doc/manuals/dlt_multinode.html ${CMAKE_SOURCE_DIR}/doc/dlt_multinode.md
+ COMMAND ${ASCIIDOC_TOOL} -a TOC1 -o ${PROJECT_BINARY_DIR}/doc/manuals/dlt_extended_network_trace.html ${CMAKE_SOURCE_DIR}/doc/dlt_extended_network_trace.md
+ COMMAND ${ASCIIDOC_TOOL} -a TOC1 -o ${PROJECT_BINARY_DIR}/doc/manuals/dlt_filetransfer.html ${CMAKE_SOURCE_DIR}/doc/dlt_filetransfer.md
+ COMMAND ${ASCIIDOC_TOOL} -a TOC1 -o ${PROJECT_BINARY_DIR}/doc/manuals/dlt_kpi.html ${CMAKE_SOURCE_DIR}/doc/dlt_kpi.md
+ COMMAND ${ASCIIDOC_TOOL} -a TOC1 -o ${PROJECT_BINARY_DIR}/doc/manuals/dlt_cdh.html ${CMAKE_SOURCE_DIR}/doc/dlt_cdh.md
COMMAND ${ASCIIDOC_TOOL} -a TOC1 -o ${PROJECT_BINARY_DIR}/doc/manuals/dlt_design_specification.html ${PROJECT_SOURCE_DIR}/doc/dlt_design_specification.txt
- COMMAND ${ASCIIDOC_TOOL} -a TOC1 -o ${PROJECT_BINARY_DIR}/doc/manuals/dlt_book.html ${PROJECT_SOURCE_DIR}/doc/dlt_book.txt
- COMMAND ${ASCIIDOC_TOOL} -a TOC1 -o ${PROJECT_BINARY_DIR}/doc/manuals/dlt_howto_debug.html ${PROJECT_SOURCE_DIR}/doc/dlt_howto_debug.txt
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/doc
)
diff --git a/doc/dlt_book.txt b/doc/dlt_book.txt
deleted file mode 100644
index a1260d2..0000000
--- a/doc/dlt_book.txt
+++ /dev/null
@@ -1,81 +0,0 @@
-////
-# SPDX license identifier: MPL-2.0
-#
-# Copyright (C) 2011-2015, BMW AG
-#
-# This file is part of GENIVI Project DLT - Diagnostic Log and Trace.
-#
-# This Source Code Form is subject to the terms of the
-# Mozilla Public License (MPL), 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/.
-#
-# For further information see http://www.genivi.org/.
-////
-
-DLT Documentation
-=================
-Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
-0.0.2, 2016/02/23: Reworked version
-:toc:
-
-image::images/genivi_chrome_1_transparent.png[width=128]
-
-Purpose
--------
-This document is a compilation of all DLT documents.
-
-Information
------------
-
-:leveloffset: 2
-
-include::../README.md[]
-
-:leveloffset: 0
-
-Manuals
--------
-
-:leveloffset: 2
-
-include::dlt_user_manual.txt[]
-
-include::dlt_cheatsheet.txt[]
-
-include::dlt_loglevel_explained.txt[]
-
-include::dlt_design_specification.txt[]
-
-include::dlt_filetransfer.md[]
-
-include::dlt_extended_network_trace.md[]
-
-include::dlt_kpi.md[]
-
-include::dlt_cdh.md[]
-
-:leveloffset: 0
-
-Manpages
---------
-
-:leveloffset: 2
-
-include::dlt-daemon.1.md[]
-
-include::dlt.conf.5.md[]
-
-include::dlt-system.1.md[]
-
-include::dlt-system.conf.5.md[]
-
-include::dlt-convert.1.md[]
-
-include::dlt-sortbytimestamp.1.md[]
-
-include::dlt-receive.1.md[]
-
-include::dlt-logstorage-ctrl.1.md[]
-
-:leveloffset: 0
diff --git a/doc/dlt_cheatsheet.txt b/doc/dlt_cheatsheet.txt
deleted file mode 100644
index 8babc2a..0000000
--- a/doc/dlt_cheatsheet.txt
+++ /dev/null
@@ -1,283 +0,0 @@
-////
-# SPDX license identifier: MPL-2.0
-#
-# Copyright (C) 2011-2015, BMW AG
-#
-# This file is part of GENIVI Project DLT - Diagnostic Log and Trace.
-#
-# This Source Code Form is subject to the terms of the
-# Mozilla Public License (MPL), 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/.
-#
-# For further information see http://www.genivi.org/.
-////
-
-DLT Cheatsheet
-==============
-Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
-0.0.1, 2012/10/11: Initial version
-
-image::images/genivi_chrome_1_transparent.png[width=128]
-
-Overview
---------
-DLT is quiet easy to use. As an application developer you only need to follow some steps as described in this document.
-
-Initialisation:
-
-- Link your application against the DLT library
-- Include the DLT header file
-- Register your application
-- Define all contexts
-- Register all contexts
-
-Now you are ready to write your logs.
-
-Termination:
-
-- Unregister all contexts
-- Unregister application
-
-Link your application to DLT library
-------------------------------------
-If you compile your application with cmake, you have to add the following lines to your CMakeLists.txt
-
-----
-find_package(PkgConfig)
-pkg_check_modules(DLT REQUIRED automotive-dlt)
-----
-
-and use the variables $\{DLT_INCLUDE_DIRS\} and $\{DLT_LIBRARIES\} for the DLT include and library paths.
-
-Include the DLT Header
-----------------------
-To use DLT you have to include the DLT header file in each file you want to use DLT.
-
-----
-#include <dlt.h>
-----
-
-Register your application
--------------------------
-You have to register your application as early as possible during the initialisation of your application.
-You have to call the DLT_REGISTER_APP().
-It is only allowed to call DLT_REGISTER_APP() *once* in your application.
-You have to provide a application id, which size is maximum four charcters long. In this example we use "MAPP".
-And you can provide also a description for your application, here it is "Test Application for Logging".
-
-----
-int main(int argc, const char\* argv\[\])
-{
- DLT_REGISTER_APP("MAPP","Test Application for Logging");
-
-}
-----
-
-.Important notes:
-* DLT may not be used in a forked child until a variant of exec() is called,
- because DLT is using non async-signal-safe functions.
-----
-dlt_user_init();
-----
-* DLT_REGISTER_APP is asynchronous. It may take some milliseconds to establish the IPC channel. Because of this, you might lose messages if you log immediately after registering. Typically this is not a problem, but may arise especially with simple examples.
-
-
-
-Define all contexts
---------------------
-You can create as many contexts as you like.
-You can declare one or more contexts in a C or CPP file.
-Each context is only allowed to be declared once.
-You have to provide a unique variable name for your context.
-
-----
-#include <dlt.h>
-
-DLT_DECLARE_CONTEXT(myContext1);
-DLT_DECLARE_CONTEXT(myContext2);
-DLT_DECLARE_CONTEXT(myContext3);
-----
-
-If you want to use a context in another C or CPP file, you can import the context by calling
-
-----
-#include <dlt.h>
-
-DLT_IMPORT_CONTEXT(myContext1);
-DLT_IMPORT_CONTEXT(myContext2);
-DLT_IMPORT_CONTEXT(myContext3);
-----
-
-Register all contexts
-----------------------
-After you have registered your application you must register your contexts, early during initialisation of your application.
-Do not call DLT_REGISTER_CONTEXT() before DLT_REGISTER_APP().
-During registration of each context, you must provide a context id, which size is maximum four charcters long. In this example we use "TESX".
-And you can provide also a description for your context, here it is "Test Context X for Logging".
-
-----
-int main(int argc, const char\* argv\[\])
-{
- DLT_REGISTER_APP("MAPP","Test Application for Logging");
-
- DLT_REGISTER_CONTEXT(myContext1,"TES1","Test Context 1 for Logging");
- DLT_REGISTER_CONTEXT(myContext2,"TES2","Test Context 2 for Logging");
- DLT_REGISTER_CONTEXT(myContext3,"TES3","Test Context 3 for Logging");
-
-}
-----
-
-Create your logs
-----------------
-Now you can start creating your logs.
-Each log command consist of the context, the log level and a variable number of logging parameters.
-
-Log Level
-~~~~~~~~~
-The log level must be one of the following values:
-
-[options="header"]
-|==================================================================
-| Log level | Description
-| DLT_LOG_FATAL | fatal system error
-| DLT_LOG_ERROR | error with impact to correct functionality
-| DLT_LOG_WARN | warning, correct behaviour could not be ensured
-| DLT_LOG_INFO | informational (default)
-| DLT_LOG_DEBUG | debug
-| DLT_LOG_VERBOSE | highest grade of information
-|==================================================================
-
-DLT_LOG_FATAL, DLT_LOG_ERROR and DLT_LOG_WARN should be used in your application, when something is going wrong.
-DLT_LOG_INFO should be used to send the most important information.
-DLT_LOG_DEBUG and DLT_LOG_VERBOSE should be only used for testing information.
-
-Each context is set by default to DLT_LOG_INFO log level. All log message are send, which use this loglevel or a lower loglevel.
-If you also want to see DLT_LOG_DEBUG and DLT_LOG_VERBOSE log messages, you have to raise the log level with the DLT viewer.
-
-Logging parameters
-~~~~~~~~~~~~~~~~~~
-The following parameter types can be used.
-You can add one or more parameters to a single log message.
-The size of all logging parameters together should not exceed 2kBytes, including the DLT message header.
-
-[options="header"]
-|===============================================================
-| Type | Description
-| DLT_STRING(TEXT) | String
-| DLT_RAW(BUF,LENGTH) | Raw buffer
-| DLT_INT(VAR) | Integer variable, dependent on platform
-| DLT_INT16(VAR) | Integer 16 Bit variable
-| DLT_INT32(VAR) | Integer 32 Bit variable
-| DLT_INT64(VAR) | Integer 64 bit variable
-| DLT_UINT(VAR) | Unsigned integer variable
-| DLT_UINT16(VAR) | Unsigned 16 Bit integer variable
-| DLT_UINT32(VAR) | Unsigned 32 Bit integer variable
-| DLT_UINT64(VAR) | Unsigned 64 bit integer variable
-| DLT_BOOL(VAR) | Boolean variable
-| DLT_FLOAT32(VAR) | Float 32 Bit variable
-| DLT_FLOAT64(VAR) | Float 64 Bitvariable
-|===============================================================
-
-Logging command
-~~~~~~~~~~~~~~~
-Here are some examples for complete log messages.
-The contexts must be registered before.
-
-----
-DLT_LOG(myContext1,DLT_LOG_ERROR,DLT_INT(5),DLT_STRING("This is a error"));
-DLT_LOG(myContext2,DLT_LOG_INFO,DLT_INT(5),DLT_STRING("But this only information"));
-DLT_LOG(myContext3,DLT_LOG_DEBUG,DLT_INT(5),DLT_STRING("But this only information"));
-----
-
-Unregister contexts and applications
-------------------------------------
-Before terminating your application you must unregister all registered contexts and unregister at last your application.
-
-----
-int main(int argc, const char\* argv\[\])
-{
- DLT_REGISTER_APP("MAPP","Test Application for Logging");
-
- DLT_REGISTER_CONTEXT(myContext1,"TES1","Test Context 1 for Logging");
- DLT_REGISTER_CONTEXT(myContext2,"TES2","Test Context 2 for Logging");
- DLT_REGISTER_CONTEXT(myContext3,"TES3","Test Context 3 for Logging");
-
- DLT_UNREGISTER_CONTEXT(myContext1);
- DLT_UNREGISTER_CONTEXT(myContext2);
- DLT_UNREGISTER_CONTEXT(myContext3);
-
- DLT_UNREGISTER_APP();
-
- return 0;
-}
-----
-
-Example
--------
-Finally here is a complete example for using DLT:
-
-.dlt_example.c
-----
-#include <stdio.h>
-#include <dlt.h>
-
-DLT_DECLARE_CONTEXT(myContext1);
-DLT_DECLARE_CONTEXT(myContext2);
-DLT_DECLARE_CONTEXT(myContext3);
-
-int main()
-{
- /* register application */
- DLT_REGISTER_APP("MAPP","Test Application for Logging");
-
- /* register all contexts */
- DLT_REGISTER_CONTEXT(myContext1,"TES1","Test Context 1 for Logging");
- DLT_REGISTER_CONTEXT(myContext2,"TES2","Test Context 2 for Logging");
- DLT_REGISTER_CONTEXT(myContext3,"TES3","Test Context 3 for Logging");
-
- /* Write your logs */
- DLT_LOG(myContext1,DLT_LOG_ERROR,DLT_INT(5),DLT_STRING("This is a error"));
- DLT_LOG(myContext2,DLT_LOG_INFO,DLT_INT(5),DLT_STRING("But this only information"));
- DLT_LOG(myContext3,DLT_LOG_DEBUG,DLT_INT(5),DLT_STRING("But this only information"));
-
- /* Sleep some time to avoid a flaw in dlt-daemon that would eat your messages
- if you deregister while it still processes your registration */
- sleep(3);
-
- /* unregister your contexts */
- DLT_UNREGISTER_CONTEXT(myContext1);
- DLT_UNREGISTER_CONTEXT(myContext2);
- DLT_UNREGISTER_CONTEXT(myContext3);
-
- /* unregister your application */
- DLT_UNREGISTER_APP();
-
- return 0;
-
-}
-----
-
-.CMakeLists.txt
-----
-cmake_minimum_required(VERSION 2.6)
-
-find_package(PkgConfig)
-pkg_check_modules(DLT REQUIRED automotive-dlt)
-
-include_directories("${DLT_INCLUDE_DIRS}")
-
-project(DLTexample)
-add_executable(dlt_example dlt_example.c)
-
-target_link_libraries(dlt_example ${DLT_LIBRARIES})
-----
-
-.Build steps
-----
-mkdir build
-cd build
-cmake ..
-make
-----
-
diff --git a/doc/dlt_for_developers.md b/doc/dlt_for_developers.md
index cf6a501..026eba4 100644
--- a/doc/dlt_for_developers.md
+++ b/doc/dlt_for_developers.md
@@ -14,6 +14,14 @@ Table of Contents
## DLT Example Application
+To use DLT from an application, it has to be linked against the DLT library.
+When the DLT daemon is installed on the system, there will be a shared library
+with the name libdlt.so which provides the interface for applications to get a
+connection to the DLT daemon. The library path and include path must be set in
+the build environment prior to building a program using the shared dlt library.
+By default, the header file "dlt.h" is located in a directory called "dlt/"
+within the standard include directory.
+
This example gives an overview of DLT usage inside an application by using a
minimal code example. Detailed information about the API can be found later in
this document.
@@ -53,6 +61,26 @@ DLT type macros. In this example, DLT\_CSTRING is used to specify a constant
string. On application cleanup, all DLT contexts, as well as the DLT
application have to be unregistered.
+### DLT with cmake
+To use DLT with cmake, the following lines are the important ones:
+
+```
+find_package(PkgConfig)
+pkg_check_modules(DLT REQUIRED automotive-dlt)
+```
+
+to INCLUDE\_DIRECTORIES, add
+
+```
+${DLT_INCLUDE_DIRS}
+```
+
+and to TARGET\_LINK\_LIBRARIES:
+
+```
+${DLT_LIBRARIES}
+```
+
## General Rules for Logging
### Be Smart
@@ -169,6 +197,31 @@ which are logged in INFO, WARN, ERROR and FATAL will logged. Hint: The default
Log Level can be changed by setting an environment variable (see DLT Library -
runtime configuration).
+### Methods to set the log level for applications and contexts
+
+- dlt-daemon sets initial application log level
+ - There is a configuration parameter (see /etc/dlt.conf) `ContextLogLevel`.
+ When a new application registers itself at the daemon, the daemon sets
+ the application's log level to the value defined by the parameter.
+ - This happens when the application registers itself with
+ `DLT_REGISTER_CONTEXT()` or `dlt_register_context()`
+
+- Environment variable `DLT_INITIAL_LOG_LEVEL`
+ - There is an environment variable which is called `DLT_INITIAL_LOG_LEVEL`.
+ It allows to set a per-application-context log level. Refer to
+ [Initial Log level](#initial-log-level) for more detail.
+
+- Application registers itself at daemon with self defined log level
+ - In this case no log level is set by the daemon but by the application
+ itself.
+ - This happens when the application registers itself with
+ `DLT_REGISTER_CONTEXT_LL_TS()` or `dlt_register_context_ll_ts()`
+
+- Client (e.g. DLT Viewer) changes the log level of a particular application
+ context at runtime.
+ - The context's initial log level is set by one of the two methods described
+ above.
+
### What to log at FATAL level
Fatal errors are the most serious error and should be very rare.
@@ -313,8 +366,13 @@ be exported:
### Register application
-**Important note**: * DLT may not be used in a forked child until a variant of
-exec() is called, because DLT is using non async-signal-safe functions.
+**Important note**
+- DLT may not be used in a forked child until a variant of exec() is called,
+ because DLT is using non async-signal-safe functions.
+- DLT\_REGISTER\_APP is asynchronous. It may take some milliseconds to establish
+ the IPC channel. Because of this, you might lose messages if you log
+ immediately after registration. Typically this is not a problem, but may arise
+ especially with simple examples.
The DLT application has to be registered as early as possible during the
initialization of the application by calling DLT\_REGISTER\_APP(). It is only
@@ -510,6 +568,18 @@ DLT\_BIN8(UINT\_VAR) | 8 Bit binary value
DLT\_BIN16(UINT\_VAR | 16 Bit binary value
DLT\_PTR(PTR\_VAR) | Architecture independent macro to print pointers
+### Network Trace
+
+It is also possible to trace network messages. The interface, here
+DLT\_NW\_TRACE\_CAN, the length of the header data and a pointer to the header
+data, the length of the payload data and a pointer to the payload data, must be
+specified. If no header or payload is available, the corresponding length must
+be set to 0, and the corresponding pointer must be set to NULL.
+
+```
+DLT_TRACE_NETWORK(mycontext, DLT_NW_TRACE_CAN, headerlen, header, payloadlen, payload);
+```
+
### DLT C++ Extension
The DLT C++ extension was added to DLT in version 2.13. This approach solves
diff --git a/doc/dlt_howto_debug.txt b/doc/dlt_howto_debug.txt
deleted file mode 100644
index 380f49b..0000000
--- a/doc/dlt_howto_debug.txt
+++ /dev/null
@@ -1,246 +0,0 @@
-////
-# SPDX license identifier: MPL-2.0
-#
-# Copyright (C) 2011-2015, BMW AG
-#
-# This file is part of GENIVI Project DLT - Diagnostic Log and Trace.
-#
-# This Source Code Form is subject to the terms of the
-# Mozilla Public License (MPL), 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/.
-#
-# For further information see http://www.genivi.org/.
-////
-
-How To - Debug DLT Daemon
-=========================
-Lassi Marttala <Lassi.LM.Marttala@partner.bmw.de>
-0.0.1, 2013/03/18: Initial version
-
-image::images/genivi_chrome_1_transparent.png[width=128]
-
-== How to set up Eclipse, tools and project for debugging dlt-daemon
-This document describes how to set up an Eclipse development environment with minimal tool set and set up a project to compile and debug dlt-daemon.
-
-This document was written using KUbuntu 12.10 desktop. Any dpkg based Linux distribution should work equally well.
-
-The purpose is to provide the user with a clean working environment, where:
-
-* Build directory can be completely separated from source directory
-* There is no need to create need project files every time a user wishes to clean their working tree
-* dlt-daemon, library and all tools can be compiled from Eclipse UI without command line
-* Debugger can be easily launched for any of the binaries in dlt-daemon project
-
-Anything in
-----
-code
-----
-in this document is considered a command line command. Please use your preferred terminal emulator.
-
-=== Prerequisites
-Instructions on how to install needed base tools for compilation.
-
-==== Linux Desktop
-You can use any Linux Desktop environment that provides the needed packages for compilation of dlt-daemon and for running Eclipse. This document assumes you already have a dpkg-based Linux Desktop running, such as Debian, Ubuntu, Kubuntu or Xubuntu.
-
-==== C/C++ Compilers and Linker
-----
-sudo apt-get install gcc g++
-----
-This will install GNU C and C++ compilers, the linker and basic libraries for compilation.
-
-Purpose: Needed for compilation of C and C++ programs.
-
-==== Zlib-devel
-----
-sudo apt-get install zlib1g-dev
-----
-This will install the zlib compression library and development headers.
-
-Purpose: Needed for compiling dlt-system with file compression support.
-
-==== CMake
-----
-sudo apt-get install cmake
-----
-This will install cmake and any needed dependencies.
-
-Purpose: DLT utilizes cmake for build management.
-
-==== Git
-----
-sudo apt-get install git
-----
-This will install git version control tool.
-
-Purpose: dlt-daemon version control is managed using git. Git is needed to clone the source code repository.
-
-==== Java
-----
-sudo apt-get install default-jdk
-----
-This will install the default Java Development Kit for you Linux Distribution. For Kubuntu this is OpenJDK 7.
-
-Purpose: Eclipse needs Java to run. JDK is not strictly needed. You might be able to substitute with _*default-jre*_. This is untested, thought.
-
-=== Install Eclipse
-Download _"Eclipse IDE for C/C++ Developers"_ from http://www.eclipse.org/.
-
-At the time of writing, _"Eclipse CDT Juno"_ was the latest version.
-
-Extract the package to a directory. You should now have directory named "eclipse", which contains a binary called "eclipse". You should be able to start Eclipse by double clicking on the binary. In case there are problems, make sure you have proper permissions for the directory, sub-directories and that the binary has "executable"-flag set.
-----
-chmod u+x eclipse
-----
-if required.
-
-On first start-up, Eclipse will ask for a workspace directory. Select a directory, under which you want to keep your Eclipse project directories.
-
-image:images/eclipse-workspace.png[]
-
-After the startup, you are greeted with a "Welcome"-screen. Dismiss the window and you should be now in an empty C/C++ development perspective:
-image:images/eclipse-cpp-perspective.png[]
-
-You have a working Eclipse now. Next we need to get the source code for dlt-daemon.
-
-=== Acquire dlt-daemon Source
-Create a directory under which you want to store your source code. Then change to it.
-----
-mkdir ~/git
-cd ~/git
-----
-
-Clone the dlt-daemon repository, from the OSS server:
-----
-git clone http://git.projects.genivi.org/dlt-daemon.git
-----
-
-Test that the current software is compilable.
-----
-cd dlt-daemon
-mkdir build
-cd build
-cmake ..
-make
-----
-
-If these commands succeeded, you can continue. If there were errors, please remedy them before proceeding.
-
-Clean up the git directory. The following command will delete all files that are not part of the repository. Please use caution.
-----
-git clean -fdx
-----
-
-Now you have a working source directory. We can proceed to setting up the Eclipse project.
-
-Your source directory will be called DLT_GIT_DIR from now on in this document.
-
-=== Eclipse Project
-Now, return to your Eclipse. You should have the default C/C++ perspective open.
-
-Click on "File -> New -> C Project"
-
-A new dialogue will open:
-
-image:images/eclipse-create-c-project.png[]
-
-Name the project _"dlt-daemon"_.
-
-Select: _"Makefile project -> Empty Project"_ from the left and _"-- Other Toolchain --"_ from the right.
-
-Make a note of the project location. This will be know *DLT_PROJECT_DIR* from now on in this document.
-
-Click _"Next"._
-
-Click _"Advanced settings..."_ in the following dialog.
-
-image:images/eclipse-project-props-1.png[]
-
-In the _"C/C++ Build"_-page, set build directory to *$\{workspace_loc:/dlt-daemon\}/build
-
-image:images/eclipse-project-props-3.png[]
-
-In the _"C/C++ Build -> Settings"_-page, _"Binary Parsers"_-tab *Check* _"Elf Parser"_
-
-image:images/eclipse-project-props-4.png[]
-
-In the _"C/C++ General -> Preprocessor Includes"_-page, _"Providers"_-tab, *check* both _"CDT GCC"_-options.
-
-*Click* "OK".
-
-*Click* "Finish"
-
-We still need to define a new custom tool, to generate the needed makefiles, from cmake-files:
-
-From the main menu of Eclipse, *click* _"Run -> External Tools External Tools Configurations."_.
-
-In the new window, *click* in the top-left small icon _"New Launch Configuration"_.
-
-image:images/eclipse-external-tools-props-1.png[]
-
-Name the new tool "cmake".
-
-Point it to the cmake binary.
-
-Working directory should be DLT_PROJECT_DIR/build
-
-Arguments should include "-DCMAKE_BUILD_TYPE=DEBUG" and final argument should be your DLT_GIT_DIR
-
-image:images/eclipse-external-tools-props-2.png[]
-
-In the _"Build"_-tab, *uncheck* _"Build before launch"_
-
-*Click* _"Apply"_ +
-*Click* _"Close"_
-
-At this point, make sure that DLT_PROJECT_DIR/build, exists. If it doesn', create an empty directory. +
-Refresh the project by selecting the project from the left and hit "F5".
-
-Let's test it!
-
-Click _"Run -> External Tools -> cmake"_. cmake should now configure the project and finish with:
-
-_"Build files have been written to: DLT_PROJECT_DIR/build"_
-
-Click _"Project -> Build All"_. The normal "make" progress should commence and you should be left with build project.
-
-Click _"Run -> Debug"_. You should be greeted with dialog like this:
-
-image:images/eclipse-debug-which.png[]
-
-Select _"dlt-daemon"_ from the list and *click* _"OK"_.
-
-Select _"gdb/mi"_ from the following dialog, and *click* _"OK"_.
-
-Click _"Yes"_ when Eclipse asks if you want to switch to the debug perspective.
-
-image:images/eclipse-debug-perspective.png[]
-
-*Congratulations! You are now in debugger.*
-
-*Click* the red square to terminate the application, and click the _"C/C++ Perspective"_ from the top right.
-
-There's one more thing we need to do, to make your life easier.
-
-*Right click* on the _"dlt-daemon"_-project and select _"Import"_ .
-
-In the following dialog, select _"General -> File system"_ and *click* _"Next"_
-
-image:images/eclipse-import-links.png[]
-
-*Click* _"Browse"_ and navigate to your DLT_GIT_DIR.
-
-*Check* _"dlt-daemon"_ root directory.
-
-*Click* _"Advanced"_ and *Check* _"Create links"_ and _"Create virtual folders"_.
-
-*Click* _"Filter types..."_ and only check the file types you want to see _"*.c, *.h"_ is sufficient for most cases.
-
-*Click* _"Finish"_
-
-You now have the source code also easily accessible from the project tree:
-
-image:images/eclipse-cpp-perspective-2.png[]
-
-*All done!* \ No newline at end of file
diff --git a/doc/dlt_loglevel_explained.txt b/doc/dlt_loglevel_explained.txt
deleted file mode 100644
index 84ac11a..0000000
--- a/doc/dlt_loglevel_explained.txt
+++ /dev/null
@@ -1,135 +0,0 @@
-DLT Log Level Explained
-=======================
-Lutz Helwing <Lutz_Helwing@mentor.com>
-0.0.1, 23rd July 2017: Initial version
-
-Overview
---------
-From the DLT point of view an application logger is defined by its "context". Part of this context is a log level value. When an application registers its context at the daemon (`DLT_REGISTER_CONTEXT()` or `dlt_register_context()`) the context's log level is set by the daemon to a value specified in dlt.conf (`ContextLogLevel`). All log messages sent by the application also have a log level which could be different from context log level. When this log level is greater than the context log level the message is not sent to dlt-daemon (i.e. filtered at application level). Usually this per-message log level is hard-coded in the application or could be part of a config file read by the application. This is a task the application developer has to take care of.
-
-Example for context log level / message log level relation:
-
-Context log level: `DLT_LOG_INFO`
-
-Message log level: `DLT_LOG_INFO`
-
-=> Message is logged
-
-
-Context log level: `DLT_LOG_INFO`
-
-Message log level: `DLT_LOG_DEBUG`
-
-=> Message is not logged
-
-
-Context log level: `DLT_LOG_ERROR`
-
-Message log level: `DLT_LOG_INFO`
-
-=> Message is not logged
-
-
-Methods to set the log level for an application context
--------------------------------------------------------
-- dlt-daemon sets initial application log level
- + There is a configuration parameter (see /etc/dlt.conf) `ContextLogLevel`.
- When a new application registers itself at the daemon, the daemon sets the application's log level to the value defined by the parameter.
- + This happens when the application registers itself with `DLT_REGISTER_CONTEXT()` or `dlt_register_context()`
-
-- Environment variable `DLT_INITIAL_LOG_LEVEL`
- + There is an environment variable which is called `DLT_INITIAL_LOG_LEVEL`. Its value has the following form: `APID:CTID:LEVEL(;APID:CTID:LEVEL...)`. It allows to set a per-application-context log level. Values are separated by ';'.
- + Example: `DLT_INITIAL_LOG_LEVEL="AP1:CTX1:2;MLP:MLPC:3" ./my_logging_program` => my_logging_program context is started with log level `DLT_LOG_WARN` (can be seen in DLT Viewer)
-
-- Application registers itself at daemon with self defined log level
- + In this case no log level is set by the daemon but by the application itself.
- + This happens when the application registers itself with `DLT_REGISTER_CONTEXT_LL_TS()` or `dlt_register_context_ll_ts()`
-
-- Client (e.g. DLT Viewer) changes the log level of a particular application context at runtime.
- + The context's initial log level is set by one of the two methods described above.
-
-
-DLT Code Snippets
------------------
-Excerpt from DLT API dlt_user_macros.h (Macro interface):
-
- /**
- * Register context (with default log level and default trace status)
- * @param CONTEXT object containing information about one special logging context
- * @param CONTEXTID context id with maximal four characters
- * @param DESCRIPTION ASCII string containing description
- */
- #define DLT_REGISTER_CONTEXT(CONTEXT,CONTEXTID,DESCRIPTION)
-
- /**
- * Register context with pre-defined log level and pre-defined trace status.
- * @param CONTEXT object containing information about one special logging context
- * @param CONTEXTID context id with maximal four characters
- * @param DESCRIPTION ASCII string containing description
- * @param LOGLEVEL log level to be pre-set for this context
- (DLT_LOG_DEFAULT is not allowed here)
- * @param TRACESTATUS trace status to be pre-set for this context
- (DLT_TRACE_STATUS_DEFAULT is not allowed here)
- */
- #define DLT_REGISTER_CONTEXT_LL_TS(CONTEXT,CONTEXTID,DESCRIPTION,LOGLEVEL,TRACESTATUS)
-
-
- /**
- * Send log message with variable list of messages (intended for verbose mode)
- * @param CONTEXT object containing information about one special logging context
- * @param LOGLEVEL the log level of the log message
- * @param ARGS variable list of arguments
- * @note To avoid the MISRA warning "The comma operator has been used outside a for statement"
- * use a semicolon instead of a comma to separate the ARGS.
- * Example: DLT_LOG(hContext, DLT_LOG_INFO, DLT_STRING("Hello world"); DLT_INT(123));
- */
- #define DLT_LOG(CONTEXT,LOGLEVEL,ARGS...)
-
-
-
-Excerpt from DLT API dlt_user.h (function interface):
-
- /**
- * Register a context in the daemon.
- * This function has to be called before first usage of the context.
- * @param handle pointer to an object containing information about one special logging context
- * @param contextid four byte long character array with the context id
- * @param description long name of the context
- * @return Value from DltReturnValue enum
- */
- DltReturnValue dlt_register_context(DltContext *handle, const char *contextid, const char * description);
-
- /**
- * Register a context in the daemon with pre-defined log level and pre-defined trace status.
- * This function has to be called before first usage of the context.
- * @param handle pointer to an object containing information about one special logging context
- * @param contextid four byte long character array with the context id
- * @param description long name of the context
- * @param loglevel This is the log level to be pre-set for this context
- (DLT_LOG_DEFAULT is not allowed here)
- * @param tracestatus This is the trace status to be pre-set for this context
- (DLT_TRACE_STATUS_DEFAULT is not allowed here)
- * @return Value from DltReturnValue enum
- */
- DltReturnValue dlt_register_context_ll_ts(DltContext *handle, const char *contextid, const char * description, int loglevel, int tracestatus);
-
- /**
- * Write a null terminated ASCII string into a DLT log message.
- * @param handle pointer to an object containing information about one special logging context
- * @param loglevel this is the current log level of the log message to be sent
- * @param text pointer to the ASCII string written into log message containing null termination.
- * @return Value from DltReturnValue enum
- */
- DltReturnValue dlt_log_string(DltContext *handle,DltLogLevelType loglevel, const char *text);
-
- /**
- * Initialize the generation of a DLT log message (intended for usage in non-verbose mode)
- * This function has to be called first, when an application wants to send a new log messages.
- * Following functions like dlt_user_log_write_string and dlt_user_log_write_finish must only be called,
- * when return value is bigger than zero.
- * @param handle pointer to an object containing information about one special logging context
- * @param log pointer to an object containing information about logging context data
- * @param loglevel this is the current log level of the log message to be sent
- * @return Value from DltReturnValue enum, DLT_RETURN_TRUE if log level is matching
- */
- DltReturnValue dlt_user_log_write_start(DltContext *handle, DltContextData *log, DltLogLevelType loglevel);
diff --git a/doc/dlt_user_manual.txt b/doc/dlt_user_manual.txt
deleted file mode 100644
index 5cccfe9..0000000
--- a/doc/dlt_user_manual.txt
+++ /dev/null
@@ -1,390 +0,0 @@
-////
-# SPDX license identifier: MPL-2.0
-#
-# Copyright (C) 2011-2015, BMW AG
-#
-# This file is part of GENIVI Project DLT - Diagnostic Log and Trace.
-#
-# This Source Code Form is subject to the terms of the
-# Mozilla Public License (MPL), 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/.
-#
-# For further information see http://www.genivi.org/.
-////
-
-DLT User Manual
-===============
-Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
-0.0.1, 2012/10/10: Initial version
-Christoph Lipka <clipka@de.adit-jv.com>
-0.0.2, 2018/12/13: updated version
-
-image::images/genivi_chrome_1_transparent.png[width=128]
-
-== Purpose
-This document describes the usage of the DLT daemon.
-The DLT daemon is the central place where logs and traces are gathered from different applications, stored temporarily or permanently and transferred to a DLT client application, which can run directly on the GENIVI system or more likely on a external tester device.
-The DLT daemon component is based on the AUTOSAR 4.0 standard DLT.
-
-== Overview
-The DLT daemon is the central component in GENIVI, which gathers all logs and traces from the DLT user applications. The logs and traces are stored optionally directly in a file in the ECU. The DLT daemon forwards all logs and traces to a connected DLT client.
-The DLT client can send control messages to the daemon, e.g. to set individual log levels of applications and contexts or get the list of applications and contexts registered in the DLT daemon.
-
-The SW components of DLT:
-
-* dlt-daemon
-* dlt-system
-* dlt-adaptor-stdin
-* dlt-adaptor-udp
-* dlt-convert
-* dlt-sortbytimestamp
-* dlt-receive
-* dlt-dbus
-* dlt-kpi
-* dlt-cdh
-
-The SW components for controlling DLT:
-
-* dlt-control
-* dlt-logstorage-ctrl
-* dlt-passive-node-ctrl
-
-The SW components of DLT for testing:
-
-* dlt-example-user
-* dlt-example-user-func
-* dlt-example-filetransfer
-* dlt-example-user-common-api
-* dlt-test-filetransfer
-* dlt-test-stress-user
-* dlt-test-client
-* dlt-test-stress-client
-* dlt-test-multi-process-client
-* dlt-test-stress
-* dlt-test-multi-process
-* dlt-test-user
-* dlt-test-fork-handler
-* dlt-test-init-free
-
-== DLT daemon
-
-=== Features
-
-* Message injection callback
-** The Viewer can send a message to an application. The application has to register an injection callback.
-* Support for multiple applications and multiple contexts organized in a hierarchy
-* Support for different interfaces between daemon and viewer (
-* Binary transport of messages (TCP/IP, Serial)
-* Verbose and none-verbose mode support
-* System log-level and individual log-levels for contexts
-* Adapters to connect Linux log facilities, e.g. syslog (planned journal)
-* User library and Daemon has a temporary internal buffer
-* Trace message (network message) support
-* The viewer writes messages from several sources into a single trace file
-* File transfer + compression for small files, e.g., screenshots of HMI
-* Many configuration options
-* Viewer supports plug-ins\* \*(SDK + example code) e.g. MOST message formatting
-* Daemon or application mode
-** The DLT daemon can be started in daemon mode, which is the normal use case. For testing purpose it can also be started in a standard application mode. In application mode all output is displayed in the console. In daemon mode output is done to the syslog daemon.The daemon mode is needed specially in System V init start-up system.
-* Offline Trace
-** Optional an offline trace memory can be configured in the DLT daemon configuration. The offline trace is stored locally in the file system. The directory of the offline trace can be configured.
-* Trace Mode
-** A API is provided in the DLT library to change the trace mode. If the trace mode is changed, the trace mode is stored persistently in the runtime configuration.
-The following modes are possible:
-*** trace off
-*** online trace only (Default)
-*** offline trace only
-*** online and offline trace
-* Start-up Trace
-** During star-up the logging data is stored in a temporary buffer, until the first client is connected. This feature is only available, if no serial connection is configured and the trace mode is "online trace only".
-
-=== Command line interface
-See Manpage dlt-daemon(1).
-
-=== Configuration
-See Manpage dlt.conf(5).
-
-== DLT system logger
-
-=== Overview
-The dlt-system application provides the following features:
-
-* DLT file-transfer manager
-* Syslog Adapter over UDP
-* Logging of file content from filesystem
-* Logging of files from proc filesystem of processes
-
-All the configuration is done in the file /etc/dlt-system.conf.
-
-=== DLT Filetransfer
-The DLT file-transfer manager can control up to two directories, if they contain any files. When a new file is detected in theses directories, the file transfer over DLT is started for this file. When the file transfer is finished, a configurable time is waited, until the file is deleted and the transfer of the next file is started. The first file transfer starts after a configurable time after dlt-system is started.
-
-Flow control is used to control the amount of data which is sent at once over DLT. Currently the fill level of the shared memory is checked. When 50% of fill level is reached no new data is sent again, until the level falls under 50% again.
-
-Typical Use cases are file transfer of screenshots or core dump files.
-
-=== Syslog adapter
-The syslog adapter provides a UDP port, to which the syslog daemon can send each syslog message. The syslog configuration must be changed to do this. The used UDP port can be configured.
-
-=== Logging of files
-Every file in the filesystem can be logged over DLT. The files can be logged only once during start-up or periodically after a defined time. Several files can be configured to be logged.
-
-=== Logging of files from proc filesystem
-Every file in the proc filesystem of a process can be logged. Theses files can be logged only once during start-up or periodically after a defined time. A specific process can be selected or all processes at once.
-
-=== Command line interface
-See Manpage dlt-system(1).
-
-=== Configuration
-See Manpage dlt-system.conf(5).
-
-== DLT command line tools
-six command line tools are provided together with DLT daemon implementation.
-
-These tools are:
-
-* Data logger: dlt-receive
-* Converter: dlt-convert
-* Sorter: dlt-sortbytimestamp
-* Configuration: dlt-control
-* Logstorage: dlt-logstorage-ctrl
-* Multinode: dlt-passive-node-ctrl
-
-=== dlt-receive
-
-==== Overview
-dlt-receive is a command line tool to connect to the dlt-daemon and receive logs and display them in the console or store them in a file.
-
-==== Command line interface
-See Manpage dlt-receive(1).
-
-=== dlt-convert
-
-==== Overview
-The dlt-convert console utility is used to read DLT files, print DLT messages in different formats (ASCII, hex, mixed, headers only) and store the messages again. Filters can be used to filter messages. Ranges and output file can be used to cut DLT files. Two files and output file can be used to join DLT files.
-
-==== Command line interface
-See Manpage dlt-convert(1).
-
-=== dlt-sortbytimestamp
-
-==== Overview
-By default messages in DLT files are ordered according to the time the logger received them. This can unhelpful when tracing a sequence of events on a busy multi-threaded/multi-core system, because thread pre-emption combined with multiple processes attempting to log messages simultaneously means that the order in which the messages are received may vary significantly from the order in which they were created.
-
-The dlt-sortbytimestamp console utility is used to re-order the messages in DLT files, sorting them according to when the messages were created.
-
-Filters can be used to filter messages OR a range of messages to be processed can specified.
-
-Ranges are essential when processing a DLT file covering more than a single reboot cycle. This is because message timestamps are recorded relative to boot time and thus timestamping is reset to zero at each boot. Events from different boot cycles will have differing receive times, but may have identical boot relative timestamps. Using *dlt-sortbytimestamp* to sort such a DLT file will result in a tangled mess. Use ranges to avoid this. Use *dlt-viewer* to ascertain the start and end message indices of the desired range.
-
-==== Command line interface
-See Manpage dlt-sortbytimestamp(1).
-
-=== dlt-logstorage-ctrl
-
-==== Overview
-The dlt-logstorage-ctrl console utility is used to send a trigger to DLT Daemon to connect/disconnect/sync a certain offline logstorage device.
-
-==== Command line interface
-See Manpage dlt-logstorage-ctrl(1).
-
-=== dlt-passive-node-ctrl
-
-==== Overview
-The dlt-passive-node-ctrl console utility is used to send a trigger to DLT daemon to (dis)connect a passive node or get current passive node status.
-
-==== Command line interface
-See Manpage dlt-passive-node-ctrl(1).
-
-== DLT adaptors
-The DLT adaptors are used to interface legacy linux applications with the DLT daemon. Therefore, there are two adaptors:
-
-* dlt-adaptor-stdin for input received from stdin
-* dlt-adaptor-udp for input received from a specific udp port
-
-As command line parameters, the application id and context id can be specified individually for each instance of these programs. These id's are a character string consisting of up to 4 characters. Empty ids are not allowed and will be replaced with a default id. If not specified, the default id's will also be taken.
-
-=== dlt-adaptor-stdin
-The dlt-adaptor-stdin is a small external program for forwarding input from stdin to DLT daemon, and can be used for e.g. sending DBUS messages to the dlt daemon using the program dbus-monitor:
-
-$ dbus-monitor | dlt-adaptor-stdin
-
-=== dlt-adaptor-udp
-The dlt-adaptor-udp is a small external program for forwarding received UDP messages to DLT daemon, and can be used for e.g. sending syslog messages to the DLT daemon. Therefore a syslog daemon called syslog-ng is necessary. This syslog daemon must be configured to send the syslog messages to a specific UDP port. For configuration of this syslog daemon, see the documentation for syslog-ng.
-
-This tool is already integrated into dlt-system.
-
-== DLT library
-To use DLT from an application, the application has to link again the DLT library. When the DLT daemon is installed on the system , there will a shared library with the name
-libdlt.so which provides the interface for applications to get a connection to the DLT daemon.
-The library path and include path must be set in the build environment prior to building a program using the shared dlt library. By default, the include file "dlt.h" is located in a directory called "dlt/" within the standard include directory.
-
-=== Using DLT with cmake
-To use DLT with cmake, the following lines are the important ones:
-
-----
-pkg_check_modules(DLT REQUIRED automotive-dlt)
-----
-
-to INCLUDE_DIRECTORIES, add
-
-----
-${DLT_INCLUDE_DIRS}
-----
-
-and to TARGET_LINK_LIBRARIES:
-
-----
-${DLT_LIBRARIES}
-----
-
-=== Logging instruction
-
-==== Include the dlt header file:
-
-----
-#include <dlt.h>
-----
-
-==== Create logging context (place it beneath the define section):
-
-----
-DLT_DECLARE_CONTEXT(myContext);
-----
-
-==== Register the application and the context in main:
-
-----
-int main(int argc, const char\* argv\[\])
-{
- DLT_REGISTER_APP("LOG","Test Application for Logging");
-
- DLT_REGISTER_CONTEXT(mycontext,"TEST","Test Context for Logging");
-...
-
-}
-----
-
-.Important notes:
-* DLT may not be used in a forked child until a variant of exec() is called,
- because DLT is using non async-signal-safe functions.
-* DLT_REGISTER_APP is asynchronous. It may take some milliseconds to establish the IPC channel. Because of this, you might lose messages if you log immediately after registering. Typically this is not a problem, but may arise especially with simple examples.
-
-==== Use one of the DLT macros or the DLT function interface:
-Here we use the macro interface of DLT.
-
-----
-DLT_LOG(mycontext,DLT_LOG_WARN,DLT_INT(5),DLT_STRING("This is a warning"));
-DLT_LOG(mycontext,DLT_LOG_INFO,DLT_INT(5),DLT_STRING("But this only information"));
-----
-
-==== Unregister the application and the context which are registered
-
-----
-DLT_UNREGISTER_CONTEXT(mycontext);
-DLT_UNREGISTER_APP();
-----
-
-=== Logging example
-
-* gedit dltdemo.c &
-* Copy the example code below into dltdemo.c
-* gcc -o dltdemo -ldlt dltdemo.c
-* rolf.haimerl|./dltdemo
-
-.DLT - Hello world
-----
-#include <stdio.h>
-#include <dlt.h>
-DLT_DECLARE_CONTEXT(mycontext);
-int main()
-{
- int num;
-
- DLT_REGISTER_APP("MYAP","My Application");
- DLT_REGISTER_CONTEXT(mycontext,"MYCT", "My Context");
-
- printf("Hello world");
-
- for(num=0;num<10;num++) {
- DLT_LOG(mycontext,DLT_LOG_INFO,DLT_STRING("Hello world"),DLT_INT(num));
- sleep(1);
- }
-
- DLT_UNREGISTER_CONTEXT(mycontext);
- DLT_UNREGISTER_APP();
- return 0;
-}
-----
-
-=== API
-Two types of DLT user interfaces are provided to applications. The first interface is a macro based interface, which makes it very easy and very pretty coding to use DLT. The second interface is a functional interface, which provides an object oriented C interface for applications.
-
-The doxygen documentation of the dlt-daemon contains more informations about functional/macro based interfaces.
-
-See INSTALL file how to generate doxygen documentation.
-
-=== DLT macro interface
-The DLT macro interface provides a very easy to use interface. It is very easy to log a flexible size of parameters into a single log in a single source code line.
-
-[options="header"]
-|==============================================================================================
-| Command | Description
-| #include <dlt.h> | The first thing to do is to include the standard header file of DLT
-| DLT_DECLARE_CONTEXT(mycontext); | The next thing is to create instances of each used context of an application. This has to be done outside of the source code before using any context.
-| DLT_IMPORT_CONTEXT(mycontext); | If a context is used a second time in another software module, the following macro has to be called to get access to the context.
-| DLT_REGISTER_APP("LOG","Test Application for Logging"); | In the next step in the initialization of the application the application must be registered in the DLT daemon. The identifier of the application, here "LOG", has a maximum of four characters.
-| DLT_REGISTER_CONTEXT(mycontext,"TEST","Test Context for Logging"); | Then each context has to be registered in the DLT daemon. The call of this macro is a must, so that the DLT daemon and client are able to set the log level of the context in the application. The identifier of the context, here "TEST", has a maximum of four characters. A default log level and default trace status is used for this context.
-| DLT_REGISTER_CONTEXT(mycontext,"TEST","Test Context for Logging",DLT_LOG_VERBOSE,DLT_TRACE_STATUS_ON); | As an alternative, a specific log level and trace status can be provided during registration of the context.
-| | Choose now between verbose mode and non-verbose mode:
-| DLT_LOG(mycontext ,DLT_LOG_WARN, DLT_INT(num),DLT_STRING(text)); | For verbose mode (default): After registration a context can be used to send log messages to the DLT daemon. The DLT_LOG macro has to be called with the used log level of the log messages and a variable list of parameters. A complete list of parameters you will find in the Addendum API specification.
-| DLT_LOG_INT(mycontext ,DLT_LOG_WARN, num); DLT_LOG_STRING_INT(mycontext ,DLT_LOG_WARN, text, num); | As an alternative, the high level logging macros can be used which exists for special combination of parameters. A complete list you will find in the Addendum API specification.
-| DLT_LOG_ID(mycontext,DLT_LOG_WARN,msgid,DLT_INT(num),DLT_STRING(text)); | For non-verbose mode: After registration a context can be used to send log messages to the DLT daemon. The DLT_LOG_ID macro has to be called with the used log level of the log messages, the message id and a variable list of parameters. A complete list of parameters you will find in the API specification.
-| int injection_callback(uint32_t service_id, void \*data, uint32_t length) | The high-level logging macros are not available in non-verbose mode. An optional feature to use is the message injection feature. The DLT client can send user defined messages to an application, identified by a service id (e.g., 0xfff). If such a message is received by the application, a callback is called. The callback has the format:
-| DLT_REGISTER_INJECTION_CALLBACK(mycontext, 0xFFF, injection_callback); | To register the callback within the application, the following call must be made:
-| DLT_TRACE_NETWORK(mycontext, DLT_NW_TRACE_CAN, headerlen, header, payloadlen, payload); | Furthermore, it is also possible to trace network messages. The interface, here DLT_NW_TRACE_CAN, the length of the header data and a pointer to the header data, the length of the payload data and a pointer to the payload data, must be specified. If no header or payload is available, the corresponding length must be set to 0, and the corresponding pointer must be set to NULL.
-| DLT_UNREGISTER_CONTEXT(mycontext); DLT_UNREGISTER_APP(); | After using the application and contexts, they must be unregistered from the DLT daemon. First all contexts, then the application must be unregistered.
-|==============================================================================================
-
-=== DLT functional interface and example
-The DLT functional interface provides a very easy to use interface. The C interface has an object oriented style.
-
-[options="header"]
-|==============================================================================================
-| Command | Description
-| #include <dlt.h> | The first thing to do is to include the standard header file of DLT:
-| DltContext mycontext; | The next thing is to create an instance of each used context of an application. This has to be done outside of the source code before using any context. The name of the instance can be defined by the user.
-| DltContextData mycontextdata; | Additionally, a data buffer used to construct the DLT log messages must be created:
-| dlt_register_app("LOG","Test Application for Logging"); | In the next step in the initialization of the application the application must be registered in the DLT daemon. The identifier of the application, here "LOG", has a maximum of four characters.
-| dlt_register_context(&mycontext,"TEST","Test Context for Logging"); | Then each context has to be registered in the DLT daemon. The call of this function is a must, so that the DLT daemon and the client are able to set the log level of the context in the application. The identifier of the context, here "TEST", has a maximum of four characters. A default log level and default trace status is used for this context.
-| dlt_register_context(&mycontext,"TEST","Test Context for Logging",DLT_LOG_VERBOSE,DLT_TRACE_STATUS_ON); | As an alternative, a specific log level and trace status can be provided during registration of the context.
-| | Choose now between verbose mode and non-verbose mode:
-| dlt_verbose_mode(); | For verbose mode (default): Optionally switch to verbose mode by calling the function dlt_verbose_mode:
-| if (dlt_user_log_write_start(&mycontext,&mycontextdata,DLT_LOG_WARN))
-{
- dlt_user_log_write_int(&mycontextdata,num);
- dlt_user_log_write_string(&mycontextdata,text);
- dlt_user_log_write_finish(&mycontextdata);
-} | After registration a context can be used to send log messages to the DLT daemon. The dlt_user_log_write function has to be called first with a pointer to the context, a pointer to the data buffer and the used log level of the log messages. For each parameter added to the DLT log message a call to dlt_user_log_write_xxx has to be done. A complete list of parameters you will find in the Addendum API specification. Sending of the DLT message is done by calling dlt_user_log_write_finish.
-| dlt_log_int(&mycontext, DLT_LOG_WARN, num); dlt_log_string_int(&mycontext, DLT_LOG_WARN, text, num); | As an alternative, the high level logging functions can be used which exists for special combination of parameters. A complete list you will find in the Addendum API specification.
-| dlt_nonverbose_mode(); | For non-verbose mode : Switch to non-verbose mode by calling the function dlt_nonverbose_mode:
-| if (dlt_user_log_write_start_id(&mycontext,&mycontextdata,DLT_LOG_WARN,msgid))
-{
- dlt_user_log_write_int(&mycontextdata,num);
- dlt_user_log_write_string(&mycontextdata,text);
- dlt_user_log_write_finish(&mycontextdata);
-} | After registration a context can be used to send log messages to the DLT daemon. The dlt_user_log_write_start_id function has to be called first with a pointer to the context, a pointer to the context data, the used log level of the log messages and the message id. For each parameter added to the DLT log message a call to dlt_user_log_write_xxx has to be done. A complete list of parameters you will find in the Addendum API specification. Sending of the DLT message is done by calling dlt_user_log_write_finish.
-| | The high-level logging functions are not available in non-verbose mode.
-| int injection_callback(uint32_t service_id, void \*data, uint32_t length) | An optional feature to use is the message injection feature. The DLT client can send user defined messages to an application, identified by a service id (e.g. 0xfff). If such a message is received by the application, a callback is called. The callback has the format: |
-| dlt_register_injection_callback(&mycontext, 0xFFF, injection_callback); | To register the callback within the application, the following call must be made: |
-| dlt_user_trace_network(&mycontext, DLT_NW_TRACE_CAN, headerlen, header, payloadlen, payload); | Furthermore, it is also possible to trace network messages. The interface, here DLT_NW_TRACE_CAN, the length of the header data and a pointer to the header data, the length of the payload data and a pointer to the payload data, must be specified. If no header or payload is available, the corresponding length must be set to 0, and the corresponding pointer must be set to NULL.
-| dlt_unregister_context(&mycontext);
-dlt_unregister_app();
-dlt_free(); | After using the application and contexts, they must be unregistered from the DLT daemon. First all contexts, then the application must be unregistered.
-|==============================================================================================
-
-== Addendum
-Implementation specifics
-
-* The implementation is multithread safe.