77 printf(
"Usage: dlt-example-common-api [options] message\n");
78 printf(
"Generate DLT messages and store them to file or send them to daemon.\n");
79 printf(
"%s \n", version);
81 printf(
" -d delay Milliseconds to wait between sending messages (Default: 500)\n");
82 printf(
" -f filename Use local log file instead of sending to daemon\n");
83 printf(
" -n count Number of messages to be generated (Default: 10)\n");
84 printf(
" -g Switch to non-verbose mode (Default: verbose mode)\n");
85 printf(
" -a Enable local printing of DLT messages (Default: disabled)\n");
86 printf(
" -m mode Set log mode 0=off,1=external,2=internal,3=both\n");
87 #ifdef DLT_TEST_ENABLE 88 printf(
" -c Corrupt user header\n");
89 printf(
" -s size Corrupt message size\n");
90 printf(
" -z size Size of message\n");
97 int main(
int argc,
char* argv[])
99 #ifdef DLT_TEST_ENABLE 116 int state=-1,newstate;
119 #ifdef DLT_TEST_ENABLE 120 while ((c = getopt (argc, argv,
"vgcd:n:z:s:")) != -1)
122 while ((c = getopt (argc, argv,
"vgd:n:")) != -1)
127 #ifdef DLT_TEST_ENABLE 161 if (optopt ==
'd' || optopt ==
'f' || optopt ==
'n')
163 fprintf (stderr,
"Option -%c requires an argument.\n", optopt);
165 else if (isprint (optopt))
167 fprintf (stderr,
"Unknown option `-%c'.\n", optopt);
171 fprintf (stderr,
"Unknown option character `\\x%x'.\n",optopt);
186 for (index = optind; index < argc; index++)
188 message = argv[index];
194 fprintf(stderr,
"ERROR: No message selected\n");
206 maxnum = atoi(nvalue);
215 delay = atoi(dvalue) * 1000;
232 #ifdef DLT_TEST_ENABLE 235 dlt_user_test_corrupt_user_header(1);
239 dlt_user_test_corrupt_message_size(1,atoi(svalue));
243 char*
buffer = malloc(atoi(zvalue));
247 fprintf(stderr,
"Cannot allocate buffer memory!\n");
255 for (num=0;num<maxnum;num++)
257 printf(
"Send %d %s\n",num,text);
264 printf(
"Client unknown state!\n");
266 else if(state == 0) {
267 printf(
"Client disconnected!\n");
269 else if(state == 1) {
270 printf(
"Client connected!\n");
#define DLT_RAW(BUF, LEN)
#define DLT_REGISTER_CONTEXT_APP(CONTEXT, CONTEXTID, APPID, DESCRIPTION)
DLT_DECLARE_CONTEXT(mycontext)
#define DLT_UNREGISTER_APP()
#define DLT_UINT16(UINT_VAR)
#define DLT_LOG_ID2(CONTEXT, LOGLEVEL, MSGID, ARGS1, ARGS2)
#define DLT_FLOAT32(FLOAT32_VAR)
#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_LOG2(CONTEXT, LOGLEVEL, ARGS1, ARGS2)
#define DLT_UNREGISTER_CONTEXT(CONTEXT)
#define DLT_UINT8(UINT_VAR)
#define DLT_LOG_ID1(CONTEXT, LOGLEVEL, MSGID, ARGS1)
int main(int argc, char *argv[])
void dlt_get_version(char *buf, size_t size)
#define DLT_UINT32(UINT_VAR)
#define DLT_LOG_ID0(CONTEXT, LOGLEVEL, MSGID)