Windows 10 Barcode Reader SDK (UWP)

DataSymbol Barcode Decoding SDK

Text Box: RKD Software
www.DataSymbol.com
www.BarcodeTools.com
Text Box: DataSymbol Barcode Decoding SDK
Windows 10(UWP)  Barcode Decoding Library
Developer’s Guide


 


Table of Contents

 

Introduction. 3

Requirements. 4

Directory Structure. 4

Technical Specifications. 5

Getting Started. 6

BarcodeDecoder class. 11

BarcodeDecoder (constructor) 11

Decode. 11

Decode. 12

SetDecoderParams. 12

barcodes. 13

DeviceID (static) 13

BarcodeList class. 14

item.. 14

length. 14

Barcode class. 15

BarcodeType. 15

Text 15

Data. 15

Location. 16

Reliability. 16

DW_DECODEPARAMS class. 17

DW_BARTYPES Enumerator. 19

DW_ERRORS Enumerator. 20

DW_DECSPEED Enumerator. 21

 


 

Introduction

 

Windows 10 DataSymbol SDK is a barcode decoding library that can easily be integrated into a customer's Universal Windows Platform applications.

DataSymbol SDK is supplied as a “.dll” file (Dynamic Link Library) and .winmd (Windows Metadata) for ARM, Win32(x86) and x64.

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:

·         Windows 10

·         Visual Studio 2015 (and higher)

 

Directory Structure

DataSymbol SDK is a Windows 10 Runtime Component written on С++. You should add reference on DataSymbol.BarcodeReader.winmd  into your project.

The DataSymbol SDK contains the following directories and files:

/

This file

Windows_10_SDK.pdf

/lib/uap10.0

Windows metadata

DataSymbol.BarcodeReader.winmd

/runtimes/win10-arm/native

ARM component

DataSymbol.BarcodeReader.dll

/runtimes/win10-x64/native

X64 component

DataSymbol.BarcodeReader.dll

/runtimes/win10-x86/native

X86 (Win32) component

DataSymbol.BarcodeReader.dll

/example

The main files of the example

MainPage.xaml

MainPage.xaml.cs

 


 

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 (Micro, Compact), QRCode (Micro), 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

 

 

Create new Windows Universal Application (in Visual Studio 2015).

 

NewProject.jpg

 

 

Add reference to the DataSymbol.BarcodeReader package. There are 3 ways to do it.

 

1. NuGet Packages Console

 

Open NuGet Packages Console

 

PMConsole.jpg

 

 

In Console Type

PM> Install-Package DataSymbol.BarcodeReader

PMConsole1.jpg

 

If the package has been installed you should to see it in the References of the Project

 

PMConsole2.jpg

 

 

The restored package you can find here

C:\Users\Your_User_Name\.nuget\packages\DataSymbol.BarcodeReader\

 

 

2. NuGet Manager

 

Open NuGet Manager (right click on the Solution).

 

NuGetManager.jpg

 

In the Search box type the DataSymbol and select DataSymbol.BarcodeReader package.

 

NuGetManager1.jpg

 

 

 

3. Add Reference Manually

 

Right click on the References and select Add Reference. Click Browse and select .winmd file.

 

ReaderReference.jpg

 

 

Now you can use the DataSymbol Decoder.

 

UseBarcodeReader.jpg

 

 

 

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

C#

 

//create decoder object

BarcodeDecoder dec = new BarcodeDecoder("");

 

int width=640, height=480;

 

//set decoder params

DW_RECT rect = new DW_RECT();

rect.left = rect.top = rect.right = rect.bottom = 0;    //decode whole frame

DW_DECODEPARAMS par = new DW_DECODEPARAMS();

par.BarcodeTypes = (uint)(DW_BARTYPES.DW_ST_DATAMATRIX | DW_BARTYPES.DW_ST_PDF417 | DW_BARTYPES.DW_ST_QRCODE);

dec.SetDecoderParams(par);

 

//allocate frame buffer

byte[] buffer = new byte[width * height];

 

//Copy frame in the buffer

//...

 

//decode frame

