summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordbiastoch <dbiastoch@de.adit-jv.com>2020-11-12 10:42:37 +0100
committerSaya Sugiura <39760799+ssugiura@users.noreply.github.com>2021-01-06 09:27:28 +0900
commit6f4d05fe7c2a90b3e89837cbea9cac95c09ad746 (patch)
tree82bb6e9532c83b6b5d8454d1f4da417a36c8de89 /src
parent360ccb0463aa7cf766d3a8228558cdc6478309a1 (diff)
downloadDLT-daemon-6f4d05fe7c2a90b3e89837cbea9cac95c09ad746.tar.gz
example: Added customization of CxtID and AppID
-It's now possbile to enter a custom app and context ID by using the new implemented "-A" and "-C" arguments. -Also added a markdown manual in the doc directory for dlt-example-user. Signed-off-by: dbiastoch <dbiastoch@de.adit-jv.com>
Diffstat (limited to 'src')
-rw-r--r--src/examples/dlt-example-user.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/examples/dlt-example-user.c b/src/examples/dlt-example-user.c
index 66515c6..9a9ab6d 100644
--- a/src/examples/dlt-example-user.c
+++ b/src/examples/dlt-example-user.c
@@ -102,8 +102,10 @@ void usage()
printf(" -g Switch to non-verbose mode (Default: verbose mode)\n");
printf(" -a Enable local printing of DLT messages (Default: disabled)\n");
printf(" -k Send marker message\n");
- printf(" -m mode Set log mode 0=off,1=external,2=internal,3=both\n");
+ printf(" -m mode Set log mode 0=off, 1=external, 2=internal, 3=both\n");
printf(" -l level Set log level to <level>, level=-1..6\n");
+ printf(" -C ContextID Set context ID for send message (Default: TEST)\n");
+ printf(" -A AppID Set app ID for send message (Default: LOG)\n");
printf(" -t timeout Set timeout when sending messages at exit, in ms (Default: 10000 = 10sec)\n");
printf(" -r size Send raw data with specified size instead of string\n");
#ifdef DLT_TEST_ENABLE
@@ -137,6 +139,9 @@ int main(int argc, char *argv[])
int index;
int c;
+ char *appID = "LOG";
+ char *contextID = "TEST";
+
char *text;
int num, maxnum;
int delay;
@@ -147,10 +152,10 @@ int main(int argc, char *argv[])
opterr = 0;
#ifdef DLT_TEST_ENABLE
- while ((c = getopt (argc, argv, "vgakcd:f:n:m:z:r:s:l:t:")) != -1)
+ while ((c = getopt (argc, argv, "vgakcd:f:n:m:z:r:s:l:t:A:C:")) != -1)
#else
- while ((c = getopt (argc, argv, "vgakd:f:n:m:l:r:t:")) != -1)
+ while ((c = getopt (argc, argv, "vgakd:f:n:m:l:r:t:A:C:")) != -1)
#endif /* DLT_TEST_ENABLE */
{
switch (c) {
@@ -211,6 +216,16 @@ int main(int argc, char *argv[])
lvalue = atoi(optarg);
break;
}
+ case 'A':
+ {
+ appID = optarg;
+ break;
+ }
+ case 'C':
+ {
+ contextID = optarg;
+ break;
+ }
case 't':
{
tvalue = optarg;
@@ -269,8 +284,8 @@ int main(int argc, char *argv[])
dlt_with_ecu_id(1);
dlt_verbose_mode();
- DLT_REGISTER_APP("LOG", "Test Application for Logging");
- DLT_REGISTER_CONTEXT(mycontext1, "TEST", "Test Context for Logging");
+ DLT_REGISTER_APP(appID, "Test Application for Logging");
+ DLT_REGISTER_CONTEXT(mycontext1, contextID, "Test Context for Logging");
DLT_REGISTER_CONTEXT_LLCCB(mycontext2, "TS1", "Test Context1 for injection", dlt_user_log_level_changed_callback);
DLT_REGISTER_CONTEXT_LLCCB(mycontext3, "TS2", "Test Context2 for injection", dlt_user_log_level_changed_callback);