summaryrefslogtreecommitdiff
path: root/includes/DLTWrapper.h
diff options
context:
space:
mode:
Diffstat (limited to 'includes/DLTWrapper.h')
-rw-r--r--includes/DLTWrapper.h68
1 files changed, 66 insertions, 2 deletions
diff --git a/includes/DLTWrapper.h b/includes/DLTWrapper.h
index dcce4ab..3a9482a 100644
--- a/includes/DLTWrapper.h
+++ b/includes/DLTWrapper.h
@@ -25,13 +25,70 @@
#ifndef DLTWRAPPER_H_
#define DLTWRAPPER_H_
+#include "config.h"
+
+#ifdef WITH_DLT
#include <dlt/dlt.h>
+#else
+
+#include <stdint.h>
+
+#define DLT_USER_BUF_MAX_SIZE 2048
+
+/**
+ * This structure is used for every context used in an application.
+ */
+typedef struct
+{
+ char contextID[4]; /**< context id */
+ int32_t log_level_pos; /**< offset in user-application context field */
+} DltContext;
+
+/**
+ * Definitions of DLT log level
+ */
+typedef enum
+{
+ DLT_LOG_DEFAULT = -1, /**< Default log level */
+ DLT_LOG_OFF = 0x00, /**< Log level off */
+ DLT_LOG_FATAL = 0x01, /**< fatal system error */
+ DLT_LOG_ERROR = 0x02, /**< error with impact to correct functionality */
+ DLT_LOG_WARN = 0x03, /**< warning, correct behaviour could not be ensured */
+ DLT_LOG_INFO = 0x04, /**< informational */
+ DLT_LOG_DEBUG = 0x05, /**< debug */
+ DLT_LOG_VERBOSE = 0x06 /**< highest grade of information */
+} DltLogLevelType;
+
+/**
+ * This structure is used for context data used in an application.
+ */
+typedef struct
+{
+ DltContext *handle; /**< pointer to DltContext */
+ char buffer[DLT_USER_BUF_MAX_SIZE]; /**< buffer for building log message*/
+ int32_t size; /**< payload size */
+ int32_t log_level; /**< log level */
+ int32_t trace_status; /**< trace status */
+ int32_t args_num; /**< number of arguments for extended header*/
+ uint8_t mcnt; /**< message counter */
+ char* context_description; /**< description of context */
+} DltContextData;
+
+#define DLT_DECLARE_CONTEXT(CONTEXT) \
+DltContext CONTEXT;
+
+
+#define DLT_IMPORT_CONTEXT(CONTEXT) \
+extern DltContext CONTEXT;
+
+#endif
+
#include <string>
class DLTWrapper
{
public:
- static DLTWrapper* instance();
+ static DLTWrapper* instance(const bool enableNoDLTDebug = false);
void registerApp(const char *appid, const char * description);
void registerContext(DltContext& handle, const char *contextid, const char * description);
void unregisterContext(DltContext& handle);
@@ -46,9 +103,16 @@ public:
void append(const char*& value);
void append(const std::string& value);
void append(const bool value);
+#ifndef WITH_DLT
+ void enableNoDLTDebug(const bool enableNoDLTDebug = true);
+#endif
~DLTWrapper();
private:
- DLTWrapper(); //is private because of singleton pattern
+ DLTWrapper(const bool enableNoDLTDebug); //is private because of singleton pattern
+#ifndef WITH_DLT
+ template<class T> void appendNoDLT(T value);
+ bool mEnableNoDLTDebug;
+#endif
DltContext mDltContext;
DltContextData mDltContextData;
static DLTWrapper* mDLTWrapper;