ex_bardecode

Unofficial Elixir NIF for Softek Barcode Reader Toolkit.

NOTE: test/fixtures/barcode.jpg should be removed from history if this repository is made public.

Installation

If available in Hex, the package can be installed by adding bardecode to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_bardecode, "~> 0.9.5"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ex_bardecode.

Usage

Bardecode exposes three functions for reading barcodes from different sources.

Bardecode.read_barcode(
  "barcode.jpg",
  %{
    license: "license key", 
    type: [:pdf417, :code128],
    multiple: true
  }
)

The options map is the same for all three functions.

Tasks

Task Description
mix compile Builds bardecode, downloading the library if needed
mix clean Removes files created by mix compile
mix test Run the test suite
mix hex.publish Publish a new version to Hex.pm

Test under Linux using a Docker container:

docker build . -t ex_bardecode
docker run -it ex_bardecode /bin/bash
mix test --trace

Code Layout

File Description
src/bardecode.c C code for the NIF
src/barcode.h Header file copied from the library
lib/bardecode.ex Elixir function stubs for calling C
test/bardecode_test.exs Elixir test suite
Makefile For building the NIF using mix compile

Resources