Cognex Mobile Barcode SDK
SDK for supporting communication with Cognex Barcode Reader devices
BarcodeScanner.h File Reference

Barcode Decoders Library
Copyright (C) Cognex Corporation. More...

Go to the source code of this file.

Macros

Grayscale image size range
#define MWB_GRAYSCALE_LENX_MIN   25
 
#define MWB_GRAYSCALE_LENX_MAX   5000
 
#define MWB_GRAYSCALE_LENY_MIN   25
 
#define MWB_GRAYSCALE_LENY_MAX   5000
 
Basic return values for API functions
#define MWB_RT_OK   0
 
#define MWB_RT_FAIL   -1
 
#define MWB_RT_NOT_SUPPORTED   -2
 
#define MWB_RT_BAD_PARAM   -3
 
#define MWB_RT_INVALID_SCANNING_RECTANGLE   -4
 
Basic return values for RegisterSDK function
#define MWB_RTREG_OK   0
 
#define MWB_RTREG_INVALID_KEY   -1
 
#define MWB_RTREG_INVALID_CHECKSUM   -2
 
#define MWB_RTREG_INVALID_APPLICATION   -3
 
#define MWB_RTREG_INVALID_SDK_VERSION   -4
 
#define MWB_RTREG_INVALID_KEY_VERSION   -5
 
#define MWB_RTREG_INVALID_PLATFORM   -6
 
#define MWB_RTREG_KEY_EXPIRED   -7
 
#define MWB_RTREG_AIMER_REQUIRED   -8
 
#define MWB_RTREG_AIMER_NOT_DETECTED   -9
 
#define MWB_RTREG_CUSTOM_SIZE_EXCEEDED   -100
 
Configuration values for use with MWB_setFlags
#define MWB_CFG_GLOBAL_HORIZONTAL_SHARPENING   0x01
 Global decoder flags value: apply sharpening on input image.
 
#define MWB_CFG_GLOBAL_VERTICAL_SHARPENING   0x02
 
#define MWB_CFG_GLOBAL_SHARPENING   0x03
 
#define MWB_CFG_GLOBAL_ROTATE90   0x04
 Global decoder flags value: apply rotation on input image.
 
#define MWB_CFG_GLOBAL_ROTATE180   0x08
 
#define MWB_CFG_GLOBAL_CALCULATE_1D_LOCATION   0x10
 Global decoder flags value: calculate location for 1D barcodeTypes (Code128, Code93, Code39 supported)
 
#define MWB_CFG_GLOBAL_VERIFY_1D_LOCATION   0x20
 Global decoder flags value: fail 1D decode if result is not confirmed by location expanding (Code128, Code93, Code39 supported)
 
#define MWB_CFG_GLOBAL_USE_CENTRIC_SCANNING   0x40
 Global decoder flags value: fail decode if result is not touching the center of viewfinder (2D + Code128, Code93, Code39 supported) 1D locaiton flags will be enabled automatically with this one.
 
#define MWB_CFG_GLOBAL_DISABLE_PREPROCESSING   0x80
 Global decoder flags value: disable some image pre=processing, suitable for devices with weak CPU.
 
#define MWB_CFG_GLOBAL_ENABLE_MULTI   0x100
 Global decoder flags value: Enable multiple barcode detection in single image.
 
#define MWB_CFG_GLOBAL_SCANLINESx2   0x200
 Global decoder flagss value: mulyiple scan lines density.
 
#define MWB_CFG_GLOBAL_SCANLINESx4   0x400
 
#define MWB_CFG_GLOBAL_SCANLINESx8   0x800
 
#define MWB_CFG_CODE39_REQ_CHKSUM   0x2
 Code39 decoder flags value: require checksum check.
 
#define MWB_CFG_CODE39_DONT_REQUIRE_STOP   0x4
 Code39 decoder flags value: don't require stop symbol - can lead to false results.
 
#define MWB_CFG_CODE39_EXTENDED_MODE   0x8
 Code39 decoder flags value: decode full ASCII.
 
#define MWB_CFG_CODE39_CODE32_ENABLED   0x10
 Code39 decoder flags value: Try decoding result to CODE32. More...
 
#define MWB_CFG_CODE39_CODE32_PREFIX   0x20
 Code39 decoder flags value: ADD 'A' prefix to Code32 result.
 
#define MWB_CFG_CODE93_EXTENDED_MODE   0x8
 Code93 decoder flags value: decode full ASCII.
 
#define MWB_CFG_EANUPC_DISABLE_ADDON   0x1
 UPC/EAN decoder disable addons detection.
 
#define MWB_CFG_EANUPC_DONT_EXPAND_UPCE   0x2
 UPC/EAN disable UPC-E expanding to UPC-A.
 
#define MWB_CFG_CODE25_REQ_CHKSUM   0x01
 Code25 decoder flags value: require checksum check MWB_CFG_CODE25_REQ_CHKSUM is deprecated and shouldn't be used in combination with other checksum flags.
 
#define MWB_CFG_CODE25_REQ_CHKSUM_STANDARD   0x02
 
#define MWB_CFG_CODE25_REQ_CHKSUM_INTERLEAVED   0x04
 
#define MWB_CFG_CODE25_REQ_CHKSUM_IATA   0x08
 
#define MWB_CFG_CODE25_REQ_CHKSUM_MATRIX   0x10
 
#define MWB_CFG_CODE25_REQ_CHKSUM_COOP   0x20
 
#define MWB_CFG_CODE25_REQ_CHKSUM_INVERTED   0x40
 
#define MWB_CFG_CODE11_REQ_SINGLE_CHKSUM   0x1
 Code11 decoder flags value: require checksum check MWB_CFG_CODE11_REQ_SINGLE_CHKSUM is set by default.
 
