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.
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.
Example:
iex> QRCodeEx.Encode.bits(<<123, 4>>)
[0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0]
Specs
encode(binary(), QRCodeEx.SpecTable.error_correction_level()) :: {QRCodeEx.SpecTable.version(), QRCodeEx.SpecTable.error_correction_level(), [0 | 1]}
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]}
Specs
encode(binary(), QRCodeEx.SpecTable.error_correction_level(), bitstring()) :: {QRCodeEx.SpecTable.version(), QRCodeEx.SpecTable.error_correction_level(), [0 | 1]}
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}