Get CAN signal from database by its name in CAPL

2k views Asked by At

I developped an user interface for simulating different types of failures on CAN signals contained in a frame (clock stuck, erroneous CRC). I need also to simulate unavailable values but in order to do so I have to use the input from the user which represents the signal name.

I don't know how to look in the database and retrieve the corresponding CAN signal in order to give it the unavailable value.

1

There are 1 answers

0
Anton Salnikov On

To get CAN signal from database use

signal * lookupSignal(char signalName[]);

For example:

signal * mySig = lookupSignal("MyNetwork::Node1::MyMessage::SignalName");

Then to get/set signal value

float value;
value = getSignal(mySig);
write("mySig value is %f", value);
setSignal(mySig, 0);