summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYusuke Sato <yusuke-sato@apn.alpine.co.jp>2018-05-18 14:35:31 +0900
committerChristoph Lipka <clipka@users.noreply.github.com>2018-05-18 07:35:31 +0200
commitf549f5527148b32a15489aae75c9e4557e19cbd4 (patch)
treef6586dd95fb402bfd396b006e876c2d18dc5d38b
parent89639e55c39687af398bdf9fbaf000338a5cb7db (diff)
downloadDLT-daemon-f549f5527148b32a15489aae75c9e4557e19cbd4.tar.gz
Introduce controlling entire system trace status feature from dlt-control (#57)
* dlt-control: Provision to control entire system trace status 1. support for setting trace status using wildcards for both app and context 2. support for setting entire system trace status *This Logic is as same as for changing log level. (SHA: a966393ad7003d02870bceffa08df5ddf4bbf864 dlt-control: Provision to control entire system log level) * dlt-daemon: Fix control entire log level / trace status issue In previous, dlt-control could send request to set all log level / trace status with DLT_LOG_DEFAULT / DLT_TRACE_STATUS_DEFAULT(-1). However, dlt-daemon could not accept these value. This change fix this issue so that setting log level/trace status of all registered contexts become possible. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp>
-rw-r--r--include/dlt/dlt_client.h11
-rw-r--r--include/dlt/dlt_protocol.h1
-rw-r--r--src/console/dlt-control.c68
-rw-r--r--src/daemon/dlt_daemon_client.c230
-rw-r--r--src/daemon/dlt_daemon_client.h9
-rw-r--r--src/daemon/dlt_daemon_common.c33
-rw-r--r--src/daemon/dlt_daemon_common.h15
-rw-r--r--src/lib/dlt_client.c37
8 files changed, 341 insertions, 63 deletions
diff --git a/include/dlt/dlt_client.h b/include/dlt/dlt_client.h
index 587c6ca..8943184 100644
--- a/include/dlt/dlt_client.h
+++ b/include/dlt/dlt_client.h
@@ -211,9 +211,9 @@ DltReturnValue dlt_client_send_default_log_level(DltClient *client, uint8_t defa
* Send the log level to all contexts registered with dlt daemon
* @param client pointer to dlt client structure
* @param LogLevel Log Level to be set
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_client_send_all_log_level(DltClient *client, uint8_t LogLevel);
+DltReturnValue dlt_client_send_all_log_level(DltClient *client, uint8_t LogLevel);
/**
* Send the default trace status to the dlt daemon
* @param client pointer to dlt client structure
@@ -222,6 +222,13 @@ int dlt_client_send_all_log_level(DltClient *client, uint8_t LogLevel);
*/
DltReturnValue dlt_client_send_default_trace_status(DltClient *client, uint8_t defaultTraceStatus);
/**
+ * Send the trace status to all contexts registered with dlt daemon
+ * @param client pointer to dlt client structure
+ * @param traceStatus trace status to be set
+ * @return Value from DltReturnValue enum
+ */
+DltReturnValue dlt_client_send_all_trace_status(DltClient *client, uint8_t traceStatus);
+/**
* Send the timing pakets status to the dlt daemon
* @param client pointer to dlt client structure
* @param timingPakets Timing pakets enabled
diff --git a/include/dlt/dlt_protocol.h b/include/dlt/dlt_protocol.h
index ee9c326..1440d6c 100644
--- a/include/dlt/dlt_protocol.h
+++ b/include/dlt/dlt_protocol.h
@@ -202,6 +202,7 @@
#define DLT_SERVICE_ID_PASSIVE_NODE_CONNECT 0xf0E /**< Service ID: (Dis)Connect passive Node */
#define DLT_SERVICE_ID_PASSIVE_NODE_CONNECTION_STATUS 0xf0F /**< Service ID: Passive Node status information */
#define DLT_SERVICE_ID_SET_ALL_LOG_LEVEL 0xf10 /**< Service ID: set all log level */
+#define DLT_SERVICE_ID_SET_ALL_TRACE_STATUS 0xf11 /**< Service ID: Set all trace status */
#define DLT_SERVICE_ID_CALLSW_CINJECTION 0xFFF /**< Service ID: Message Injection (minimal ID) */
/*
diff --git a/src/console/dlt-control.c b/src/console/dlt-control.c
index 9c309a9..7e90c7c 100644
--- a/src/console/dlt-control.c
+++ b/src/console/dlt-control.c
@@ -72,6 +72,7 @@
#define DLT_GLOGINFO_DATA_MAX 800
#define DLT_GET_LOG_INFO_HEADER 18 /*Get log info header size in response text */
#define DLT_INVALID_LOG_LEVEL 0xF
+#define DLT_INVALID_TRACE_STATUS 0xF
/* Option of GET_LOG_INFO */
#define DLT_SERVICE_GET_LOG_INFO_OPT7 7 /* get Apid, ApDescription, Ctid, CtDescription, loglevel, tracestatus */
@@ -217,7 +218,14 @@ void usage()
printf(" -l level -c xyz* (set level for all ctxts whose name starts with xyz)\n");
printf(" -l level -c ctxid (set level for the particular ctxt)\n");
printf(" -l level (set level for all the registered contexts)\n");
- printf(" -r tracestatus Set the trace status (0=off - 1=on,255=default)\n");
+ printf(" -r tracestatus Set the trace status (0=off - 1=on,255=default)\n");
+ printf(" supported options:\n");
+ printf(" -r tracestatus -a appid -c ctid\n");
+ printf(" -r tracestatus -a abc* (set status for all ctxts of apps name starts with abc)\n");
+ printf(" -r tracestatus -a appid (set status for all ctxts of this app)\n");
+ printf(" -r tracestatus -c xyz* (set status for all ctxts whose name starts with xyz)\n");
+ printf(" -r tracestatus -c ctxid (set status for the particular ctxt)\n");
+ printf(" -r tracestatus (set status for all the registered contexts)\n");
printf(" -d loglevel Set the default log level (0=off - 5=verbose)\n");
printf(" -f tracestatus Set the default trace status (0=off - 1=on)\n");
printf(" -i enable Enable timing packets (0=off - 1=on)\n");
@@ -293,7 +301,7 @@ int main(int argc, char* argv[])
dltdata.xvalue = 0;
dltdata.tvalue = 1000;
dltdata.lvalue = DLT_INVALID_LOG_LEVEL;
- dltdata.rvalue = -1;
+ dltdata.rvalue = DLT_INVALID_TRACE_STATUS;
dltdata.dvalue = -1;
dltdata.fvalue = -1;
dltdata.ivalue = -1;
@@ -384,8 +392,13 @@ int main(int argc, char* argv[])
}
case 'r':
{
- dltdata.rvalue = atoi(optarg);;
- break;
+ dltdata.rvalue = strtol(optarg, &endptr, 10);
+ if ((dltdata.rvalue < DLT_TRACE_STATUS_DEFAULT) || (dltdata.rvalue > DLT_TRACE_STATUS_ON))
+ {
+ fprintf (stderr, "invalid trace status, supported trace status -1, 0, 1\n");
+ return -1;
+ }
+ break;
}
case 'd':
{
@@ -615,22 +628,41 @@ int main(int argc, char* argv[])
}
}
}
- else if(dltdata.rvalue!=-1 && dltdata.avalue && dltdata.cvalue)
- {
- /* trace status */
- printf("Set trace status:\n");
- printf("AppId: %s\n",dltdata.avalue);
- printf("ConId: %s\n",dltdata.cvalue);
- printf("TraceStatus: %d\n",dltdata.rvalue);
- /* send control message in*/
- if (dlt_client_send_trace_status(&g_dltclient,
- dltdata.avalue,
- dltdata.cvalue,
- dltdata.rvalue) != DLT_RETURN_OK)
+ else if (dltdata.rvalue != DLT_INVALID_TRACE_STATUS)
+ {
+ if ((dltdata.avalue == 0) && (dltdata.cvalue == 0))
+ {
+ if (dltdata.vflag)
+ {
+ printf("Set all trace status:\n");
+ printf("Tracestatus: %d\n", dltdata.rvalue);
+ }
+ if (0 != dlt_client_send_all_trace_status(&g_dltclient,
+ dltdata.rvalue))
+ {
+ fprintf(stderr, "ERROR: Could not send trace status\n");
+ }
+ }
+ else
{
- fprintf(stderr, "ERROR: Could not send trace status\n");
+ /* trace status */
+ if (dltdata.vflag)
+ {
+ printf("Set trace status:\n");
+ printf("AppId: %s\n", dltdata.avalue);
+ printf("ConId: %s\n", dltdata.cvalue);
+ printf("Tracestatus: %d\n", dltdata.rvalue);
+ }
+ /* send control message*/
+ if (0 != dlt_client_send_trace_status(&g_dltclient,
+ dltdata.avalue,
+ dltdata.cvalue,
+ dltdata.rvalue))
+ {
+ fprintf(stderr, "ERROR: Could not send trace status\n");
+ }
}
- }
+ }
else if(dltdata.dvalue!=-1)
{
/* default log level */
diff --git a/src/daemon/dlt_daemon_client.c b/src/daemon/dlt_daemon_client.c
index e526bf0..7c6e1bd 100644
--- a/src/daemon/dlt_daemon_client.c
+++ b/src/daemon/dlt_daemon_client.c
@@ -595,6 +595,11 @@ int dlt_daemon_client_process_control(int sock, DltDaemon *daemon, DltDaemonLoca
dlt_daemon_control_set_all_log_level(sock, daemon, daemon_local, msg, verbose);
break;
}
+ case DLT_SERVICE_ID_SET_ALL_TRACE_STATUS:
+ {
+ dlt_daemon_control_set_all_trace_status(sock, daemon, daemon_local, msg, verbose);
+ break;
+ }
case DLT_SERVICE_ID_OFFLINE_LOGSTORAGE:
{
dlt_daemon_control_service_logstorage(sock, daemon, daemon_local, msg, verbose);
@@ -1580,7 +1585,14 @@ void dlt_daemon_send_log_level(int sock, DltDaemon *daemon, DltDaemonLocal *daem
}
-void dlt_daemon_find_multiple_context_and_send(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, int8_t app_flag, char *str, int8_t len, int8_t loglevel, int verbose)
+void dlt_daemon_find_multiple_context_and_send_log_level(int sock,
+ DltDaemon *daemon,
+ DltDaemonLocal *daemon_local,
+ int8_t app_flag,
+ char *str,
+ int8_t len,
+ int8_t loglevel,
+ int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
@@ -1591,6 +1603,7 @@ void dlt_daemon_find_multiple_context_and_send(int sock, DltDaemon *daemon, DltD
if (daemon == 0)
{
+ dlt_vlog(LOG_ERR, "%s: Invalid parameters\n", __func__);
return;
}
@@ -1648,7 +1661,9 @@ void dlt_daemon_control_set_log_level(int sock, DltDaemon *daemon, DltDaemonLoca
req = (DltServiceSetLogLevel*) (msg->databuffer);
if (daemon_local->flags.enforceContextLLAndTS)
+ {
req->log_level = getStatus(req->log_level, daemon_local->flags.contextLogLevel);
+ }
dlt_set_id(apid, req->apid);
dlt_set_id(ctid, req->ctid);
@@ -1656,19 +1671,19 @@ void dlt_daemon_control_set_log_level(int sock, DltDaemon *daemon, DltDaemonLoca
ctxtid_length = strlen(ctid);
if ((appid_length != 0) && (apid[appid_length-1] == '*') && (ctid[0] == 0)) /*appid provided having '*' in it and ctid is null*/
{
- dlt_daemon_find_multiple_context_and_send(sock, daemon, daemon_local, 1, apid, appid_length-1, req->log_level, verbose);
+ dlt_daemon_find_multiple_context_and_send_log_level(sock, daemon, daemon_local, 1, apid, appid_length-1, req->log_level, verbose);
}
else if ((ctxtid_length != 0) && (ctid[ctxtid_length-1] == '*') && (apid[0] == 0)) /*ctid provided is having '*' in it and appid is null*/
{
- dlt_daemon_find_multiple_context_and_send(sock, daemon, daemon_local, 0, ctid, ctxtid_length-1, req->log_level, verbose);
+ dlt_daemon_find_multiple_context_and_send_log_level(sock, daemon, daemon_local, 0, ctid, ctxtid_length-1, req->log_level, verbose);
}
else if ((appid_length != 0) && (apid[appid_length-1] != '*') && (ctid[0] == 0)) /*only app id case*/
{
- dlt_daemon_find_multiple_context_and_send(sock, daemon, daemon_local, 1, apid, DLT_ID_SIZE, req->log_level, verbose);
+ dlt_daemon_find_multiple_context_and_send_log_level(sock, daemon, daemon_local, 1, apid, DLT_ID_SIZE, req->log_level, verbose);
}
else if ((ctxtid_length != 0) && (ctid[ctxtid_length-1] != '*') && (apid[0] == 0)) /*only context id case*/
{
- dlt_daemon_find_multiple_context_and_send(sock, daemon, daemon_local, 0, ctid, DLT_ID_SIZE, req->log_level, verbose);
+ dlt_daemon_find_multiple_context_and_send_log_level(sock, daemon, daemon_local, 0, ctid, DLT_ID_SIZE, req->log_level, verbose);
}
else
{
@@ -1681,22 +1696,104 @@ void dlt_daemon_control_set_log_level(int sock, DltDaemon *daemon, DltDaemonLoca
}
else
{
- dlt_log(LOG_ERR, "Context not found!\n");
+ dlt_vlog(LOG_ERR, "Could not set log level: %d. Context [%.4s:%.4s] not found:", req->log_level, apid, ctid);
dlt_daemon_control_service_response(sock, daemon, daemon_local, DLT_SERVICE_ID_SET_LOG_LEVEL, DLT_SERVICE_RESPONSE_ERROR, verbose);
}
}
}
-void dlt_daemon_control_set_trace_status(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, DltMessage *msg, int verbose)
+
+void dlt_daemon_send_trace_status(int sock,
+ DltDaemon *daemon,
+ DltDaemonLocal *daemon_local,
+ DltDaemonContext *context,
+ int8_t tracestatus,
+ int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
- char apid[DLT_ID_SIZE],ctid[DLT_ID_SIZE];
- DltServiceSetLogLevel *req; /* request uses same struct as set log level */
- DltDaemonContext *context;
- int32_t id=DLT_SERVICE_ID_SET_TRACE_STATUS;
+ int32_t id = DLT_SERVICE_ID_SET_TRACE_STATUS;
+ int8_t old_trace_status = 0;
+
+ old_trace_status = context->trace_status;
+ context->trace_status = tracestatus; /* No endianess conversion necessary*/
+
+ if ((context->user_handle >= DLT_FD_MINIMUM) &&
+ (dlt_daemon_user_send_log_level(daemon, context, verbose)==0))
+ {
+ dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_OK, verbose);
+ }
+ else
+ {
+ dlt_log(LOG_ERR, "Trace status could not be sent!\n");
+ context->trace_status = old_trace_status;
+ dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
+ }
+}
+
+void dlt_daemon_find_multiple_context_and_send_trace_status(int sock,
+ DltDaemon *daemon,
+ DltDaemonLocal *daemon_local,
+ int8_t app_flag,
+ char *str,
+ int8_t len,
+ int8_t tracestatus,
+ int verbose)
+{
+ PRINT_FUNCTION_VERBOSE(verbose);
+
+ int count = 0;
+ DltDaemonContext *context = NULL;
+ char src_str[DLT_ID_SIZE +1] = {0};
+ int8_t ret = 0;
+
+ if (daemon == 0)
+ {
+ dlt_vlog(LOG_ERR, "%s: Invalid parameters\n", __func__);
+ return;
+ }
+
+ for (count = 0; count < daemon->num_contexts; count++)
+ {
+ context = &(daemon->contexts[count]);
- int8_t old_trace_status;
+ if (context)
+ {
+ if (app_flag == 1)
+ {
+ strncpy(src_str, context->apid, DLT_ID_SIZE);
+ }
+ else
+ {
+ strncpy(src_str, context->ctid, DLT_ID_SIZE);
+ }
+ ret = strncmp(src_str, str, len);
+ if (ret == 0)
+ {
+ dlt_daemon_send_trace_status(sock, daemon, daemon_local, context, tracestatus, verbose);
+ }
+ else if ((ret > 0) && (app_flag == 1))
+ {
+ break;
+ }
+ else
+ {
+ continue;
+ }
+ }
+ }
+}
+
+void dlt_daemon_control_set_trace_status(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, DltMessage *msg, int verbose)
+{
+ PRINT_FUNCTION_VERBOSE(verbose);
+
+ char apid[DLT_ID_SIZE+1] = {0};
+ char ctid[DLT_ID_SIZE+1] = {0};
+ DltServiceSetLogLevel *req = NULL;
+ DltDaemonContext *context = NULL;
+ int8_t appid_length = 0;
+ int8_t ctxtid_length = 0;
if ((daemon == NULL) || (msg == NULL) || (msg->databuffer == NULL))
{
@@ -1709,38 +1806,46 @@ void dlt_daemon_control_set_trace_status(int sock, DltDaemon *daemon, DltDaemonL
}
req = (DltServiceSetLogLevel*) (msg->databuffer);
+ if (daemon_local->flags.enforceContextLLAndTS)
+ {
+ req->log_level = getStatus(req->log_level, daemon_local->flags.contextTraceStatus);
+ }
dlt_set_id(apid, req->apid);
dlt_set_id(ctid, req->ctid);
-
- context=dlt_daemon_context_find(daemon, apid, ctid, verbose);
-
- /* Set log level */
- if (context!=0)
+ appid_length = strlen(apid);
+ ctxtid_length = strlen(ctid);
+ if ((appid_length != 0) && (apid[appid_length-1] == '*') && (ctid[0] == 0)) /*appid provided having '*' in it and ctid is null*/
{
- old_trace_status = context->trace_status;
- if (daemon_local->flags.enforceContextLLAndTS)
- context->trace_status = getStatus(req->log_level, daemon_local->flags.contextTraceStatus);
- else
- context->trace_status = req->log_level; /* No endianess conversion necessary */
+ dlt_daemon_find_multiple_context_and_send_trace_status(sock, daemon, daemon_local, 1, apid, appid_length-1, req->log_level, verbose);
+ }
+ else if ((ctxtid_length != 0) && (ctid[ctxtid_length-1] == '*') && (apid[0] == 0)) /*ctid provided is having '*' in it and appid is null*/
+ {
+ dlt_daemon_find_multiple_context_and_send_trace_status(sock, daemon, daemon_local, 0, ctid, ctxtid_length-1, req->log_level, verbose);
+ }
+ else if ((appid_length != 0) && (apid[appid_length-1] != '*') && (ctid[0] == 0)) /*only app id case*/
+ {
+ dlt_daemon_find_multiple_context_and_send_trace_status(sock, daemon, daemon_local, 1, apid, DLT_ID_SIZE, req->log_level, verbose);
+ }
+ else if ((ctxtid_length != 0) && (ctid[ctxtid_length-1] != '*') && (apid[0] == 0)) /*only context id case*/
+ {
+ dlt_daemon_find_multiple_context_and_send_trace_status(sock, daemon, daemon_local, 0, ctid, DLT_ID_SIZE, req->log_level, verbose);
+ }
+ else
+ {
+ context=dlt_daemon_context_find(daemon, apid, ctid, verbose);
- if ((context->user_handle >= DLT_FD_MINIMUM ) &&
- (dlt_daemon_user_send_log_level(daemon, context, verbose)==0))
+ /* Set trace status */
+ if (context!=0)
{
- dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_OK, verbose);
+ dlt_daemon_send_trace_status(sock, daemon, daemon_local, context, req->log_level, verbose);
}
else
{
- //dlt_log(LOG_ERR, "Trace Status could not be sent!\n");
- context->trace_status = old_trace_status;
- dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
+ dlt_vlog(LOG_ERR, "Could not set trace status: %d. Context [%.4s:%.4s] not found:", req->log_level, apid, ctid);
+ dlt_daemon_control_service_response(sock, daemon, daemon_local, DLT_SERVICE_ID_SET_LOG_LEVEL, DLT_SERVICE_RESPONSE_ERROR, verbose);
}
}
- else
- {
- //dlt_log(LOG_ERR, "Context not found!\n");
- dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
- }
}
void dlt_daemon_control_set_default_log_level(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, DltMessage *msg, int verbose)
@@ -1792,6 +1897,7 @@ void dlt_daemon_control_set_all_log_level(int sock, DltDaemon *daemon, DltDaemon
if ((daemon == NULL) || (msg == NULL) || (msg->databuffer == NULL))
{
+ dlt_vlog(LOG_ERR, "%s: Invalid parameters\n", __func__);
return;
}
@@ -1803,15 +1909,19 @@ void dlt_daemon_control_set_all_log_level(int sock, DltDaemon *daemon, DltDaemon
req = (DltServiceSetDefaultLogLevel*) (msg->databuffer);
/* No endianess conversion necessary */
- if ((req != NULL) && (req->log_level <= DLT_LOG_VERBOSE))
+ if ((req != NULL) && ((req->log_level <= DLT_LOG_VERBOSE) || (req->log_level == (uint8_t)DLT_LOG_DEFAULT)))
{
- if (daemon_local->flags.enforceContextLLAndTS)
+ if (daemon_local->flags.enforceContextLLAndTS)
+ {
loglevel = getStatus(req->log_level, daemon_local->flags.contextLogLevel);
- else
- loglevel = req->log_level; /* No endianess conversion necessary */
+ }
+ else
+ {
+ loglevel = req->log_level; /* No endianess conversion necessary */
+ }
/* Send Update to all contexts using the new log level */
- dlt_daemon_user_send_all_update(daemon, loglevel, verbose);
+ dlt_daemon_user_send_all_log_level_update(daemon, loglevel, verbose);
dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_OK, verbose);
}
@@ -1861,6 +1971,50 @@ void dlt_daemon_control_set_default_trace_status(int sock, DltDaemon *daemon, Dl
}
}
+void dlt_daemon_control_set_all_trace_status(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, DltMessage *msg, int verbose)
+{
+ PRINT_FUNCTION_VERBOSE(verbose);
+
+ DltServiceSetDefaultLogLevel *req = NULL;
+ int32_t id = DLT_SERVICE_ID_SET_ALL_TRACE_STATUS;
+ int8_t tracestatus = 0;
+
+ if ((daemon == NULL) || (msg == NULL) || (msg->databuffer == NULL))
+ {
+ dlt_vlog(LOG_ERR, "%s: Invalid parameters\n", __func__);
+ return;
+ }
+
+ if (DLT_CHECK_RCV_DATA_SIZE(msg->datasize, sizeof(DltServiceSetDefaultLogLevel)) < 0)
+ {
+ return;
+ }
+
+ req = (DltServiceSetDefaultLogLevel*) (msg->databuffer);
+
+ /* No endianess conversion necessary */
+ if ((req != NULL) && ((req->log_level <= DLT_TRACE_STATUS_ON) || (req->log_level == (uint8_t)DLT_TRACE_STATUS_DEFAULT)))
+ {
+ if (daemon_local->flags.enforceContextLLAndTS)
+ {
+ tracestatus = getStatus(req->log_level, daemon_local->flags.contextTraceStatus);
+ }
+ else
+ {
+ tracestatus = req->log_level; /* No endianess conversion necessary */
+ }
+
+ /* Send Update to all contexts using the new log level */
+ dlt_daemon_user_send_all_trace_status_update(daemon, tracestatus, verbose);
+
+ dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_OK, verbose);
+ }
+ else
+ {
+ dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
+ }
+}
+
void dlt_daemon_control_set_timing_packets(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, DltMessage *msg, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
diff --git a/src/daemon/dlt_daemon_client.h b/src/daemon/dlt_daemon_client.h
index 275ee3e..b974b67 100644
--- a/src/daemon/dlt_daemon_client.h
+++ b/src/daemon/dlt_daemon_client.h
@@ -249,6 +249,15 @@ void dlt_daemon_control_set_all_log_level(int sock, DltDaemon *daemon, DltDaemon
*/
void dlt_daemon_control_set_default_trace_status(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, DltMessage *msg, int verbose);
/**
+ * Process and generate response to received set all trace status control message
+ * @param sock connection handle used for sending response
+ * @param daemon pointer to dlt daemon structure
+ * @param daemon_local pointer to dlt daemon local structure
+ * @param msg pointer to received control message
+ * @param verbose if set to true verbose information is printed out.
+ */
+void dlt_daemon_control_set_all_trace_status(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, DltMessage *msg, int verbose);
+/**
* Process and generate response to set timing packets control message
* @param sock connection handle used for sending response
* @param daemon pointer to dlt daemon structure
diff --git a/src/daemon/dlt_daemon_common.c b/src/daemon/dlt_daemon_common.c
index 0f56cc3..40d8d5c 100644
--- a/src/daemon/dlt_daemon_common.c
+++ b/src/daemon/dlt_daemon_common.c
@@ -1287,7 +1287,7 @@ void dlt_daemon_user_send_default_update(DltDaemon *daemon, int verbose)
}
}
-void dlt_daemon_user_send_all_update(DltDaemon *daemon, int8_t log_level, int verbose)
+void dlt_daemon_user_send_all_log_level_update(DltDaemon *daemon, int8_t log_level, int verbose)
{
int32_t count = 0;
DltDaemonContext *context = NULL;
@@ -1316,6 +1316,37 @@ void dlt_daemon_user_send_all_update(DltDaemon *daemon, int8_t log_level, int ve
}
}
+void dlt_daemon_user_send_all_trace_status_update(DltDaemon *daemon, int8_t trace_status, int verbose)
+{
+ int32_t count = 0;
+ DltDaemonContext *context = NULL;
+
+ PRINT_FUNCTION_VERBOSE(verbose);
+
+ if (daemon == NULL)
+ {
+ return;
+ }
+
+ dlt_vlog(LOG_NOTICE, "All trace status is updated -> %i\n", trace_status);
+
+ for (count = 0; count < daemon->num_contexts; count++)
+ {
+ context = &(daemon->contexts[count]);
+ if (context)
+ {
+ if (context->user_handle >= DLT_FD_MINIMUM)
+ {
+ context->trace_status = trace_status;
+ if (dlt_daemon_user_send_log_level(daemon, context, verbose) == -1)
+ {
+ dlt_vlog(LOG_WARNING, "Cannot send trace status %.4s:%.4s -> %i\n", context->apid, context->ctid, context->trace_status);
+ }
+ }
+ }
+ }
+}
+
void dlt_daemon_user_send_all_log_state(DltDaemon *daemon, int verbose)
{
int32_t count;
diff --git a/src/daemon/dlt_daemon_common.h b/src/daemon/dlt_daemon_common.h
index 02d2860..d79febb 100644
--- a/src/daemon/dlt_daemon_common.h
+++ b/src/daemon/dlt_daemon_common.h
@@ -355,13 +355,20 @@ int dlt_daemon_user_send_log_state(DltDaemon *daemon,DltDaemonApplication *app,i
void dlt_daemon_user_send_default_update(DltDaemon *daemon, int verbose);
/**
- * Send user messages to all user applications context, or trace status
- * to update with the new log level
+ * Send user messages to all user applications context to update with the new log level
* @param daemon pointer to dlt daemon structure
- * @param log level to be set
+ * @param log_level new log level to be set
* @param verbose if set to true verbose information is printed out.
*/
-void dlt_daemon_user_send_all_update(DltDaemon *daemon, int8_t log_level, int verbose);
+void dlt_daemon_user_send_all_log_level_update(DltDaemon *daemon, int8_t log_level, int verbose);
+
+/**
+ * Send user messages to all user applications context to update with the new trace status
+ * @param daemon pointer to dlt daemon structure
+ * @param trace_status new trace status to be set
+ * @param verbose if set to true verbose information is printed out.
+ */
+void dlt_daemon_user_send_all_trace_status_update(DltDaemon *daemon, int8_t trace_status, int verbose);
/**
* Send user messages to all user applications the log status
diff --git a/src/lib/dlt_client.c b/src/lib/dlt_client.c
index fadd789..8a6595e 100644
--- a/src/lib/dlt_client.c
+++ b/src/lib/dlt_client.c
@@ -765,6 +765,43 @@ DltReturnValue dlt_client_send_default_trace_status(DltClient *client, uint8_t d
return DLT_RETURN_OK;
}
+DltReturnValue dlt_client_send_all_trace_status(DltClient *client, uint8_t traceStatus)
+{
+ DltServiceSetDefaultLogLevel *req;
+ uint8_t *payload;
+
+ if (client == NULL)
+ {
+ dlt_vlog(LOG_ERR, "%s: Invalid parameters\n", __func__);
+ return DLT_RETURN_ERROR;
+ }
+
+ payload = (uint8_t *) malloc(sizeof(DltServiceSetDefaultLogLevel));
+
+ if (payload == 0)
+ {
+ dlt_vlog(LOG_ERR, "%s: Could not allocate memory %d\n", __func__, sizeof(DltServiceSetDefaultLogLevel));
+ return DLT_RETURN_ERROR;
+ }
+
+ req = (DltServiceSetDefaultLogLevel *) payload;
+
+ req->service_id = DLT_SERVICE_ID_SET_ALL_TRACE_STATUS;
+ req->log_level = traceStatus;
+ dlt_set_id(req->com, "remo");
+
+ /* free message */
+ if (dlt_client_send_ctrl_msg(client, "APP", "CON", payload, sizeof(DltServiceSetDefaultLogLevel)) == -1)
+ {
+ free(payload);
+ return DLT_RETURN_ERROR;
+ }
+
+ free(payload);
+
+ return DLT_RETURN_OK;
+}
+
DltReturnValue dlt_client_send_timing_pakets(DltClient *client, uint8_t timingPakets)
{
DltServiceSetVerboseMode *req;