94 printf(
"Usage: %s [options] <remote address|serial device>\n", name);
95 printf(
"Receive messages from dlt-test-multi-process.\n");
96 printf(
"%s", version);
98 printf(
" -m Total messages to receive. (Default: 10000)\n");
99 printf(
" -y Serial device mode.\n");
100 printf(
" -b baudrate Serial device baudrate. (Default: 115200)\n");
101 printf(
" -v Verbose. Increases the verbosity level of dlt client library.\n");
102 printf(
" -o filename Output messages in new DLT file.\n");
124 while ((c = getopt(argc, argv,
"m:yb:vo:")) != -1) {
142 if(optopt ==
'm' || optopt ==
'b' || optopt ==
'o')
144 fprintf(stderr,
"Option -%c requires an argument.\n", optopt);
146 if (isprint(optopt)) {
147 fprintf(stderr,
"Unknown option '-%c'.\n", optopt);
149 fprintf(stderr,
"Unknown option character '\\x%x'.\n", optopt);
172 fprintf(stderr,
"set serial device didn't succeed\n");
181 fprintf(stderr,
"set serial ip didn't succeed\n");
192 int main(
int argc,
char *argv[]) {
220 params.
output_handle = open(params.
output,O_WRONLY|O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
224 fprintf(stderr,
"Failed to open %s for writing.\n",params.
output);
245 static int last_print_time;
246 if(last_print_time >= time(
NULL) &&
252 printf(
"\033[2J\033[1;1H");
253 printf(
"Statistics:\n");
258 printf(
" Throughput (msgs/sec)/(B/sec) : %ld/%ld\n",
264 printf(
"All messages received succesfully!\n");
270 last_print_time = time(
NULL);
284 if(apid[0] !=
'M' || apid[1] !=
'T')
287 params->messages_left--;
295 char *buf = malloc(buflen);
298 printf(
"Out of memory\n");
301 memset(buf, 0, buflen);
319 if (params->output_handle > 0)
326 stats.
output_bytes += writev(params->output_handle, iov, 2);
328 if(params->messages_left < 1)
void print_stats(s_statistics stats, s_parameters params)
void dlt_set_id(char *id, const char *text)
void dlt_client_register_message_callback(int(*registerd_callback)(DltMessage *message, void *data))
DltReturnValue dlt_client_main_loop(DltClient *client, void *data, int verbose)
int dlt_client_set_server_ip(DltClient *client, char *ipaddr)
DltReturnValue dlt_client_setbaudrate(DltClient *client, int baudrate)
DltExtendedHeader * extendedheader
int dlt_client_set_serial_device(DltClient *client, char *serial_device)
int broken_messages_received
static char data[kDataSize]
DltReturnValue dlt_client_init(DltClient *client, int verbose)
DltReturnValue dlt_client_cleanup(DltClient *client, int verbose)
DltReturnValue dlt_client_connect(DltClient *client, int verbose)
int init_dlt_connect(DltClient *client, const s_parameters *params, int argc, char *argv[])
uint8_t headerbuffer[sizeof(DltStorageHeader)+sizeof(DltStandardHeader)+sizeof(DltStandardHeaderExtra)+sizeof(DltExtendedHeader)]
int receive(DltMessage *msg, void *data)
void init_params(s_parameters *params)
int main(int argc, char *argv[])
DltReturnValue dlt_message_payload(DltMessage *msg, char *text, int textlength, int type, int verbose)
void dlt_get_version(char *buf, size_t size)
int read_params(s_parameters *params, int argc, char *argv[])