Hi Pau,
On Thu, Feb 01, 2018 at 12:18:11AM +0100, Pau Espin Pedrol wrote:
thanks for the explanation! However, it's still not clear to me how to get the decoded payload out of the receive statement. From https://www.eclipse.org/forums/index.php/t/1089269/ I saw there's this "@decoded" keyword you can use but I couldn't figure out how to really use it in a proper way, and what exactly I would be getting with it.
The ETSI TTCN-3 language spec actually has plenty of useful examples.
From ETSI ES 201 873-1 V4.8.1, Section 22.2.2 Example 2:
MyPort.receive(MyType2:{header := ?, payload := decmatch mw_myTemplate}) -> value (v_myVar := @decoded payload); // The encoded payload field of the received message is decoded and matched with // mw_myTemplate; if the matching is successful the decoded payload is stored in v_myVar.
I'm also wondering if several decmatch expressions can be stacked in a single statment, for instance image something like:
I have no idea, guess you'd have to try.
RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS(foo, bar, decmatch tr_ANOTHER_TEMPLATE)). Linking it with first question, what I would be getting when using the @decoded keyword in this case?
I guess you should raise that in the Eclipse Titan forum ;)
And extra question I asked myself while doing some tests today: is there a way to check if a template received through a function parameter matches a specific template?
templates cannot match other templates. They can only match values
I tried with match() but from what I understood from the compilation errors, it seems match() actually checks a value vs a template,
correct.
Hm maybe just using "==" would work, I didn't check it.
You can compare if two templates are equal. I would argue that this is not the same as your question "a template matches a template". So using "==" between two identical templates should evaluate true (I don't think I ever tried). But for sure, a more generic template wound not be equal to a more specific template, even though there are values that could match both templates.
Last query: Did you find a good tutorial or well documented examples for beginners in some specific place?
I've so far been looking primarily at * https://www.ttcn-3.org/files/TTCN3_P.pdf * the above-mentioned ETSI core language spec for TTCN-3 * the Eclipse/Ericsson TITAN referenceguide.pdf "Programmers Guide" which is part of https://www.eclipse.org/downloads/download.php?file=/titan/TitanDocuments_6_...