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

View Source

AFL Message Control Field (MCL) as per EN 13757-7:2018

BitField NameDescription
7RESReserved (0b0 by default)
6MLMPMessage Length in Message Present *a
5MCMPMessage counter in Message Present *a
4KIMPKey Information in Message Present *a
3AT
2ATAuthentication-Type (see Table 6)
1AT
0AT
  • *a 0 = field is not present; 1 = field is present

The bits 4 to 7 in the AFL.MCL field define the presence of additional fields in the message.

If the AFL.MCL field is used it always shall be present in the first fragment. It shall not be present in any following fragments of the same message.

That is, we can expect the MCL field in fragment_id == 0x01.

Summary

Functions

Returns the authentication type and it's length

Parses the Message Control Field (MCL) from the AFL.

Encodes the Message Control Field (MCL) to a binary.

Functions

authentication_type(message_control_field)

Returns the authentication type and it's length

decode(arg)

Parses the Message Control Field (MCL) from the AFL.

Examples

iex> decode(<<0b00000000>>)
{:ok, %Exmbus.Parser.Afl.MessageControlField{
  message_length_present?: false,
  message_counter_present?: false,
  key_information_present?: false,
  authentication_type: 0
}}

encode(arg1)

Encodes the Message Control Field (MCL) to a binary.

Examples

iex> encode(%Exmbus.Parser.Afl.MessageControlField{
...>   message_length_present?: false,
...>   message_counter_present?: false,
...>   key_information_present?: false,
...>   authentication_type: 0b0000
...> })
<<0b00000000>>

iex> encode(%Exmbus.Parser.Afl.MessageControlField{
...>   message_length_present?: true,
...>   message_counter_present?: true,
...>   key_information_present?: true,
...>   authentication_type: 0b0011
...> })
<<0b01110011>>

iex> encode(nil)
<<>>