sdt.brc.android
Class BarcodeReader

java.lang.Object
  extended by sdt.brc.android.BarcodeReader

public class BarcodeReader
extends Object

The Barcode engine for reading barcodes from image


Field Summary
static int SDTBARCODE_ALL_1D
          All 1-D Barcodes flag (0x0001ffff) combining all 1-D barcode types currently supported by SD-TOOLKIL Barcode SDK 2.1 for Android
static int SDTBARCODE_ALL_2D
          All 2-D Barcodes flag (0x000e0000) combining all 1-D barcode types currently supported by SD-TOOLKIL Barcode SDK 2.1 for Android
static int SDTBARCODE_CODABAR
          Codabar barcode type flag (0x00000001).
static int SDTBARCODE_CODE11
          Code 11 barcode type flag (0x00000020).
static int SDTBARCODE_CODE128
          Code 128 barcode type flag (0x00000002).
static int SDTBARCODE_CODE32
          Code 32 barcode type flag (0x00000004).
static int SDTBARCODE_CODE39
          Code 39 barcode type flag (0x00000008).
static int SDTBARCODE_CODE93
          Code 93 barcode type flag (0x00000010).
static int SDTBARCODE_DATAMATRIX
          DataMatrix barcode type flag (0x00020000)
static int SDTBARCODE_EAN13
          EAN13 barcode type flag (0x00000040).
static int SDTBARCODE_EAN5
          EAN5 barcode type flag (0x00000100).
static int SDTBARCODE_EAN8
          EAN8 barcode type flag (0x00000080).
static int SDTBARCODE_I2OF5
          I2of5 barcode type flag (0x00000200).
static int SDTBARCODE_INTELLIMAIL
          Intelligent Mail barcode type flag (0x00010000)
static int SDTBARCODE_PATCH_CODE
          Patch code barcode type flag (0x00000400).
static int SDTBARCODE_PDF417
          PDF417 barcode type flag (0x00040000)
static int SDTBARCODE_PLUS2
          Plus2 barcode type flag (0x00001000).
static int SDTBARCODE_PLUS5
          Plus5 barcode type flag (0x00002000).
static int SDTBARCODE_POSTNET
          Postnet barcode type flag (0x00000800).
static int SDTBARCODE_QRCODE
          QR Code barcode type flag (0x00080000)
static int SDTBARCODE_UNKNOWN
          Unknown barcode type flag (0x00000000).
static int SDTBARCODE_UPCA
          UPC-A barcode type flag (0x00004000).
static int SDTBARCODE_UPCB
          UPC-B barcode type flag (0x00008000).
static int SDTREADDIRECTION_ALL
          All supported reading directions flag flag (0x0f).
static int SDTREADDIRECTION_BTT
          Right-to-Left barcode reading direction flag (0x08).
static int SDTREADDIRECTION_LTR
          Left-to-right barcode reading direction flag (0x01).
static int SDTREADDIRECTION_RTL
          Right-to-Left barcode reading direction flag (0x02).
static int SDTREADDIRECTION_TTB
          Right-to-Left barcode reading direction flag (0x04).
 
Constructor Summary
BarcodeReader(Context context, String licenseKey)
          Creates a new BarcodeReader object
 
Method Summary
 void finalize()
           
 BarcodeReaderResult getResultAt(int pos)
          The method returns BarcodeReaderResult object containg information about successfully recognized barcode in the previous call to readRGBBuffer(byte[] data, int width, int height, int bpp).
 int getResultsCount()
          The method returns count of successfully recognized barcodes in the previous call to readRGBBuffer(byte[] data, int width, int height, int bpp)
 int readRGBBuffer(byte[] data, int width, int height, int bpp)
          The method reads the image data from RGB image buffer allocated in memory.
 int readRGBBufferInt(int[] data, int width, int height)
          The method reads the image data from RGB 32 image integer buffer allocated in memory.
 void setActiveScanRectangle(int left, int top, int right, int bottom)
          The method defines the square area within the image where the reader will look for barcodes in next call to readRGBImageBuffer(byte[], int, int, int).
 void setExpectedBarcodesCount(int count)
          The method limit the recognition to only one barcode symbol.
 void setReadInputDirections(long dwFlags)
          The method specifies barcode reading directions the Barcode Reader will use to scan the image in next call to readRGBImageBuffer(byte[], int, int, int).
 void setReadInputTypes(long dwFlags)
          The method specifies barcode types the Barcode Reader will look for in next call to readRGBImageBuffer(byte[], int, int, int).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SDTBARCODE_UNKNOWN

public static int SDTBARCODE_UNKNOWN
Unknown barcode type flag (0x00000000).


SDTBARCODE_CODABAR

public static int SDTBARCODE_CODABAR
Codabar barcode type flag (0x00000001).


SDTBARCODE_CODE128

public static int SDTBARCODE_CODE128
Code 128 barcode type flag (0x00000002).


SDTBARCODE_CODE32

public static int SDTBARCODE_CODE32
Code 32 barcode type flag (0x00000004). Code 32 barcode is also known as Base 32, Pharma 32/39, and Italian Pharmacode.


