diff options
author | Alexander Wenzel <Alexander.AW.Wenzel@bmw.de> | 2014-09-11 16:14:07 +0200 |
---|---|---|
committer | Alexander Wenzel <Alexander.AW.Wenzel@bmw.de> | 2014-09-11 16:24:43 +0200 |
commit | c8d990b893838b3263ac020b095f1a520908e815 (patch) | |
tree | dbc8f21021a6c478b4f0e5ddcf79afcd8c700646 /src/daemon/dlt-daemon.c | |
parent | 406f947a0f8dca7ac1fbdc6b1df2bbe37af1b669 (diff) | |
download | DLT-daemon-c8d990b893838b3263ac020b095f1a520908e815.tar.gz |
Added new API to send marker message from application.
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'src/daemon/dlt-daemon.c')
-rw-r--r-- | src/daemon/dlt-daemon.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c index c8b4703..1a98ca9 100644 --- a/src/daemon/dlt-daemon.c +++ b/src/daemon/dlt-daemon.c @@ -1473,6 +1473,14 @@ int dlt_daemon_process_user_messages(DltDaemon *daemon, DltDaemonLocal *daemon_l } break; } + case DLT_USER_MESSAGE_MARKER: + { + if (dlt_daemon_process_user_message_marker(daemon, daemon_local, daemon_local->flags.vflag)==-1) + { + run_loop=0; + } + break; + } default: { dlt_log(LOG_ERR,"(Internal) Invalid user message type received!\n"); @@ -2345,6 +2353,35 @@ int dlt_daemon_process_user_message_log_mode(DltDaemon *daemon, DltDaemonLocal * return 0; } +int dlt_daemon_process_user_message_marker(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose) +{ + PRINT_FUNCTION_VERBOSE(verbose); + + if ((daemon==0) || (daemon_local==0)) + { + dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_marker()\n"); + return -1; + } + + if (daemon_local->receiver.bytesRcvd < (int32_t)(sizeof(DltUserHeader))) + { + /* Not enough bytes received */ + return -1; + } + + /* Create automatic unregister context response for unregistered context */ + dlt_daemon_control_message_marker(DLT_DAEMON_SEND_TO_ALL,daemon,daemon_local,verbose); + + /* keep not read data in buffer */ + if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgLogMode))==-1) + { + dlt_log(LOG_ERR,"Can't remove bytes from receiver for user message log mode\n"); + return -1; + } + + return 0; +} + int dlt_daemon_send_ringbuffer_to_client(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose) { int ret; |