Send ECU Id if enabled and added library API to change.
authorAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Tue, 13 May 2014 15:06:31 +0000 (17:06 +0200)
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Fri, 16 May 2014 06:37:40 +0000 (08:37 +0200)
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
include/dlt/dlt_user.h
src/examples/dlt-example-user.c
src/lib/dlt_user.c
src/lib/dlt_user_cfg.h

index 0c665ab..93ac0a0 100644 (file)
@@ -232,6 +232,7 @@ typedef struct
     int8_t use_extende_header_for_non_verbose; /**< Use extended header for non verbose: 1 enabled, 0 disabled */
     int8_t with_session_id;                                        /**< Send always session id: 1 enabled, 0 disabled */
     int8_t with_timestamp;                                         /**< Send always timestamp: 1 enabled, 0 disabled */
+    int8_t with_ecu_id;                                                /**< Send always ecu id: 1 enabled, 0 disabled */
 
     int8_t enable_local_print;            /**< Local printing of log messages: 1 enabled, 0 disabled */
     int8_t local_print_mode;              /**< Local print mode, controlled by environment variable */
@@ -569,6 +570,14 @@ int dlt_with_session_id(int8_t with_session_id);
 int dlt_with_timestamp(int8_t with_timestamp);
 
 /**
+ * Send ecu id configuration.
+ * Enabled by default.
+ * @param with_ecu_id Send ecu id in each message if enabled
+ * @return negative value if no success
+ */
+int dlt_with_ecu_id(int8_t with_ecu_id);
+
+/**
  * Set maximum logged log level and trace status of application
  *
  * @param loglevel This is the log level to be set for the whole application
index 3dcf245..25d3110 100755 (executable)
@@ -235,6 +235,11 @@ int main(int argc, char* argv[])
         }
     }
 
+    dlt_with_session_id(1);
+    dlt_with_timestamp(1);
+    dlt_with_ecu_id(1);
+    dlt_verbose_mode();
+
     DLT_REGISTER_APP("LOG","Test Application for Logging");
     DLT_REGISTER_CONTEXT(mycontext,"TEST","Test Context for Logging");
 
index b7ab992..0b28ff8 100644 (file)
@@ -408,6 +408,9 @@ int dlt_init_common(void)
     /* With timestamp is enabled by default */
     dlt_user.with_timestamp= DLT_USER_WITH_TIMESTAMP;
 
+    /* With timestamp is enabled by default */
+    dlt_user.with_ecu_id= DLT_USER_WITH_ECU_ID;
+
     /* Local print is disabled by default */
     dlt_user.enable_local_print = 0;
 
@@ -2761,6 +2764,22 @@ int dlt_with_timestamp(int8_t with_timestamp)
     return 0;
 }
 
+int dlt_with_ecu_id(int8_t with_ecu_id)
+{
+    if (dlt_user_initialised==0)
+    {
+        if (dlt_init()<0)
+        {
+            return -1;
+        }
+    }
+
+    /* Set with_timestamp */
+    dlt_user.with_ecu_id = with_ecu_id;
+
+    return 0;
+}
+
 int dlt_enable_local_print(void)
 {
     if (dlt_user_initialised==0)
@@ -2940,7 +2959,13 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, int mtype)
     }
 
     msg.standardheader = (DltStandardHeader*)(msg.headerbuffer + sizeof(DltStorageHeader));
-    msg.standardheader->htyp = DLT_HTYP_WEID | DLT_HTYP_PROTOCOL_VERSION1 ;
+    msg.standardheader->htyp = DLT_HTYP_PROTOCOL_VERSION1 ;
+
+    /* send ecu id */
+    if(dlt_user.with_ecu_id)
+    {
+               msg.standardheader->htyp |= DLT_HTYP_WEID;
+    }
 
     /* send timestamp */
     if(dlt_user.with_timestamp)
index 4c3e201..9559c98 100755 (executable)
 /* send always timestamp: 0 - don't use, 1 - use */\r
 #define DLT_USER_WITH_TIMESTAMP 1\r
 \r
+/* send always ecu id: 0 - don't use, 1 - use */\r
+#define DLT_USER_WITH_ECU_ID 1\r
+\r
 /* default message id for non-verbose mode, if no message id was provided */\r
 #define DLT_USER_DEFAULT_MSGID 0xffff\r
 \r