pk_volt
Member level 2
I found a pretty helpful CAPL programming tutorial pdf on here, which has helped me get started with CAPL very quickly.
However, I'm trying to pass a message to another function as an argument, and I can't seem to get this right. I'm basically just trying to do a simple loopback from CAN1 to CAN2. Note: the commented out code in "on message CAN1.vtmCmd1" loopback code works, but I would preferably like to use functions to organize my test cases.
Here is my code.
---------- Post added at 20:00 ---------- Previous post was at 19:56 ----------
ah, I just figured it out. Turns out you have to create a "pointer" or another instance for the gateway message inside my function: For future references, here is the code that i got it to work:
However, I'm trying to pass a message to another function as an argument, and I can't seem to get this right. I'm basically just trying to do a simple loopback from CAN1 to CAN2. Note: the commented out code in "on message CAN1.vtmCmd1" loopback code works, but I would preferably like to use functions to organize my test cases.
Here is my code.
Code:
on message CAN1.vtmCmd1
{
//Loopback for 1 second, fault for 600ms.
invalid_test_0x232(this);
/* message *gatewayMsg;
gatewayMsg = this;
gatewayMsg.CAN = 2;
output(gatewayMsg);
*/
}
Code:
void invalid_test_0x232(message vtmCmd1 tmCmd1){
int tm;
char test_state = 0;
char alive_counter;
//configure pkt to loop out to CAN2
tmCmd1.CAN = 2;
output(tmCmd1);
---------- Post added at 20:00 ---------- Previous post was at 19:56 ----------
ah, I just figured it out. Turns out you have to create a "pointer" or another instance for the gateway message inside my function: For future references, here is the code that i got it to work:
Code:
void invalid_test_0x232(message vtmCmd1 tmCmd1){
int tm;
char test_state = 0;
char alive_counter;
//configure pkt to loop out to CAN2
//tmCmd1.CAN = 2;
//output(tmCmd1);
message *gMsg;
gMsg = tmCmd1;
gMsg.CAN = 2;
output(gMsg);
/*
}