diff options
Diffstat (limited to 'include/dlt')
-rwxr-xr-x | include/dlt/dlt_protocol.h | 16 | ||||
-rw-r--r-- | include/dlt/dlt_user.h | 10 | ||||
-rw-r--r-- | include/dlt/dlt_user_macros.h | 8 |
3 files changed, 26 insertions, 8 deletions
diff --git a/include/dlt/dlt_protocol.h b/include/dlt/dlt_protocol.h index 1c30d66..c2e91d7 100755 --- a/include/dlt/dlt_protocol.h +++ b/include/dlt/dlt_protocol.h @@ -155,14 +155,14 @@ #define DLT_TYPE_INFO_STRU 0x00004000 /**< Struct */
#define DLT_TYPE_INFO_SCOD 0x00038000 /**< coding of the type string: 0 = ASCII, 1 = UTF-8 */
-#define DLT_TYLE_8BIT 1
-#define DLT_TYLE_16BIT 2
-#define DLT_TYLE_32BIT 3
-#define DLT_TYLE_64BIT 4
-#define DLT_TYLE_128BIT 5
-
-#define DLT_SCOD_ASCII 0
-#define DLT_SCOD_UTF8 1
+#define DLT_TYLE_8BIT 0x00000001
+#define DLT_TYLE_16BIT 0x00000002
+#define DLT_TYLE_32BIT 0x00000003
+#define DLT_TYLE_64BIT 0x00000004
+#define DLT_TYLE_128BIT 0x00000005
+
+#define DLT_SCOD_ASCII 0x00000000
+#define DLT_SCOD_UTF8 0x00008000
/*
* Definitions of DLT services.
diff --git a/include/dlt/dlt_user.h b/include/dlt/dlt_user.h index 0523da2..b548707 100644 --- a/include/dlt/dlt_user.h +++ b/include/dlt/dlt_user.h @@ -345,6 +345,16 @@ int dlt_user_log_write_int64(DltContextData *log, int64_t data); */ int dlt_user_log_write_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. + * @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_utf8_string(DltContextData *log, const char *text); + /** * Write a binary memory block into a DLT log message. * dlt_user_log_write_start has to be called before adding any attributes to the log message. diff --git a/include/dlt/dlt_user_macros.h b/include/dlt/dlt_user_macros.h index 20f605d..c8551b1 100644 --- a/include/dlt/dlt_user_macros.h +++ b/include/dlt/dlt_user_macros.h @@ -202,6 +202,14 @@ extern DltContext CONTEXT; }) /** + * Add utf8-encoded string parameter to the log messsage. + * @param TEXT UTF8-encoded string + */ +#define DLT_UTF8(TEXT) ({ \ + dlt_user_log_write_utf8_string(&log,TEXT); \ + }) + +/** * Add boolean parameter to the log messsage. * @param BOOL_VAR Boolean value (mapped to uint8) */ |