adinecsoi
adinecsoi

Reputation: 21

Get CAN signal from database by its name in CAPL

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.

Upvotes: 2

Views: 2365

Answers (1)

Anton Salnikov
Anton Salnikov

Reputation: 31

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);

Upvotes: 1

Related Questions