From 3cec2f355765ec225ef5f8c228f7d00720582e52 Mon Sep 17 00:00:00 2001 From: Jens Lorenz Date: Thu, 8 Dec 2016 11:05:49 +0100 Subject: AMUtil: Check log level support of DLT added. Signed-off-by: Jens Lorenz --- AudioManagerUtilities/CMakeLists.txt | 10 ++++++++++ AudioManagerUtilities/include/CAmDltWrapper.h | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/AudioManagerUtilities/CMakeLists.txt b/AudioManagerUtilities/CMakeLists.txt index 6e9a06f..5933e4b 100644 --- a/AudioManagerUtilities/CMakeLists.txt +++ b/AudioManagerUtilities/CMakeLists.txt @@ -109,6 +109,16 @@ IF (WITH_DLT) add_definitions(${DLT_CFLAGS_OTHER}) + set (DLT_VERSIONING ${DLT_VERSION}) + string (REPLACE "." ";" DLT_VERSIONING ${DLT_VERSIONING}) + list (LENGTH DLT_VERSIONING size) + + if (size GREATER "1") + list (GET DLT_VERSIONING 0 DLT_MAJOR_VERSION) + list (GET DLT_VERSIONING 1 DLT_MINOR_VERSION) + add_definitions (-DDLT_MAJOR_VERSION=${DLT_MAJOR_VERSION} -DDLT_MINOR_VERSION=${DLT_MINOR_VERSION}) + endif (size GREATER "1") + set(AUDIO_MANAGER_UTILITIES_LIBS ${AUDIO_MANAGER_UTILITIES_LIBS} ${DLT_LIBRARIES} diff --git a/AudioManagerUtilities/include/CAmDltWrapper.h b/AudioManagerUtilities/include/CAmDltWrapper.h index 8c2b514..a37ec77 100644 --- a/AudioManagerUtilities/include/CAmDltWrapper.h +++ b/AudioManagerUtilities/include/CAmDltWrapper.h @@ -158,6 +158,18 @@ public: bool init(DltLogLevelType loglevel, DltContext* context = NULL); + bool checkLogLevel(DltLogLevelType logLevel) + { +#ifdef WITH_DLT + #if (DLT_MAJOR_VERSION >= 2 && DLT_MINOR_VERSION >= 16) + return (1 == dlt_user_is_logLevel_enabled(&mDltContext,logLevel)? true: false); + #else + return false; + #endif +#else + return (logLevel <= mDltContext.log_level_user); +#endif + } void deinit(); void send(); void append(const int8_t value); -- cgit v1.2.1