81 #define DLT_TESTCLIENT_TEXTBUFSIZE 10024 82 #define DLT_TESTCLIENT_ECU_ID "ECU1" 84 #define DLT_TESTCLIENT_NUM_TESTS 7 138 printf(
"Usage: dlt-test-stress-client [options] hostname/serial_device_name\n");
139 printf(
"Test against received data from dlt-test-stress-user.\n");
140 printf(
"%s \n", version);
141 printf(
"Options:\n");
142 printf(
" -a Print DLT messages; payload as ASCII\n");
143 printf(
" -x Print DLT messages; payload as hex\n");
144 printf(
" -m Print DLT messages; payload as hex and ASCII\n");
145 printf(
" -s Print DLT messages; only headers\n");
146 printf(
" -v Verbose mode\n");
147 printf(
" -h Usage\n");
148 printf(
" -y Serial device mode\n");
149 printf(
" -b baudrate Serial device baudrate (Default: 115200)\n");
150 printf(
" -e ecuid Set ECU ID (Default: ECU1)\n");
151 printf(
" -o filename Output messages in new DLT file\n");
152 printf(
" -f filename Enable filtering of messages\n");
153 printf(
" -n messages Number of messages to be received per test(Default: 10000)\n");
159 int main(
int argc,
char* argv[])
204 while ((c = getopt (argc, argv,
"vashyxmf:o:e:b:n:")) != -1)
260 dltdata.
bvalue = atoi(optarg);
265 dltdata.
nvalue = atoi(optarg);
270 if (optopt ==
'o' || optopt ==
'f' || optopt ==
't')
272 fprintf (stderr,
"Option -%c requires an argument.\n", optopt);
274 else if (isprint (optopt))
276 fprintf (stderr,
"Unknown option `-%c'.\n", optopt);
280 fprintf (stderr,
"Unknown option character `\\x%x'.\n",optopt);
303 if (dltclient.
mode==0)
305 for (index = optind; index < argc; index++)
309 fprintf(stderr,
"set server ip didn't succeed\n");
314 if (dltclient.
servIP == 0)
317 fprintf(stderr,
"ERROR: No hostname selected\n");
325 for (index = optind; index < argc; index++)
329 fprintf(stderr,
"set serial device didn't succeed\n");
337 fprintf(stderr,
"ERROR: No serial device name specified\n");
365 dltdata.
ohandle = open(dltdata.
ovalue,O_WRONLY|O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
370 fprintf(stderr,
"ERROR: Output file %s cannot be opened!\n",dltdata.
ovalue);
414 uint32_t type_info, type_info_tmp;
415 int16_t length,length_tmp;
419 uint32_t value_tmp = 0;
424 if ((message==0) || (data==0))
501 if(value < dltdata->last_value)
534 if ((length>=0) && (length==datalength))
553 else if (dltdata->
mflag)
557 else if (dltdata->
sflag)
570 bytes_written = writev(dltdata->
ohandle, iov, 2);
571 if (0 > bytes_written){
572 printf(
"dlt_testclient_message_callback, error when: writev(dltdata->ohandle, iov, 2) \n");
#define DLT_ENDIAN_GET_32(htyp, x)
DltReturnValue dlt_message_print_header(DltMessage *message, char *text, uint32_t size, int verbose)
#define DLT_TYPE_INFO_SINT
DltStorageHeader * storageheader
#define DLT_TESTCLIENT_TEXTBUFSIZE
void dlt_set_id(char *id, const char *text)
void dlt_client_register_message_callback(int(*registerd_callback)(DltMessage *message, void *data))
DltReturnValue dlt_file_set_filter(DltFile *file, DltFilter *filter, int verbose)
DltReturnValue dlt_client_main_loop(DltClient *client, void *data, int verbose)
int test_counter_macro[DLT_TESTCLIENT_NUM_TESTS]
int dlt_client_set_server_ip(DltClient *client, char *ipaddr)
int dlt_testclient_message_callback(DltMessage *message, void *data)
DltReturnValue dlt_message_filter_check(DltMessage *msg, DltFilter *filter, int verbose)
unsigned long time_elapsed
#define DLT_MSG_READ_VALUE(dst, src, length, type)
#define DLT_GET_MSIN_MSTP(msin)
DltReturnValue dlt_client_setbaudrate(DltClient *client, int baudrate)
DltReturnValue dlt_filter_init(DltFilter *filter, int verbose)
int count_received_messages
DltExtendedHeader * extendedheader
#define DLT_TESTCLIENT_ECU_ID
int dlt_client_set_serial_device(DltClient *client, char *serial_device)
#define DLT_IS_MSIN_VERB(msin)
#define DLT_ENDIAN_GET_16(htyp, x)
#define DLT_TESTCLIENT_NUM_TESTS
static char data[kDataSize]
DltReturnValue dlt_set_storageheader(DltStorageHeader *storageheader, const char *ecu)
#define DLT_IS_HTYP_UEH(htyp)
DltReturnValue dlt_client_init(DltClient *client, int verbose)
int count_not_received_messages
DltReturnValue dlt_filter_free(DltFilter *filter, int verbose)
DltReturnValue dlt_client_cleanup(DltClient *client, int verbose)
uint32_t dlt_uptime(void)
DltReturnValue dlt_client_connect(DltClient *client, int verbose)
DltReturnValue dlt_filter_load(DltFilter *filter, const char *filename, int verbose)
int test_counter_function[DLT_TESTCLIENT_NUM_TESTS]
uint8_t headerbuffer[sizeof(DltStorageHeader)+sizeof(DltStandardHeader)+sizeof(DltStandardHeaderExtra)+sizeof(DltExtendedHeader)]
#define DLT_IS_HTYP_WEID(htyp)
DltStandardHeaderExtra headerextra
DltReturnValue dlt_file_init(DltFile *file, int verbose)
DltReturnValue dlt_file_free(DltFile *file, int verbose)
DltStandardHeader * standardheader
#define DLT_TYPE_INFO_RAWD
void dlt_get_version(char *buf, size_t size)
DltReturnValue dlt_message_print_hex(DltMessage *message, char *text, uint32_t size, int verbose)
unsigned long bytes_received
int main(int argc, char *argv[])
DltReturnValue dlt_message_print_mixed_plain(DltMessage *message, char *text, uint32_t size, int verbose)