summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/dlt_example_user.md106
-rw-r--r--src/examples/dlt-example-user.c25
2 files changed, 126 insertions, 5 deletions
diff --git a/doc/dlt_example_user.md b/doc/dlt_example_user.md
new file mode 100644
index 0000000..d2f9af6
--- /dev/null
+++ b/doc/dlt_example_user.md
@@ -0,0 +1,106 @@
+% DLT-EXAMPLE-USER(1)
+
+# NAME
+
+**dlt-example-user** - Console based application for sending a custom dlt message
+
+# SYNOPSIS
+
+**dlt-example-user** \[**-h**\] \[**-g**\] \[**-a**\] \[**-k**\] \[**-d** delay\] \[**-f** filename\] \[**-n** count\] \[**-m** mode\] \[**-l** level\] \[**-A** appID\] \[**-C** contextID\] \[**-t** timeout\] \[**-s** size\] message
+
+# DESCRIPTION
+
+Sends the given message as DLT messages to DLT daemon or prints the raw DLT messages into a local file.
+
+## OPTIONS
+
+-h
+
+: Display a short help text.
+
+-g
+
+: Switch to non-verbose mode (Default: verbose mode).
+
+-a
+
+: Enable local printing of DLT messages (Default: disabled).
+
+-k
+
+: Send marker message.
+
+-d
+
+: Milliseconds to wait between sending messages (Default: 500).
+
+-f
+
+: Use local log file instead of sending to daemon.
+
+-n
+
+: Number of messages to be generated (Default: 10).
+
+-m
+
+: Set log mode 0=off, 1=external, 2=internal, 3=both.
+
+-l
+
+: Set log level, level=-1..6 (Default: 3).
+
+-A
+
+: Set app ID for send message (Default: LOG).
+
+-C
+
+: Set context ID for send message (Default: TEST).
+
+-t
+
+: Set timeout when sending messages at exit, in ms (Default: 10000 = 10sec).
+
+-r
+
+: Send raw data with specified size instead of string.
+
+
+# EXAMPLES
+
+Send "HelloWorld" with default settings (10 times, every 0.5 seconds) as DLT message to dlt-daemon::
+
+ dlt-example-user HelloWorld
+
+Set app ID to `APP1`, context Id to `TEST` and log level to `error` for send message::
+
+ dlt-example-user -l 2 -A APP1 -C TEST HelloWorld
+
+Send 100 DLT messages every second::
+
+ dlt-example-user -n 100 -d 1000 HelloWorld
+
+# EXIT STATUS
+
+Non zero is returned in case of failure.
+
+# Notes
+
+The default descriptions for application and context registration are used irrespective of the IDs that could be set. App will always register with "Test Application for Logging" and context with "Test Context for Logging".
+
+# AUTHOR
+
+Darian Biastoch (dbiastoch@de.adit-jv.com)
+
+# COPYRIGHT
+
+Copyright (C) 2020 ADIT GmbH. License MPL-2.0: Mozilla Public License version 2.0 <http://mozilla.org/MPL/2.0/>.
+
+# BUGS
+
+See Github issue: <https://github.com/GENIVI/dlt-daemon/issues>
+
+# SEE ALSO
+
+**dlt-daemon(1)** \ No newline at end of file
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);