summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/dlt_for_developers.md19
-rw-r--r--include/dlt/dlt_user.h7
-rw-r--r--include/dlt/dlt_user_macros.h7
-rw-r--r--src/lib/dlt_user.c11
4 files changed, 44 insertions, 0 deletions
diff --git a/doc/dlt_for_developers.md b/doc/dlt_for_developers.md
index 1773f20..9f3f09c 100644
--- a/doc/dlt_for_developers.md
+++ b/doc/dlt_for_developers.md
@@ -405,6 +405,25 @@ the IPC channel. Because of this, messages might be lost if logs are emitted
immediately after registering. Typically this is not a problem, but may arise
especially with simple examples.
+### Get application ID
+
+To get the application ID value, requested to allocate a char array at least
+4 byte length and input to the function call.
+
+The application ID will be stored in this input char array.
+
+#### MACRO
+
+```
+DLT_GET_APPID(appid);
+```
+
+#### Function
+
+```
+dlt_get_appid(appid);
+```
+
### Define and register all logging contexts
As many contexts as needed can be defined. These contexts can be declared as
diff --git a/include/dlt/dlt_user.h b/include/dlt/dlt_user.h
index 85656d9..69cb854 100644
--- a/include/dlt/dlt_user.h
+++ b/include/dlt/dlt_user.h
@@ -537,6 +537,13 @@ DltReturnValue dlt_unregister_app(void);
DltReturnValue dlt_unregister_app_flush_buffered_logs(void);
/**
+ * Get the application id
+ * @param four byte long character array to store the application id
+ * @return Value from DltReturnValue enum
+ */
+DltReturnValue dlt_get_appid(char *appid);
+
+/**
* Register a context in the daemon.
* This function has to be called before first usage of the context.
* @param handle pointer to an object containing information about one special logging context
diff --git a/include/dlt/dlt_user_macros.h b/include/dlt/dlt_user_macros.h
index 4ad6854..1b386bf 100644
--- a/include/dlt/dlt_user_macros.h
+++ b/include/dlt/dlt_user_macros.h
@@ -126,6 +126,13 @@
(void)dlt_unregister_app_flush_buffered_logs(); } while (0)
/**
+ * To Get application ID.
+ * @Param APPID character pointer of minimum 4 bytes
+ */
+#define DLT_GET_APPID(APPID) do{\
+ dlt_get_appid(APPID);} while(0)
+
+/**
* Register context (with default log level and default trace status)
* @param CONTEXT object containing information about one special logging context
* @param CONTEXTID context id with maximal four characters
diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c
index 8031b66..c3da424 100644
--- a/src/lib/dlt_user.c
+++ b/src/lib/dlt_user.c
@@ -414,6 +414,17 @@ DltReturnValue dlt_init(void)
return DLT_RETURN_OK;
}
+DltReturnValue dlt_get_appid(char *appid)
+{
+ if (appid != NULL) {
+ strncpy(appid, dlt_user.appID, 4);
+ return DLT_RETURN_OK;
+ } else {
+ dlt_log(LOG_ERR, "Invalid parameter.\n");
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+}
+
DltReturnValue dlt_init_file(const char *name)
{
/* check null pointer */