summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinclude/dlt/dlt_client.h50
-rwxr-xr-xsrc/console/dlt-control.c86
-rwxr-xr-xsrc/lib/dlt_client.c119
3 files changed, 251 insertions, 4 deletions
diff --git a/include/dlt/dlt_client.h b/include/dlt/dlt_client.h
index c2ad605..ac9d61e 100755
--- a/include/dlt/dlt_client.h
+++ b/include/dlt/dlt_client.h
@@ -140,8 +140,58 @@ int dlt_client_send_ctrl_msg(DltClient *client, char *apid, char *ctid, uint8_t
* @return negative value if there was an error
*/
int dlt_client_send_inject_msg(DltClient *client, char *apid, char *ctid, uint32_t serviceID, uint8_t *buffer, uint32_t size);
+/**
+ * Send an set log level message to the dlt daemon
+ * @param client pointer to dlt client structure
+ * @param apid application id
+ * @param ctid context id
+ * @param SendLogLevel Log Level
+ * @return negative value if there was an error
+ */
int dlt_client_send_log_level(DltClient *client, char *apid, char *ctid, uint8_t logLevel);
+/**
+ * Send a set trace status message to the dlt daemon
+ * @param client pointer to dlt client structure
+ * @param apid application id
+ * @param ctid context id
+ * @param defaultTraceStatus Default Trace Status
+ * @return negative value if there was an error
+ */
int dlt_client_send_trace_status(DltClient *client, char *apid, char *ctid, uint8_t traceStatus);
+/**
+ * Send the default log level to the dlt daemon
+ * @param client pointer to dlt client structure
+ * @param defaultLogLevel Default Log Level
+ * @return negative value if there was an error
+ */
+int dlt_client_send_default_log_level(DltClient *client, uint8_t defaultLogLevel);
+/**
+ * Send the default trace status to the dlt daemon
+ * @param client pointer to dlt client structure
+ * @param defaultTraceStatus Default Trace Status
+ * @return negative value if there was an error
+ */
+int dlt_client_send_default_trace_status(DltClient *client, uint8_t defaultTraceStatus);
+/**
+ * Send the timing pakets status to the dlt daemon
+ * @param client pointer to dlt client structure
+ * @param timingPakets Timing pakets enabled
+ * @return negative value if there was an error
+ */
+int dlt_client_send_timing_pakets(DltClient *client, uint8_t timingPakets);
+/**
+ * Send the store config command to the dlt daemon
+ * @param client pointer to dlt client structure
+ * @return negative value if there was an error
+ */
+int dlt_client_send_store_config(DltClient *client);
+/**
+ * Send the reset to factory default command to the dlt daemon
+ * @param client pointer to dlt client structure
+ * @return negative value if there was an error
+ */
+int dlt_client_send_reset_to_factory_default(DltClient *client);
+
/**
* Set baudrate within dlt client structure
* @param client pointer to dlt client structure
diff --git a/src/console/dlt-control.c b/src/console/dlt-control.c
index eb3f4dd..8b390c5 100755
--- a/src/console/dlt-control.c
+++ b/src/console/dlt-control.c
@@ -79,6 +79,11 @@ typedef struct {
int tvalue;
int lvalue;
int rvalue;
+ int dvalue;
+ int fvalue;
+ int ivalue;
+ int oflag;
+ int gflag;
int bvalue;
char ecuid[4];
@@ -166,8 +171,13 @@ void usage()
printf(" -m message Control message injection in ASCII\n");
printf(" -x message Control message injection in Hex e.g. 'ad 01 24 ef'\n");
printf(" -t milliseconds Timeout to terminate application (Default:1000)'\n");
- printf(" -l loglevel Set the log level (0=off - 5=verbose,255=default)\n");
- printf(" -r tracestatus Set the trace status (0=off - 1=on,255=default\n");
+ printf(" -l loglevel Set the log level (0=off - 5=verbose,255=default)\n");
+ printf(" -r tracestatus Set the trace status (0=off - 1=on,255=default)\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");
+ printf(" -o Store configuration\n");
+ printf(" -g Reset to factory default\n");
}
/**
@@ -194,11 +204,16 @@ int main(int argc, char* argv[])
dltdata.tvalue = 1000;
dltdata.lvalue = -1;
dltdata.rvalue = -1;
+ dltdata.dvalue = -1;
+ dltdata.fvalue = -1;
+ dltdata.ivalue = -1;
+ dltdata.oflag = -1;
+ dltdata.gflag = -1;
/* Fetch command line arguments */
opterr = 0;
- while ((c = getopt (argc, argv, "vhye:b:a:c:s:m:x:t:l:r:")) != -1)
+ while ((c = getopt (argc, argv, "vhye:b:a:c:s:m:x:t:l:r:d:f:i:og")) != -1)
switch (c)
{
case 'v':
@@ -267,6 +282,31 @@ int main(int argc, char* argv[])
dltdata.rvalue = atoi(optarg);;
break;
}
+ case 'd':
+ {
+ dltdata.dvalue = atoi(optarg);;
+ break;
+ }
+ case 'f':
+ {
+ dltdata.fvalue = atoi(optarg);;
+ break;
+ }
+ case 'i':
+ {
+ dltdata.ivalue = atoi(optarg);;
+ break;
+ }
+ case 'o':
+ {
+ dltdata.oflag = 1;
+ break;
+ }
+ case 'g':
+ {
+ dltdata.gflag = 1;
+ break;
+ }
case '?':
{
@@ -397,10 +437,48 @@ int main(int argc, char* argv[])
printf("Set trace status:\n");
printf("AppId: %s\n",dltdata.avalue);
printf("ConId: %s\n",dltdata.cvalue);
- printf("TraceStatus:: %d\n",dltdata.rvalue);
+ printf("TraceStatus: %d\n",dltdata.rvalue);
/* send control message in*/
dlt_client_send_trace_status(&dltclient,dltdata.avalue,dltdata.cvalue,dltdata.rvalue);
}
+ else if(dltdata.dvalue!=-1)
+ {
+ /* default log level */
+ printf("Set default log level:\n");
+ printf("Loglevel: %d\n",dltdata.dvalue);
+ /* send control message in*/
+ dlt_client_send_default_log_level(&dltclient,dltdata.dvalue);
+ }
+ else if(dltdata.rvalue!=-1)
+ {
+ /* default trace status */
+ printf("Set default trace status:\n");
+ printf("TraceStatus: %d\n",dltdata.rvalue);
+ /* send control message in*/
+ dlt_client_send_default_trace_status(&dltclient,dltdata.rvalue);
+ }
+ else if(dltdata.ivalue!=-1)
+ {
+ /* timing pakets */
+ printf("Set timing pakets:\n");
+ printf("Timing packets: %d\n",dltdata.ivalue);
+ /* send control message in*/
+ dlt_client_send_timing_pakets(&dltclient,dltdata.ivalue);
+ }
+ else if(dltdata.oflag!=-1)
+ {
+ /* default trace status */
+ printf("Store config\n");
+ /* send control message in*/
+ dlt_client_send_store_config(&dltclient);
+ }
+ else if(dltdata.gflag!=-1)
+ {
+ /* reset to factory default */
+ printf("Reset to factory default\n");
+ /* send control message in*/
+ dlt_client_send_reset_to_factory_default(&dltclient);
+ }
/* Dlt Client Main Loop */
//dlt_client_main_loop(&dltclient, &dltdata, dltdata.vflag);
diff --git a/src/lib/dlt_client.c b/src/lib/dlt_client.c
index 9104416..8c1e9ca 100755
--- a/src/lib/dlt_client.c
+++ b/src/lib/dlt_client.c
@@ -540,6 +540,125 @@ int dlt_client_send_trace_status(DltClient *client, char *apid, char *ctid, uint
return 0;
}
+int dlt_client_send_default_log_level(DltClient *client, uint8_t defaultLogLevel)
+{
+ DltServiceSetDefaultLogLevel *req;
+ uint8_t *payload;
+
+ payload = (uint8_t *) malloc(sizeof(DltServiceSetDefaultLogLevel));
+
+ if(payload==0)
+ {
+ return -1;
+ }
+
+ req = (DltServiceSetDefaultLogLevel *) payload;
+
+ req->service_id = DLT_SERVICE_ID_SET_DEFAULT_LOG_LEVEL;
+ req->log_level=defaultLogLevel;
+ dlt_set_id(req->com,"remo");
+
+ /* free message */
+ if (dlt_client_send_ctrl_msg(client,"APP","CON",payload,sizeof(DltServiceSetDefaultLogLevel))==-1)
+ {
+ free(payload);
+ return -1;
+ }
+
+ free(payload);
+
+ return 0;
+}
+
+int dlt_client_send_default_trace_status(DltClient *client, uint8_t defaultTraceStatus)
+{
+ DltServiceSetDefaultLogLevel *req;
+ uint8_t *payload;
+
+ payload = (uint8_t *) malloc(sizeof(DltServiceSetDefaultLogLevel));
+
+ if(payload==0)
+ {
+ return -1;
+ }
+
+ req = (DltServiceSetDefaultLogLevel *) payload;
+
+ req->service_id = DLT_SERVICE_ID_SET_DEFAULT_TRACE_STATUS;
+ req->log_level=defaultTraceStatus;
+ dlt_set_id(req->com,"remo");
+
+ /* free message */
+ if (dlt_client_send_ctrl_msg(client,"APP","CON",payload,sizeof(DltServiceSetDefaultLogLevel))==-1)
+ {
+ free(payload);
+ return -1;
+ }
+
+ free(payload);
+
+ return 0;
+}
+
+int dlt_client_send_timing_pakets(DltClient *client, uint8_t timingPakets)
+{
+ DltServiceSetVerboseMode *req;
+ uint8_t *payload;
+
+ payload = (uint8_t *) malloc(sizeof(DltServiceSetVerboseMode));
+
+ if(payload==0)
+ {
+ return -1;
+ }
+
+ req = (DltServiceSetVerboseMode *) payload;
+
+ req->service_id = DLT_SERVICE_ID_SET_TIMING_PACKETS;
+ req->new_status=timingPakets;
+
+ /* free message */
+ if (dlt_client_send_ctrl_msg(client,"APP","CON",payload,sizeof(DltServiceSetVerboseMode))==-1)
+ {
+ free(payload);
+ return -1;
+ }
+
+ free(payload);
+
+ return 0;
+}
+
+int dlt_client_send_store_config(DltClient *client)
+{
+ uint32_t service_id;
+
+ service_id = DLT_SERVICE_ID_STORE_CONFIG;
+
+ /* free message */
+ if (dlt_client_send_ctrl_msg(client,"APP","CON",(uint8_t*)&service_id,sizeof(uint32_t))==-1)
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int dlt_client_send_reset_to_factory_default(DltClient *client)
+{
+ uint32_t service_id;
+
+ service_id = DLT_SERVICE_ID_RESET_TO_FACTORY_DEFAULT;
+
+ /* free message */
+ if (dlt_client_send_ctrl_msg(client,"APP","CON",(uint8_t*)&service_id,sizeof(uint32_t))==-1)
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
int dlt_client_setbaudrate(DltClient *client, int baudrate)
{
if (client==0)