# call

The operation belongs to the family of procedure-based communication operations. It is used to specify that a test component calls a procedure in the system under test or in another test component. The communication may be either blocking or non-blocking.

- The operation can be used on connected procedure-based (or mixed) ports.
- In case of multiple connections the receiver may be addressed.

Related keywords:

- address
- catch
- create
- getreply
- modifies
- nowait
- param
- signature
- system
- to

1. Non-blocking communication

### port_reference.call ( template_instance [ ,nowait ] ) [ to address_reference ];

- port_reference points out the port where the procedure is called at.

- The call keyword introduces the procedure call.

- template_instance is one of the following:

  - in-line signature template (see the example1);
  - a specific value signature template (see the example 2);
  - a modified signature template (see the example 3);

TITAN specific restriction compared to the standard: modified template is not implemented. When encountered in the TTCN-3 program, an error message will be generated.

- The optional keyword nowait is used when the signature is intended for blocking communication. but the process call should be made in a non-blocking way.

- The optional to keyword is used when a port is connected to several entities and identification of the communication partner is required.

- address_reference is one of the following:

  - a component reference (cf. create) or the keyword system, in case of one-to-many connections.
  - an address reference (cf. address) , when there are several entities within the system under test.

2. Blocking communication

### port_reference.call ( template_instance [ ,call_timer ] ) [ to address_reference ] {[ response_handling_part ] [ exception_handling_part ]};

- port_reference points out the port where the procedure is called at.

- The call keyword introduces the procedure call.

- template_instance is one of the following:

  - in-line signature template;
  - a specific value signature template;
  - a modified signature template ;

TITAN specific restriction compared to the standard: modified template is not implemented. When encountered in the TTCN-3 program, an error message will be generated.

- The optional call_timer (a floating point value) determines the waiting time for a response in seconds.

- The optional to keyword is used when a port is connected to several entities and identification of the communication partner is required.

- address_reference is one of the following:

  - a component reference (cf. create) or the keyword system, in case of one-to-many connections.
  - an address reference (cf. address) , when there are several entities within the system under test.

- The response and exception handling part between curly brackets is used to handle responses and exceptions. It has the same structure as an alt statement. Its elements may occur several times; they are separated by semicolons (see the example 4).

  - response_handling_part begins with a pair of brackets: [] Inside the bracket there may be an optional Boolean expression. The following statements are examined only when it is true. The following getreply keyword introduces the description of response handling. ;
  - exception_handling_part begins with a pair of brackets: [] Inside the bracket there may be an optional Boolean expression. The following statements are examined only when it is true. The following catch keyword introduces the description of exception handling. When applicable, timout conditions are also handled here.

Example 1: in-line signature template

signature S_MyProc (out integer pl_MyPar1, inout boolean pl_MyPar2, in charset pl_MyPar3) noblock;
MujPort_PCO.call(S_MyProc:{ -, true, "marcipaan"}) to system;

The signature S_MyProc suitable for non-blocking communication is defined in the first line. It has three parameters (pl_MyPar1, pl_MyPar2 and pl_MyPar3).
In the second line, the procedure is called at the port MujPort_PCO. The port is connected to several components therefore it must be addressed, in our case to the test system interface. The first parameter has no value assigned because it is an out parameter from the point of view of the called procedure. The second parameter (pl_MyPar2) has the value true, the third one contains "marcipaan".

Example 2: signature template

template S_MyProc t_NiaTemplate (boolean pl_param) := {
field1 := 16,
field2 := pl_param,
field3 := "massepain"
}

MujPort_PCO.call (t_NiaTemplate(true));

The parameterized template (t_NiaTemplate) has three fields. When called as shown in the second line, the values true and "massepain" will be sent to the port MujPort_PCO. The first parameter is don't care because it is defined as an out parameter.

Example 3: modified signature template

MujPort_PCO.call (modifies t_NiaTemplate(false) := {field3 := "pate d'amande"});

The template defined in example 2 is modified. When sent as shown, the values false and ""pate d'amande" will be sent to the port MujPort_PCO as second and third parameters.

Example 4: blocking communication

signature S_MyProcc (in integer pl_MyPar41, inout integer pl_MyPar42) return integer exception (integer, float);
MujPort_PCO.call(S_MyProcc:{512, 1024}, 1E-1) to system {
[] MujPort_PCO.getreply(MyProcc:{?, ?}) -> value v_MyResult param (v_MyPar1Var,v_MyPar2Var) { }
[] MujPort_PCO.catch(MyProcc, MyExceptionOne) {
setverdict(fail);
stop;
}
[] MujPort_PCO.catch(MyProcc, ExceptionTypeTwo : ?) {
setverdict(inconc);
}
[v_MyCondition] MujPort_PCO.catch(MyProcc, MyExceptionThree) { }
[] MyPort.catch(timeout) {
setverdict(fail);
stop;
}
}

The signature S_MyProcc suitable for blocking communication is defined in the first line. It has two parameters (pl_MyPar41 and pl_MyPar42). The procedure returns an integer value and may raise exceptions, the type of the latter is integer respective float.
In the second line, the procedure is called with a time supervision of 100 ms at the port MujPort_PCO. The port is connected to several components therefore it must be addressed, in our case to the test system interface. The first parameter has the integer value 512, the second one (pl_MyPar2) has the integer value 1024.
The first alternative in the response and exception handling part processes the reply: all values are matched, the returned integer value is stored in the variable v_MyResult and the two returned parameters are stored in the variables v_MyPar1Var and v_MyPar2Var respectively.
The second alternative catches the first exception using the template MyExceptionOne, sets the verdict to fail and stops the test case.
The third alternative catches the second exception using the template MyExceptionTwo and sets the verdict to inconc.
The fourth alternative catches the third exception using the template MyExceptionThree provided that the varibale v_MyCondition equals true and does nothing.
The fifth alternative is activated when timeout occurs, sets the verdict to fail and stops the test case.

BNF definition of call