SDTBARCODE_CODE39

public static int SDTBARCODE_CODE39
Code 39 barcode type flag (0x00000008).


SDTBARCODE_CODE93

public static int SDTBARCODE_CODE93
Code 93 barcode type flag (0x00000010).


SDTBARCODE_CODE11

public static int SDTBARCODE_CODE11
Code 11 barcode type flag (0x00000020).


SDTBARCODE_EAN13

public static int SDTBARCODE_EAN13
EAN13 barcode type flag (0x00000040).


SDTBARCODE_EAN8

public static int SDTBARCODE_EAN8
EAN8 barcode type flag (0x00000080).


SDTBARCODE_EAN5

public static int SDTBARCODE_EAN5
EAN5 barcode type flag (0x00000100).


SDTBARCODE_I2OF5

public static int SDTBARCODE_I2OF5
I2of5 barcode type flag (0x00000200). (Interleaved 2 of 5 also known as Code25)


SDTBARCODE_PATCH_CODE

public static int SDTBARCODE_PATCH_CODE
Patch code barcode type flag (0x00000400).


SDTBARCODE_POSTNET

public static int SDTBARCODE_POSTNET
Postnet barcode type flag (0x00000800).


SDTBARCODE_PLUS2

public static int SDTBARCODE_PLUS2
Plus2 barcode type flag (0x00001000). (2-digit supplementals associated with EAN and UPC)


SDTBARCODE_PLUS5

public static int SDTBARCODE_PLUS5
Plus5 barcode type flag (0x00002000). (5-digit supplementals associated with EAN and UPC)


SDTBARCODE_UPCA

public static int SDTBARCODE_UPCA
UPC-A barcode type flag (0x00004000).


SDTBARCODE_UPCB

public static int SDTBARCODE_UPCB
UPC-B barcode type flag (0x00008000).


SDTBARCODE_INTELLIMAIL

public static int SDTBARCODE_INTELLIMAIL
Intelligent Mail barcode type flag (0x00010000)


SDTBARCODE_ALL_1D

public static int SDTBARCODE_ALL_1D
All 1-D Barcodes flag (0x0001ffff) combining all 1-D barcode types currently supported by SD-TOOLKIL Barcode SDK 2.1 for Android


SDTBARCODE_DATAMATRIX

public static int SDTBARCODE_DATAMATRIX
DataMatrix barcode type flag (0x00020000)


SDTBARCODE_PDF417

public static int SDTBARCODE_PDF417
PDF417 barcode type flag (0x00040000)


SDTBARCODE_QRCODE

public static int SDTBARCODE_QRCODE
QR Code barcode type flag (0x00080000)


SDTBARCODE_ALL_2D

public static int SDTBARCODE_ALL_2D
All 2-D Barcodes flag (0x000e0000) combining all 1-D barcode types currently supported by SD-TOOLKIL Barcode SDK 2.1 for Android


SDTREADDIRECTION_LTR

public static int SDTREADDIRECTION_LTR
Left-to-right barcode reading direction flag (0x01). Corresponds to normally positioned barcode.


SDTREADDIRECTION_RTL

public static int SDTREADDIRECTION_RTL
Right-to-Left barcode reading direction flag (0x02). Corresponds to 180 degrees rotated barcode


SDTREADDIRECTION_TTB

public static int SDTREADDIRECTION_TTB
Right-to-Left barcode reading direction flag (0x04). Corresponds to 90 degrees CW rotated barcode


SDTREADDIRECTION_BTT

public static int SDTREADDIRECTION_BTT
Right-to-Left barcode reading direction flag (0x08). Corresponds to 90 degrees CCW rotated barcode


SDTREADDIRECTION_ALL

public static int SDTREADDIRECTION_ALL
All supported reading directions flag flag (0x0f).

Constructor Detail

BarcodeReader

public BarcodeReader(Context context,
                     String licenseKey)
Creates a new BarcodeReader object

Parameters:
licenseKey - Developer License Key
Method Detail

finalize

public void finalize()
Overrides:
finalize in class Object

setExpectedBarcodesCount

public void setExpectedBarcodesCount(int count)
The method limit the recognition to only one barcode symbol. Once first barcode symbol will be recognized on image the readRGBImageBuffer(byte[], int, int, int) or readRGBImageBufferInt(int[], int, int, int) will returns immidiatelly

Parameters:
count - [in] number of expected barcode symbols

setActiveScanRectangle

public void setActiveScanRectangle(int left,
                                   int top,
                                   int right,
                                   int bottom)
The method defines the square area within the image where the reader will look for barcodes in next call to readRGBImageBuffer(byte[], int, int, int). If one of boundary values passed to the function exceeds input image size then image boundary will be used instead.

Parameters:
left - [in] positive integer value specified left boundary of the scan area in pixels
top - [in] positive integer value specified top boundary of the scan area in pixels
right - [in] positive integer value specified right boundary of the scan area in pixels
bottom - [in] positive integer value specified bottom boundary of the scan area in pixels

