I am attempting to implement your C example within my application. However I am noticing it is out of date.
The line dbcppp_MessageForEachSignal(msg, print_signal_data, &frame); does not compile as dbcppp_MessageForEachSignal does not seem to exist. I had to make a few other changes, nothing major. This is what I have so far.
void test_dbcppp(struct can_frame frame) {
const dbcppp_Network* net = dbcppp_NetworkLoadDBCFromFile("your.dbc");
if (net) {
uint64_t n_msgs = dbcppp_NetworkMessages_Size(net);
for (uint64_t i = 0; i < n_msgs; i++) {
const dbcppp_Message* msg = dbcppp_NetworkMessages_Get(net, i);
if (dbcppp_MessageId(msg) == frame.can_id)
{
printf("Received message: %s\n", dbcppp_MessageName(msg));
dbcppp_MessageForEachSignal(msg, print_signal_data, &frame);
for (uint64_t i = 0; i < dbcppp_MessageSignals_Size(msg); i++) {
const dbcppp_Signal* sig = dbcppp_MessageSignals_Get(msg, i);
uint64_t raw = dbcppp_SignalDecode(sig, frame.data);
double phys = dbcppp_SignalRawToPhys(sig, raw);
printf("\t%s=%f\n", dbcppp_SignalName(sig), phys);
}
}
}
}
dbcppp_NetworkFree(net);
}
The intended use is the what you did there: For iterating about internal structures, the *_Size and _Get combination has to be used. The C example has to be updated accordingly.
Hello,
I am attempting to implement your C example within my application. However I am noticing it is out of date.
The line
dbcppp_MessageForEachSignal(msg, print_signal_data, &frame);
does not compile as dbcppp_MessageForEachSignal does not seem to exist. I had to make a few other changes, nothing major. This is what I have so far.