Exemplo n.º 1
0
        public static void glassDecoderInit()
        {
            Console.WriteLine("Decoder initialization");
            //register your copy of library with givern user/password
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_39, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_93, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_25, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_128, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_AZTEC, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_DM, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_EANUPC, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_QR, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_PDF, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_RSS, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_CODABAR, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_DOTCODE, "username", "key");


            BarcodeConfig.MWB_setActiveCodes(BarcodeConfig.MWB_CODE_MASK_DM | BarcodeConfig.MWB_CODE_MASK_QR);


            BarcodeConfig.MWB_setDirection(BarcodeConfig.MWB_SCANDIRECTION_HORIZONTAL);

            BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_25, RECT_LANDSCAPE_1D);
            BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_39, RECT_LANDSCAPE_1D);
            BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_93, RECT_LANDSCAPE_1D);
            BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_128, RECT_LANDSCAPE_1D);
            BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_AZTEC, RECT_LANDSCAPE_2D);
            BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_DM, RECT_LANDSCAPE_2D);
            BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_EANUPC, RECT_LANDSCAPE_1D);
            BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_PDF, RECT_LANDSCAPE_1D);
            BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_QR, RECT_LANDSCAPE_2D);
            BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_RSS, RECT_LANDSCAPE_1D);
            BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_CODABAR, RECT_LANDSCAPE_1D);


            // 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);
            //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);
        }
Exemplo n.º 2
0
 private void InitConfig(ScanningConfig config)
 {
     //  register the plugin - must be done foreach not using the full bitmask
     if (config.Code == BarcodeConfig.MWB_CODE_MASK_39)
     {
         BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_39, config.UserName, config.Key);
         BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_39, RECT_FULL_1D);
     }
     else if (config.Code == BarcodeConfig.MWB_CODE_MASK_93)
     {
         BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_93, config.UserName, config.Key);
         BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_93, RECT_FULL_1D);
     }
     else if (config.Code == BarcodeConfig.MWB_CODE_MASK_25)
     {
         BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_25, config.UserName, config.Key);
         BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_25, RECT_FULL_1D);
     }
     else if (config.Code == BarcodeConfig.MWB_CODE_MASK_128)
     {
         BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_128, config.UserName, config.Key);
         BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_128, RECT_FULL_1D);
     }
     else if (config.Code == BarcodeConfig.MWB_CODE_MASK_AZTEC)
     {
         BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_AZTEC, config.UserName, config.Key);
         BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_AZTEC, RECT_FULL_2D);
     }
     else if (config.Code == BarcodeConfig.MWB_CODE_MASK_DM)
     {
         BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_DM, config.UserName, config.Key);
         BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_DM, RECT_FULL_2D);
     }
     else if (config.Code == BarcodeConfig.MWB_CODE_MASK_EANUPC)
     {
         BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_EANUPC, config.UserName, config.Key);
         BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_EANUPC, RECT_FULL_1D);
     }
     else if (config.Code == BarcodeConfig.MWB_CODE_MASK_QR)
     {
         BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_QR, config.UserName, config.Key);
         BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_QR, RECT_FULL_2D);
     }
     else if (config.Code == BarcodeConfig.MWB_CODE_MASK_PDF)
     {
         BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_PDF, config.UserName, config.Key);
         BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_PDF, RECT_FULL_1D);
     }
     else if (config.Code == BarcodeConfig.MWB_CODE_MASK_RSS)
     {
         BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_RSS, config.UserName, config.Key);
         BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_RSS, RECT_FULL_1D);
     }
     else if (config.Code == BarcodeConfig.MWB_CODE_MASK_CODABAR)
     {
         BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_CODABAR, config.UserName, config.Key);
         BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_CODABAR, RECT_FULL_1D);
     }
     else if (config.Code == BarcodeConfig.MWB_CODE_MASK_DOTCODE)
     {
         BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_DOTCODE, config.UserName, config.Key);
         BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_DOTCODE, RECT_DOTCODE);
     }
     else if (config.Code == BarcodeConfig.MWB_CODE_MASK_11)
     {
         BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_11, config.UserName, config.Key);
         BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_11, RECT_FULL_1D);
     }
     else if (config.Code == BarcodeConfig.MWB_CODE_MASK_MSI)
     {
         BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_MSI, config.UserName, config.Key);
         BarcodeConfig.MWBsetScanningRect(BarcodeConfig.MWB_CODE_MASK_MSI, RECT_FULL_1D);
     }
 }
Exemplo n.º 3
0
        public static void customDecoderInit()
        {
            Console.WriteLine("Decoder initialization");
            //register your copy of library with givern user/password
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_39, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_93, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_25, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_128, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_AZTEC, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_DM, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_EANUPC, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_QR, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_PDF, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_RSS, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_CODABAR, "username", "key");
            BarcodeConfig.MWB_registerCode(BarcodeConfig.MWB_CODE_MASK_DOTCODE, "username", "key");


            // 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);

            // 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_RSS );
            //BarcodeConfig.MWB_setActiveCodes( BarcodeConfig.MWB_CODE_MASK_DOTCODE );


            // 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);


            // But for better performance, set like this for PORTRAIT scanning...
            // BarcodeConfig.MWB_setDirection(BarcodeConfig.MWB_SCANDIRECTION_VERTICAL);
            // set the scanning rectangle based on scan direction(format in pct: x, y, width, height)
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_25,     RECT_PORTRAIT_1D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_39,     RECT_PORTRAIT_1D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_93,     RECT_PORTRAIT_1D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_128,    RECT_PORTRAIT_1D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_AZTEC,  RECT_PORTRAIT_2D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_DM,     RECT_PORTRAIT_2D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_EANUPC, RECT_PORTRAIT_1D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_PDF,    RECT_PORTRAIT_1D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_QR,     RECT_PORTRAIT_2D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_RSS,    RECT_PORTRAIT_1D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_CODABAR,RECT_PORTRAIT_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.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_25,     RECT_LANDSCAPE_1D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_39,     RECT_LANDSCAPE_1D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_93,     RECT_LANDSCAPE_1D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_128,    RECT_LANDSCAPE_1D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_AZTEC,  RECT_LANDSCAPE_2D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_DM,     RECT_LANDSCAPE_2D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_EANUPC, RECT_LANDSCAPE_1D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_PDF,    RECT_LANDSCAPE_1D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_QR,     RECT_LANDSCAPE_2D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_RSS,    RECT_LANDSCAPE_1D);
            // BarcodeConfig.MWB_setScanningRect(BarcodeConfig.MWB_CODE_MASK_CODABAR,RECT_LANDSCAPE_1D);


            // 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);

            //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);
        }