harald v0.1.1 Harald.Transport.UART.Framing View Source
A framer module that defines a frame as a HCI packet.
Reference: Version 5.0, Vol 2, Part E, 5.4
Link to this section Summary
Functions
Returns a tuple like {remaining_desired_length, part_of_bin, rest_of_bin}
Link to this section Functions
Link to this function
binary_split(bin, desired_length) View Source
Returns a tuple like {remaining_desired_length, part_of_bin, rest_of_bin}
.
iex> binary_split(<<1, 2, 3, 4>>, 0)
{0, <<>>, <<1, 2, 3, 4>>}
iex> binary_split(<<1, 2, 3, 4>>, 2)
{0, <<1, 2>>, <<3, 4>>}
iex> binary_split(<<1, 2, 3, 4>>, 4)
{0, <<1, 2, 3, 4>>, <<>>}
iex> binary_split(<<1, 2, 3, 4>>, 6)
{2, <<1, 2, 3, 4>>, <<>>}