DW_ERRORS err = dec.Decode(buffer, width, height, rect);

 

//show results

if (dec.barcodes.length != 0)

{

    for (uint i = 0; i < dec.barcodes.length; ++i)

    {

        Debug.WriteLine(dec.barcodes.item(i).Text);

    }

}

 

 

 

 


BarcodeDecoder class

   Namespace: DataSymbol.BarcodeReader

 

Methods

BarcodeDecoder (constructor)

 

BarcodeDecoder class constructor.

Syntax

BarcodeDecoder(String sKey);

 

Parameters

sKey

The license key.

 

 

 

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

DW_ERRORS Decode(byte[] img, int width, int height, DW_RECT rect);

 

Parameters

img

Array of bytes that contains the frame

width

frame width

height

frame height

rect

scanning zone rectangle, if right and left are null then scan whole frame

 

Return Value

Error code.

 

Decode

 

Decodes .pgm file.

Syntax

DW_ERRORS Decode(byte[] PGM, DW_RECT rect);

 

Parameters

PGM

Contents of PGM file

width

frame width

height

frame height

rect

scanning zone rectangle, if right and left are null then scan whole file

 

Return Value

Error code.

 

SetDecoderParams

 

Sets all decoder properties.

Syntax

DW_ERRORS SetDecoderParams(DW_DECODEPARAMS decParams);

 

Parameters

decParams

DW_DECODEPARAMS class

 

Return Value

Error code.

 

Properties

barcodes


Returns decoded barcodes list.

Property value

Type: BarcodeList

 

DeviceID (static)

 

Returns the string with device ID used by SDK.

Syntax

static String DeviceID();

 

Return Value

Device ID string.


 

BarcodeList class

   Namespace: DataSymbol.BarcodeReader

 

Methods

item

 

Returns Barcode object.

Syntax

Barcode item(uint32 index);

 

Parameters

index

Number of the barcode you want to get.

 

Return Value

Barcode object.

 

Properties

length

 

Returns the quantity of barcodes which were found.

Property value

Type: uint32


 

Barcode class

   Namespace: DataSymbol.BarcodeReader

 

Properties

 

BarcodeType

 

Returns the quantity of barcodes which were found.

Property value

Type: DW_BARTYPES

 

Text

 

Returns human readable data (barcode string).

Property value

Type: string

 

Data

 

Returns raw barcode data. Some barcode types (PDF417, Code128, QRCode, etc.) can contain binary data that is why to get this barcode you should better use this method instead of Text property.

Property value

Type: byte[]

 

 

 

Location

 

Returns barcode coordinates.

Property value

Type: DW_POINT[]

 

Reliability


Returns barcode decoding reliability (decoding quality). Possible values 0…100. Decoding quality less than 30 is considered as bad. This parameter is actual for 2D barcodes (PDF417, DataMatrix, QRCode, Aztec).

Property value

Type: uint8


DW_DECODEPARAMS class

   Namespace: BarcodeReader

 

Properties

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)

LinearShowSymbologyID

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

LinearFindBarcodes

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.

LinearVerifyCheckDigit

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

LinearShowCheckDigit

Show the check digit or not.

LinearShowStartStop

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

LinearCode39EnableExtended

Decode Code 39 as Code 39 Extended or not.

LinearUPCE2UPCA

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

LinearInterl25MinLen

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.

LinearInterl25MaxLen

The maximum length of an Interleaved 2/5 barcode.

LinearIndustr25MinLen

The minimum length of an Industrial 2/5 barcode.

LinearIndustr25MaxLen

The maximum length of an Industrial 2/5 barcode.

LinearCode11MinLen

The minimum length of a Code11 barcode.

LinearCode11MaxLen

The maximum length of a Code11 barcode.

LinearCode39MinLen

The minimum length of a Code39 barcode.

LinearCode39MaxLen

The maximum length of a Code39 barcode.

LinearCode128MinLen

The minimum length of a Code128 barcode.

LinearCode128MaxLen

The maximum length of a Code128 barcode.

LinearCodabarMinLen

