Skip to content

Commit

Permalink
Update to latest Codec.
Browse files Browse the repository at this point in the history
Signed-off-by: Rule Timothy (VM/EMT3) <[email protected]>
  • Loading branch information
timrulebosch committed Sep 12, 2024
1 parent 24605f7 commit fb88afa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
9 changes: 8 additions & 1 deletion dse/modelc/model/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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++) {
Expand All @@ -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);
}

Expand Down
3 changes: 3 additions & 0 deletions tests/cmocka/model/test_ncodec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down

0 comments on commit fb88afa

Please sign in to comment.