93 printf(
"Usage: dlt-example-user [options] message\n");
94 printf(
"Generate DLT messages and store them to file or send them to daemon.\n");
95 printf(
"%s \n", version);
97 printf(
" -d delay Milliseconds to wait between sending messages (Default: 500)\n");
98 printf(
" -f filename Use local log file instead of sending to daemon\n");
99 printf(
" -n count Number of messages to be generated (Default: 10)\n");
100 printf(
" -g Switch to non-verbose mode (Default: verbose mode)\n");
101 printf(
" -a Enable local printing of DLT messages (Default: disabled)\n");
102 printf(
" -k Send marker message\n");
103 printf(
" -m mode Set log mode 0=off,1=external,2=internal,3=both\n");
104 printf(
" -l level Set log level to <level>, level=-1..6\n");
105 printf(
" -t timeout Set timeout when sending messages at exit, in ms (Default: 10000 = 10sec)\n");
106 #ifdef DLT_TEST_ENABLE 107 printf(
" -c Corrupt user header\n");
108 printf(
" -s size Corrupt message size\n");
109 printf(
" -z size Size of message\n");
116 int main(
int argc,
char* argv[])
121 #ifdef DLT_TEST_ENABLE 141 int state=-1,newstate;
144 #ifdef DLT_TEST_ENABLE 145 while ((c = getopt (argc, argv,
"vgakcd:f:n:m:z:s:l:t:")) != -1)
147 while ((c = getopt (argc, argv,
"vgakd:f:n:m:l:t:")) != -1)
167 #ifdef DLT_TEST_ENABLE 206 lvalue = atoi(optarg);
216 if (optopt ==
'd' || optopt ==
'f' || optopt ==
'n'|| optopt ==
'l' || optopt ==
't')
218 fprintf (stderr,
"Option -%c requires an argument.\n", optopt);
220 else if (isprint (optopt))
222 fprintf (stderr,
"Unknown option `-%c'.\n", optopt);
226 fprintf (stderr,
"Unknown option character `\\x%x'.\n",optopt);
241 for (index = optind; index < argc; index++)
243 message = argv[index];
249 fprintf(stderr,
"ERROR: No message selected\n");
278 printf(
"Set log mode to %d\n",atoi(mvalue));
300 maxnum = atoi(nvalue);
309 delay = atoi(dvalue) * 1000;
331 #ifdef DLT_TEST_ENABLE 334 dlt_user_test_corrupt_user_header(1);
338 dlt_user_test_corrupt_message_size(1,atoi(svalue));
342 char*
buffer = malloc(atoi(zvalue));
346 fprintf(stderr,
"Cannot allocate buffer memory!\n");
354 for (num=0;num<maxnum;num++)
356 printf(
"Send %d %s\n",num,text);
363 printf(
"Client unknown state!\n");
365 else if(state == 0) {
366 printf(
"Client disconnected!\n");
368 else if(state == 1) {
369 printf(
"Client connected!\n");
404 printf(
"Injection %d, Length=%d \n",service_id,length);
409 printf(
"%s \n", text);
420 memcpy(text,context_id,DLT_ID_SIZE);
422 printf(
"Log level changed of context %s, LogLevel=%u, TraceState=%u \n",text,log_level,trace_status);
#define DLT_RAW(BUF, LEN)
int dlt_set_resend_timeout_atexit(uint32_t timeout_in_milliseconds)
#define DLT_UNREGISTER_APP()
DltReturnValue dlt_verbose_mode(void)
#define DLT_UINT16(UINT_VAR)
DLT_DECLARE_CONTEXT(mycontext)
#define DLT_NONVERBOSE_MODE()
#define DLT_REGISTER_INJECTION_CALLBACK(CONTEXT, SERVICEID, CALLBACK)
DltReturnValue dlt_print_mixed_string(char *text, int textlength, uint8_t *ptr, int size, int html)
DltReturnValue dlt_with_session_id(int8_t with_session_id)
DltReturnValue dlt_init_file(const char *name)
#define DLT_FLOAT32(FLOAT32_VAR)
void dlt_user_log_level_changed_callback(char context_id[DLT_ID_SIZE], uint8_t log_level, uint8_t trace_status)
static char * service_id[]
static char data[kDataSize]
#define DLT_LOG_ID(CONTEXT, LOGLEVEL, MSGID, ARGS...)
#define DLT_REGISTER_APP(APPID, DESCRIPTION)
unsigned char buffer[BUFFER_SIZE]
Buffer for dlt file transfer. The size is defined by BUFFER_SIZE.
#define DLT_REGISTER_CONTEXT(CONTEXT, CONTEXTID, DESCRIPTION)
#define DLT_UNREGISTER_CONTEXT(CONTEXT)
#define DLT_UINT8(UINT_VAR)
#define DLT_ENABLE_LOCAL_PRINT()
#define DLT_LOG(CONTEXT, LOGLEVEL, ARGS...)
int dlt_user_injection_callback(uint32_t service_id, void *data, uint32_t length)
DltReturnValue dlt_with_timestamp(int8_t with_timestamp)
void dlt_get_version(char *buf, size_t size)
int main(int argc, char *argv[])
DltReturnValue dlt_set_log_mode(DltUserLogMode mode)
#define DLT_UINT32(UINT_VAR)
#define DLT_REGISTER_LOG_LEVEL_CHANGED_CALLBACK(CONTEXT, CALLBACK)
DltReturnValue dlt_with_ecu_id(int8_t with_ecu_id)