EQRCode.Encode (EQRCode v0.1.8) View Source

Data encoding in Byte Mode.

Link to this section Summary

Functions

Returns bits for any binary data.

Returns the lowest version for the given binary.

Link to this section Functions

Specs

bits(bitstring()) :: [0 | 1]

Returns bits for any binary data.

Example:

iex> EQRCode.Encode.bits(<<123, 4>>)
[0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0]
Link to this function

encode(bin, error_correction_level)

View Source

Specs

Encode the binary.

Example:

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]}
Link to this function

encode(bin, error_correction_level, bits)

View Source

Specs

Link to this function

version(bin, error_correction_level)

View Source

Specs

version(binary(), EQRCode.SpecTable.error_correction_level()) ::
  {:error, :no_version_found} | {:ok, EQRCode.SpecTable.version()}

Returns the lowest version for the given binary.

Example:

iex> EQRCode.Encode.version("hello world!", :l)
{:ok, 1}