diff options
Diffstat (limited to 'src/tests/dlt-test-user.c')
-rw-r--r-- | src/tests/dlt-test-user.c | 845 |
1 files changed, 397 insertions, 448 deletions
diff --git a/src/tests/dlt-test-user.c b/src/tests/dlt-test-user.c index 9a57573..5e0fe47 100644 --- a/src/tests/dlt-test-user.c +++ b/src/tests/dlt-test-user.c @@ -64,8 +64,8 @@ * $LastChangedRevision: 1670 $ * $LastChangedDate: 2011-04-08 15:12:06 +0200 (Fr, 08. Apr 2011) $ * $LastChangedBy$ - Initials Date Comment - aw 13.01.2010 initial + * Initials Date Comment + * aw 13.01.2010 initial */ #include <stdio.h> /* for printf() and fprintf() */ @@ -79,15 +79,14 @@ #define DLT_TEST_NUM_CONTEXT 9 /* LogLevel string representation */ -static const char *loglevelstr[DLT_LOG_MAX] = -{ - "DLT_LOG_OFF", - "DLT_LOG_FATAL", - "DLT_LOG_ERROR", - "DLT_LOG_WARN", - "DLT_LOG_INFO", - "DLT_LOG_DEBUG", - "DLT_LOG_VERBOSE" +static const char *loglevelstr[DLT_LOG_MAX] = { + "DLT_LOG_OFF", + "DLT_LOG_FATAL", + "DLT_LOG_ERROR", + "DLT_LOG_WARN", + "DLT_LOG_INFO", + "DLT_LOG_DEBUG", + "DLT_LOG_VERBOSE" }; /* Test functions... */ @@ -138,7 +137,7 @@ void usage() { char version[255]; - dlt_get_version(version,255); + dlt_get_version(version, 255); printf("Usage: dlt-test-user [options]\n"); printf("Test user application providing several Tests.\n"); @@ -171,9 +170,9 @@ void usage() /** * Main function of tool. */ -int main(int argc, char* argv[]) +int main(int argc, char *argv[]) { - //int vflag = 0; + /*int vflag = 0; */ char *fvalue = 0; char *nvalue = 0; @@ -182,17 +181,15 @@ int main(int argc, char* argv[]) int i; char ctid[4], ctdesc[255]; - int num,maxnum; + int num, maxnum; opterr = 0; while ((c = getopt (argc, argv, "vf:n:")) != -1) - { - switch (c) - { + switch (c) { case 'v': { - //vflag = 1; + /*vflag = 1; */ break; } case 'f': @@ -207,18 +204,13 @@ int main(int argc, char* argv[]) } case '?': { - if (optopt == 'd' || optopt == 'f' || optopt == 'n') - { + if ((optopt == 'd') || (optopt == 'f') || (optopt == 'n')) fprintf (stderr, "Option -%c requires an argument.\n", optopt); - } else if (isprint (optopt)) - { fprintf (stderr, "Unknown option `-%c'.\n", optopt); - } else - { - fprintf (stderr, "Unknown option character `\\x%x'.\n",optopt); - } + fprintf (stderr, "Unknown option character `\\x%x'.\n", optopt); + /* unknown or wrong option used, show usage information and terminate */ usage(); return -1; @@ -226,76 +218,70 @@ int main(int argc, char* argv[]) default: { abort (); - return -1;//for parasoft + return -1;/*for parasoft */ } } - } - if (fvalue) - { + + + if (fvalue) { /* DLT is intialised automatically, except another output target will be used */ - if (dlt_init_file(fvalue)<0) /* log to file */ - { + if (dlt_init_file(fvalue) < 0) /* log to file */ return -1; - } } if (nvalue) - { maxnum = atoi(nvalue); - } else - { maxnum = 1; - } /* Register APP */ - DLT_REGISTER_APP("DIFT","DLT Interface Test"); + DLT_REGISTER_APP("DIFT", "DLT Interface Test"); /* Register CONTEXTS... */ - DLT_REGISTER_CONTEXT(context_info,"INFO","Information context"); + DLT_REGISTER_CONTEXT(context_info, "INFO", "Information context"); /* used for macro interface tests */ - DLT_REGISTER_CONTEXT(context_macro_callback,"CBM","Callback Test context for macro interface"); - for (i=0;i<DLT_TEST_NUM_CONTEXT;i++) - { - snprintf(ctid,4,"TM%d",i+1); - snprintf(ctdesc,255,"Test %d context for macro interface",i+1); - DLT_REGISTER_CONTEXT(context_macro_test[i],ctid,ctdesc); + DLT_REGISTER_CONTEXT(context_macro_callback, "CBM", "Callback Test context for macro interface"); + + for (i = 0; i < DLT_TEST_NUM_CONTEXT; i++) { + snprintf(ctid, 4, "TM%d", i + 1); + snprintf(ctdesc, 255, "Test %d context for macro interface", i + 1); + DLT_REGISTER_CONTEXT(context_macro_test[i], ctid, ctdesc); } /* used for function interface tests */ - dlt_register_context(&context_function_callback,"CBF","Callback Test context for function interface"); - for (i=0;i<DLT_TEST_NUM_CONTEXT;i++) - { - snprintf(ctid,4,"TF%d",i+1); - snprintf(ctdesc,255,"Test %d context for function interface",i+1); - dlt_register_context(&(context_function_test[i]),ctid,ctdesc); + dlt_register_context(&context_function_callback, "CBF", "Callback Test context for function interface"); + + for (i = 0; i < DLT_TEST_NUM_CONTEXT; i++) { + snprintf(ctid, 4, "TF%d", i + 1); + snprintf(ctdesc, 255, "Test %d context for function interface", i + 1); + dlt_register_context(&(context_function_test[i]), ctid, ctdesc); } /* Register callbacks... */ /* with macro interface */ - DLT_LOG(context_macro_callback,DLT_LOG_INFO,DLT_STRING("Register callback (Macro Interface) for Injection ID: 0xFFF")); + DLT_LOG(context_macro_callback, DLT_LOG_INFO, + DLT_STRING("Register callback (Macro Interface) for Injection ID: 0xFFF")); DLT_REGISTER_INJECTION_CALLBACK(context_macro_callback, 0xFFF, test_injection_macro_callback); /* with function interface */ - if (dlt_user_log_write_start(&context_function_callback,&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"Register callback (Function Interface) for Injection ID: 0xFFF"); + if (dlt_user_log_write_start(&context_function_callback, &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "Register callback (Function Interface) for Injection ID: 0xFFF"); dlt_user_log_write_finish(&context_data); } + dlt_register_injection_callback(&context_function_callback, 0xFFF, test_injection_function_callback); /* Tests starting */ printf("Tests starting\n"); - DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Tests starting")); + DLT_LOG(context_info, DLT_LOG_INFO, DLT_STRING("Tests starting")); /* wait 3 seconds before starting */ sleep(3); - for (num=0;num<maxnum;num++) - { + for (num = 0; num < maxnum; num++) { /* Execute tests... */ /* with macro interface */ @@ -326,7 +312,7 @@ int main(int argc, char* argv[]) /* Tests finished */ printf("Tests finished\n"); - DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Tests finished")); + DLT_LOG(context_info, DLT_LOG_INFO, DLT_STRING("Tests finished")); /* wait 3 seconds before terminating application */ sleep(3); @@ -335,17 +321,15 @@ int main(int argc, char* argv[]) DLT_UNREGISTER_CONTEXT(context_info); /* used for macro interface tests */ - for (i=0;i<DLT_TEST_NUM_CONTEXT;i++) - { + for (i = 0; i < DLT_TEST_NUM_CONTEXT; i++) DLT_UNREGISTER_CONTEXT(context_macro_test[i]); - } + DLT_UNREGISTER_CONTEXT(context_macro_callback); /* used for function interface tests */ - for (i=0;i<DLT_TEST_NUM_CONTEXT;i++) - { + for (i = 0; i < DLT_TEST_NUM_CONTEXT; i++) dlt_unregister_context(&(context_function_test[i])); - } + dlt_unregister_context(&context_function_callback); /* Unregister APP */ @@ -362,18 +346,18 @@ int test1m(void) { /* Test 1: (Macro IF) Test all log levels */ printf("Test1m: (Macro IF) Test all log levels\n"); - DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test1: (Macro IF) Test all log levels")); + DLT_LOG(context_info, DLT_LOG_INFO, DLT_STRING("Test1: (Macro IF) Test all log levels")); - DLT_LOG(context_macro_test[0],DLT_LOG_FATAL,DLT_STRING("fatal")); - DLT_LOG(context_macro_test[0],DLT_LOG_ERROR,DLT_STRING("error")); - DLT_LOG(context_macro_test[0],DLT_LOG_WARN,DLT_STRING("warn")); - DLT_LOG(context_macro_test[0],DLT_LOG_INFO,DLT_STRING("info")); - DLT_LOG(context_macro_test[0],DLT_LOG_DEBUG,DLT_STRING("debug")); - DLT_LOG(context_macro_test[0],DLT_LOG_VERBOSE,DLT_STRING("verbose")); + DLT_LOG(context_macro_test[0], DLT_LOG_FATAL, DLT_STRING("fatal")); + DLT_LOG(context_macro_test[0], DLT_LOG_ERROR, DLT_STRING("error")); + DLT_LOG(context_macro_test[0], DLT_LOG_WARN, DLT_STRING("warn")); + DLT_LOG(context_macro_test[0], DLT_LOG_INFO, DLT_STRING("info")); + DLT_LOG(context_macro_test[0], DLT_LOG_DEBUG, DLT_STRING("debug")); + DLT_LOG(context_macro_test[0], DLT_LOG_VERBOSE, DLT_STRING("verbose")); /* wait 2 second before next test */ sleep(2); - DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test1: (Macro IF) finished")); + DLT_LOG(context_info, DLT_LOG_INFO, DLT_STRING("Test1: (Macro IF) finished")); return 0; } @@ -385,34 +369,32 @@ int test2m(void) /* Test 2: (Macro IF) Test all variable types (verbose) */ printf("Test2m: (Macro IF) Test all variable types (verbose)\n"); - DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test2: (Macro IF) Test all variable types (verbose)")); - - DLT_LOG(context_macro_test[1],DLT_LOG_INFO,DLT_STRING("string"),DLT_STRING("Hello world")); - DLT_LOG(context_macro_test[1],DLT_LOG_INFO,DLT_STRING("utf8"),DLT_UTF8("Hello world")); - DLT_LOG(context_macro_test[1],DLT_LOG_INFO,DLT_STRING("bool"),DLT_BOOL(1)); - DLT_LOG(context_macro_test[1],DLT_LOG_INFO,DLT_STRING("int"),DLT_INT(INT32_MIN)); /* (-2147483647-1) */ - DLT_LOG(context_macro_test[1],DLT_LOG_INFO,DLT_STRING("int8"),DLT_INT8(INT8_MIN)); /* (-128) */ - DLT_LOG(context_macro_test[1],DLT_LOG_INFO,DLT_STRING("int16"),DLT_INT16(INT16_MIN)); /* (-32767-1) */ - DLT_LOG(context_macro_test[1],DLT_LOG_INFO,DLT_STRING("int32"),DLT_INT32(INT32_MIN)); /* (-2147483647-1) */ - DLT_LOG(context_macro_test[1],DLT_LOG_INFO,DLT_STRING("int64"),DLT_INT64(INT64_MIN)); /* (-__INT64_C(9223372036854775807)-1) */ - DLT_LOG(context_macro_test[1],DLT_LOG_INFO,DLT_STRING("uint"),DLT_UINT(UINT32_MAX)); /* (4294967295U) */ - DLT_LOG(context_macro_test[1],DLT_LOG_INFO,DLT_STRING("uint8"),DLT_UINT8(UINT8_MAX)); /* (255) */ - DLT_LOG(context_macro_test[1],DLT_LOG_INFO,DLT_STRING("uint16"),DLT_UINT16(UINT16_MAX)); /* (65535) */ - DLT_LOG(context_macro_test[1],DLT_LOG_INFO,DLT_STRING("uint32"),DLT_UINT32(UINT32_MAX)); /* (4294967295U) */ - DLT_LOG(context_macro_test[1],DLT_LOG_INFO,DLT_STRING("uint64"),DLT_UINT64(UINT64_MAX)); /* (__UINT64_C(18446744073709551615)) */ - DLT_LOG(context_macro_test[1],DLT_LOG_INFO,DLT_STRING("float32"),DLT_FLOAT32(FLT_MIN),DLT_FLOAT32(FLT_MAX)); - DLT_LOG(context_macro_test[1],DLT_LOG_INFO,DLT_STRING("float64"),DLT_FLOAT64(DBL_MIN),DLT_FLOAT64(DBL_MAX)); - - for(num2=0;num2<10;num2++) - { + DLT_LOG(context_info, DLT_LOG_INFO, DLT_STRING("Test2: (Macro IF) Test all variable types (verbose)")); + + DLT_LOG(context_macro_test[1], DLT_LOG_INFO, DLT_STRING("string"), DLT_STRING("Hello world")); + DLT_LOG(context_macro_test[1], DLT_LOG_INFO, DLT_STRING("utf8"), DLT_UTF8("Hello world")); + DLT_LOG(context_macro_test[1], DLT_LOG_INFO, DLT_STRING("bool"), DLT_BOOL(1)); + DLT_LOG(context_macro_test[1], DLT_LOG_INFO, DLT_STRING("int"), DLT_INT(INT32_MIN)); /* (-2147483647-1) */ + DLT_LOG(context_macro_test[1], DLT_LOG_INFO, DLT_STRING("int8"), DLT_INT8(INT8_MIN)); /* (-128) */ + DLT_LOG(context_macro_test[1], DLT_LOG_INFO, DLT_STRING("int16"), DLT_INT16(INT16_MIN)); /* (-32767-1) */ + DLT_LOG(context_macro_test[1], DLT_LOG_INFO, DLT_STRING("int32"), DLT_INT32(INT32_MIN)); /* (-2147483647-1) */ + DLT_LOG(context_macro_test[1], DLT_LOG_INFO, DLT_STRING("int64"), DLT_INT64(INT64_MIN)); /* (-__INT64_C(9223372036854775807)-1) */ + DLT_LOG(context_macro_test[1], DLT_LOG_INFO, DLT_STRING("uint"), DLT_UINT(UINT32_MAX)); /* (4294967295U) */ + DLT_LOG(context_macro_test[1], DLT_LOG_INFO, DLT_STRING("uint8"), DLT_UINT8(UINT8_MAX)); /* (255) */ + DLT_LOG(context_macro_test[1], DLT_LOG_INFO, DLT_STRING("uint16"), DLT_UINT16(UINT16_MAX)); /* (65535) */ + DLT_LOG(context_macro_test[1], DLT_LOG_INFO, DLT_STRING("uint32"), DLT_UINT32(UINT32_MAX)); /* (4294967295U) */ + DLT_LOG(context_macro_test[1], DLT_LOG_INFO, DLT_STRING("uint64"), DLT_UINT64(UINT64_MAX)); /* (__UINT64_C(18446744073709551615)) */ + DLT_LOG(context_macro_test[1], DLT_LOG_INFO, DLT_STRING("float32"), DLT_FLOAT32(FLT_MIN), DLT_FLOAT32(FLT_MAX)); + DLT_LOG(context_macro_test[1], DLT_LOG_INFO, DLT_STRING("float64"), DLT_FLOAT64(DBL_MIN), DLT_FLOAT64(DBL_MAX)); + + for (num2 = 0; num2 < 10; num2++) buffer[num2] = num2; - } - DLT_LOG(context_macro_test[1],DLT_LOG_INFO,DLT_STRING("raw"),DLT_RAW(buffer,10)); + DLT_LOG(context_macro_test[1], DLT_LOG_INFO, DLT_STRING("raw"), DLT_RAW(buffer, 10)); /* wait 2 second before next test */ sleep(2); - DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test2: (Macro IF) finished")); + DLT_LOG(context_info, DLT_LOG_INFO, DLT_STRING("Test2: (Macro IF) finished")); return 0; } @@ -424,38 +406,46 @@ int test3m(void) /* Test 3: (Macro IF) Test all variable types (non-verbose) */ printf("Test3m: (Macro IF) Test all variable types (non-verbose)\n"); - DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test3: (Macro IF) Test all variable types (non-verbose)")); + DLT_LOG(context_info, DLT_LOG_INFO, DLT_STRING("Test3: (Macro IF) Test all variable types (non-verbose)")); DLT_NONVERBOSE_MODE(); - DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,1,DLT_STRING("string"),DLT_STRING("Hello world")); - DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,2,DLT_STRING("utf8"),DLT_UTF8("Hello world")); - DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,3,DLT_STRING("bool"),DLT_BOOL(1)); - DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,4,DLT_STRING("int"),DLT_INT(INT32_MIN)); /* (-2147483647-1) */ - DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,5,DLT_STRING("int8"),DLT_INT8(INT8_MIN)); /* (-128) */ - DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,6,DLT_STRING("int16"),DLT_INT16(INT16_MIN)); /* (-32767-1) */ - DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,7,DLT_STRING("int32"),DLT_INT32(INT32_MIN)); /* (-2147483647-1) */ - DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,8,DLT_STRING("int64"),DLT_INT64(INT64_MIN)); /* (-__INT64_C(9223372036854775807)-1) */ - DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,9,DLT_STRING("uint"),DLT_UINT(UINT32_MAX)); /* (4294967295U) */ - DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,10,DLT_STRING("uint8"),DLT_UINT8(UINT8_MAX)); /* (255) */ - DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,11,DLT_STRING("uint16"),DLT_UINT16(UINT16_MAX)); /* (65535) */ - DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,12,DLT_STRING("uint32"),DLT_UINT32(UINT32_MAX)); /* (4294967295U) */ - DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,13,DLT_STRING("uint64"),DLT_UINT64(UINT64_MAX)); /* (__UINT64_C(18446744073709551615)) */ - DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,14,DLT_STRING("float32"),DLT_FLOAT32(FLT_MIN),DLT_FLOAT32(FLT_MAX)); - DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,15,DLT_STRING("float64"),DLT_FLOAT64(DBL_MIN),DLT_FLOAT64(DBL_MAX)); - - - for(num2=0;num2<10;num2++) - { + DLT_LOG_ID(context_macro_test[2], DLT_LOG_INFO, 1, DLT_STRING("string"), DLT_STRING("Hello world")); + DLT_LOG_ID(context_macro_test[2], DLT_LOG_INFO, 2, DLT_STRING("utf8"), DLT_UTF8("Hello world")); + DLT_LOG_ID(context_macro_test[2], DLT_LOG_INFO, 3, DLT_STRING("bool"), DLT_BOOL(1)); + DLT_LOG_ID(context_macro_test[2], DLT_LOG_INFO, 4, DLT_STRING("int"), DLT_INT(INT32_MIN)); /* (-2147483647-1) */ + DLT_LOG_ID(context_macro_test[2], DLT_LOG_INFO, 5, DLT_STRING("int8"), DLT_INT8(INT8_MIN)); /* (-128) */ + DLT_LOG_ID(context_macro_test[2], DLT_LOG_INFO, 6, DLT_STRING("int16"), DLT_INT16(INT16_MIN)); /* (-32767-1) */ + DLT_LOG_ID(context_macro_test[2], DLT_LOG_INFO, 7, DLT_STRING("int32"), DLT_INT32(INT32_MIN)); /* (-2147483647-1) */ + DLT_LOG_ID(context_macro_test[2], DLT_LOG_INFO, 8, DLT_STRING("int64"), DLT_INT64(INT64_MIN)); /* (-__INT64_C(9223372036854775807)-1) */ + DLT_LOG_ID(context_macro_test[2], DLT_LOG_INFO, 9, DLT_STRING("uint"), DLT_UINT(UINT32_MAX)); /* (4294967295U) */ + DLT_LOG_ID(context_macro_test[2], DLT_LOG_INFO, 10, DLT_STRING("uint8"), DLT_UINT8(UINT8_MAX)); /* (255) */ + DLT_LOG_ID(context_macro_test[2], DLT_LOG_INFO, 11, DLT_STRING("uint16"), DLT_UINT16(UINT16_MAX)); /* (65535) */ + DLT_LOG_ID(context_macro_test[2], DLT_LOG_INFO, 12, DLT_STRING("uint32"), DLT_UINT32(UINT32_MAX)); /* (4294967295U) */ + DLT_LOG_ID(context_macro_test[2], DLT_LOG_INFO, 13, DLT_STRING("uint64"), DLT_UINT64(UINT64_MAX)); /* (__UINT64_C(18446744073709551615)) */ + DLT_LOG_ID(context_macro_test[2], + DLT_LOG_INFO, + 14, + DLT_STRING("float32"), + DLT_FLOAT32(FLT_MIN), + DLT_FLOAT32(FLT_MAX)); + DLT_LOG_ID(context_macro_test[2], + DLT_LOG_INFO, + 15, + DLT_STRING("float64"), + DLT_FLOAT64(DBL_MIN), + DLT_FLOAT64(DBL_MAX)); + + for (num2 = 0; num2 < 10; num2++) buffer[num2] = num2; - } - DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,14,DLT_STRING("raw"),DLT_RAW(buffer,10)); + + DLT_LOG_ID(context_macro_test[2], DLT_LOG_INFO, 14, DLT_STRING("raw"), DLT_RAW(buffer, 10)); DLT_VERBOSE_MODE(); /* wait 2 second before next test */ sleep(2); - DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test3: (Macro IF) finished")); + DLT_LOG(context_info, DLT_LOG_INFO, DLT_STRING("Test3: (Macro IF) finished")); return 0; } @@ -465,23 +455,21 @@ int test4m(void) char buffer[1024]; int num; - for(num=0;num<1024;num++) - { + for (num = 0; num < 1024; num++) buffer[num] = num; - } /* Test 4: (Macro IF) Message size test */ printf("Test4m: (Macro IF) Test different message sizes\n"); - DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test4: (Macro IF) Test different message sizes")); + DLT_LOG(context_info, DLT_LOG_INFO, DLT_STRING("Test4: (Macro IF) Test different message sizes")); - DLT_LOG(context_macro_test[3],DLT_LOG_INFO,DLT_STRING("1"),DLT_RAW(buffer,1)); - DLT_LOG(context_macro_test[3],DLT_LOG_INFO,DLT_STRING("16"),DLT_RAW(buffer,16)); - DLT_LOG(context_macro_test[3],DLT_LOG_INFO,DLT_STRING("256"),DLT_RAW(buffer,256)); - DLT_LOG(context_macro_test[3],DLT_LOG_INFO,DLT_STRING("1024"),DLT_RAW(buffer,1024)); + DLT_LOG(context_macro_test[3], DLT_LOG_INFO, DLT_STRING("1"), DLT_RAW(buffer, 1)); + DLT_LOG(context_macro_test[3], DLT_LOG_INFO, DLT_STRING("16"), DLT_RAW(buffer, 16)); + DLT_LOG(context_macro_test[3], DLT_LOG_INFO, DLT_STRING("256"), DLT_RAW(buffer, 256)); + DLT_LOG(context_macro_test[3], DLT_LOG_INFO, DLT_STRING("1024"), DLT_RAW(buffer, 1024)); /* wait 2 second before next test */ sleep(2); - DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test4: (Macro IF) finished")); + DLT_LOG(context_info, DLT_LOG_INFO, DLT_STRING("Test4: (Macro IF) finished")); return 0; } @@ -494,58 +482,52 @@ int test5m(void) void *ptr = malloc(sizeof(int)); - for(num=0;num<32;num++) - { + for (num = 0; num < 32; num++) buffer[num] = num; - } /* Test 5: (Macro IF) Test high-level API */ printf("Test5m: (Macro IF) Test high-level API\n"); - DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test5: (Macro IF) Test high-level API")); + DLT_LOG(context_info, DLT_LOG_INFO, DLT_STRING("Test5: (Macro IF) Test high-level API")); - DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_INT")); + DLT_LOG(context_macro_test[4], DLT_LOG_INFO, DLT_STRING("Next line: DLT_LOG_INT")); DLT_LOG_INT(context_macro_test[4], DLT_LOG_INFO, -42); - DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_UINT")); + DLT_LOG(context_macro_test[4], DLT_LOG_INFO, DLT_STRING("Next line: DLT_LOG_UINT")); DLT_LOG_UINT(context_macro_test[4], DLT_LOG_INFO, 42); - DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_STRING")); + DLT_LOG(context_macro_test[4], DLT_LOG_INFO, DLT_STRING("Next line: DLT_LOG_STRING")); DLT_LOG_STRING(context_macro_test[4], DLT_LOG_INFO, "String output"); - DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_RAW")); - DLT_LOG_RAW(context_macro_test[4],DLT_LOG_INFO, buffer,16); + DLT_LOG(context_macro_test[4], DLT_LOG_INFO, DLT_STRING("Next line: DLT_LOG_RAW")); + DLT_LOG_RAW(context_macro_test[4], DLT_LOG_INFO, buffer, 16); - DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_STRING_INT")); + DLT_LOG(context_macro_test[4], DLT_LOG_INFO, DLT_STRING("Next line: DLT_LOG_STRING_INT")); DLT_LOG_STRING_INT(context_macro_test[4], DLT_LOG_INFO, "String output: ", -42); - DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_STRING_UINT")); - DLT_LOG_STRING_UINT(context_macro_test[4], DLT_LOG_INFO,"String output: ", 42); + DLT_LOG(context_macro_test[4], DLT_LOG_INFO, DLT_STRING("Next line: DLT_LOG_STRING_UINT")); + DLT_LOG_STRING_UINT(context_macro_test[4], DLT_LOG_INFO, "String output: ", 42); - DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_PTR")); - DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_PTR(ptr)); + DLT_LOG(context_macro_test[4], DLT_LOG_INFO, DLT_STRING("Next line: DLT_LOG_PTR")); + DLT_LOG(context_macro_test[4], DLT_LOG_INFO, DLT_PTR(ptr)); - DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next lines: DLT_IS_LOG_LEVEL_ENABLED")); - for (i = DLT_LOG_FATAL; i < DLT_LOG_MAX; i++) - { - if (DLT_IS_LOG_LEVEL_ENABLED(context_macro_test[4],i)) - { + DLT_LOG(context_macro_test[4], DLT_LOG_INFO, DLT_STRING("Next lines: DLT_IS_LOG_LEVEL_ENABLED")); + + for (i = DLT_LOG_FATAL; i < DLT_LOG_MAX; i++) { + if (DLT_IS_LOG_LEVEL_ENABLED(context_macro_test[4], i)) DLT_LOG(context_info, DLT_LOG_INFO, DLT_STRING("Loglevel is enabled: "), DLT_STRING(loglevelstr[i])); - } else - { DLT_LOG(context_info, DLT_LOG_INFO, DLT_STRING("Loglevel is disabled: "), DLT_STRING(loglevelstr[i])); - } } /* wait 2 second before next test */ sleep(2); - DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test5: (Macro IF) finished")); + DLT_LOG(context_info, DLT_LOG_INFO, DLT_STRING("Test5: (Macro IF) finished")); free(ptr); return 0; @@ -563,9 +545,9 @@ int test6m(void) DLT_DISABLE_LOCAL_PRINT(); DLT_LOG_STRING(context_macro_test[5], DLT_LOG_INFO, "Message (invisible: not locally printed)"); - /* wait 2 second before next test */ + /* wait 2 second before next test */ sleep(2); - DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test6: (Macro IF) finished")); + DLT_LOG(context_info, DLT_LOG_INFO, DLT_STRING("Test6: (Macro IF) finished")); return 0; } @@ -575,10 +557,8 @@ int test7m(void) char buffer[32]; int num; - for(num=0;num<32;num++) - { + for (num = 0; num < 32; num++) buffer[num] = num; - } /* Show all log messages and traces */ DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON); @@ -595,7 +575,7 @@ int test7m(void) /* wait 2 second before next test */ sleep(2); - DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test7: (Macro IF) finished")); + DLT_LOG(context_info, DLT_LOG_INFO, DLT_STRING("Test7: (Macro IF) finished")); DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT); sleep(2); @@ -605,13 +585,11 @@ int test7m(void) int test8m(void) { - char buffer[1024*5]; + char buffer[1024 * 5]; int num; - for(num=0;num<1024*5;num++) - { + for (num = 0; num < 1024 * 5; num++) buffer[num] = num; - } /* Show all log messages and traces */ DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON); @@ -621,14 +599,14 @@ int test8m(void) DLT_LOG_STRING(context_info, DLT_LOG_INFO, "Test 8: (Macro IF) Test truncated network trace"); /* Dummy messages: 16 byte header, 5k payload */ - DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer); - DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer); - DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer); - DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer); + DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_IPC, 16, buffer, 1024 * 5, buffer); + DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_CAN, 16, buffer, 1024 * 5, buffer); + DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024 * 5, buffer); + DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_MOST, 16, buffer, 1024 * 5, buffer); /* wait 2 second before next test */ sleep(2); - DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test8: (Macro IF) finished")); + DLT_LOG(context_info, DLT_LOG_INFO, DLT_STRING("Test8: (Macro IF) finished")); DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT); sleep(2); @@ -638,13 +616,11 @@ int test8m(void) int test9m(void) { - char buffer[1024*5]; + char buffer[1024 * 5]; int num; - for(num=0;num<1024*5;num++) - { + for (num = 0; num < 1024 * 5; num++) buffer[num] = num; - } /* Show all log messages and traces */ DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON); @@ -654,14 +630,14 @@ int test9m(void) DLT_LOG_STRING(context_info, DLT_LOG_INFO, "Test 9: (Macro IF) Test segmented network trace"); /* Dummy messages: 16 byte header, 5k payload */ - DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer); - DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer); - DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer); - DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer); + DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_IPC, 16, buffer, 1024 * 5, buffer); + DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_CAN, 16, buffer, 1024 * 5, buffer); + DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024 * 5, buffer); + DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_MOST, 16, buffer, 1024 * 5, buffer); /* wait 2 second before next test */ sleep(2); - DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test9: (Macro IF) finished")); + DLT_LOG(context_info, DLT_LOG_INFO, DLT_STRING("Test9: (Macro IF) finished")); DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT); sleep(2); @@ -673,48 +649,47 @@ int test1f(void) { /* Test 1: (Function IF) Test all log levels */ printf("Test1f: (Function IF) Test all log levels\n"); - if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"Test1: (Function IF) Test all log levels"); + + if (dlt_user_log_write_start(&context_info, &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "Test1: (Function IF) Test all log levels"); dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_FATAL)>0) - { - dlt_user_log_write_string(&context_data,"fatal"); + if (dlt_user_log_write_start(&(context_function_test[0]), &context_data, DLT_LOG_FATAL) > 0) { + dlt_user_log_write_string(&context_data, "fatal"); dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_ERROR)>0) - { - dlt_user_log_write_string(&context_data,"error"); + + if (dlt_user_log_write_start(&(context_function_test[0]), &context_data, DLT_LOG_ERROR) > 0) { + dlt_user_log_write_string(&context_data, "error"); dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_WARN)>0) - { - dlt_user_log_write_string(&context_data,"warn"); + + if (dlt_user_log_write_start(&(context_function_test[0]), &context_data, DLT_LOG_WARN) > 0) { + dlt_user_log_write_string(&context_data, "warn"); dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"info"); + + if (dlt_user_log_write_start(&(context_function_test[0]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "info"); dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_DEBUG)>0) - { - dlt_user_log_write_string(&context_data,"debug"); + + if (dlt_user_log_write_start(&(context_function_test[0]), &context_data, DLT_LOG_DEBUG) > 0) { + dlt_user_log_write_string(&context_data, "debug"); dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_VERBOSE)>0) - { - dlt_user_log_write_string(&context_data,"verbose"); + + if (dlt_user_log_write_start(&(context_function_test[0]), &context_data, DLT_LOG_VERBOSE) > 0) { + dlt_user_log_write_string(&context_data, "verbose"); dlt_user_log_write_finish(&context_data); } /* wait 2 second before next test */ sleep(2); - if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"Test1: (Function IF) finished"); + + if (dlt_user_log_write_start(&context_info, &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "Test1: (Function IF) finished"); dlt_user_log_write_finish(&context_data); } @@ -728,113 +703,106 @@ int test2f(void) /* Test 2: (Function IF) Test all variable types (verbose) */ printf("Test2f: (Function IF) Test all variable types (verbose)\n"); - if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"Test2: (Function IF) Test all variable types (verbose)"); + + if (dlt_user_log_write_start(&context_info, &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "Test2: (Function IF) Test all variable types (verbose)"); dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"bool"); - dlt_user_log_write_bool(&context_data,1); + if (dlt_user_log_write_start(&(context_function_test[1]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "bool"); + dlt_user_log_write_bool(&context_data, 1); dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"int"); - dlt_user_log_write_int(&context_data,INT32_MIN); /* (-2147483647-1) */ + if (dlt_user_log_write_start(&(context_function_test[1]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "int"); + dlt_user_log_write_int(&context_data, INT32_MIN); /* (-2147483647-1) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"int8"); - dlt_user_log_write_int8(&context_data,INT8_MIN); /* (-128) */ + + if (dlt_user_log_write_start(&(context_function_test[1]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "int8"); + dlt_user_log_write_int8(&context_data, INT8_MIN); /* (-128) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"int16"); - dlt_user_log_write_int16(&context_data,INT16_MIN); /* (-32767-1) */ + + if (dlt_user_log_write_start(&(context_function_test[1]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "int16"); + dlt_user_log_write_int16(&context_data, INT16_MIN); /* (-32767-1) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"int32"); - dlt_user_log_write_int32(&context_data,INT32_MIN); /* (-2147483647-1) */ + + if (dlt_user_log_write_start(&(context_function_test[1]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "int32"); + dlt_user_log_write_int32(&context_data, INT32_MIN); /* (-2147483647-1) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"int64"); - dlt_user_log_write_int64(&context_data,INT64_MIN); /* (-__INT64_C(9223372036854775807)-1) */ + + if (dlt_user_log_write_start(&(context_function_test[1]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "int64"); + dlt_user_log_write_int64(&context_data, INT64_MIN); /* (-__INT64_C(9223372036854775807)-1) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"uint"); - dlt_user_log_write_uint(&context_data,UINT32_MAX); /* (4294967295U) */ + if (dlt_user_log_write_start(&(context_function_test[1]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "uint"); + dlt_user_log_write_uint(&context_data, UINT32_MAX); /* (4294967295U) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"uint8"); - dlt_user_log_write_uint8(&context_data,UINT8_MAX); /* (255) */ + + if (dlt_user_log_write_start(&(context_function_test[1]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "uint8"); + dlt_user_log_write_uint8(&context_data, UINT8_MAX); /* (255) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"uint16"); - dlt_user_log_write_uint16(&context_data,UINT16_MAX); /* (65535) */ + + if (dlt_user_log_write_start(&(context_function_test[1]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "uint16"); + dlt_user_log_write_uint16(&context_data, UINT16_MAX); /* (65535) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"uint32"); - dlt_user_log_write_uint32(&context_data,UINT32_MAX); /* (4294967295U) */ + + if (dlt_user_log_write_start(&(context_function_test[1]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "uint32"); + dlt_user_log_write_uint32(&context_data, UINT32_MAX); /* (4294967295U) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"uint64"); - dlt_user_log_write_uint64(&context_data,UINT64_MAX); /* (__UINT64_C(18446744073709551615)) */ + + if (dlt_user_log_write_start(&(context_function_test[1]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "uint64"); + dlt_user_log_write_uint64(&context_data, UINT64_MAX); /* (__UINT64_C(18446744073709551615)) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"float32"); - dlt_user_log_write_float32(&context_data,FLT_MIN); - dlt_user_log_write_float32(&context_data,FLT_MAX); + if (dlt_user_log_write_start(&(context_function_test[1]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "float32"); + dlt_user_log_write_float32(&context_data, FLT_MIN); + dlt_user_log_write_float32(&context_data, FLT_MAX); dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"float64"); - dlt_user_log_write_float64(&context_data,DBL_MIN); - dlt_user_log_write_float64(&context_data,DBL_MAX); + + if (dlt_user_log_write_start(&(context_function_test[1]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "float64"); + dlt_user_log_write_float64(&context_data, DBL_MIN); + dlt_user_log_write_float64(&context_data, DBL_MAX); dlt_user_log_write_finish(&context_data); } - for(num2=0;num2<10;num2++) - { + for (num2 = 0; num2 < 10; num2++) buffer[num2] = num2; - } - if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"raw"); - dlt_user_log_write_raw(&context_data,buffer,10); + if (dlt_user_log_write_start(&(context_function_test[1]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "raw"); + dlt_user_log_write_raw(&context_data, buffer, 10); dlt_user_log_write_finish(&context_data); } /* wait 2 second before next test */ sleep(2); - if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"Test2: (Function IF) finished"); + + if (dlt_user_log_write_start(&context_info, &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "Test2: (Function IF) finished"); dlt_user_log_write_finish(&context_data); } @@ -848,107 +816,100 @@ int test3f(void) /* Test 3: (Function IF) Test all variable types (non-verbose) */ printf("Test3f: (Function IF) Test all variable types (non-verbose)\n"); - if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"Test3: (Function IF) Test all variable types (non-verbose)"); + + if (dlt_user_log_write_start(&context_info, &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "Test3: (Function IF) Test all variable types (non-verbose)"); dlt_user_log_write_finish(&context_data); } dlt_nonverbose_mode(); - if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,1)>0) // bug mb: we have to compare against >0. in case of error -1 is returned! - { - dlt_user_log_write_string(&context_data,"bool"); - dlt_user_log_write_bool(&context_data,1); + if (dlt_user_log_write_start_id(&(context_function_test[2]), &context_data, DLT_LOG_INFO, 1) > 0) { /* bug mb: we have to compare against >0. in case of error -1 is returned! */ + dlt_user_log_write_string(&context_data, "bool"); + dlt_user_log_write_bool(&context_data, 1); dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,2)>0) - { - dlt_user_log_write_string(&context_data,"int"); - dlt_user_log_write_int(&context_data,INT32_MIN); /* (-2147483647-1) */ + if (dlt_user_log_write_start_id(&(context_function_test[2]), &context_data, DLT_LOG_INFO, 2) > 0) { + dlt_user_log_write_string(&context_data, "int"); + dlt_user_log_write_int(&context_data, INT32_MIN); /* (-2147483647-1) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,3)>0) - { - dlt_user_log_write_string(&context_data,"int8"); - dlt_user_log_write_int8(&context_data,INT8_MIN); /* (-128) */ + + if (dlt_user_log_write_start_id(&(context_function_test[2]), &context_data, DLT_LOG_INFO, 3) > 0) { + dlt_user_log_write_string(&context_data, "int8"); + dlt_user_log_write_int8(&context_data, INT8_MIN); /* (-128) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,4)>0) - { - dlt_user_log_write_string(&context_data,"int16"); - dlt_user_log_write_int16(&context_data,INT16_MIN); /* (-32767-1) */ + + if (dlt_user_log_write_start_id(&(context_function_test[2]), &context_data, DLT_LOG_INFO, 4) > 0) { + dlt_user_log_write_string(&context_data, "int16"); + dlt_user_log_write_int16(&context_data, INT16_MIN); /* (-32767-1) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,5)>0) - { - dlt_user_log_write_string(&context_data,"int32"); - dlt_user_log_write_int32(&context_data,INT32_MIN); /* (-2147483647-1) */ + + if (dlt_user_log_write_start_id(&(context_function_test[2]), &context_data, DLT_LOG_INFO, 5) > 0) { + dlt_user_log_write_string(&context_data, "int32"); + dlt_user_log_write_int32(&context_data, INT32_MIN); /* (-2147483647-1) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,6)>0) - { - dlt_user_log_write_string(&context_data,"int64"); - dlt_user_log_write_int64(&context_data,INT64_MIN); /* (-__INT64_C(9223372036854775807)-1) */ + + if (dlt_user_log_write_start_id(&(context_function_test[2]), &context_data, DLT_LOG_INFO, 6) > 0) { + dlt_user_log_write_string(&context_data, "int64"); + dlt_user_log_write_int64(&context_data, INT64_MIN); /* (-__INT64_C(9223372036854775807)-1) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,7)>0) - { - dlt_user_log_write_string(&context_data,"uint"); - dlt_user_log_write_uint(&context_data,UINT32_MAX); /* (4294967295U) */ + if (dlt_user_log_write_start_id(&(context_function_test[2]), &context_data, DLT_LOG_INFO, 7) > 0) { + dlt_user_log_write_string(&context_data, "uint"); + dlt_user_log_write_uint(&context_data, UINT32_MAX); /* (4294967295U) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,8)>0) - { - dlt_user_log_write_string(&context_data,"uint8"); - dlt_user_log_write_uint8(&context_data,UINT8_MAX); /* (255) */ + + if (dlt_user_log_write_start_id(&(context_function_test[2]), &context_data, DLT_LOG_INFO, 8) > 0) { + dlt_user_log_write_string(&context_data, "uint8"); + dlt_user_log_write_uint8(&context_data, UINT8_MAX); /* (255) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,9)>0) - { - dlt_user_log_write_string(&context_data,"uint16"); - dlt_user_log_write_uint16(&context_data,UINT16_MAX); /* (65535) */ + + if (dlt_user_log_write_start_id(&(context_function_test[2]), &context_data, DLT_LOG_INFO, 9) > 0) { + dlt_user_log_write_string(&context_data, "uint16"); + dlt_user_log_write_uint16(&context_data, UINT16_MAX); /* (65535) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,10)>0) - { - dlt_user_log_write_string(&context_data,"uint32"); - dlt_user_log_write_uint32(&context_data,UINT32_MAX); /* (4294967295U) */ + + if (dlt_user_log_write_start_id(&(context_function_test[2]), &context_data, DLT_LOG_INFO, 10) > 0) { + dlt_user_log_write_string(&context_data, "uint32"); + dlt_user_log_write_uint32(&context_data, UINT32_MAX); /* (4294967295U) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,11)>0) - { - dlt_user_log_write_string(&context_data,"uint64"); - dlt_user_log_write_uint64(&context_data,UINT64_MAX); /* (__UINT64_C(18446744073709551615)) */ + + if (dlt_user_log_write_start_id(&(context_function_test[2]), &context_data, DLT_LOG_INFO, 11) > 0) { + dlt_user_log_write_string(&context_data, "uint64"); + dlt_user_log_write_uint64(&context_data, UINT64_MAX); /* (__UINT64_C(18446744073709551615)) */ dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,12)>0) - { - dlt_user_log_write_string(&context_data,"float32"); - dlt_user_log_write_float32(&context_data,FLT_MIN); - dlt_user_log_write_float32(&context_data,FLT_MAX); + if (dlt_user_log_write_start_id(&(context_function_test[2]), &context_data, DLT_LOG_INFO, 12) > 0) { + dlt_user_log_write_string(&context_data, "float32"); + dlt_user_log_write_float32(&context_data, FLT_MIN); + dlt_user_log_write_float32(&context_data, FLT_MAX); dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,13)>0) - { - dlt_user_log_write_string(&context_data,"float64"); - dlt_user_log_write_float64(&context_data,DBL_MIN); - dlt_user_log_write_float64(&context_data,DBL_MAX); + + if (dlt_user_log_write_start_id(&(context_function_test[2]), &context_data, DLT_LOG_INFO, 13) > 0) { + dlt_user_log_write_string(&context_data, "float64"); + dlt_user_log_write_float64(&context_data, DBL_MIN); + dlt_user_log_write_float64(&context_data, DBL_MAX); dlt_user_log_write_finish(&context_data); } - for(num2=0;num2<10;num2++) - { + for (num2 = 0; num2 < 10; num2++) buffer[num2] = num2; - } - if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,14)>0) - { - dlt_user_log_write_string(&context_data,"raw"); - dlt_user_log_write_raw(&context_data,buffer,10); + if (dlt_user_log_write_start_id(&(context_function_test[2]), &context_data, DLT_LOG_INFO, 14) > 0) { + dlt_user_log_write_string(&context_data, "raw"); + dlt_user_log_write_raw(&context_data, buffer, 10); dlt_user_log_write_finish(&context_data); } @@ -956,9 +917,9 @@ int test3f(void) /* wait 2 second before next test */ sleep(2); - if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"Test3: (Function IF) finished"); + + if (dlt_user_log_write_start(&context_info, &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "Test3: (Function IF) finished"); dlt_user_log_write_finish(&context_data); } @@ -970,49 +931,46 @@ int test4f(void) char buffer[1024]; int num; - for(num=0;num<1024;num++) - { + for (num = 0; num < 1024; num++) buffer[num] = num; - } /* Test 4: (Function IF) Message size test */ printf("Test4f: (Function IF) Test different message sizes\n"); - if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"Test4: (Function IF) Test different message sizes"); + + if (dlt_user_log_write_start(&context_info, &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "Test4: (Function IF) Test different message sizes"); dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"1"); - dlt_user_log_write_raw(&context_data,buffer,1); + if (dlt_user_log_write_start(&(context_function_test[3]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "1"); + dlt_user_log_write_raw(&context_data, buffer, 1); dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"16"); - dlt_user_log_write_raw(&context_data,buffer,16); + + if (dlt_user_log_write_start(&(context_function_test[3]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "16"); + dlt_user_log_write_raw(&context_data, buffer, 16); dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"256"); - dlt_user_log_write_raw(&context_data,buffer,256); + + if (dlt_user_log_write_start(&(context_function_test[3]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "256"); + dlt_user_log_write_raw(&context_data, buffer, 256); dlt_user_log_write_finish(&context_data); } - if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"1024"); - dlt_user_log_write_raw(&context_data,buffer,1024); + + if (dlt_user_log_write_start(&(context_function_test[3]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "1024"); + dlt_user_log_write_raw(&context_data, buffer, 1024); dlt_user_log_write_finish(&context_data); } /* wait 2 second before next test */ sleep(2); - if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"Test4: (Function IF) finished"); + + if (dlt_user_log_write_start(&context_info, &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "Test4: (Function IF) finished"); dlt_user_log_write_finish(&context_data); } @@ -1026,51 +984,47 @@ int test5f(void) int i; char log[DLT_USER_BUF_MAX_SIZE]; - for(num=0;num<32;num++) - { + for (num = 0; num < 32; num++) buffer[num] = num; - } /* Test 5: (Function IF) Test high-level API */ printf("Test5f: (Function IF) Test high-level API\n"); - dlt_log_string(&context_info,DLT_LOG_INFO,"Test5: (Function IF) Test high-level API"); + dlt_log_string(&context_info, DLT_LOG_INFO, "Test5: (Function IF) Test high-level API"); - dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_int()"); - dlt_log_int(&(context_function_test[4]),DLT_LOG_INFO, -42); + dlt_log_string(&(context_function_test[4]), DLT_LOG_INFO, "Next line: dlt_log_int()"); + dlt_log_int(&(context_function_test[4]), DLT_LOG_INFO, -42); - dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_uint()"); - dlt_log_uint(&(context_function_test[4]),DLT_LOG_INFO, 42); + dlt_log_string(&(context_function_test[4]), DLT_LOG_INFO, "Next line: dlt_log_uint()"); + dlt_log_uint(&(context_function_test[4]), DLT_LOG_INFO, 42); - dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_string()"); - dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO, "String output"); + dlt_log_string(&(context_function_test[4]), DLT_LOG_INFO, "Next line: dlt_log_string()"); + dlt_log_string(&(context_function_test[4]), DLT_LOG_INFO, "String output"); - dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_raw()"); - dlt_log_raw(&(context_function_test[4]),DLT_LOG_INFO, buffer,16); + dlt_log_string(&(context_function_test[4]), DLT_LOG_INFO, "Next line: dlt_log_raw()"); + dlt_log_raw(&(context_function_test[4]), DLT_LOG_INFO, buffer, 16); - dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_string_int()"); + dlt_log_string(&(context_function_test[4]), DLT_LOG_INFO, "Next line: dlt_log_string_int()"); dlt_log_string_int(&(context_function_test[4]), DLT_LOG_INFO, "String output: ", -42); - dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_string_uint()"); - dlt_log_string_uint(&(context_function_test[4]), DLT_LOG_INFO,"String output: ", 42); + dlt_log_string(&(context_function_test[4]), DLT_LOG_INFO, "Next line: dlt_log_string_uint()"); + dlt_log_string_uint(&(context_function_test[4]), DLT_LOG_INFO, "String output: ", 42); - dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO, "Next lines: dlt_user_is_logLevel_enabled"); - for (i = DLT_LOG_FATAL; i < DLT_LOG_MAX; i++) - { - if (dlt_user_is_logLevel_enabled(&(context_function_test[4]),i) == DLT_RETURN_TRUE) - { + dlt_log_string(&(context_function_test[4]), DLT_LOG_INFO, "Next lines: dlt_user_is_logLevel_enabled"); + + for (i = DLT_LOG_FATAL; i < DLT_LOG_MAX; i++) { + if (dlt_user_is_logLevel_enabled(&(context_function_test[4]), i) == DLT_RETURN_TRUE) { snprintf(log, DLT_USER_BUF_MAX_SIZE, "Loglevel is enabled: %s", loglevelstr[i]); - dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO, log); + dlt_log_string(&(context_function_test[4]), DLT_LOG_INFO, log); } - else - { + else { snprintf(log, DLT_USER_BUF_MAX_SIZE, "Loglevel is disabled: %s", loglevelstr[i]); - dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO, log); + dlt_log_string(&(context_function_test[4]), DLT_LOG_INFO, log); } } /* wait 2 second before next test */ sleep(2); - dlt_log_string(&context_info,DLT_LOG_INFO,"Test5: (Function IF) finished"); + dlt_log_string(&context_info, DLT_LOG_INFO, "Test5: (Function IF) finished"); return 0; } @@ -1079,31 +1033,31 @@ int test6f(void) { /* Test 6: (Function IF) Test local printing */ printf("Test6f: (Function IF) Test local printing\n"); - if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"Test 6: (Function IF) Test local printing"); + + if (dlt_user_log_write_start(&context_info, &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "Test 6: (Function IF) Test local printing"); dlt_user_log_write_finish(&context_data); } dlt_enable_local_print(); - if (dlt_user_log_write_start(&(context_function_test[5]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"Message (visible: locally printed)"); + + if (dlt_user_log_write_start(&(context_function_test[5]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "Message (visible: locally printed)"); dlt_user_log_write_finish(&context_data); } dlt_disable_local_print(); - if (dlt_user_log_write_start(&(context_function_test[5]),&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"Message (invisible: not locally printed)"); + + if (dlt_user_log_write_start(&(context_function_test[5]), &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "Message (invisible: not locally printed)"); dlt_user_log_write_finish(&context_data); } - /* wait 2 second before next test */ + /* wait 2 second before next test */ sleep(2); - if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"Test6: (Function IF) finished"); + + if (dlt_user_log_write_start(&context_info, &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "Test6: (Function IF) finished"); dlt_user_log_write_finish(&context_data); } @@ -1115,19 +1069,17 @@ int test7f(void) char buffer[32]; int num; - for(num=0;num<32;num++) - { + for (num = 0; num < 32; num++) buffer[num] = num; - } /* Show all log messages and traces */ dlt_set_application_ll_ts_limit(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON); /* Test 7: (Function IF) Test network trace */ printf("Test7f: (Function IF) Test network trace\n"); - if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"Test 7: (Function IF) Test network trace"); + + if (dlt_user_log_write_start(&context_info, &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "Test 7: (Function IF) Test network trace"); dlt_user_log_write_finish(&context_data); } @@ -1139,9 +1091,9 @@ int test7f(void) /* wait 2 second before next test */ sleep(2); - if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"Test7: (Function IF) finished"); + + if (dlt_user_log_write_start(&context_info, &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "Test7: (Function IF) finished"); dlt_user_log_write_finish(&context_data); } @@ -1153,36 +1105,35 @@ int test7f(void) int test8f(void) { - char buffer[1024*5]; + char buffer[1024 * 5]; int num; - for(num=0;num<1024*5;num++) - { + for (num = 0; num < 1024 * 5; num++) buffer[num] = num; - } /* Show all log messages and traces */ dlt_set_application_ll_ts_limit(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON); /* Test 8: (Function IF) Test truncated network trace */ printf("Test8f: (Function IF) Test truncated network trace\n"); - if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"Test 8: (Function IF) Test truncated network trace"); + + if (dlt_user_log_write_start(&context_info, &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "Test 8: (Function IF) Test truncated network trace"); dlt_user_log_write_finish(&context_data); } /* Dummy message: 16 byte header, 32 byte payload */ - dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer, 1); - dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer, 1); - dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer, 1); - dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer, 1); + dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_IPC, 16, buffer, 1024 * 5, buffer, 1); + dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_CAN, 16, buffer, 1024 * 5, buffer, 1); + dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024 * 5, buffer, + 1); + dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_MOST, 16, buffer, 1024 * 5, buffer, 1); /* wait 2 second before next test */ sleep(2); - if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"Test8: (Function IF) finished"); + + if (dlt_user_log_write_start(&context_info, &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "Test8: (Function IF) finished"); dlt_user_log_write_finish(&context_data); } @@ -1194,36 +1145,34 @@ int test8f(void) int test9f(void) { - char buffer[1024*5]; + char buffer[1024 * 5]; int num; - for(num=0;num<1024*5;num++) - { + for (num = 0; num < 1024 * 5; num++) buffer[num] = num; - } /* Show all log messages and traces */ dlt_set_application_ll_ts_limit(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON); /* Test 9: (Function IF) Test segmented network trace */ printf("Test9f: (Function IF) Test segmented network trace\n"); - if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"Test 9: (Function IF) Test segmented network trace"); + + if (dlt_user_log_write_start(&context_info, &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "Test 9: (Function IF) Test segmented network trace"); dlt_user_log_write_finish(&context_data); } /* Dummy message: 16 byte header, 5k payload */ - dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer); - dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer); - dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer); - dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer); + dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_IPC, 16, buffer, 1024 * 5, buffer); + dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_CAN, 16, buffer, 1024 * 5, buffer); + dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024 * 5, buffer); + dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_MOST, 16, buffer, 1024 * 5, buffer); /* wait 2 second before next test */ sleep(2); - if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0) - { - dlt_user_log_write_string(&context_data,"Test9: (Function IF) finished"); + + if (dlt_user_log_write_start(&context_info, &context_data, DLT_LOG_INFO) > 0) { + dlt_user_log_write_string(&context_data, "Test9: (Function IF) finished"); dlt_user_log_write_finish(&context_data); } @@ -1237,15 +1186,15 @@ int test_injection_macro_callback(uint32_t service_id, void *data, uint32_t leng { char text[1024]; - memset(text,0,1024); - snprintf(text,1024,"Injection received (macro IF). ID: 0x%.4x, Length: %d",service_id,length); + memset(text, 0, 1024); + snprintf(text, 1024, "Injection received (macro IF). ID: 0x%.4x, Length: %d", service_id, length); printf("%s \n", text); - DLT_LOG(context_macro_callback, DLT_LOG_INFO, DLT_STRING("Injection received (macro IF). ID: "), DLT_UINT32(service_id),DLT_STRING("Data:"),DLT_STRING(text)); - memset(text,0,1024); + DLT_LOG(context_macro_callback, DLT_LOG_INFO, DLT_STRING("Injection received (macro IF). ID: "), + DLT_UINT32(service_id), DLT_STRING("Data:"), DLT_STRING(text)); + memset(text, 0, 1024); - if (length>0) - { - dlt_print_mixed_string(text,1024,data,length,0); + if (length > 0) { + dlt_print_mixed_string(text, 1024, data, length, 0); printf("%s \n", text); } @@ -1256,16 +1205,16 @@ int test_injection_function_callback(uint32_t service_id, void *data, uint32_t l { char text[1024]; - memset(text,0,1024); + memset(text, 0, 1024); - snprintf(text,1024,"Injection received (function IF). ID: 0x%.4x, Length: %d",service_id,length); + snprintf(text, 1024, "Injection received (function IF). ID: 0x%.4x, Length: %d", service_id, length); printf("%s \n", text); - DLT_LOG(context_function_callback, DLT_LOG_INFO, DLT_STRING("Injection received (function IF). ID: "), DLT_UINT32(service_id),DLT_STRING("Data:"),DLT_STRING(text)); - memset(text,0,1024); + DLT_LOG(context_function_callback, DLT_LOG_INFO, DLT_STRING("Injection received (function IF). ID: "), + DLT_UINT32(service_id), DLT_STRING("Data:"), DLT_STRING(text)); + memset(text, 0, 1024); - if (length>0) - { - dlt_print_mixed_string(text,1024,data,length,0); + if (length > 0) { + dlt_print_mixed_string(text, 1024, data, length, 0); printf("%s \n", text); } |