Barcode Reader & Decoder Software

Home arrow Barcode Recognition SDK arrow Android SDK Docs
Home
 
Barcode Recognition SDK
 
 
Barcode Scanner
 
Document Processor
 
Buy Now
  
FAQs
 
Support
 
OnLine Barcode Decoder

Our Barcode Creation Tools:
www.BarcodeTools.com

On-Line Barcode Generator:
www.bcmaker.com

Barcode Generator
Android Barcode Reader SDK documentation
DataSymbol Barcode Decoding SDK

Text Box: RKD Software
www.DataSymbol.com
www.BarcodeTools.com
Text Box: DataSymbol Barcode Decoding SDK
Android  Barcode Decoding Library
Developer’s Guide


 


Table of Contents

 

Introduction. 3

Requirements. 4

Installation. 4

Directory Structure. 4

Technical Specifications. 5

Getting Started. 6

BarcodeReaderWrapper methods. 9

InitLib. 9

FreeLib. 9

Renew.. 9

getDeviceID.. 10

Decode. 10

BarcodeReaderWrapper members. 12

General 12

Decoder Settings. 12

Barcode Types. 13

Error Codes. 14

DecodingResult members. 15

 


 

Introduction

 

Android DataSymbol SDK is a barcode decoding library that can easily be integrated into a customer's applications.

DataSymbol SDK is supplied as a “.so” file (Dynamic Link Library).

High performance and reliable barcode decoding. It reads torn, crumpled barcodes and also barcodes corrupted in other ways. Decodes barcodes printed on various surfaces - plastic surfaces, distorted surfaces, etc.

Can search only part of image for barcodes.

Reads all barcodes from an image at a once independently of the orientation and location of the barcode.

Does not require the barcode to have a quiet zone. That is why it can read incorrectly positioned barcodes.

Can read barcodes from noisy and blurred images.

It can find barcodes that cannot be recognized.

Decodes images that have distortions typical of scanned images and images received by fax.

Processes low resolution and dithering images.

Decodes barcodes with human-introduced artifacts (signatures, marks, etc.).


 

Requirements

The DataSymbol SDK library has the following system requirements:

·         Android 2.1 or higher

·         Eclipse developer environment

 

Installation

Copy the SDK in any folder of your machine.

 

Directory Structure

DataSymbol SDK is a dynamic library written on С++. You should include into your project (libs/armeabi folder) only one file libbarcodereader.so.

The DataSymbol SDK contains the following directories and files:

/BarcodeReader/BarcodeDecoder/
libs/armeabi

libbarcodereader.so

/BarcodeReader/BarcodeDecoder/src/

com/datasymbol/barcodereader

Barcode reader wrapper.

·         BarcodeReaderWrapper.java

·         DecodingResult.java

/BarcodeReader

Eclipse workspace

/BarcodeDecoder

Eclipse example.

/BarcodeDecoder1

Eclipse example.

 


 

Technical Specifications

Decodes all popular barcode types.

Linear:

Interleaved 2/5, Industrial 2/5, Code 39, Code 39 Extended, Codabar, Code 11, Code 128, Code 128 Extended, EAN/UCC 128, UPC-E, UPC-A, EAN-8, EAN-13, Code 93, Code 93 Extended, DataBar Omnidirectional (RSS-14), DataBar Truncated (RSS-14 Truncated), DataBar Limited (RSS Limited), DataBar Stacked, DataBar Expanded, DataBar Expanded Stacked.

2D: PDF417 (PDF417 Compact), QRCode, DataMatrix, Aztec (Aztec Compact)

Decodes any oriented barcodes.

Decoding time: depends from many factors (library settings, image size, barcode count, etc.) but usually up to 50ms on 2 GHz machine on 840x480 image.

 

Approximately barcode resolution (minimal module size) in pixel

Linear:             0.7 px

PDF417:          1.3 px

DataMatrix:    2 px

QRCode:         1.6 px

AztecCode:      1.6 px


 

Getting Started

Open BarcodeReader workspace.

eclipse.bmp

 

 

 

When you start BarcodeReader workspace first time you can see this error.

 

 

 

 

 

You need to set path to your Android SDK. Go to Windows-Preferences-Android and set the correct “SDK Location”

 

err2.png

 

 

 

 

If you have no Android API version 3 (used in example project), you can see this error.

 

err3.png

 

 

Go to the Project Properties and set correct API level you have.

 

err4.png

 

 

 

Clean Project.

err5.png

 

 

