summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2013-10-11 16:31:49 +0200
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2013-10-18 11:04:23 +0200
commit967d6b662984054a809e31ab1363d24e5d32b58a (patch)
treea038c6848786021d322e8836f03f8ef6f7dd11dc /src
parentf9ea5461ae46f52870469b190b939d2724deb83f (diff)
downloadDLT-daemon-967d6b662984054a809e31ab1363d24e5d32b58a.tar.gz
Added command line commands set log level and set trace status.
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/console/dlt-control.c40
-rwxr-xr-xsrc/lib/dlt_client.c65
2 files changed, 101 insertions, 4 deletions
diff --git a/src/console/dlt-control.c b/src/console/dlt-control.c
index 4d16be1..eb3f4dd 100755
--- a/src/console/dlt-control.c
+++ b/src/console/dlt-control.c
@@ -77,6 +77,8 @@ typedef struct {
char *mvalue;
char *xvalue;
int tvalue;
+ int lvalue;
+ int rvalue;
int bvalue;
char ecuid[4];
@@ -164,6 +166,8 @@ 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");
}
/**
@@ -188,11 +192,13 @@ int main(int argc, char* argv[])
dltdata.mvalue = 0;
dltdata.xvalue = 0;
dltdata.tvalue = 1000;
+ dltdata.lvalue = -1;
+ dltdata.rvalue = -1;
/* Fetch command line arguments */
opterr = 0;
- while ((c = getopt (argc, argv, "vhye:b:a:c:s:m:x:t:")) != -1)
+ while ((c = getopt (argc, argv, "vhye:b:a:c:s:m:x:t:l:r:")) != -1)
switch (c)
{
case 'v':
@@ -251,6 +257,16 @@ int main(int argc, char* argv[])
dltdata.tvalue = atoi(optarg);;
break;
}
+ case 'l':
+ {
+ dltdata.lvalue = atoi(optarg);;
+ break;
+ }
+ case 'r':
+ {
+ dltdata.rvalue = atoi(optarg);;
+ break;
+ }
case '?':
{
@@ -365,6 +381,26 @@ int main(int argc, char* argv[])
/* send control message in hex */
dlt_client_send_inject_msg(&dltclient,dltdata.avalue,dltdata.cvalue,dltdata.svalue,buffer,size);
}
+ else if(dltdata.lvalue!=-1 && dltdata.avalue && dltdata.cvalue)
+ {
+ /* log level */
+ printf("Set log level:\n");
+ printf("AppId: %s\n",dltdata.avalue);
+ printf("ConId: %s\n",dltdata.cvalue);
+ printf("Loglevel: %d\n",dltdata.lvalue);
+ /* send control message*/
+ dlt_client_send_log_level(&dltclient,dltdata.avalue,dltdata.cvalue,dltdata.lvalue);
+ }
+ 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*/
+ dlt_client_send_trace_status(&dltclient,dltdata.avalue,dltdata.cvalue,dltdata.rvalue);
+ }
/* Dlt Client Main Loop */
//dlt_client_main_loop(&dltclient, &dltdata, dltdata.vflag);
@@ -385,14 +421,12 @@ int main(int argc, char* argv[])
int dlt_receive_message_callback(DltMessage *message, void *data)
{
- DltReceiveData *dltdata;
if ((message==0) || (data==0))
{
return -1;
}
- dltdata = (DltReceiveData*)data;
return 0;
}
diff --git a/src/lib/dlt_client.c b/src/lib/dlt_client.c
index 76a4c71..9104416 100755
--- a/src/lib/dlt_client.c
+++ b/src/lib/dlt_client.c
@@ -319,7 +319,6 @@ int dlt_client_send_ctrl_msg(DltClient *client, char *apid, char *ctid, uint8_t
{
DltMessage msg;
int ret;
- int offset=0;
int32_t len;
@@ -477,6 +476,70 @@ int dlt_client_send_inject_msg(DltClient *client, char *apid, char *ctid, uint32
return 0;
}
+int dlt_client_send_log_level(DltClient *client, char *apid, char *ctid, uint8_t logLevel)
+{
+ DltServiceSetLogLevel *req;
+ uint8_t *payload;
+
+ payload = (uint8_t *) malloc(sizeof(DltServiceSetLogLevel));
+
+ if(payload==0)
+ {
+ return -1;
+ }
+
+ req = (DltServiceSetLogLevel *) payload;
+
+ req->service_id = DLT_SERVICE_ID_SET_LOG_LEVEL;
+ dlt_set_id(req->apid,apid);
+ dlt_set_id(req->ctid,ctid);
+ req->log_level=logLevel;
+ dlt_set_id(req->com,"remo");
+
+ /* free message */
+ if (dlt_client_send_ctrl_msg(client,"APP","CON",payload,sizeof(DltServiceSetLogLevel))==-1)
+ {
+ free(payload);
+ return -1;
+ }
+
+ free(payload);
+
+ return 0;
+}
+
+int dlt_client_send_trace_status(DltClient *client, char *apid, char *ctid, uint8_t traceStatus)
+{
+ DltServiceSetLogLevel *req;
+ uint8_t *payload;
+
+ payload = (uint8_t *) malloc(sizeof(DltServiceSetLogLevel));
+
+ if(payload==0)
+ {
+ return -1;
+ }
+
+ req = (DltServiceSetLogLevel *) payload;
+
+ req->service_id = DLT_SERVICE_ID_SET_TRACE_STATUS;
+ dlt_set_id(req->apid,apid);
+ dlt_set_id(req->ctid,ctid);
+ req->log_level=traceStatus;
+ dlt_set_id(req->com,"remo");
+
+ /* free message */
+ if (dlt_client_send_ctrl_msg(client,"APP","CON",payload,sizeof(DltServiceSetLogLevel))==-1)
+ {
+ free(payload);
+ return -1;
+ }
+
+ free(payload);
+
+ return 0;
+}
+
int dlt_client_setbaudrate(DltClient *client, int baudrate)
{
if (client==0)