Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » Encode FIELDORDER Attribute over b8 type(Encode FIELDORDER Attribute in B12_type)
Encode FIELDORDER Attribute over b8 type [message #1829510] Mon, 06 July 2020 04:09 Go to next message
yin kaizhong is currently offline yin kaizhongFriend
Messages: 2
Registered: June 2020
Junior Member
I try to encode recorde use FIELDORDER Attribute;

code:
type bitstring B3_Type length(3)
type bitstring B1_Type length(1)
type bitstring B12_Type length(12);

group test1
{
type record order_Test {
B1_Type D_C,
B3_Type Reserved,
B12_Type SequenceNumber
} with {
variant "FIELDORDER(msb)"
};
} with { encode "RAW"}

testcase F_test() runs on MTCType system MTCType
{
var order_Test tt1 := {'1'B, '000'B, '000000000001'B};
var bitstring v_Bitstring := encvalue(p_PDCP_PDU);
var octetstring v_Octetstring := bit2oct(v_Bitstring);
log(v_Bitstring);
log(v_Octetstring);
}

////////////////
The result log:
'1000000100000000'B
'8100'O

but I want get result like this:
'1000000000000001'B
'8001'O



And do the next test code:
group test1
{
type record order_Test {
B1_Type D_C,
B3_Type Reserved,
B4_Type b4v,
B8_Type b8v
} with {
variant "FIELDORDER(msb)"
};
} with { encode "RAW"}
////////////////
The result log:
'1000000000000001'B
'8001'O

It's the result I want.

so, how to use FIELDORDER Attribute in B12_type can get my want result?? thanks
Re: Encode FIELDORDER Attribute over b8 type [message #1829517 is a reply to message #1829510] Mon, 06 July 2020 05:25 Go to previous message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Yin,


you need to use BYTEORDER for SequenceNumber of type B12_Type to swap positions (the leading half byte will be moved to the end),

as below:

type record order_Test {
B1_Type D_C,
B3_Type Reserved,
B12_Type SequenceNumber
} with {
variant "FIELDORDER(msb)"
variant (SequenceNumber) "BYTEORDER(last)"
};



This results in the following encoding:

07:19:49.142963 RAWTest4.ttcn:29 Encode '8001'O
07:19:49.145019 RAWTest4.ttcn:31 EncodedBitstr '1000000000000001'B




Best regards
Elemer
Previous Topic:Implementing components in C++
Next Topic:compiler.exe -s0 for Windows
Goto Forum:
  


Current Time: Sun Oct 06 20:28:03 GMT 2024

Powered by FUDForum. Page generated in 0.04372 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top