setReadInputTypes

public void setReadInputTypes(long dwFlags)
The method specifies barcode types the Barcode Reader will look for in next call to readRGBImageBuffer(byte[], int, int, int). By default the Barcode Reader look for all barcode types.

Parameters:
dwFlags - [in] Specifies barcode types the Barcode Reader will look for. This parameter can be one or combination of the following values:

Value Integer Value Description
SDTBARCODE_CODABAR 0x00000001 Codabar barcode
SDTBARCODE_CODE128 0x00000002 Code 128 barcode
SDTBARCODE_CODE32 0x00000004 Code 32 (also known as Base 32, Pharma 32/39, and Italian Pharmacode)
SDTBARCODE_CODE39 0x00000008 Code 39 barcode
SDTBARCODE_CODE93 0x00000010 Code 93 barcode
SDTBARCODE_CODE11 0x00000020 Code 11 barcode
SDTBARCODE_EAN13 0x00000040 EAN13 barcode
SDTBARCODE_EAN8 0x00000080 EAN8 barcode
SDTBARCODE_EAN5 0x00000100 EAN5 barcode
SDTBARCODE_I2OF5 0x00000200 Interleaved 2 of 5 barcode
SDTBARCODE_PATCH_CODE 0x00000400 Patch code barcode
SDTBARCODE_POSTNET 0x00000800 Postnet barcode
SDTBARCODE_PLUS2 0x00001000 Plus2 (2-digit supplementals assoc. with EAN and UPC)
SDTBARCODE_PLUS5 0x00002000 Plus5 (5-digit supplementals assoc. with EAN and UPC)
SDTBARCODE_UPCA 0x00004000 UPC-A barcode
SDTBARCODE_UPCB 0x00008000 UPC-B barcode
SDTBARCODE_INTELLIMAIL 0x00010000 Intelligent Mail barcode
SDTBARCODE_ALL_1D 0x0001ffff All above 1-D Barcodes currently supported by SD-TOOLKIT Barcode Reader SDK 2.1 for Android
SDTBARCODE_DATAMATRIX 0x00020000 DataMatrix 2D Barcode
SDTBARCODE_PDF417 0x00040000 PDF417 2D Barcode
SDTBARCODE_QRCODE 0x00080000 QR Code 2D Barcode
SDTBARCODE_ALL_2D 0x000e0000 All above 2-D Barcodes currently supported by SD-TOOLKIT Barcode Reader SDK 2.1 for Android


setReadInputDirections

public void setReadInputDirections(long dwFlags)
The method specifies barcode reading directions the Barcode Reader will use to scan the image in next call to readRGBImageBuffer(byte[], int, int, int). By default the Barcode Reader look in all directions.

Parameters:
dwFlags - [in] Specifies barcode types the Barcode Reader will look for. This parameter can be one or combination of the following values:

Value Integer Value Description
SDTREADDIRECTION_LTR 0x00000001 Left-to-Right. Corresponds to normally oriented barcodes.
SDTREADDIRECTION_RTL 0x00000002 Right-to-Left. Corresponds to 180 degrees rotated barcodes.
SDTREADDIRECTION_TTB 0x00000004 Top-to-Bottom. Corresponds to 90 degrees clock-wise rotated barcodes.
SDTREADDIRECTION_BTT 0x00000008 Bottom-to-Top. Corresponds to 90 degrees counter-clock-wise rotated barcodes.
SDTREADDIRECTION_ALL 0x00000010 All possible directions.


readRGBBuffer

public int readRGBBuffer(byte[] data,
                         int width,
                         int height,
                         int bpp)
The method reads the image data from RGB image buffer allocated in memory. The recognition results are stored internally and can be obtained by call to getResultAt(int pos).

Parameters:
data - [in] buffer allocated in memory and filled in with RGB or grayscale data
width - [in] image width in pixels
height - [in] image height in pixels
bpp - [in] bits per pixels. The following values are supported: 32, 24, 16, 8(grayscale)
Returns:
Number of successfully recognized barcode symbols.

readRGBBufferInt

public int readRGBBufferInt(int[] data,
                            int width,
                            int height)
The method reads the image data from RGB 32 image integer buffer allocated in memory. The recognition results are stored internally and can be obtained by call to getResultAt(int pos).

Parameters:
data - [in] buffer allocated in memory and filled in with RGB
width - [in] image width in pixels
height - [in] image height in pixels
Returns:
Number of successfully recognized barcode symbols.

getResultsCount

public int getResultsCount()
The method returns count of successfully recognized barcodes in the previous call to readRGBBuffer(byte[] data, int width, int height, int bpp)

Returns:
count of barcodes or 0 in case of no barcodes were detected.

getResultAt

public BarcodeReaderResult getResultAt(int pos)
The method returns BarcodeReaderResult object containg information about successfully recognized barcode in the previous call to readRGBBuffer(byte[] data, int width, int height, int bpp). The count of recognized and available barcodes can be obtained by call to getResultsCount().

Returns:
BarcodeReaderResult object or null.