View Source QRCodeEx.Encode (QRCodeEx v0.1.1)

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> QRCodeEx.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> QRCodeEx.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(), QRCodeEx.SpecTable.error_correction_level()) ::
  {:error, :no_version_found} | {:ok, QRCodeEx.SpecTable.version()}

Returns the lowest version for the given binary.

Example:

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