Exmbus.Parser.Afl.FragmentationControlField (Exmbus v0.4.0)

View Source

AFL Fragmentation Control Field (FCL) as per EN 13757-7:2018

BitField NameDescription
15RESReserved (0b0 by default)
14MFMore-Fragments
0b0 This is the last fragment
0b1 More fragments are following
13MCLPMessage Control in this Fragment Present *a
12MLPMessage Length in this Fragment Present *a
11MCRPMessage counter in this Fragment Present *a
10MACPMAC in this Fragment Present *a
9KIPKey Information in this Fragment Present *a
8RESReserved (0b0 by default)
7 to 0FIDFragment-ID
  • *a 0 = field is not present; 1 = field is present

The Fragment ID is used for the identification of each single fragment of a long message. Set FID to 1 for the first fragment of a fragmented message. FID shall increment with each fragment. The FID shall never roll over. For unfragmented messages the FID shall be set to 0.

Summary

Functions

Parses the Fragmentation Control Field (FCL) from the AFL.

Encodes the Fragmentation Control Field (FCL) to a binary format.

If the fragment ID is greater than 0, the message is fragmented

Functions

decode(arg)

Parses the Fragmentation Control Field (FCL) from the AFL.

Examples

iex> decode(<<0b00000000, 0b00101100>>)
{:ok, %Exmbus.Parser.Afl.FragmentationControlField{
  more_fragments?: false,
  message_control_present?: true,
  message_length_present?: false,
  message_counter_present?: true,
  mac_present?: true,
  key_information_present?: false,
  fragment_id: 0
}}

encode(fcl)

Encodes the Fragmentation Control Field (FCL) to a binary format.

Examples

iex> encode(%Exmbus.Parser.Afl.FragmentationControlField{
...> more_fragments?: false,
...> message_control_present?: true,
...> message_length_present?: false,
...> message_counter_present?: true,
...> mac_present?: true,
...> key_information_present?: false,
...> fragment_id: 0
...> })
<<0b00000000, 0b00101100>>

fragmented?(fragmentation_control_field)

If the fragment ID is greater than 0, the message is fragmented