Web SDK Assembly

Barcode Decoder WebAssembly (datasymbol-sdk.wasm file) provides the low level interface. You can write your own JavaScript code (instead our DSScanner) that works directly with WebAssembly.

InitLib
Initialize WebAssembly library.

Syntax
object.InitLib(pszKey)
Parameters
pszKey Pointer to the null-terminated string with library key. If parameter is NULL then library will work in demo mode.
Return Value
long. Returns the HANDLE of barcode decoder. You should to save this value to use it in future. If returns NULL then SDK cannot be initialized.
Remarks
This method should be called before any else. To free the library you should to call FreeLib



FreeLib
Release WebAssembly library.

Syntax
object.FreeLib(decHandle)
Parameters
decHandle HANDLE of barcode decoder returned by InitLib method.
Return Value
integer. Returns the Error Code.



DecodeRGBA
Decodes the RGBA encoded image.

Syntax
object.DecodeRGBA(decHandle, pRGBA, width, height)
Parameters
decHandle HANDLE of barcode decoder returned by InitLib method.
pRGBA Pointer to the byte array containded RGBA image
width An integer value that defines the width of RGBA image
height An integer value that defines the height of RGBA image
Return Value
integer. Returns the Error Code.



DecodeGraymap
Decodes the gray map.

Syntax
object.DecodeGraymap(decHandle, pImg, width, height)
Parameters
decHandle HANDLE of barcode decoder returned by InitLib method.
pImg Pointer to the byte array containded gray map.
width An integer value that defines the width of the gray map image
height An integer value that defines the height of gray map image
Return Value
integer. Returns the Error Code.
Remarks
A gray map 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. The matrix is passed to the DecodeGrayMap method as a one-dimensional array. The first upper line of the image is sent first, then comes the second line and so on.



DecodePGM
Decodes the PGM (portable gray map) file.

Syntax
object.DecodePGM(decHandle, pImg, width, height)
Parameters
decHandle HANDLE of barcode decoder returned by InitLib method.
pPGM Pointer to the byte array containded the whole PGM file.
pgmLen An integer value that defines the PGM file length
Return Value
integer. Returns the Error Code.



setProperty
Sets the various properties of Barcode Decoder.

Syntax
object.setProperty(decHandle, pszPropName, pData)
Parameters
decHandle HANDLE of barcode decoder returned by InitLib method.
pszPropName Pointer to the null-terminated string that defines the Propery name.
pData Pointer to byte array that defines the property value. Length of byte array depends from property.

