From: Alexander Wenzel Date: Mon, 19 May 2014 12:23:55 +0000 (+0200) Subject: DLT_CSTRING implementation non verbose mode. X-Git-Tag: v2.11.0~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a91fe28c05c54f7428325b0290a29c28966ae56;p=profile%2Fivi%2Fdlt-daemon.git DLT_CSTRING implementation non verbose mode. Signed-off-by: Alexander Wenzel --- diff --git a/examples/README.txt b/examples/README.txt index 728e5c2..fe42331 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -1,4 +1,5 @@ This folder contains several examples of applications using the DLT library. These examples will be extended in the future to show different Use Cases. Example1: Minimal DLT Example -Example2-3: Non Verbose Mode Examples with different AppIdds +Example2: Non Verbose Mode Examples with different AppIdds and normal Strings +Example3: Non Verbose Mode Examples with different AppIdds and constant strings diff --git a/examples/example3/example3.c b/examples/example3/example3.c index bd72671..737a2a1 100644 --- a/examples/example3/example3.c +++ b/examples/example3/example3.c @@ -61,9 +61,9 @@ int main() for(num=0;num<10;num++) { - DLT_LOG_ID(con_exa3,DLT_LOG_INFO,DLT_EXA3_CON_EXA3_ID1,DLT_INT32(12345678),DLT_STRING("Hello world 1!")); - DLT_LOG_ID(con_exa3,DLT_LOG_ERROR,DLT_EXA3_CON_EXA3_ID2,DLT_INT32(87654321),DLT_STRING("Hello world 2!")); - DLT_LOG_ID(con_exa3,DLT_LOG_WARN,DLT_EXA3_CON_EXA3_ID3,DLT_INT32(11223344),DLT_STRING("Hello world 3!")); + DLT_LOG_ID(con_exa3,DLT_LOG_INFO,DLT_EXA3_CON_EXA3_ID1,DLT_INT32(12345678),DLT_CSTRING("Hello world 1!")); + DLT_LOG_ID(con_exa3,DLT_LOG_ERROR,DLT_EXA3_CON_EXA3_ID2,DLT_INT32(87654321),DLT_CSTRING("Hello world 2!")); + DLT_LOG_ID(con_exa3,DLT_LOG_WARN,DLT_EXA3_CON_EXA3_ID3,DLT_INT32(11223344),DLT_CSTRING("Hello world 3!")); usleep(1000); } diff --git a/examples/example3/example3.xml b/examples/example3/example3.xml index 706c0b5..616cfcb 100644 --- a/examples/example3/example3.xml +++ b/examples/example3/example3.xml @@ -38,14 +38,9 @@ PDU_1000_1 + Hello world 1! 0 OTHER - - - 0 - - - PDU_1001_0 @@ -60,14 +55,9 @@ PDU_1001_1 + Hello world 2! 0 OTHER - - - 0 - - - PDU_1002_0 @@ -82,14 +72,9 @@ PDU_1002_1 + Hello world 3! 0 OTHER - - - 0 - - - diff --git a/include/dlt/dlt_common_api.h b/include/dlt/dlt_common_api.h index 83acac5..f849567 100644 --- a/include/dlt/dlt_common_api.h +++ b/include/dlt/dlt_common_api.h @@ -234,8 +234,8 @@ * In the future in none verbose mode the string will not be sent via DLT message. * @param TEXT ASCII string */ -#define DLT_CSTRING(TEXT) \ - DLT_STRING(TEXT) +/* #define DLT_CSTRING(TEXT) */ +/* UNCHANGED */ #endif /* DLT_COMMON_API_H */ diff --git a/include/dlt/dlt_user.h b/include/dlt/dlt_user.h index 93ac0a0..7d41896 100644 --- a/include/dlt/dlt_user.h +++ b/include/dlt/dlt_user.h @@ -354,7 +354,18 @@ int dlt_user_log_write_int64(DltContextData *log, int64_t data); */ int dlt_user_log_write_string( DltContextData *log, const char *text); - /** +/** + * Write a constant null terminated ASCII string into a DLT log message. + * In non verbose mode DLT parameter will not be send at all. + * dlt_user_log_write_start has to be called before adding any attributes to the log message. + * Finish sending log message by calling dlt_user_log_write_finish. + * @param log pointer to an object containing information about logging context data + * @param text pointer to the parameter written into log message containing null termination. + * @return negative value if there was an error + */ +int dlt_user_log_write_constant_string( DltContextData *log, const char *text); + +/** * Write a null terminated UTF8 string into a DLT log message. * dlt_user_log_write_start has to be called before adding any attributes to the log message. * Finish sending log message by calling dlt_user_log_write_finish. diff --git a/include/dlt/dlt_user_macros.h b/include/dlt/dlt_user_macros.h index 3b6bb06..37a8ccf 100644 --- a/include/dlt/dlt_user_macros.h +++ b/include/dlt/dlt_user_macros.h @@ -207,6 +207,13 @@ extern DltContext CONTEXT; dlt_user_log_write_string(&log,TEXT) /** + * Add constant string parameter to the log messsage. + * @param TEXT Constant ASCII string + */ +#define DLT_CSTRING(TEXT) \ + dlt_user_log_write_constant_string(&log,TEXT) + +/** * Add utf8-encoded string parameter to the log messsage. * @param TEXT UTF8-encoded string */ diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c index 0b28ff8..2d04467 100644 --- a/src/lib/dlt_user.c +++ b/src/lib/dlt_user.c @@ -1853,6 +1853,17 @@ int dlt_user_log_write_string(DltContextData *log, const char *text) return 0; } +int dlt_user_log_write_constant_string(DltContextData *log, const char *text) +{ + /* Send parameter only in verbose mode */ + if (dlt_user.verbose_mode) + { + return dlt_user_log_write_string(log,text); + } + + return 0; +} + int dlt_user_log_write_utf8_string(DltContextData *log, const char *text) { uint16_t arg_size;