summaryrefslogtreecommitdiff
path: root/src/daemon/dlt_daemon_common.c
diff options
context:
space:
mode:
authorAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2011-10-12 13:51:03 +0200
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2011-10-12 13:51:03 +0200
commit3272e8e16749b58d13e72e9a3fcadab16550ea71 (patch)
tree402caed8cabaffb667d8b51f6c145fca21c3c23d /src/daemon/dlt_daemon_common.c
parent98280f75c07d574a2776558c4fec2797c2b21450 (diff)
downloadDLT-daemon-3272e8e16749b58d13e72e9a3fcadab16550ea71.tar.gz
Implemented new DLT user library function dlt_get_log_state.
Diffstat (limited to 'src/daemon/dlt_daemon_common.c')
-rwxr-xr-xsrc/daemon/dlt_daemon_common.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/daemon/dlt_daemon_common.c b/src/daemon/dlt_daemon_common.c
index e10b20d..dbb1e7a 100755
--- a/src/daemon/dlt_daemon_common.c
+++ b/src/daemon/dlt_daemon_common.c
@@ -969,6 +969,42 @@ int dlt_daemon_user_send_log_level(DltDaemon *daemon,DltDaemonContext *context,i
return ((ret==DLT_RETURN_OK)?0:-1);
}
+int dlt_daemon_user_send_log_state(DltDaemon *daemon,DltDaemonApplication *app,int verbose)
+{
+ DltUserHeader userheader;
+ DltUserControlMsgLogState logstate;
+ DltReturnValue ret;
+
+ PRINT_FUNCTION_VERBOSE(verbose);
+
+ if ((daemon==0) || (app==0))
+ {
+ return -1;
+ }
+
+ if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_LOG_STATE)==-1)
+ {
+ return -1;
+ }
+
+ logstate.log_state = daemon->state;
+
+ /* log to FIFO */
+ ret = dlt_user_log_out2(app->user_handle, &(userheader), sizeof(DltUserHeader), &(logstate), sizeof(DltUserControlMsgLogState));
+
+ if (ret!=DLT_RETURN_OK)
+ {
+ if (errno==EPIPE)
+ {
+ /* Close connection */
+ close(app->user_handle);
+ app->user_handle=0;
+ }
+ }
+
+ return ((ret==DLT_RETURN_OK)?0:-1);
+}
+
int dlt_daemon_control_process_control(int sock, DltDaemon *daemon, DltMessage *msg, int verbose)
{
uint32_t id,id_tmp=0;
@@ -2179,6 +2215,35 @@ void dlt_daemon_user_send_default_update(DltDaemon *daemon, int verbose)
}
}
+void dlt_daemon_user_send_all_log_state(DltDaemon *daemon, int verbose)
+{
+ int32_t count;
+ DltDaemonApplication *app;
+
+ PRINT_FUNCTION_VERBOSE(verbose);
+
+ if (daemon==0)
+ {
+ return;
+ }
+
+ for (count=0;count<daemon->num_applications; count ++)
+ {
+ app = &(daemon->applications[count]);
+
+ if (app)
+ {
+ if (app->user_handle!=0)
+ {
+ if (dlt_daemon_user_send_log_state(daemon, app, verbose)==-1)
+ {
+ return;
+ }
+ }
+ }
+ }
+}
+
void dlt_daemon_control_message_time(int sock, DltDaemon *daemon, int verbose)
{
DltMessage msg;