public static void customDecoderInit() { Console.WriteLine("Decoder initialization"); //register your copy of library with givern SDK key int registerResult = BarcodeConfig.MWB_registerSDK("key"); switch (registerResult) { case BarcodeConfig.MWB_RTREG_OK: Console.WriteLine("Registration OK"); break; case BarcodeConfig.MWB_RTREG_INVALID_KEY: Console.WriteLine("Registration Invalid Key"); break; case BarcodeConfig.MWB_RTREG_INVALID_CHECKSUM: Console.WriteLine("Registration Invalid Checksum"); break; case BarcodeConfig.MWB_RTREG_INVALID_APPLICATION: Console.WriteLine("Registration Invalid Application"); break; case BarcodeConfig.MWB_RTREG_INVALID_SDK_VERSION: Console.WriteLine("Registration Invalid SDK Version"); break; case BarcodeConfig.MWB_RTREG_INVALID_KEY_VERSION: Console.WriteLine("Registration Invalid Key Version"); break; case BarcodeConfig.MWB_RTREG_INVALID_PLATFORM: Console.WriteLine("Registration Invalid Platform"); break; case BarcodeConfig.MWB_RTREG_KEY_EXPIRED: Console.WriteLine("Registration Key Expired"); break; default: break; } // choose code type or types you want to search for // Our sample app is configured by default to search all supported barcodes... BarcodeConfig.MWB_setActiveCodes(BarcodeConfig.MWB_CODE_MASK_25 | BarcodeConfig.MWB_CODE_MASK_39 | BarcodeConfig.MWB_CODE_MASK_93 | BarcodeConfig.MWB_CODE_MASK_128 | BarcodeConfig.MWB_CODE_MASK_AZTEC | BarcodeConfig.MWB_CODE_MASK_DM | BarcodeConfig.MWB_CODE_MASK_EANUPC | BarcodeConfig.MWB_CODE_MASK_PDF | BarcodeConfig.MWB_CODE_MASK_QR | BarcodeConfig.MWB_CODE_MASK_CODABAR | BarcodeConfig.MWB_CODE_MASK_RSS | BarcodeConfig.MWB_CODE_MASK_MAXICODE | BarcodeConfig.MWB_CODE_MASK_DOTCODE | BarcodeConfig.MWB_CODE_MASK_11 | BarcodeConfig.MWB_CODE_MASK_MSI | BarcodeConfig.MWB_CODE_MASK_POSTAL); // But for better performance, only activate the symbologies your application requires... // BarcodeConfig.MWB_setActiveCodes( BarcodeConfig.MWB_CODE_MASK_25 ); // BarcodeConfig.MWB_setActiveCodes( BarcodeConfig.MWB_CODE_MASK_39 ); // BarcodeConfig.MWB_setActiveCodes( BarcodeConfig.MWB_CODE_MASK_93 ); // BarcodeConfig.MWB_setActiveCodes( BarcodeConfig.MWB_CODE_MASK_128 ); // BarcodeConfig.MWB_setActiveCodes( BarcodeConfig.MWB_CODE_MASK_AZTEC ); // BarcodeConfig.MWB_setActiveCodes( BarcodeConfig.MWB_CODE_MASK_DM ); // BarcodeConfig.MWB_setActiveCodes( BarcodeConfig.MWB_CODE_MASK_EANUPC ); // BarcodeConfig.MWB_setActiveCodes( BarcodeConfig.MWB_CODE_MASK_PDF ); // BarcodeConfig.MWB_setActiveCodes( BarcodeConfig.MWB_CODE_MASK_QR ); // BarcodeConfig.MWB_setActiveCodes( BarcodeConfig.MWB_CODE_MASK_CODABAR ); // BarcodeConfig.MWB_setActiveCodes( BarcodeConfig.MWB_CODE_MASK_RSS ); // BarcodeConfig.MWB_setActiveCodes( BarcodeConfig.MWB_CODE_MASK_MAXICODE ); // BarcodeConfig.MWB_setActiveCodes( BarcodeConfig.MWB_CODE_MASK_DOTCODE ); // BarcodeConfig.MWB_setActiveCodes( BarcodeConfig.MWB_CODE_MASK_11 ); // BarcodeConfig.MWB_setActiveCodes( BarcodeConfig.MWB_CODE_MASK_MSI ); // BarcodeConfig.MWB_setActiveCodes( BarcodeConfig.MWB_CODE_MASK_POSTAL ); // Our sample app is configured by default to search both directions... BarcodeConfig.MWB_setDirection(BarcodeConfig.MWB_SCANDIRECTION_HORIZONTAL | BarcodeConfig.MWB_SCANDIRECTION_VERTICAL); // set the scanning rectangle based on scan direction(format in pct: x, y, width, height) BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_25, RECT_FULL_1D); BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_39, RECT_FULL_1D); BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_93, RECT_FULL_1D); BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_128, RECT_FULL_1D); BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_AZTEC, RECT_FULL_2D); BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_DM, RECT_FULL_2D); BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_EANUPC, RECT_FULL_1D); BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_PDF, RECT_FULL_1D); BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_QR, RECT_FULL_2D); BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_RSS, RECT_FULL_1D); BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_CODABAR, RECT_FULL_1D); BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_DOTCODE, RECT_DOTCODE); BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_11, RECT_FULL_1D); BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_MSI, RECT_FULL_1D); BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_MAXICODE, RECT_FULL_2D); BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_POSTAL, RECT_FULL_1D); // But for better performance, set like this for PORTRAIT scanning... // BarcodeConfig.MWB_setDirection(BarcodeConfig.MWB_SCANDIRECTION_VERTICAL); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_25, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_39, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_93, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_128, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_AZTEC, RECT_FULL_2D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_DM, RECT_FULL_2D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_EANUPC, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_PDF, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_QR, RECT_FULL_2D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_RSS, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_CODABAR, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_DOTCODE, RECT_DOTCODE); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_11, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_MSI, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_MAXICODE, RECT_FULL_2D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_POSTAL, RECT_FULL_1D); // or like this for LANDSCAPE scanning - Preferred for dense or wide codes... // BarcodeConfig.MWB_setDirection(BarcodeConfig.MWB_SCANDIRECTION_HORIZONTAL); // set the scanning rectangle based on scan direction(format in pct: x, y, width, height) //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_25, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_39, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_93, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_128, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_AZTEC, RECT_FULL_2D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_DM, RECT_FULL_2D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_EANUPC, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_PDF, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_QR, RECT_FULL_2D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_RSS, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_CODABAR, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_DOTCODE, RECT_DOTCODE); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_11, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_MSI, RECT_FULL_1D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_MAXICODE, RECT_FULL_2D); //BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_POSTAL, RECT_FULL_1D); BarcodeConfig.MWB_setMinLength(BarcodeConfig.MWB_CODE_MASK_25, 5); BarcodeConfig.MWB_setMinLength(BarcodeConfig.MWB_CODE_MASK_MSI, 5); BarcodeConfig.MWB_setMinLength(BarcodeConfig.MWB_CODE_MASK_39, 5); BarcodeConfig.MWB_setMinLength(BarcodeConfig.MWB_CODE_MASK_CODABAR, 5); BarcodeConfig.MWB_setMinLength(BarcodeConfig.MWB_CODE_MASK_11, 5); MWScannerViewController.setActiveParserMask(BarcodeConfig.MWP_PARSER_MASK_NONE); // set decoder effort level (1 - 5) // for live scanning scenarios, a setting between 1 to 3 will suffice // levels 4 and 5 are typically reserved for batch scanning BarcodeConfig.MWB_setLevel(2); //BarcodeConfig.MWBsetMaxThreads (1); // disable multithreading //BarcodeConfig.MWBenableZoom(false); // disable zoom //BarcodeConfig.MWBsetZoomLevels(150,300,0); // first 2 params to set zoom levels in %; third param to set initial level [0|1|2] //BarcodeConfig.MWB_setDuplicatesTimeout (2); //ignore scanning the same barcode; int timeout param is in seconds //get and print Library version int ver = BarcodeConfig.MWB_getLibVersion(); int v1 = (ver >> 16); int v2 = (ver >> 8) & 0xff; int v3 = (ver & 0xff); String libVersion = v1.ToString() + "." + v2.ToString() + "." + v3.ToString(); Console.WriteLine("Lib version: " + libVersion); }