Search code examples
can-buscapl

CAPL Scripting - CAN C communication (Stop transmitting one message from DBC)


I am working on a CAPL script that has to allow all messages to transmit on a CAN C channel and stop transmitting one particular message from the database file. Can anyone help with the method/function/code I can use?


Solution

  • Your question is vague, but I'm assuming you are going from one CAN channel to another. For instance, CAN C to CAN D (or CAN 3 to CAN 4), than you could do:

    on message CAN3.0x7FF  // This would be that one ID that stops at some point
    {
      message CAN4.0x7FF msg;
      msg = this;
    
      // Assuming you are receiving on CAN 3, and looking to transmit on CAN 4
      if(this.dir == rx)
      {
          // Declare a global variable that sets to 1 when you want it to stop
        if(MSG_STOP == 0)
           output(msg);
      }
    }
    
    on message CAN3.*
    {
    
      message CAN4.* msg;
      msg = this;
      if (this.dir == rx)
      {
        output (msg);
      } 
    }