#define MWB_CFG_CODE11_REQ_DOUBLE_CHKSUM   0x2
 
#define MWB_CFG_MSI_REQ_10_CHKSUM   0x01
 MSI Plessey decoder flags value: require checksum check MWB_CFG_MSI_REQ_10_CHKSUM is set by default.
 
#define MWB_CFG_MSI_REQ_1010_CHKSUM   0x02
 
#define MWB_CFG_MSI_REQ_11_IBM_CHKSUM   0x04
 
#define MWB_CFG_MSI_REQ_11_NCR_CHKSUM   0x08
 
#define MWB_CFG_MSI_REQ_1110_IBM_CHKSUM   0x10
 
#define MWB_CFG_MSI_REQ_1110_NCR_CHKSUM   0x20
 
#define MWB_CFG_CODABAR_INCLUDE_STARTSTOP   0x1
 Codabar decoder flags value: include start/stop symbols in result.
 
#define MWB_CFG_DM_DPM_MODE   0x2
 Datamatrix decoder flags value: enable DPM mode.
 
#define MWB_CFG_TELEPEN_FORCE_NUMERIC   0x1
 Telepen decoder flags.
 
#define MWB_PAR_ID_ECI_MODE   0x08
 Barcode decoder param types.
 
#define MWB_PAR_ID_RESULT_PREFIX   0x10
 
#define MWB_PAR_ID_VERIFY_LOCATION   0x20
 
#define MWB_PAR_ID_SCAN_COLOR   0x40
 
#define MWB_PAR_ID_SAFE_ZONE_SCALE   0x80
 
#define MWB_PAR_VALUE_ECI_DISABLED   0x00
 Barcode param values.
 
#define MWB_PAR_VALUE_ECI_ENABLED   0x01
 
#define MWB_PAR_VALUE_RESULT_PREFIX_NEVER   0x00
 
#define MWB_PAR_VALUE_RESULT_PREFIX_ALWAYS   0x01
 
#define MWB_PAR_VALUE_RESULT_PREFIX_DEFAULT   0x02
 
#define MWB_PAR_VALUE_VERIFY_LOCATION_OFF   0x00
 
#define MWB_PAR_VALUE_VERIFY_LOCATION_ON   0x01
 
#define MWB_PAR_VALUE_VERIFY_LOCATION_STRICT   0x02
 
#define MWB_PAR_VALUE_COLOR_NORMAL   0x01
 
#define MWB_PAR_VALUE_COLOR_INVERTED   0x02
 
#define MWB_PAR_VALUE_COLOR_BOTH   0x04
 
Bit mask identifiers for supported decoder types
#define MWB_CODE_MASK_NONE   0x00000000u
 
#define MWB_CODE_MASK_QR   0x00000001u
 
#define MWB_CODE_MASK_DM   0x00000002u
 
#define MWB_CODE_MASK_RSS   0x00000004u
 
#define MWB_CODE_MASK_39   0x00000008u
 
#define MWB_CODE_MASK_EANUPC   0x00000010u
 
#define MWB_CODE_MASK_128   0x00000020u
 
#define MWB_CODE_MASK_PDF   0x00000040u
 
#define MWB_CODE_MASK_AZTEC   0x00000080u
 
#define MWB_CODE_MASK_25   0x00000100u
 
#define MWB_CODE_MASK_93   0x00000200u
 
#define MWB_CODE_MASK_CODABAR   0x00000400u
 
#define MWB_CODE_MASK_DOTCODE   0x00000800u
 
#define MWB_CODE_MASK_11   0x00001000u
 
#define MWB_CODE_MASK_MSI   0x00002000u
 
#define MWB_CODE_MASK_MAXICODE   0x00004000u
 
#define MWB_CODE_MASK_POSTAL   0x00008000u
 
#define MWB_CODE_MASK_TELEPEN   0x00010000u
 
#define MWB_CODE_MASK_ALL   0x00ffffffu
 
Bit mask identifiers for RSS decoder types
#define MWB_SUBC_MASK_RSS_14   0x00000001u
 
#define MWB_SUBC_MASK_RSS_14_STACK   0x00000002u
 
#define MWB_SUBC_MASK_RSS_LIM   0x00000004u
 
#define MWB_SUBC_MASK_RSS_EXP   0x00000008u
 
Bit mask identifiers for QR decoder types
#define MWB_SUBC_MASK_QR_STANDARD   0x00000001u
 
#define MWB_SUBC_MASK_QR_MICRO   0x00000002u
 
Bit mask identifiers for PDF decoder types
#define MWB_SUBC_MASK_PDF_STANDARD   0x00000001u
 
#define MWB_SUBC_MASK_PDF_MICRO   0x00000002u
 
Bit mask identifiers for 2 of 5 decoder types
#define MWB_SUBC_MASK_C25_INTERLEAVED   0x00000001u
 
#define MWB_SUBC_MASK_C25_STANDARD   0x00000002u
 
#define MWB_SUBC_MASK_C25_ITF14   0x00000004u
 
#define MWB_SUBC_MASK_C25_IATA   0x00000008u
 
#define MWB_SUBC_MASK_C25_MATRIX   0x00000010u
 
#define MWB_SUBC_MASK_C25_COOP   0x00000020u
 
#define MWB_SUBC_MASK_C25_INVERTED   0x00000040u
 
Bit mask identifiers for POSTAL decoder types
#define MWB_SUBC_MASK_POSTAL_POSTNET   0x00000001u
 
#define MWB_SUBC_MASK_POSTAL_PLANET   0x00000002u
 
#define MWB_SUBC_MASK_POSTAL_IM   0x00000004u
 
