diff --git a/Makefile b/Makefile index 4494535..68e12f9 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ DSE_SCHEMA_VERSION ?= 1.2.8 export DSE_SCHEMA_URL ?= $(DSE_SCHEMA_REPO)/releases/download/v$(DSE_SCHEMA_VERSION)/dse-schemas.tar.gz DSE_NCODEC_REPO ?= https://github.com/boschglobal/dse.standards -DSE_NCODEC_VERSION ?= 1.0.8 +DSE_NCODEC_VERSION ?= 1.1.0 export DSE_NCODEC_URL ?= $(DSE_NCODEC_REPO)/archive/refs/tags/v$(DSE_NCODEC_VERSION).zip diff --git a/dse/modelc/model/trace.c b/dse/modelc/model/trace.c index 30ed537..4448fc9 100644 --- a/dse/modelc/model/trace.c +++ b/dse/modelc/model/trace.c @@ -45,6 +45,7 @@ static void _trace_log( NCodecTraceData* td = nc->private; NCodecCanMessage* msg = m; static char b[NCT_BUFFER_LEN]; + static char bus_identifier[NCT_BUSID_LEN]; /* Setup bus identifier (on first call). */ if (strlen(td->bus_identifier) == 0) { @@ -62,6 +63,12 @@ static void _trace_log( /* Format and write the log. */ memset(b, 0, NCT_BUFFER_LEN); + if (strcmp(direction, "RX") == 0) { + snprintf(bus_identifier, NCT_BUSID_LEN, "%d:%d:%d", + msg->sender.bus_id, msg->sender.node_id, msg->sender.interface_id); + } else { + strncpy(bus_identifier, td->bus_identifier, NCT_BUSID_LEN); + } if (msg->len <= 16) { // Short form log. for (uint32_t i = 0; i < msg->len; i++) { @@ -86,7 +93,7 @@ static void _trace_log( } } log_notice("(%s) %.6f [%s] %s %02x %d %d :%s", td->model_inst_name, - *td->simulation_time, td->bus_identifier, direction, msg->frame_id, + *td->simulation_time, bus_identifier, direction, msg->frame_id, msg->frame_type, msg->len, b); } diff --git a/tests/cmocka/model/test_ncodec.c b/tests/cmocka/model/test_ncodec.c index 0e066b9..84ed227 100644 --- a/tests/cmocka/model/test_ncodec.c +++ b/tests/cmocka/model/test_ncodec.c @@ -210,6 +210,9 @@ void test_ncodec__network_stream(void** state) assert_int_equal(msg.len, strlen(greeting)); assert_non_null(msg.buffer); assert_memory_equal(msg.buffer, greeting, strlen(greeting)); + assert_int_equal(msg.sender.bus_id, 1); + assert_int_equal(msg.sender.node_id, 8); + assert_int_equal(msg.sender.interface_id, 3); }