From 442688504260bb2bfcfb08a9865f223d2ab2d19a Mon Sep 17 00:00:00 2001 From: dbiastoch Date: Wed, 13 Jan 2021 11:27:17 +0100 Subject: dlt-receive: Enabled more filtering by using json filter files -Added '-j' flag to dlt-receive for reading a json filter file -Added more attributes to DltFilter (LogLevel, MaxPayload, MinPayload) for extended message filtering, when using old filters these values are set to default. Same behaviour, when they are not defined in json filter file. -extended dlt_common.c to support json filter files and new DltFilter attributes +add dlt_json_filter_load to parse a json filter file into a DltFilter +add dlt_json_filter_save to print a DltFilter into a json file -Two new libraries are used to parse the json filter files: json-c for Linux based systems and the QNX internal libjson for QNX systems -gtest_dlt_common was modified to test the new function 'dlt_json_filter_load' +add testfile_extended.dlt that contains a bigger varity of messages (different context/app IDs, lengths and log levels) +add testfilter.json which is a valid json filter file -New dependency on library was added to related CMakeLists and is described in README.md Signed-off-by: dbiastoch --- CMakeLists.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bc416a..1b47159 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,7 @@ option(WITH_DLT_KPI "Set to ON to build src/kpi binaries" option(WITH_DLT_FATAL_LOG_TRAP "Set to ON to enable DLT_LOG_FATAL trap(trigger segv inside dlt-user library)" OFF) option(WITH_UDP_CONNECTION "Set to ON to enable dlt UDP multicast SUPPORT" OFF) option(WITH_LIB_SHORT_VERSION "Set to ON to build library with only major number in version" OFF) +option(WITH_EXTENDED_FILTERING "Set to OFF to build without extended filtering. Using json filter files is only supported for Linux based system with json-c and QNX." ON) option(WITH_DLT_DAEMON_VSOCK_IPC "Set to ON to enable VSOCK support in daemon" OFF) option(WITH_DLT_LIB_VSOCK_IPC "Set to ON to enable VSOCK support in library (DLT_IPC is not used in library)" OFF) @@ -235,6 +236,25 @@ if(WITH_DLT_FATAL_LOG_TRAP) add_definitions(-DDLT_FATAL_LOG_RESET_ENABLE) endif() +if(WITH_DLT_FILTER_BACKEND_PROP) + add_definitions(-DHAS_PROPRIETARY_FILTER_BACKEND) +endif() + +if(WITH_EXTENDED_FILTERING) + if(("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") OR ("${CMAKE_SYSTEM_NAME}" MATCHES "Android")) + find_package(PkgConfig REQUIRED) + pkg_check_modules(JSON REQUIRED json-c) + set(DLT_JSON_LIBRARY ${JSON_LIBRARIES}) + elseif("${CMAKE_SYSTEM_NAME}" MATCHES "QNX") + set(DLT_JSON_LIBRARY json) + else() + message(FATAL_ERROR "OS doesn't support extended filtering. Please build without cmake option '-DWITH_EXTENDED_FILTERING=OFF'") + endif() + add_definitions(-DEXTENDED_FILTERING) +else() + set(DLT_JSON_LIBRARY "") +endif() + add_subdirectory(doc) add_subdirectory(src) add_subdirectory(include/dlt) @@ -302,6 +322,7 @@ message(STATUS "DLT_VSOCK_PORT = ${DLT_VSOCK_PORT}") message(STATUS "WITH_UDP_CONNECTION = ${WITH_UDP_CONNECTION}") message(STATUS "WITH_DLT_QNX_SYSTEM = ${WITH_DLT_QNX_SYSTEM}") message(STATUS "WITH_LIB_SHORT_VERSION = ${WITH_LIB_SHORT_VERSION}") +message(STATUS "WITH_EXTENDED_FILTERING = ${WITH_EXTENDED_FILTERING}") message(STATUS "Change a value with: cmake -D=") message(STATUS "-------------------------------------------------------------------------------") message(STATUS) -- cgit v1.2.1