#define MWB_SUBC_MASK_POSTAL_ROYAL   0x00000008u
 
#define MWB_SUBC_MASK_POSTAL_AUSTRALIAN   0x00000010u
 
Bit mask identifiers for UPC/EAN decoder types
#define MWB_SUBC_MASK_EANUPC_EAN_13   0x00000001u
 
#define MWB_SUBC_MASK_EANUPC_EAN_8   0x00000002u
 
#define MWB_SUBC_MASK_EANUPC_UPC_A   0x00000004u
 
#define MWB_SUBC_MASK_EANUPC_UPC_E   0x00000008u
 
#define MWB_SUBC_MASK_EANUPC_UPC_E1   0x00000010u
 
Bit mask identifiers for 1D scanning direction
#define MWB_SCANDIRECTION_HORIZONTAL   0x00000001u
 
#define MWB_SCANDIRECTION_VERTICAL   0x00000002u
 
#define MWB_SCANDIRECTION_OMNI   0x00000004u
 
#define MWB_SCANDIRECTION_AUTODETECT   0x00000008u
 
#define MWB_SCANDIRECTION_CUSTOM   0x00000010u
 
Identifiers for result types
#define MWB_RESULT_TYPE_RAW   0x00000001u
 
#define MWB_RESULT_TYPE_MW   0x00000002u
 
Identifiers for result fields types
#define MWB_RESULT_FT_BYTES   0x00000001u
 
#define MWB_RESULT_FT_TEXT   0x00000002u
 
#define MWB_RESULT_FT_TYPE   0x00000003u
 
#define MWB_RESULT_FT_SUBTYPE   0x00000004u
 
#define MWB_RESULT_FT_SUCCESS   0x00000005u
 
#define MWB_RESULT_FT_ISGS1   0x00000006u
 
#define MWB_RESULT_FT_LOCATION   0x00000007u
 
#define MWB_RESULT_FT_IMAGE_WIDTH   0x00000008u
 
#define MWB_RESULT_FT_IMAGE_HEIGHT   0x00000009u
 
#define MWB_RESULT_FT_PARSER_BYTES   0x0000000Au
 
#define MWB_RESULT_FT_MODULES_COUNT_X   0x0000000Bu
 
#define MWB_RESULT_FT_MODULES_COUNT_Y   0x0000000Cu
 
#define MWB_RESULT_FT_MODULE_SIZE_X   0x0000000Du
 
#define MWB_RESULT_FT_MODULE_SIZE_Y   0x0000000Eu
 
#define MWB_RESULT_FT_SKEW   0x0000000Fu
 
#define MWB_RESULT_FT_KANJI   0x00000010u
 
#define MWB_RESULT_FT_BARCODE_WIDTH   0x00000011u
 
#define MWB_RESULT_FT_BARCODE_HEIGHT   0x00000012u
 
#define MWB_RESULT_FT_TEXT_ENCODING   0x00000013u
 
#define MWB_RESULT_FT_PDF_ROWS   0x00000020u
 
#define MWB_RESULT_FT_PDF_COLUMNS   0x00000021u
 
#define MWB_RESULT_FT_PDF_TRUNCATED   0x00000022u
 
#define MWB_RESULT_FT_PDF_ECLEVEL   0x00000023u
 
#define MWB_RESULT_FT_PDF_CODEWORDS   0x00000024u
 
Descriptive names of result field types
#define MWB_RESULT_FNAME_BYTES   "Bytes"
 
#define MWB_RESULT_FNAME_TEXT   "Text"
 
#define MWB_RESULT_FNAME_TYPE   "Type"
 
#define MWB_RESULT_FNAME_SUBTYPE   "Subtype"
 
#define MWB_RESULT_FNAME_SUCCESS   "Success"
 
#define MWB_RESULT_FNAME_ISGS1   "GS1 compliance"
 
#define MWB_RESULT_FNAME_KANJI   "Kanji encoding"
 
#define MWB_RESULT_FNAME_TEXT_ENCODING   "Text encoding"
 
#define MWB_RESULT_FNAME_LOCATION   "Location"
 
#define MWB_RESULT_FNAME_IMAGE_WIDTH   "Image Width"
 
#define MWB_RESULT_FNAME_IMAGE_HEIGHT   "Image Height"
 
#define MWB_RESULT_FNAME_PARSER_BYTES   "Parser Input"
 
#define MWB_RESULT_FNAME_MODULES_COUNT_X   "Modules Count X"
 
#define MWB_RESULT_FNAME_MODULES_COUNT_Y   "Modules Count Y"
 
#define MWB_RESULT_FNAME_MODULE_SIZE_X   "Module Size X"
 
#define MWB_RESULT_FNAME_MODULE_SIZE_Y   "Module Size Y"
 
#define MWB_RESULT_FNAME_SKEW   "Skew"
 
#define MWB_RESULT_FNAME_BARCODE_WIDTH   "Barcode Width"
 
#define MWB_RESULT_FNAME_BARCODE_HEIGHT   "Barcode Height"
 
#define MWB_RESULT_FNAME_PDF_ROWS   "PDF417 Rows Count"
 
#define MWB_RESULT_FNAME_PDF_COLUMNS   "PDF417 Columns Count"
 
#define MWB_RESULT_FNAME_PDF_TRUNCATED   "PDF417 is Truncated"
 
#define MWB_RESULT_FNAME_PDF_ECLEVEL   "PDF417 EC Level"
 
#define MWB_RESULT_FNAME_PDF_CODEWORDS   "PDF417 Codewords"
 

Typedefs

typedef unsigned int uint32_t
 
typedef unsigned char uint8_t
 

Enumerations

