summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMartin Willers <M.Willers@gmx.net>2021-05-31 07:45:48 +0200
committerGitHub <noreply@github.com>2021-05-31 14:45:48 +0900
commit3bb7eb24092ff771ccfd1119f8c1088f3f78f981 (patch)
tree58ef9ed71736b72f929eaa508c088184654e4701 /include
parentd40ecef57050a48ca2abf9c307793d183972658e (diff)
downloadDLT-daemon-3bb7eb24092ff771ccfd1119f8c1088f3f78f981.tar.gz
Add missing string functions (#309)
Signed-off-by: Martin Willers <M.Willers@gmx.net>
Diffstat (limited to 'include')
-rw-r--r--include/dlt/dlt_user.h.in64
-rw-r--r--include/dlt/dlt_user_macros.h38
2 files changed, 98 insertions, 4 deletions
diff --git a/include/dlt/dlt_user.h.in b/include/dlt/dlt_user.h.in
index e4a1f06..960b9f0 100644
--- a/include/dlt/dlt_user.h.in
+++ b/include/dlt/dlt_user.h.in
@@ -496,7 +496,7 @@ DltReturnValue dlt_user_log_write_sized_string(DltContextData *log, const char *
/**
* Write a constant null terminated ASCII string into a DLT log message.
- * In non verbose mode DLT parameter will not be send at all.
+ * In non verbose mode DLT parameter will not be sent 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
@@ -507,11 +507,11 @@ DltReturnValue dlt_user_log_write_constant_string(DltContextData *log, const cha
/**
* Write a constant, potentially non-null-terminated ASCII string into a DLT log message.
- * In non verbose mode DLT parameter will not be send at all.
+ * In non verbose mode DLT parameter will not be sent 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.
+ * @param text pointer to the parameter written into log message
* @param length length in bytes of @a text (without any termination character)
* @return Value from DltReturnValue enum
*/
@@ -539,6 +539,29 @@ DltReturnValue dlt_user_log_write_utf8_string(DltContextData *log, const char *t
DltReturnValue dlt_user_log_write_sized_utf8_string(DltContextData *log, const char *text, uint16_t length);
/**
+ * Write a constant null terminated UTF8 string into a DLT log message.
+ * In non verbose mode DLT parameter will not be sent 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 Value from DltReturnValue enum
+ */
+DltReturnValue dlt_user_log_write_constant_utf8_string(DltContextData *log, const char *text);
+
+/**
+ * Write a constant, potentially non-null-terminated UTF8 string into a DLT log message.
+ * In non verbose mode DLT parameter will not be sent 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
+ * @param length length in bytes of @a text (without any termination character)
+ * @return Value from DltReturnValue enum
+ */
+DltReturnValue dlt_user_log_write_sized_constant_utf8_string(DltContextData *log, const char *text, uint16_t length);
+
+/**
* Write a null-terminated ASCII string with "name" attribute into a DLT log message.
* dlt_user_log_write_start has to be called before adding any parameters to the log message.
* Finish building a log message by calling dlt_user_log_write_finish.
@@ -595,7 +618,7 @@ DltReturnValue dlt_user_log_write_constant_string_attr(DltContextData *log, cons
* and no content to the message.
*
* @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
+ * @param text pointer to the parameter written into log message
* @param length length in bytes of @a text (without any termination character)
* @param name the "name" attribute (or NULL)
* @return value from DltReturnValue enum
@@ -634,6 +657,39 @@ DltReturnValue dlt_user_log_write_utf8_string_attr(DltContextData *log, const ch
DltReturnValue dlt_user_log_write_sized_utf8_string_attr(DltContextData *log, const char *text, uint16_t length, const char *name);
/**
+ * Write a constant, null-terminated UTF8 string with "name" attribute into a DLT log message.
+ * In non-verbose mode, this parameter will not be sent at all.
+ * dlt_user_log_write_start has to be called before adding any parameters to the log message.
+ * Finish building a log message by calling dlt_user_log_write_finish.
+ *
+ * If @a name is NULL, this function will add an attribute field with length 0
+ * and no content to the message.
+ *
+ * @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
+ * @param name the "name" attribute (or NULL)
+ * @return value from DltReturnValue enum
+ */
+DltReturnValue dlt_user_log_write_constant_utf8_string_attr(DltContextData *log, const char *text, const char *name);
+
+/**
+ * Write a constant, potentially non-null-terminated UTF8 string with "name" attribute into a DLT log message.
+ * In non-verbose mode, this parameter will not be sent at all.
+ * dlt_user_log_write_start has to be called before adding any parameters to the log message.
+ * Finish building a log message by calling dlt_user_log_write_finish.
+ *
+ * If @a name is NULL, this function will add an attribute field with length 0
+ * and no content to the message.
+ *
+ * @param log pointer to an object containing information about logging context data
+ * @param text pointer to the parameter written into log message
+ * @param length length in bytes of @a text (without any termination character)
+ * @param name the "name" attribute (or NULL)
+ * @return value from DltReturnValue enum
+ */
+DltReturnValue dlt_user_log_write_sized_constant_utf8_string_attr(DltContextData *log, const char *text, uint16_t length, const char *name);
+
+/**
* 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.
* 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 24b7b7a..f7d8033 100644
--- a/include/dlt/dlt_user_macros.h
+++ b/include/dlt/dlt_user_macros.h
@@ -369,6 +369,24 @@
(void)dlt_user_log_write_sized_utf8_string(&log_local, TEXT, LEN)
/**
+ * Add constant utf8-encoded string parameter to the log messsage.
+ * @param TEXT Constant UTF8-encoded string
+ */
+#define DLT_CUTF8(TEXT) \
+ (void)dlt_user_log_write_constant_utf8_string(&log_local, TEXT)
+
+/**
+ * Add constant utf8-encoded string parameter with given length to the log messsage.
+ * The string in @a TEXT does not need to be null-terminated, but
+ * the copied string will be null-terminated at its destination
+ * in the message buffer.
+ * @param TEXT Constant UTF8-encoded string
+ * @param LEN length in bytes to take from @a TEXT
+ */
+#define DLT_SIZED_CUTF8(TEXT, LEN) \
+ (void)dlt_user_log_write_sized_constant_utf8_string(&log_local, TEXT, LEN)
+
+/**
* Add string parameter with "name" attribute to the log messsage.
* @param TEXT ASCII string
* @param NAME "name" attribute
@@ -429,6 +447,26 @@
(void)dlt_user_log_write_sized_utf8_string_attr(&log_local, TEXT, LEN, ATTR)
/**
+ * Add constant utf8-encoded string parameter with "name" attribute to the log messsage.
+ * @param TEXT Constant UTF8-encoded string
+ * @param NAME "name" attribute
+ */
+#define DLT_CUTF8_ATTR(TEXT, NAME) \
+ (void)dlt_user_log_write_constant_utf8_string_attr(&log_local, TEXT, NAME)
+
+/**
+ * Add constant utf8-encoded string parameter with given length and "name" attribute to the log messsage.
+ * The string in @a TEXT does not need to be null-terminated, but
+ * the copied string will be null-terminated at its destination
+ * in the message buffer.
+ * @param TEXT Constant UTF8-encoded string
+ * @param LEN length in bytes to take from @a TEXT
+ * @param NAME "name" attribute
+ */
+#define DLT_SIZED_CUTF8_ATTR(TEXT, LEN, NAME) \
+ (void)dlt_user_log_write_sized_constant_utf8_string_attr(&log_local, TEXT, LEN, NAME)
+
+/**
* Add boolean parameter to the log messsage.
* @param BOOL_VAR Boolean value (mapped to uint8)
*/