The minimum length of a Codabar barcode.

LinearCodabarMaxLen

The maximum length of a Codabar barcode.

LinearCode93MinLen

The minimum length of a Code93 barcode.

LinearCode93MaxLen

The maximum length of a Code93 barcode.

LinearDecSpeed

Linear barcode reading speed. Possible values:

·         0 - Normal

·         1 - Fast

·         2 - Slow

LinearVerify

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

Decoder Settings (PDF417)

PDF417FindBarcodes

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

PDF417DecSpeed

PDF417 barcode reading speed.

PDF417SymbologyID

Show the PDF417 symbology ID.

PDF417FindMicro

Finds PDF417 Micro barcodes

PDF417Robust

Robust decoding

Decoder Settings (DataMatrix)

DataMatrixFindBarcodes

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

DataMatrixDecSpeed

DataMatrix barcode reading speed

DataMatrixSymbologyID

Show the DataMatrix symbology ID.

DataMatrixInverseType

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

DataMatrixSupportECI

support or not ECI (Extended Channel Interpretation)

Decoder Settings (QRCode)

QRCodeFindBarcodes

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

QRCodeDecSpeed

QRCode barcode reading speed

QRCodeSymbologyID

Show the QRCode symbology ID.

QRCodeFindMicro

Finds Micro QRCode.

Decoder Settings (AztecCode)

AztecCodeFindBarcodes

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

AztecCodeDecSpeed

AztecCode barcode reading speed

AztecCodeSymbologyID

Show the AztecCode symbology ID.


DW_BARTYPES Enumerator

   Namespace: BarcodeReader

 

Specifies barcode type.

Barcode Type

Value

Constant

Code 128

0x00000001

DW_ST_CODE128

Code 39

0x00000002

DW_ST_CODE39

Interleaved 2/5

0x00000004

DW_ST_INTERL25

EAN-13

0x00000008

DW_ST_EAN13

EAN-8

0x00000010

DW_ST_EAN8

Codabar

0x00000020

DW_ST_CODABAR

Code 11

0x00000040

DW_ST_CODE11

UPC-A

0x00000080

DW_ST_UPCA

UPC-E

0x00000100

DW_ST_UPCE

Industrial 2/5

0x00000200

DW_ST_INDUSTR25

Code 93

0x00000400

DW_ST_CODE93

DataBar omnidirectional, DataBar Truncated

0x00000800

DW_ST_DATABAR_OMNI

DataBar limited

0x00001000

DW_ST_DATABAR_LIM

DataBar stacked

0x00002000

DW_ST_DATABAR_STACKED

DataBar Expanded

0x00004000

DW_ST_DATABAR_EXP

DataBar Expanded stacked

0x00008000

DW_ST_DATABAR_EXP_STACKED

unrecognized linear

0x01000000

DW_ST_LINEAR_UNDEC

unrecognized PDF417

0x02000000

DW_ST_PDF417_UNDEC

unrecognized DataMatrix

0x04000000

DW_ST_DATAMATRIX_UNDEC

unrecognized QRCode

0x08000000

DW_ST_QRCODE_UNDEC

unrecognized AztecCode

0x00100000

DW_ST_AZTECCODE_UNDEC

DataMatrix

0x10000000

DW_ST_DATAMATRIX

PDF417

0x20000000

DW_ST_PDF417

QRCode

0x40000000

DW_ST_QRCODE

AztecCode

0x80000000

DW_ST_AZTECCODE


 

DW_ERRORS Enumerator

   Namespace: BarcodeReader

 

Specifies error codes.

 

DW_OK

Ok

DW_ERROR

Error

DW_ERR_IN_PARAM

invalid input parameter

DW_CANT_ALLOC_MEM

can't allocate memory

DW_LIB_NOT_INIT

library doesn't initialized

DW_ERR_RES_IDX

invalid decoding result index

 

 


 

DW_DECSPEED Enumerator

   Namespace: BarcodeReader

 

Specifies decoding speed.

 

DWS_NORMAL

Normal

DWS_FAST

Fast

DWS_SLOW

Slow