Result values for all code types
enum  res_types {
  FOUND_NONE = 0 , FOUND_DM , FOUND_39 , FOUND_RSS_14 ,
  FOUND_RSS_14_STACK , FOUND_RSS_LIM , FOUND_RSS_EXP , FOUND_EAN_13 ,
  FOUND_EAN_8 , FOUND_UPC_A , FOUND_UPC_E , FOUND_128 ,
  FOUND_PDF , FOUND_QR , FOUND_AZTEC , FOUND_25_INTERLEAVED ,
  FOUND_25_STANDARD , FOUND_93 , FOUND_CODABAR , FOUND_DOTCODE ,
  FOUND_128_GS1 , FOUND_ITF14 , FOUND_11 , FOUND_MSI ,
  FOUND_25_IATA , FOUND_25_MATRIX , FOUND_25_COOP , FOUND_25_INVERTED ,
  FOUND_QR_MICRO , FOUND_MAXICODE , FOUND_POSTNET , FOUND_PLANET ,
  FOUND_IMB , FOUND_ROYALMAIL , FOUND_MICRO_PDF , FOUND_32 ,
  FOUND_AUSTRALIAN , FOUND_TELEPEN
}
 

Functions

User API function headers
unsigned int MWB_getLibVersion (void)
 Returns version code of Barcode Scanner Library. More...
 
char * MWB_getLibVersionText (void)
 
unsigned int MWB_getSupportedCodes (void)
 Returns supported decoders in this library release. More...
 
int MWB_setScanningRect (const uint32_t codeMask, float left, float top, float width, float height)
 Sets rectangular area for barcode scanning with selected single decoder type. More...
 
int MWB_setTargetRect (float left, float top, float width, float height)
 Sets rectangular area for targeted barcode scanning. More...
 
int MWB_getScanningRect (const uint32_t codeMask, float *left, float *top, float *width, float *height)
 Get rectangular area for barcode scanning with selected single or multiple decoder type(s). More...
 
int MWB_getTargetRect (float *left, float *top, float *width, float *height)
 Get rectangular area for targeted barcode scanning Output values are in percentages of screeen width and height (range 0 - 100) More...
 
int MWB_registerSDK (const char *key)
 Registers licensing information for all SDK functionality. More...
 
int MWB_registerSDKCustom (const char *key, const char *customData)
 Same as RegisterSDK with addition of custom string to be sent along with tracking info. More...
 
char * MWB_getDeviceID (void)
 Get device ID It should be called after registering call, and works only on iOS and Android. More...
 
char * MWB_getLicenseString (void)
 Get license string for retrieving remaining devices It should be called after registering call, and works only on iOS and Android. More...
 
int MWB_setActiveCodes (const uint32_t codeMask)
 Sets active or inactive status of decoder types and updates decoder execution priority list. More...
 
int MWB_getActiveCodes (void)
 Get active decoder types. More...
 
int MWB_enableCode (const uint32_t codeMask)
 Enable decoder type Upon library load, all decoder types are inactive by default. More...
 
int MWB_disableCode (const uint32_t codeMask)
 Disable decoder type Remove barcode type from set of enabled types. More...
 
int MWB_setActiveSubcodes (const uint32_t codeMask, const uint32_t subMask)
 Set active subcodes for given code group flag. More...
 
int MWB_getActiveSubcodes (const uint32_t codeMask)
 Get active subcodes for given code group flag. More...
 
int MWB_enableSubcode (const uint32_t codeMask, const uint32_t subMask)
 enable subcode for given code group flag. More...
 
int MWB_disableSubcode (const uint32_t codeMask, const uint32_t subMask)
 Disable subcode for given code group flag. More...
 
int MWB_setCodePriority (const uint32_t codeMask, const uint8_t priority)
 Sets code priority level for selected decoder group or groups. More...
 
int MWB_cleanupLib (void)
 Free memory resources allocated by library. More...
 
int MWB_getLastType (void)
 Retrieves actual detected code type after successful MWB_scanGrayscaleImage call. More...
 
int MWB_isLastGS1 (void)
 Retrieves is result of GS1 type. More...
 
int MWB_scanGrayscaleImage (uint8_t *pp_image, int lenX, int lenY, uint8_t **pp_data)
 Main scan function. More...
 
int MWB_scanGrayscaleRegions (uint8_t *pp_image, int lenX, int lenY, float *regionsData, int numberOfRegions, int maxThreads, uint8_t **pp_data)
 Multi-regions scan function. More...
 
int MWB_createRegionsFromTiles (int tilesX, int tilesY, int overlap, float *regionsData)
 Create multiple regions based on number of tiles by X and Y axes. More...
 
int MWB_setFlags (const uint32_t codeMask, const uint32_t flags)
 Configure options for single barcode type. More...
 
int MWB_enableFlag (const uint32_t codeMask, const uint32_t flag)
 Enable option for single barcode type (or global one). More...
 
int MWB_disableFlag (const uint32_t codeMask, const uint32_t flag)
 Disable option for single barcode type (or global one). More...
 
int MWB_getFlags (const uint32_t codeMask)
 Get active flags for single barcode type. More...
 
int MWB_setLevel (const int level)
 Configure global library effort level. More...
 
int MWB_setDirection (const uint32_t direction)
 Configure scanning direction for 1D barcodes. More...
 
int MWB_setMinLength (const uint32_t codeMask, const uint32_t minLength)
 Set minimum result length for single barcode type. More...
 
int MWB_setParam (const uint32_t codeMask, const uint32_t paramId, const uint32_t paramValue)
 Set custom decoder param. More...
 
int MWB_getParam (const uint32_t codeMask, const uint32_t paramId)
 Get specified decoder param. More...
 
int MWB_getDirection (void)
 Get active scanning direction. More...
 
int MWB_validateVIN (char *vin, int length)
 VIN validator. More...
 
