EQRCode.Encode (EQRCode v0.1.10) View Source
Data encoding in Byte Mode.
Link to this section Summary
Functions
Returns bits for any binary data.
Encode the binary.
Returns the lowest version for the given binary.
Link to this section Functions
Specs
bits(bitstring()) :: [0 | 1]
Returns bits for any binary data.
Examples
iex> EQRCode.Encode.bits(<<123, 4>>)
[0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0]
Specs
encode(binary(), EQRCode.SpecTable.error_correction_level()) :: {EQRCode.SpecTable.version(), EQRCode.SpecTable.error_correction_level(), [0 | 1]}
Encode the binary.
Examples
iex> EQRCode.Encode.encode("hello world!", :l)
{1, :l, [0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1,
0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1,
0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1,
1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0,
0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1,
1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0]}
Specs
encode(binary(), EQRCode.SpecTable.error_correction_level(), bitstring()) :: {EQRCode.SpecTable.version(), EQRCode.SpecTable.error_correction_level(), [0 | 1]}
Specs
version(binary(), EQRCode.SpecTable.error_correction_level()) :: {:error, :no_version_found} | {:ok, EQRCode.SpecTable.version()}
Returns the lowest version for the given binary.
Examples
iex> EQRCode.Encode.version("hello world!", :l)
{:ok, 1}