diff options
author | Manikandan C <mchockalingam@de.adit-jv.com> | 2018-10-29 16:32:17 +0100 |
---|---|---|
committer | Christoph Lipka <clipka@users.noreply.github.com> | 2018-11-23 11:10:47 +0100 |
commit | d515020fa1bcb5d874084a68c9de9434dc9d994e (patch) | |
tree | 339074f3d4e0858dfbe1c528705ed3e4343521f3 /src/daemon | |
parent | 3cfb292aa43774428ce8dfe120fe16785942b086 (diff) | |
download | DLT-daemon-d515020fa1bcb5d874084a68c9de9434dc9d994e.tar.gz |
Gateway Improvements
-Support to send and parse periodic control messages
-add application/contexts to passive ECU list
-Refactor dlt_gateway_send_control_message
-Gateway issues with corrupted data and on demand connection
-Unit Test update
Signed-off-by: Saya Sugiura ssugiura@jp.adit-jv.com
Signed-off-by: Christoph Lipka clipka@jp.adit-jv.com
Signed-off-by: S. Hameed shameed@jp.adit-jv.com
Signed-off-by: ManikandanC Manikandan.Chockalingam@in.bosch.com
Diffstat (limited to 'src/daemon')
-rw-r--r-- | src/daemon/CMakeLists.txt | 10 | ||||
-rw-r--r-- | src/daemon/dlt_daemon_client.c | 11 | ||||
-rw-r--r-- | src/daemon/dlt_daemon_offline_logstorage.c | 48 |
3 files changed, 45 insertions, 24 deletions
diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt index 063913b..9a22ccd 100644 --- a/src/daemon/CMakeLists.txt +++ b/src/daemon/CMakeLists.txt @@ -32,13 +32,13 @@ install(TARGETS dlt-daemon COMPONENT base) if (WITH_DLT_UNIT_TESTS) - add_library(dlt_daemon ${dlt_daemon_SRCS} ${systemd_SRCS}) + add_library(dlt_daemon ${dlt_daemon_SRCS}) target_link_libraries(dlt_daemon rt ${CMAKE_THREAD_LIBS_INIT}) install(TARGETS dlt_daemon - RUNTIME DESTINATION bin - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/static - COMPONENT base) + RUNTIME DESTINATION bin + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/static + COMPONENT base) endif(WITH_DLT_UNIT_TESTS) INSTALL(FILES dlt.conf diff --git a/src/daemon/dlt_daemon_client.c b/src/daemon/dlt_daemon_client.c index dd69326..bd3233f 100644 --- a/src/daemon/dlt_daemon_client.c +++ b/src/daemon/dlt_daemon_client.c @@ -68,17 +68,6 @@ #include "dlt_daemon_offline_logstorage.h" #include "dlt_gateway.h" -/* checks if received size is big enough for expected data */ -#define DLT_CHECK_RCV_DATA_SIZE(received, required) \ - ({ \ - int _ret = DLT_RETURN_OK; \ - if (((int)received - (int)required) < 0) { \ - dlt_vlog(LOG_WARNING, "%s: Received data not complete\n", __func__); \ - _ret = DLT_RETURN_ERROR; \ - } \ - _ret; \ - }) - /** Global text output buffer, mainly used for creation of error/warning strings */ static char str[DLT_DAEMON_TEXTBUFSIZE]; diff --git a/src/daemon/dlt_daemon_offline_logstorage.c b/src/daemon/dlt_daemon_offline_logstorage.c index fe4d8a7..109cc73 100644 --- a/src/daemon/dlt_daemon_offline_logstorage.c +++ b/src/daemon/dlt_daemon_offline_logstorage.c @@ -347,15 +347,47 @@ STATIC DltReturnValue dlt_daemon_logstorage_update_passive_node_context( int loglevel, int verbose) { - // Need to be updated - // To avoid compiler warning - (void) daemon_local; - (void) apid; - (void) ctid; - (void) ecuid; - (void) loglevel; - (void) verbose; + DltServiceSetLogLevel req = {0}; + DltPassiveControlMessage ctrl = {0}; + DltGatewayConnection *con = NULL; + PRINT_FUNCTION_VERBOSE(verbose); + + if ((daemon_local == NULL) || (apid == NULL) || (ctid == NULL) || (ecuid == NULL) || + (loglevel > DLT_LOG_VERBOSE) || (loglevel < DLT_LOG_DEFAULT)) + { + dlt_vlog(LOG_ERR, "%s: Wrong parameter\n", __func__); + return DLT_RETURN_WRONG_PARAMETER; + } + + con = dlt_gateway_get_connection(&daemon_local->pGateway, ecuid, verbose); + + if (con == NULL) + { + dlt_vlog(LOG_ERR, + "Failed to fond connection to passive node %s\n", + ecuid); + return DLT_RETURN_ERROR; + } + + ctrl.id = DLT_SERVICE_ID_SET_LOG_LEVEL; + ctrl.type = CONTROL_MESSAGE_ON_DEMAND; + + dlt_set_id(req.apid, apid); + dlt_set_id(req.ctid, ctid); + + req.log_level = loglevel; + + if (dlt_gateway_send_control_message(con, &ctrl, (void *) &req, verbose) != 0) + { + dlt_vlog(LOG_ERR, + "Failed to forward SET_LOG_LEVEL message to passive node %s\n", + ecuid); + + return DLT_RETURN_ERROR; + } + + return DLT_RETURN_OK; return DLT_RETURN_OK; } |