int MWB_getBarcodeLocation (float *points)
 Barcode location points . More...
 
int MWB_setResultType (const uint32_t resultType)
 Set result type from MWB_scanGrayscaleImage. More...
 
int MWB_getResultType (void)
 Get currently active result type.
 
int MWB_setDuplicatesTimeout (uint32_t timeout)
 
void MWB_setDuplicate (uint8_t *barcode, int length)
 

Detailed Description

Barcode Decoders Library
Copyright (C) Cognex Corporation.

Cognex Mobile Barcode SDK's easy API is preferred instead of this header file and its associated legacy API. Unless explicitly directed to use this header/API, all new applications should now only be using ReaderDevice. Applications that use this API, may still use it, there is no need for migraton as it will be not removed without further notice.

Macro Definition Documentation

◆ MWB_CFG_CODE39_CODE32_ENABLED

#define MWB_CFG_CODE39_CODE32_ENABLED   0x10

Code39 decoder flags value: Try decoding result to CODE32.

if failed, Code39 will return

Enumeration Type Documentation

◆ res_types

enum res_types
Enumerator
FOUND_NONE 
FOUND_DM 
FOUND_39 
FOUND_RSS_14 
FOUND_RSS_14_STACK 
FOUND_RSS_LIM 
FOUND_RSS_EXP 
FOUND_EAN_13 
FOUND_EAN_8 
FOUND_UPC_A 
FOUND_UPC_E 
FOUND_128 
FOUND_PDF 
FOUND_QR 
FOUND_AZTEC 
FOUND_25_INTERLEAVED 
FOUND_25_STANDARD 
FOUND_93 
FOUND_CODABAR 
FOUND_DOTCODE 
FOUND_128_GS1 
FOUND_ITF14 
FOUND_11 
FOUND_MSI 
FOUND_25_IATA 
FOUND_25_MATRIX 
FOUND_25_COOP 
FOUND_25_INVERTED 
FOUND_QR_MICRO 
FOUND_MAXICODE 
FOUND_POSTNET 
FOUND_PLANET 
FOUND_IMB 
FOUND_ROYALMAIL 
FOUND_MICRO_PDF 
FOUND_32 
FOUND_AUSTRALIAN 
FOUND_TELEPEN 

Function Documentation

◆ MWB_cleanupLib()

int MWB_cleanupLib ( void  )

Free memory resources allocated by library.

Should be invoked when library is not needed anymore, which is typically at application closing time. This cleanup is not necessary on most platforms, as memory resources are deallocated automatically by operating system.

Return values
MWB_RT_OKSuccess

◆ MWB_createRegionsFromTiles()

int MWB_createRegionsFromTiles ( int  tilesX,
int  tilesY,
int  overlap,
float *  regionsData 
)

Create multiple regions based on number of tiles by X and Y axes.

Parameters
[in]tilesXNumber of tiles by X axis
[in]tilesYNumber of tiles by Y axis
[in]overlapHow much each region should overlap neighbour one, expressed in percentage of image size
[out]regionsDatapre-allocated array for regions rectangles, must be of size tilesX * tilesY * 4 at least
Return values
>0Number of regions created
MWB_RT_BAD_PARAMNull pointer or out of range parameters

◆ MWB_disableCode()

int MWB_disableCode ( const uint32_t  codeMask)

Disable decoder type Remove barcode type from set of enabled types.

Parameters
[in]codeMaskBit flags (MWB_CODE_MASK_...) of decoder type to be deactivated.
Return values
MWB_RT_OKRequested decoder type supported and deactivated.
MWB_RT_NOT_SUPPORTEDRequested decoder type is not supported in this library release

◆ MWB_disableFlag()

int MWB_disableFlag ( const uint32_t  codeMask,
const uint32_t  flag 
)

Disable option for single barcode type (or global one).

MWB_disableFlag disable option (if any) for decoder type specified in codeMask. Available options depend on selected decoder type.

Parameters
[in]codeMaskSingle decoder type (MWB_CODE_MASK_...)
[in]flagSelected decoder type option (MWB_FLAG_...)
RSS decoder - no configuration options
Code39 decoder
- MWB_CFG_CODE39_REQ_CHKSUM - Checksum check mandatory
Return values
MWB_RT_OKSuccess
MWB_RT_BAD_PARAMFlag value out of range
MWB_RT_NOT_SUPPORTEDFlag value not supported for selected decoder

◆ MWB_disableSubcode()

int MWB_disableSubcode ( const uint32_t  codeMask,
const uint32_t  subMask 
)

Disable subcode for given code group flag.

Parameters
[in]codeMaskSingle decoder type/group (MWB_CODE_MASK_...)
[in]subMaskFlag of requested decoder subtype (MWB_SUBC_MASK_)
Return values
MWB_RT_OKDeactivation successful
MWB_RT_BAD_PARAMNo decoder group selected
MWB_RT_NOT_SUPPORTEDDecoder group or subtype not supported

◆ MWB_enableCode()

int MWB_enableCode ( const uint32_t  codeMask)

Enable decoder type Upon library load, all decoder types are inactive by default.

User must call this function at least once to choose active decoder.

Parameters
[in]codeMaskBit flags (MWB_CODE_MASK_...) of decoder type to be activated.
Return values
MWB_RT_OKRequested decoder type supported and activated.
MWB_RT_NOT_SUPPORTEDRequested decoder type is not supported in this library release

◆ MWB_enableFlag()

int MWB_enableFlag ( const uint32_t  codeMask,
const uint32_t  flag 
)

Enable option for single barcode type (or global one).

MWB_enableFlag configures option (if any) for decoder type specified in codeMask. Available options depend on selected decoder type.

