Exmbus.Parser.Binary (Exmbus v0.3.0)
View SourceUtility to find and collect bytes in a binary.
Summary
Functions
Collect a sequence of bytes where the first bit in each byte represents if the next byte is part of the sequence. Meaning the returned binary will have the first bit of each byte set, except the last byte.
Functions
Collect a sequence of bytes where the first bit in each byte represents if the next byte is part of the sequence. Meaning the returned binary will have the first bit of each byte set, except the last byte.
Examples:
iex> {:ok, <<0xFF, 0x00>>, <<0x00>>} = collect_by_extension_bit(<<0xFF, 0x00, 0x00>>)
iex> {:ok, <<0x00>>, <<0x00>>} = collect_by_extension_bit(<<0x00, 0x00>>)
iex> {:ok, <<0x80, 0x80, 0x00>>, <<0x00>>} = collect_by_extension_bit(<<1::1, 0::7, 1::1, 0::7, 0x00, 0x00>>)