The usage of the library is very simple. Here below, please, find the typical sample of the library usage.

 

 BarcodeReaderWrapper mbr;

 mbr = new BarcodeReaderWrapper();

 mbr.barcodeTypes |= BarcodeReaderWrapper.ST_AZTECCODE; //add AztecCode

 mbr.InitLib( context );

 

 public void onPreviewFrame(byte[] data, Camera camera)

 {

   //supported formats

   int fmt = camera.getParameters().getPreviewFormat();

   if( !(fmt == PixelFormat.YCbCr_422_SP ||

         fmt == PixelFormat.YCbCr_420_SP) )

      return;

 

   //preview size

   int width = camera.getParameters().getPreviewSize().width;

   int height = camera.getParameters().getPreviewSize().height;

 

   //decode the frame

   DecodingResult[] decRes = mbr.Decode(data, width, height, 0, 0, 0, 0);

 

   //successful

   if( mbr.decError == 0 && decRes != null && decRes.length != 0 )

   {

     String sBarcodeText = new String( decRes[0].data, 0,

      decRes[0].data.length );

   }

 

 


BarcodeReaderWrapper methods

 

InitLib
Initializes library. You need to call this method before any else.

Syntax

    public native boolean InitLib(Object activity);

 

 

Parameters

activity

Activity object. If you are working in demo mode you can set null.

 

Return Value

True if no errors.

 

FreeLib
Finalizes working with library.

Syntax

    public native boolean FreeLib();

 

 

Return Value

True if no errors.

 

Renew
Force re-reading barcode decoder settings.

Syntax

    public native boolean Renew();

 

 

 

 

 

 

 

 

Example

 

 BarcodeReaderWrapper mbr;

 mbr = new BarcodeReaderWrapper();

 mbr.barcodeTypes |= BarcodeReaderWrapper.ST_AZTECCODE; //add AztecCode

 mbr.InitLib( context );

 

 //change decoder settings after initialization

 mbr.barcodeTypes |= BarcodeReaderWrapper.ST_QRCODE;

 

 mbr.Renew();

 

 

Return Value

True if no errors.

 

getDeviceID
Returns device ID. This ID has been used to activate SDK library on the device.

Syntax

    public native String getDeviceID(Object activity);

 

 

Return Value

Device ID string.

 

Decode
Decodes one frame. The frame is a byte matrix. Each byte has the value from 0 to 255 and represents one image pixel. 0 means a black pixel, 255 means a white pixel. Pixels are placed from the left to the right, from top to bottom, row by row.

The matrix is passed to the Decode method as a one-dimensional array. The first upper line of the image is sent first, then comes the second line and so on.

See the picture below for explanation.

rawdata.gif

Syntax

    public native DecodingResult[] Decode( byte[] img, int width, int height, 

            int left, int top, int right, int bottom );

 

Parameters

img

Array of bytes that contains the frame

width

frame width

height

frame height

left, top, right, bottom

scanning zone rectangle, if all parameters are null then scan whole frame

 

Return Value

DecodingResult array.


 

BarcodeReaderWrapper members

 

General

sKey

Set this field if you have the license key to set SDK in production mode.

 

Example:

  BarcodeReaderWrapper mbr;

  mbr = new BarcodeReaderWrapper();

  mbr.sKey = “MQgqfP6lARpINhTpNvxXh9vE3k...”;

  mbr.InitLib( context );

 

decError

SDK saves in this field the decoding error or BR_OK if no errors

Decoder Settings

barcodeTypes

Sets what types of barcodes should be decoded. Each barcode type has specified integer value. The barcodeTypes property can consist of any combination of these values, you should use the OR for that.

Example:

barcodeTypes = DW_ST_PDF417|DW_ST_QRCODE;

inverseType

Sets what barcodes should be decoded (darks on light or lights on dark).

Decoder Settings (Linear)

bLinearShowSymbologyID

Sets the value determining whether to add Symbology ID to the barcode text or not.

uiLinearFindBarcodes

Sets how many Linear barcodes should be decoded on the image. An image may contain one or several barcodes. Works only in Professional edition, Standard decodes only one barcode.

bLinearVerifyCheckDigit

Sets the value determining whether to verify the optional check digit in barcodes where this check digit is optional.

bLinearShowCheckDigit

Show the check digit or not.

bLinearShowStartStop

Show the start/stop characters or not. Some barcode types have start/stop characters (for example, Code39).

bLinearCode39EnableExtended

Decode Code 39 as Code 39 Extended or not.

bLinearUPCE2UPCA

Convert a UPC-E barcode to UPC-A or not.

uiLinearInterl25MinLen

The minimum length of an Interleaved 2/5 barcode. If the length of a read barcode is less than this value, the barcode is considered unrecognized.

uiLinearInterl25MaxLen

The maximum length of an Interleaved 2/5 barcode.

uiLinearIndustr25MinLen

The minimum length of an Industrial 2/5 barcode.

uiLinearIndustr25MaxLen

The maximum length of an Industrial 2/5 barcode.

uiLinearCode11MinLen

The minimum length of a Code11 barcode.

uiLinearCode11MaxLen

The maximum length of a Code11 barcode.

uiLinearCode39MinLen

The minimum length of a Code39 barcode.

uiLinearCode39MaxLen

The maximum length of a Code39 barcode.

uiLinearCode128MinLen

The minimum length of a Code128 barcode.

uiLinearCode128MaxLen

The maximum length of a Code128 barcode.

uiLinearCodabarMinLen

The minimum length of a Codabar barcode.

uiLinearCodabarMaxLen

The maximum length of a Codabar barcode.

uiLinearCode93MinLen

The minimum length of a Code93 barcode.

uiLinearCode93MaxLen

The maximum length of a Code93 barcode.

LinearDecSpeed

Linear barcode reading speed. Possible values:

·         0 - Normal

·         1 - Fast

·         2 - Slow

bLinearVerify

Verify linear barcode after decoding. Improves reliability linear barcode reading.

Decoder Settings (PDF417)

uiPDF417FindBarcodes

Sets how many PDF417 barcodes should be decoded on the image.

bPDF417Fast

PDF417 barcode reading speed.

Decoder Settings (DataMatrix)

uiDataMatrixFindBarcodes

Sets how many DataMatrix barcodes should be decoded on the image.

DataMatrixDecSpeed

DataMatrix barcode reading speed.

Decoder Settings (QRCode)

uiQRCodeFindBarcodes

Sets how many QRCode barcodes should be decoded on the image.

QRCodeDecSpeed

QRCode barcode reading speed.

Decoder Settings (AztecCode)

uiAztecCodeFindBarcodes

Sets how many AztecCode barcodes should be decoded on the image.

AztecCodeDecSpeed

AztecCode barcode reading speed.

Barcode Types

DW_ST_CODE128

Code 128

DW_ST_CODE39

Code 39

DW_ST_INTERL25

Interleaved 2/5

DW_ST_EAN13

EAN-13

DW_ST_EAN8

EAN-8

DW_ST_CODABAR

Codabar

DW_ST_CODE11

Code 11

DW_ST_UPCA

UPC-A

DW_ST_UPCE

UPC-E

DW_ST_INDUSTR25

Industrial 2/5

DW_ST_CODE93

Code 93

DW_ST_DATABAR_OMNI

DataBar omnidirectional, DataBar Truncated

DW_ST_DATABAR_LIM

DataBar limited

DW_ST_DATABAR_STACKED

DataBar stacked

DW_ST_DATABAR_EXP

DataBar Expanded

DW_ST_DATABAR_EXP_STACKED

DataBar Expanded stacked

DW_ST_LINEAR_UNDEC

unrecognized linear

DW_ST_PDF417_UNDEC

unrecognized PDF417

DW_ST_DATAMATRIX_UNDEC

unrecognized DataMatrix

DW_ST_QRCODE_UNDEC

unrecognized QRCode

DW_ST_AZTECCODE_UNDEC

unrecognized AztecCode

DW_ST_DATAMATRIX

DataMatrix

DW_ST_PDF417

PDF417

DW_ST_QRCODE

QRCode

DW_ST_AZTECCODE

AztecCode

Error Codes

BR_OK

Ok

BR_ERROR

Error

BR_NULL_DATA

img parameter in the Decode method is empty

BR_DATA_ERR_LEN

byte array length (Decode method) doesn't much to width and height

BR_CANT_GET_ARRAY

unable to get byte array elements

BR_LIB_NOT_INIT

library is not initialized

BR_DECODING_ERR

decoding error

BR_PACK_RESULT

can't transfer decoding result

 


 

DecodingResult members

 

barcodeType

Barcode type

data

Barcode data (byte array)

x1, y1, …

Barcode coordinates

 

 

Copyright © 1999-2017, RKD Software & RKD System Inc., All rights reserved.
All trademarks mentioned are the property of their respective owners.