Parameters
[in]codeMaskSingle decoder type (MWB_CODE_MASK_...)
[in]flagSelected decoder type option (MWB_FLAG_...)
RSS decoder - no configuration options
Code39 decoder
- MWB_CFG_CODE39_REQ_CHKSUM - Checksum check mandatory
Return values
MWB_RT_OKSuccess
MWB_RT_BAD_PARAMFlag value out of range
MWB_RT_NOT_SUPPORTEDFlag value not supported for selected decoder

◆ MWB_enableSubcode()

int MWB_enableSubcode ( const uint32_t  codeMask,
const uint32_t  subMask 
)

enable subcode for given code group flag.

Subcodes under some decoder type are all activated by default.

Parameters
[in]codeMaskSingle decoder type/group (MWB_CODE_MASK_...)
[in]subMaskFlag of requested decoder subtype (MWB_SUBC_MASK_)
Return values
MWB_RT_OKActivation successful
MWB_RT_BAD_PARAMNo decoder group selected
MWB_RT_NOT_SUPPORTEDDecoder group or subtype not supported

◆ MWB_getActiveCodes()

int MWB_getActiveCodes ( void  )

Get active decoder types.

Return values
Activedecoder types

◆ MWB_getActiveSubcodes()

int MWB_getActiveSubcodes ( const uint32_t  codeMask)

Get active subcodes for given code group flag.

Parameters
[in]codeMaskSingle decoder type/group (MWB_CODE_MASK_...)
Return values
>=0 Acctive subtypes for given code mask
MWB_RT_BAD_PARAMNo decoder group selected
MWB_RT_NOT_SUPPORTEDDecoder group or subtype not supported

◆ MWB_getBarcodeLocation()

int MWB_getBarcodeLocation ( float *  points)

Barcode location points .

Returns quad points of detected barcode. Currently Works for PDF 417, QR, Datamatrix, Aztec and Dotcode

Parameters
[out]pointsUser provided float buffer to be filled with coordinates in order - X1, Y1, X2, Y2, X3, Y3, X4, Y4
Return values
MWB_RT_OKBarcode location points returned
MWB_RT_FAILBarcode location points not available

◆ MWB_getDeviceID()

char* MWB_getDeviceID ( void  )

Get device ID It should be called after registering call, and works only on iOS and Android.

Return values
nonNULL ID of device
NULLID can't be retrieved

◆ MWB_getDirection()

int MWB_getDirection ( void  )

Get active scanning direction.

Return values
ORedbit flags of active scanning directions given with MWB_SCANDIRECTION_... bit-masks

◆ MWB_getFlags()

int MWB_getFlags ( const uint32_t  codeMask)

Get active flags for single barcode type.

Get active flags for single barcode type.

Parameters
[in]codeMaskSingle decoder type (MWB_CODE_MASK_...) or 0 for global flags
Return values
MWB_RT_OKSuccess

◆ MWB_getLastType()

int MWB_getLastType ( void  )

Retrieves actual detected code type after successful MWB_scanGrayscaleImage call.

If last call was not successful, it will return FOUND_NONE.

Return values
res_typesLast decoded type
MWB_RT_FAILLibrary error

◆ MWB_getLibVersion()

unsigned int MWB_getLibVersion ( void  )

Returns version code of Barcode Scanner Library.

Returns
32-bit version code in x.y.z format.
Byte 3 (most significant byte): reserved (0)
Byte 2: value x
Byte 1: value y
Byte 0 (least significant byte): value z

◆ MWB_getLicenseString()

char* MWB_getLicenseString ( void  )

Get license string for retrieving remaining devices It should be called after registering call, and works only on iOS and Android.

Return values
nonNULL encrypted licenseString
NULLID can't be retrieved

◆ MWB_getParam()

int MWB_getParam ( const uint32_t  codeMask,
const uint32_t  paramId 
)

Get specified decoder param.

MWB_setParam gets specified decoder param id/value pair for decoder type specified in codeMask.

Parameters
[in]codeMaskSingle decoder type (MWB_CODE_MASK_...)
[in]paramIdID of param
Return values
>=0 Param value
MWB_RT_BAD_PARAMInvalid parameter specified
MWB_RT_NOT_SUPPORTEDFunction not supported for specified codeMask

◆ MWB_getScanningRect()

int MWB_getScanningRect ( const uint32_t  codeMask,
float *  left,
float *  top,
float *  width,
float *  height 
)

Get rectangular area for barcode scanning with selected single or multiple decoder type(s).

If codeMask is 0, union rectangle of all ACTIVE barcode types will be returned Output values are in percentages of screeen width and height (range 0 - 100)

Parameters
[in]codeMaskSingle decoder type selector (MWB_CODE_MASK_...) or 0
[out]leftX coordinate of left edge
[out]topY coordinate of top edge
[out]widthRectangle witdh (x axis)
[out]heightRectangle height (y axis)
Return values
MWB_RT_OKRectangle get successfully
MWB_RT_NOT_SUPPORTEDRectangle get failed

◆ MWB_getSupportedCodes()

unsigned int MWB_getSupportedCodes ( void  )

Returns supported decoders in this library release.

Returns
32-bit bit mask where each non-zero bit represents supported decoder according to MWB_CODE_MASK_... values defined in BarcodeScanner.h header file.

◆ MWB_getTargetRect()

int MWB_getTargetRect ( float *  left,
float *  top,
float *  width,
float *  height 
)

Get rectangular area for targeted barcode scanning Output values are in percentages of screeen width and height (range 0 - 100)

Parameters
[out]leftX coordinate of left edge
[out]topY coordinate of top edge
[out]widthRectangle witdh (x axis)
[out]heightRectangle height (y axis)
Return values
MWB_RT_OKRectangle get successfully
MWB_RT_NOT_SUPPORTEDRectangle get failed