Properties
Name Value
barcodeTypes 4 bytes. what types of barcodes should be decoded.
totalBarcodes 4 bytes. how many barcodes of all types to search for in the entire document.
Default value - 0 (unlimited)
frameTime 4 bytes. Time to decode 1 frame in milliseconds.
Default value - 0 (unlimited).
bCalcBlurring 4 bytes boolean. calculate the blurring value of decoded barcode (default - false).
scanDirection 4 bytes. Scanning direction, horizontaly (1) or verticaly (2). You can use it to reduce the barcode decoding time
Default value - 3 (horizontaly and verticaly).
uiLinearFindBarcodes 4 bytes. how many Linear barcodes to search
Default value - 1
bLinearVerifyCheckDigit 4 bytes boolean. Check the optional Linear check digit
Default value - 0 (false)
bLinearShowCheckDigit 4 bytes boolean. Show Linear check digit
Default value - 1 (true)
bLinearShowStartStop 4 bytes boolean. Show Linear check digit
Default value - 0 (false)
bLinearVerify 4 bytes boolean. Verify linear barcode after decoding. Improves reliability linear barcode reading.
Default value - False (don't verify).
bLinearCode39EnableExtended 4 bytes boolean. Decode Code 39 as Code 39 Extended or not.
Default value - 0 (false)
bLinearUPCE2UPCA 4 bytes boolean. Convert a UPC-E barcode to UPC-A or not.
Default value - 0 (false)
uiLinearInterl25MinLen 4 bytes. minimum length of an Interleaved 2/5 barcode
Default value - 2
uiLinearInterl25MaxLen 4 bytes. miximum length of an Interleaved 2/5 barcode
Default value - 50
uiLinearIndustr25MinLen 4 bytes. minimum length of an Industrial 2/5 barcode
Default value - 1
uiLinearIndustr25MaxLen 4 bytes. miximum length of an Industrial 2/5 barcode
Default value - 50
uiLinearCode11MinLen 4 bytes. minimum length of an Code 11 barcode
Default value - 1
uiLinearCode11MaxLen 4 bytes. miximum length of an Code 11 barcode
Default value - 50
uiLinearCode39MinLen 4 bytes. minimum length of an Code 39 barcode
Default value - 1
uiLinearCode39MaxLen 4 bytes. miximum length of an Code 39 barcode
Default value - 50
uiLinearCode128MinLen 4 bytes. minimum length of an Code 128 barcode
Default value - 1
uiLinearCode128MaxLen 4 bytes. miximum length of an Code 128 barcode
Default value - 50
uiLinearCodabarMinLen 4 bytes. minimum length of an Codabar barcode
Default value - 1
uiLinearCodabarMaxLen 4 bytes. miximum length of an Codabar barcode
Default value - 50
uiLinearCode93MinLen 4 bytes. minimum length of an Code 93 barcode
Default value - 1
uiLinearCode93MaxLen 4 bytes. miximum length of an Code 93 barcode
Default value - 50
LinearDecSpeed 4 bytes. Speed of Linear barcode decoder
Default value - 0
Possible values:
0 - Normal
1 - Fast
2 - Slow
uiPDF417FindBarcodes 4 bytes. how many PDF417 barcodes to search
Default value - 1
PDF417DecSpeed 4 bytes. Speed of PDF417 barcode decoder
Default value - 0
Possible values:
0 - Normal
1 - Fast
2 - Slow
bPDF417FindMicro 4 bytes boolean. Search PDF417 Micro barcodes
Default value - 0 (false)
bPDF417SupportECI 4 bytes boolean. Support PDF417 ECI
Default value - 0 (false)
bPDF417Robust 4 bytes boolean. Robust PDF417 decoding
Default value - 0 (false)
uiDataMatrixFindBarcodes 4 bytes. how many DataMatrix barcodes to search
Default value - 1
DataMatrixDecSpeed 4 bytes. Speed of DataMatrix barcode decoder
Default value - 0
Possible values:
0 - Normal
1 - Fast
2 - Slow
DataMatrixInverseType 4 bytes. what barcodes should be decoded (darks on light or lights on dark).
Default value - (1) darks on light
2-light on dark, 3-light and dark
bDataMatrixSupportECI 4 bytes boolean. Support DataMatrix ECI
Default value - 0 (false)
DataMatrixDecMirror 4 bytes. Normal/Mirror DataMatrix decoding
Default value - 0
Possible values:
0 - only Normal
1 - only Mirror
2 - Normal and Mirror
uiQRCodeFindBarcodes 4 bytes. how many QRCode barcodes to search
Default value - 1
QRCodeDecSpeed 4 bytes. Speed of QRCode barcode decoder
Default value - 0
Possible values:
0 - Normal
1 - Fast
2 - Slow
bQRCodeFindMicro 4 bytes boolean. Search Micro QRCode
Default value - 0 (false)
QRCodeDecMirror 4 bytes. Normal/Mirror QRCode decoding
Default value - 0
Possible values:
0 - only Normal
1 - only Mirror
2 - Normal and Mirror
uiAztecCodeFindBarcodes 4 bytes. how many AztecCode barcodes to search
Default value - 1
AztecCodeDecSpeed 4 bytes. Speed of AztecCode barcode decoder
Default value - 0
Possible values:
0 - Normal
1 - Fast
2 - Slow
ScanningRectLeft 4 bytes. Left coordinate of scanning area. It works when all ScanningRectX parameters are correct
ScanningRectTop 4 bytes. Top coordinate of scanning area
ScanningRectWidth 4 bytes. Width of scanning area
ScanningRectHeight 4 bytes. Height of scanning area
Return Value
integer. Returns the Error Code.



getResNum
Gets the number of decoded barcodes.

Syntax
object.getResNum(decHandle)
Parameters
decHandle HANDLE of barcode decoder returned by InitLib method.
Return Value
integer. If less than 0 then it returns the Error Code, else the barcode number.



getResBarcodeType
Gets the barcode type.

Syntax
object.getResBarcodeType(decHandle, barcodeNum)
Parameters
decHandle HANDLE of barcode decoder returned by InitLib method.
barcodeNum integer value that defines the barcode number.
Return Value
integer. If less than 0 then it returns the Error Code, else the barcode type.



getResDQ
Gets the decoding quality.

Syntax
object.getResDQ(decHandle, barcodeNum)
Parameters
decHandle HANDLE of barcode decoder returned by InitLib method.
barcodeNum integer value that defines the barcode number.
Return Value
integer. If less than 0 then it returns the Error Code, else the decoding quality (0...100).



getResData
Gets the barcode data.

Syntax
object.getResData(decHandle, pOutBuf, bufLen, barcodeNum)
Parameters
decHandle HANDLE of barcode decoder returned by InitLib method.
pOutBuf pointer to the outer buffer
bufLen outer buffer length
barcodeNum integer value that defines the barcode number.
Return Value
integer. If less than 0 then it returns the Error Code, else the barcode data.



getResPoints
Gets the barcode corners coordinates.

Syntax
object.getResPoints(decHandle, pOutBuf, bufLen, barcodeNum)
Parameters
decHandle HANDLE of barcode decoder returned by InitLib method.
pOutBuf pointer to the outer buffer
bufLen outer buffer length
barcodeNum integer value that defines the barcode number.
Return Value
integer. Returns the Error Code.
Remarks
Method copies in the pOutBuf 8 integer (32 bit) values. 0 value - x1 coordinate, 1 value - y1 coordinate, 2 value - x2 coordinate, 3 value - y2 coordinate, etc.



Error Codes
0 Ok
1 Error
2 invalid decoder handle
3 invalid parameter
4 invalid barcode number
5 not enought memory
6 unknown property



Barcode Types
0x00000001 Code 128
0x00000002 Code 39
0x00000004 Interleaved 2/5
0x00000008 EAN-13
0x00000010 EAN-8
0x00000020 Codabar
0x00000040 Code 11
0x00000080 UPC-A
0x00000100 UPC-E
0x00000200 Industrial 2/5
0x00000400 Code 93
0x00000800 DataBar omnidirectional, DataBar Truncated
0x00001000 DataBar limited
0x00002000 DataBar stacked
0x00004000 DataBar Expanded
0x00008000 DataBar Expanded stacked
0x01000000 unrecognized linear
0x02000000 unrecognized PDF417
0x04000000 unrecognized DataMatrix
0x08000000 unrecognized QRCode
0x00100000 unrecognized AztecCode
0x10000000 DataMatrix
0x20000000 PDF417
0x40000000 QRCode
0x80000000 AztecCode