vendredi 5 janvier 2018

CAPL Canoe wait for a specific can Message

I'm currently trying to Test Auto-Generated-Code for a Controller.

The Test will be done in CANoe with Capl.

I've already tried a lot of things out and it's working good. But now I want to Test a "message lost".

I have Need something like this.

CAN 1 is sending a test Message for 10 Times. 3 Times there will be a Message lost. CAN 2 which is receiving the Signals has to react to this with a specific value. I Need something like WaitForMessage(int aTimeOut, Message yourMessage) which for example 0 for succesfully accesing the Message or -1 for timeOut.

    on timer sendMessage
  {
    if(anzahlAnBotschaften > 0) // amount of sent Messages
    {
      if(anzahlAnBotschaften % 3 == 0) // 3 times message lost
      {
        botschaftWirdGesendet = 0;  
        lRet = ???? here is the part where i want to wait for a an answer from CAN2 
        if(lRet != 0)
        {
          TestStepPass("010.1", "SNA was triggered");
        }
        else
        {
          TestStepFail("010.1", "Timeout was triggered, but no SNA was found");
         }
      }
      else
      {
        botschaftWirdGesendet = 1;
        output(sendingCan_BrkSys);
        lRet = TestGetWaitEventMsgData(receivingCan_BrkSys.);
        if(lRet == 0) 
        {
          // same for the positive case
        }
      }
      anzahlAnBotschaften -- ;
      setTimer(botschaftsAusfall,20);
    }
  }

If I wasn't specific enough please let me know and thank you all :D

Greetings from Germany

Aucun commentaire:

Enregistrer un commentaire