◆ MWB_isLastGS1()

int MWB_isLastGS1 ( void  )

Retrieves is result of GS1 type.

Return values
1true
0false
MWB_RT_FAILLibrary error

◆ MWB_registerSDK()

int MWB_registerSDK ( const char *  key)

Registers licensing information for all SDK functionality.

It should be called just before scanning is going to be used.

Parameters
[in]keyLicense key string
Return values
MWB_RT_OKRegistration successful
<0 Error code - see MWB_RTREG values

◆ MWB_registerSDKCustom()

int MWB_registerSDKCustom ( const char *  key,
const char *  customData 
)

Same as RegisterSDK with addition of custom string to be sent along with tracking info.

It should be called just before scanning is going to be used.

Parameters
[in]keyLicense key string
[in]customDataCustom string
Return values
MWB_RT_OKRegistration successful
<0 Error code - see MWB_RTREG values

◆ MWB_scanGrayscaleImage()

int MWB_scanGrayscaleImage ( uint8_t pp_image,
int  lenX,
int  lenY,
uint8_t **  pp_data 
)

Main scan function.

Invokes all activated decoders by priority. For successful scan, allocates pp_data buffer and pass it to user. User should deallocate *pp_data pointer when no more needed.

Parameters
[in]pp_imageByte array representing grayscale value of image pixels. Array shold be stored in row after row fashion, starting with top row.
[in]lenXX axis size (width) of image.
[in]lenYY axis size (length) of image.
[out]pp_dataOn successful decode, library allocates new byte array where it stores decoded string result. Pointer to string is passed here. User application is responsible for deallocating this buffer after use.
Return values
>0Result string length for successful decode
MWB_RT_BAD_PARAMNull pointer or out of range parameters
MWB_RT_NOT_SUPPORTEDUnsupported decoder found in execution list - library error

◆ MWB_scanGrayscaleRegions()

int MWB_scanGrayscaleRegions ( uint8_t pp_image,
int  lenX,
int  lenY,
float *  regionsData,
int  numberOfRegions,
int  maxThreads,
uint8_t **  pp_data 
)

Multi-regions scan function.

Invokes all activated decoders by priority. For successful scan, allocates pp_data buffer and pass it to user. User should deallocate *pp_data pointer when no more needed.

Parameters
[in]pp_imageByte array representing grayscale value of image pixels. Array shold be stored in row after row fashion, starting with top row.
[in]lenXX axis size (width) of image.
[in]lenYY axis size (length) of image.
[in]regionsDataRectangles data in form of continuous array of left, top, width, height expressed in percentages of image size
[in]numberOfRegionsNumber of rectangles provided in regionsData array
[in]maxThreadsMaximum number of threads to be used in decoding
[out]pp_dataOn successful decode, library allocates new byte array where it stores decoded string result. Pointer to string is passed here. User application is responsible for deallocating this buffer after use.
Return values
>0Result string length for successful decode
MWB_RT_BAD_PARAMNull pointer or out of range parameters
MWB_RT_NOT_SUPPORTEDUnsupported decoder found in execution list - library error
MWB_RT_INVALID_SCANNING_RECTANGLEScanning rectangle for all active barcodes must be set to 0,0,100,100

◆ MWB_setActiveCodes()

int MWB_setActiveCodes ( const uint32_t  codeMask)

Sets active or inactive status of decoder types and updates decoder execution priority list.

Upon library load, all decoder types are inactive by default. User must call this function at least once to choose active set of active decoders.

Parameters
[in]codeMaskORed bit flags (MWB_CODE_MASK_...) of decoder types to be activated. Bit value '1' activates corresponding decoder, while bit value deactivates it.
Return values
MWB_RT_OKAll requested decoder types supported and activated.
MWB_RT_NOT_SUPPORTEDOne or more requested decoder types is not supported in this library release. On this error, activation status of all supported types will not be changed.

◆ MWB_setActiveSubcodes()

int MWB_setActiveSubcodes ( const uint32_t  codeMask,
const uint32_t  subMask 
)

Set active subcodes for given code group flag.

Subcodes under some decoder type are all activated by default.

Parameters
[in]codeMaskSingle decoder type/group (MWB_CODE_MASK_...)
[in]subMaskORed bit flags of requested decoder subtypes (MWB_SUBC_MASK_)
Return values
MWB_RT_OKActivation successful
MWB_RT_BAD_PARAMNo decoder group selected
MWB_RT_NOT_SUPPORTEDDecoder group or subtype not supported

◆ MWB_setCodePriority()

int MWB_setCodePriority ( const uint32_t  codeMask,
const uint8_t  priority 
)

Sets code priority level for selected decoder group or groups.

If this library release supports multiple decoder types, user can activate more than one type to be invoked when main scan image function is called by user. MWB_setCodePriority enables user to control order by which decoders will be called.

Parameters
[in]codeMaskSingle decoder type/group (MWB_CODE_MASK_...)
[in]priorityPriority level
Return values
MWB_RT_OKSuccess
MWB_RT_NOT_SUPPORTEDDecoder group not supported

◆ MWB_setDirection()

int MWB_setDirection ( const uint32_t  direction)

Configure scanning direction for 1D barcodes.

This function enables some control over scanning lines choice for 1D barcodes. By ORing available bit-masks user can add one or more direction options to scanning lines set. Density of lines and angle step for omni scan can be controlled with MWB_setLevel API function. Available options are:
- MWB_SCANDIRECTION_HORIZONTAL - horizontal lines
- MWB_SCANDIRECTION_VERTICAL - vertical lines
- MWB_SCANDIRECTION_OMNI - omnidirectional lines
- MWB_SCANDIRECTION_AUTODETECT - enables BarcodeScanner's autodetection of barcode direction

Parameters
[in]directionORed bit mask of direction modes given with MWB_SCANDIRECTION_... bit-masks
Return values
MWB_RT_OKSuccess
MWB_RT_BAD_PARAMDirection out of range

◆ MWB_setFlags()

int MWB_setFlags ( const uint32_t  codeMask,
const uint32_t  flags 
)

Configure options for single barcode type.

MWB_setFlags configures options (if any) for decoder type specified in codeMask. Options are given in flags as bitwise OR of option bits. Available options depend on selected decoder type.

Parameters
[in]codeMaskSingle decoder type (MWB_CODE_MASK_...)
[in]flagsORed bit mask of selected decoder type options (MWB_FLAG_...)
RSS decoder - no configuration options
Code39 decoder
- MWB_CFG_CODE39_REQ_CHKSUM - Checksum check mandatory
Return values
MWB_RT_OKSuccess
MWB_RT_FAILNo code found in image
MWB_RT_BAD_PARAMFlag values out of range
MWB_RT_NOT_SUPPORTEDFlag values not supported for selected decoder

◆ MWB_setLevel()

int MWB_setLevel ( const int  level)

Configure global library effort level.

Barcode detector relies on image processing and geometry inerpolation for extracting optimal data for decoding. Higher effort level involves more processing and intermediate parameter values, thus increasing probability of successful detection with low quality images, but also consuming more CPU time. Although level is global on library level, each decoder type has its own parameter set for each level.

Parameters
[in]levelEffort level - available values are 1, 2, 3, 4 and 5.
Return values
MWB_RT_OKSuccess
MWB_RT_BAD_PARAMLevel out of range for selected decoder

◆ MWB_setMinLength()

int MWB_setMinLength ( const uint32_t  codeMask,
const uint32_t  minLength 
)

Set minimum result length for single barcode type.

MWB_setMinLength set minimum acceptable result length for decoder type specified in codeMask.

Parameters
[in]codeMaskSingle decoder type (MWB_CODE_MASK_...)
[in]minLengthMinimum length of result
Function is applicable to 1D barcode types with low or non existent error
protection like Code39, Code25, Code 11, Codabar to preven false results
from short bars fragments
Return values
MWB_RT_OKSuccess
MWB_RT_BAD_PARAMInvalid parameter specified
MWB_RT_NOT_SUPPORTEDFunction not supported for specified codeMask

◆ MWB_setParam()

int MWB_setParam ( const uint32_t  codeMask,
const uint32_t  paramId,
const uint32_t  paramValue 
)

Set custom decoder param.

MWB_setParam set custom decoder param id/value pair for decoder type specified in codeMask.

Parameters
[in]codeMaskSingle decoder type (MWB_CODE_MASK_...)
[in]paramIdID of param
[in]paramValueInteger value of param
Return values
MWB_RT_OKSuccess
MWB_RT_BAD_PARAMInvalid parameter specified
MWB_RT_NOT_SUPPORTEDFunction not supported for specified codeMask

◆ MWB_setResultType()

int MWB_setResultType ( const uint32_t  resultType)

Set result type from MWB_scanGrayscaleImage.

Users now can choose between getting raw result bytes as a resulf of image scan, or byte representation of complex result structure containing all information about the scanned barcode.

Parameters
[in]resultTypeType of result returned: MWB_RESULT_TYPE_RAW - return raw result bytes MWB_RESULT_TYPE_MW - return bytes of MWResult structure - should be converted to MWResult object.
Return values
MWB_RT_OKResult type set successfuly
MWB_RT_FAILInvalid result type specified

◆ MWB_setScanningRect()

int MWB_setScanningRect ( const uint32_t  codeMask,
float  left,
float  top,
float  width,
float  height 
)

Sets rectangular area for barcode scanning with selected single decoder type.

After MWB_setScanningRect() call, all subseqent scans will be restricted to this region. If rectangle is not set, whole image is scanned. Also, if width or height is zero, whole image is scanned.

Parameters are interpreted as percentage of image dimensions, i.e. ranges are 0 - 100 for all parameters.

Parameters
[in]codeMaskSingle decoder type selector (MWB_CODE_MASK_...)
[in]leftX coordinate of left edge (percentage)
[in]topY coordinate of top edge (percentage)
[in]widthRectangle witdh (x axis) (percentage)
[in]heightRectangle height (y axis) (percentage)
Return values
MWB_RT_OKRectangle set successfully
MWB_RT_BAD_PARAMRectange percentages invalid (out of range)

◆ MWB_setTargetRect()

int MWB_setTargetRect ( float  left,
float  top,
float  width,
float  height 
)

Sets rectangular area for targeted barcode scanning.

If rectangle size is greater than zero, decoder will discard all barcodes which location doesn't interleave with this rectangle If width or height is zero, targeted scanning is disabled

Parameters are interpreted as percentage of image dimensions, i.e. ranges are 0 - 100 for all parameters.

Parameters
[in]leftX coordinate of left edge (percentage)
[in]topY coordinate of top edge (percentage)
[in]widthRectangle witdh (x axis) (percentage)
[in]heightRectangle height (y axis) (percentage)
Return values
MWB_RT_OKRectangle set successfully
MWB_RT_BAD_PARAMRectange percentages invalid (out of range)

◆ MWB_validateVIN()

int MWB_validateVIN ( char *  vin,
int  length 
)

VIN validator.

Checks if the input is a valid Vehicle Identification Number

Parameters
[in]vinString that should be validated
[in]lengthLength of the string
Return values
MWB_RT_OKValid VIN
MWB_RT_FAILNot a valid VIN