protected ScanSettings GetScanSettings() { ScanSettings settings = ScanSettings.Create(); settings.SetSymbologyEnabled(Barcode.SymbologyEan13, true); settings.SetSymbologyEnabled(Barcode.SymbologyUpce, true); settings.SetSymbologyEnabled(Barcode.SymbologyUpca, true); settings.SetSymbologyEnabled(Barcode.SymbologyEan8, true); settings.MatrixScanEnabled = true; settings.MaxNumberOfCodesPerFrame = 12; settings.HighDensityModeEnabled = true; settings.CodeCachingDuration = 0; settings.CodeDuplicateFilter = 0; return(settings); }
void InitializeAndStartBarcodeScanning() { ScanSettings settings = ScanSettings.Create(); int[] symbologiesToEnable = new int[] { Barcode.SymbologyEan13, Barcode.SymbologyEan8, Barcode.SymbologyUpca, Barcode.SymbologyDataMatrix, Barcode.SymbologyQr, Barcode.SymbologyCode39, Barcode.SymbologyCode128, Barcode.SymbologyInterleaved2Of5, Barcode.SymbologyUpce }; foreach (int symbology in symbologiesToEnable) { settings.SetSymbologyEnabled(symbology, true); } SymbologySettings symSettings = settings.GetSymbologySettings(Barcode.SymbologyCode128); short[] activeSymbolCounts = new short[] { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; symSettings.SetActiveSymbolCounts(activeSymbolCounts); barcodePicker = new BarcodePicker(this, settings); barcodePicker.SetOnScanListener(this); SetContentView(barcodePicker); }
void InitializeBarcodeScanning() { ScanSettings settings = ScanSettings.Create(); int[] symbologiesToEnable = { Barcode.SymbologyEan13, Barcode.SymbologyEan8, Barcode.SymbologyUpca, Barcode.SymbologyCode39, Barcode.SymbologyCode128, Barcode.SymbologyInterleaved2Of5, Barcode.SymbologyUpce }; ScanAreaSettings scanAreaSettings = new ScanAreaSettings(); scanAreaSettings.SquareCodeLocationConstraint = BarcodeScannerSettings.CodeLocationRestrict; scanAreaSettings.WideCodeLocationConstraint = BarcodeScannerSettings.CodeLocationRestrict; scanAreaSettings.WideCodeLocationArea = new RectF(0f, 0.475f, 1f, 0.525f); scanAreaSettings.SquareCodeLocationArea = new RectF(0f, 0.3f, 1f, 0.7f); settings.AreaSettingsPortrait = scanAreaSettings; settings.AreaSettingsLandscape = scanAreaSettings; settings.CodeDuplicateFilter = 1000; foreach (int symbology in symbologiesToEnable) { settings.SetSymbologyEnabled(symbology, true); } barcodePicker = new BarcodePicker(this, settings); barcodePicker.OverlayView.SetGuiStyle(ScanOverlay.GuiStyleLaser); barcodePicker.SetOnScanListener(this); (FindViewById(Resource.Id.picker_container) as FrameLayout).AddView(barcodePicker, 0); }
void InitializeAndStartBarcodeScanning() { // The scanning behavior of the barcode picker is configured through scan // settings. We start with empty scan settings and enable a generous set // of 1D symbologies. MatrixScan is currently only supported for 1D // symbologies, enabling 2D symbologies will result in unexpected results. // In your own apps, only enable the symbologies you actually need. ScanSettings settings = ScanSettings.Create(); int[] symbologiesToEnable = new int[] { Barcode.SymbologyEan13, Barcode.SymbologyEan8, Barcode.SymbologyUpca, Barcode.SymbologyCode39, Barcode.SymbologyCode128, Barcode.SymbologyInterleaved2Of5, Barcode.SymbologyUpce }; foreach (int symbology in symbologiesToEnable) { settings.SetSymbologyEnabled(symbology, true); } // Enable MatrixScan and set the max number of barcodes that can be recognized per frame // to some reasonable number for your use case. The max number of codes per frame does not // limit the number of codes that can be tracked at the same time, it only limits the // number of codes that can be newly recognized per frame. settings.MatrixScanEnabled = true; settings.MaxNumberOfCodesPerFrame = 10; // Prefer the back-facing camera, if there is any. settings.CameraFacingPreference = ScanSettings.CameraFacingBack; barcodePicker = new BarcodePicker(this, settings); barcodePicker.OverlayView.SetGuiStyle(ScanOverlay.GuiStyleMatrixScan); // Set the GUI style to MatrixScan to see a visualization of the tracked barcodes. If you // would like to visualize it yourself, set it to ScanOverlay.GuiStyleNone and update your // visualization in the didProcess() callback. barcodePicker.OverlayView.SetGuiStyle(ScanOverlay.GuiStyleMatrixScan); // When using MatrixScan vibrating is often not desired. barcodePicker.OverlayView.SetVibrateEnabled(false); // Register listener, in order to be notified about relevant events // (e.g. a successfully scanned bar code). barcodePicker.SetOnScanListener(this); // Register a process frame listener to be able to reject tracked codes. barcodePicker.SetProcessFrameListener(this); // Set listener for the scan event. barcodePicker.SetOnScanListener(this); // Show the scan user interface SetContentView(barcodePicker); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RequestWindowFeature(WindowFeatures.NoTitle); Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); // Set the app key before instantiating the picker. ScanditLicense.AppKey = appKey; // The scanning behavior of the barcode picker is configured through scan // settings. We start with empty scan settings and enable a very generous // set of symbologies. In your own apps, only enable the symbologies you // actually need. ScanSettings settings = ScanSettings.Create(); int[] symbologiesToEnable = new int[] { Barcode.SymbologyEan13, Barcode.SymbologyEan8, Barcode.SymbologyUpca, Barcode.SymbologyDataMatrix, Barcode.SymbologyQr, Barcode.SymbologyCode39, Barcode.SymbologyCode128, Barcode.SymbologyInterleaved2Of5, Barcode.SymbologyUpce }; for (int sym = 0; sym < symbologiesToEnable.Length; sym++) { settings.SetSymbologyEnabled(symbologiesToEnable[sym], true); } // Some 1d barcode symbologies allow you to encode variable-length data. By default, the // Scandit BarcodeScanner SDK only scans barcodes in a certain length range. If your // application requires scanning of one of these symbologies, and the length is falling // outside the default range, you may need to adjust the "active symbol counts" for this // symbology. This is shown in the following few lines of code. SymbologySettings symSettings = settings.GetSymbologySettings(Barcode.SymbologyCode128); short[] activeSymbolCounts = new short[] { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; symSettings.SetActiveSymbolCounts(activeSymbolCounts); // For details on defaults and how to calculate the symbol counts for each symbology, take // a look at http://docs.scandit.com/stable/c_api/symbologies.html. picker = new BarcodePicker(this, settings); // Set listener for the scan event. picker.SetOnScanListener(this); // Show the scan user interface SetContentView(picker); }
void InitializeAndStartBarcodeScanning() { // The scanning behavior of the barcode picker is configured through scan // settings. We start with empty scan settings and enable a very generous // set of symbologies. In your own apps, only enable the symbologies you // actually need. ScanSettings settings = ScanSettings.Create(); int[] symbologiesToEnable = new int[] { Barcode.SymbologyEan13, Barcode.SymbologyEan8, Barcode.SymbologyUpca, Barcode.SymbologyDataMatrix, Barcode.SymbologyQr, Barcode.SymbologyCode39, Barcode.SymbologyCode128, Barcode.SymbologyInterleaved2Of5, Barcode.SymbologyUpce }; foreach (int symbology in symbologiesToEnable) { settings.SetSymbologyEnabled(symbology, true); } // Some 1d barcode symbologies allow you to encode variable-length data. By default, the // Scandit BarcodeScanner SDK only scans barcodes in a certain length range. If your // application requires scanning of one of these symbologies, and the length is falling // outside the default range, you may need to adjust the "active symbol counts" for this // symbology. This is shown in the following few lines of code. SymbologySettings symSettings = settings.GetSymbologySettings(Barcode.SymbologyCode128); short[] activeSymbolCounts = new short[] { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; symSettings.SetActiveSymbolCounts(activeSymbolCounts); // For details on defaults and how to calculate the symbol counts for each symbology, take // a look at http://docs.scandit.com/stable/c_api/symbologies.html. barcodePicker = new BarcodePicker(this, settings); // Set listener for the scan event. barcodePicker.SetOnScanListener(this); // Show the scan user interface SetContentView(barcodePicker); }
void InitializeBarcodeScanning() { ScanSettings settings = ScanSettings.Create(); int[] symbologiesToEnable = { Barcode.SymbologyEan13, Barcode.SymbologyEan8, Barcode.SymbologyUpca, Barcode.SymbologyUpce, Barcode.SymbologyDataMatrix, Barcode.SymbologyQr, Barcode.SymbologyCode39, Barcode.SymbologyCode128, Barcode.SymbologyInterleaved2Of5 }; foreach (int symbology in symbologiesToEnable) { settings.SetSymbologyEnabled(symbology, true); } // Enable and set the restrict active area. This will make sure that codes are only scanned in a very thin band in the center of the image. settings.SetActiveScanningArea(ScanSettings.OrientationPortrait, new RectF(0f, 0.48f, 1f, 0.52f)); // Setup the barcode scanner barcodePicker = new BarcodePicker(this, settings); // Add listener for the scan event. We keep references to the // delegates until the picker is no longer used as the delegates are softly // referenced and can be removed because of low memory. barcodePicker.SetOnScanListener(this); // Modify the GUI style to have a "laser" line instead of a square viewfinder. barcodePicker.OverlayView.SetGuiStyle(ScanOverlay.GuiStyleLaser); // Start scanning in paused state. barcodePicker.StartScanning(true); (FindViewById(Resource.Id.picker_container) as FrameLayout).AddView(barcodePicker, 0); GrantCameraPermissionsThenStartScanning(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RequestWindowFeature(WindowFeatures.NoTitle); Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); ScanditLicense.AppKey = appKey; ScanSettings settings = ScanSettings.Create(); int[] symbologiesToEnable = new int[] { Barcode.SymbologyEan13, Barcode.SymbologyEan8, Barcode.SymbologyUpca, Barcode.SymbologyDataMatrix, Barcode.SymbologyQr, Barcode.SymbologyCode39, Barcode.SymbologyCode128, Barcode.SymbologyInterleaved2Of5, Barcode.SymbologyUpce }; for (int sym = 0; sym < symbologiesToEnable.Length; sym++) { settings.SetSymbologyEnabled(symbologiesToEnable[sym], true); } SymbologySettings symSettings = settings.GetSymbologySettings(Barcode.SymbologyCode128); short[] activeSymbolCounts = new short[] { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; symSettings.SetActiveSymbolCounts(activeSymbolCounts); // For details on defaults and how to calculate the symbol counts for each symbology, take // a look at http://docs.scandit.com/stable/c_api/symbologies.html. picker = new BarcodePicker(this, settings); picker.SetOnScanListener(this); SetContentView(picker); }
protected override void OnElementChanged(ElementChangedEventArgs <CustomStackLayout> e) { base.OnElementChanged(e); //var test = this as ViewGroup; if (e.NewElement != null) { // Set the app key before instantiating the picker. ScanditLicense.AppKey = appKey; // The scanning behavior of the barcode picker is configured through scan // settings. We start with empty scan settings and enable a very generous // set of symbologies. In your own apps, only enable the symbologies you // actually need. ScanSettings settings = ScanSettings.Create(); int[] symbologiesToEnable = new int[] { Barcode.SymbologyEan13, Barcode.SymbologyEan8, Barcode.SymbologyUpca, Barcode.SymbologyDataMatrix, Barcode.SymbologyQr, Barcode.SymbologyCode39, Barcode.SymbologyCode128, Barcode.SymbologyInterleaved2Of5, Barcode.SymbologyUpce }; for (int sym = 0; sym < symbologiesToEnable.Length; sym++) { settings.SetSymbologyEnabled(symbologiesToEnable[sym], true); } //// Some 1d barcode symbologies allow you to encode variable-length data. By default, the //// Scandit BarcodeScanner SDK only scans barcodes in a certain length range. If your //// application requires scanning of one of these symbologies, and the length is falling //// outside the default range, you may need to adjust the "active symbol counts" for this //// symbology. This is shown in the following few lines of code. SymbologySettings symSettings = settings.GetSymbologySettings(Barcode.SymbologyCode128); short[] activeSymbolCounts = new short[] { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; symSettings.SetActiveSymbolCounts(activeSymbolCounts); // For details on defaults and how to calculate the symbol counts for each symbology, take // a look at http://docs.scandit.com/stable/c_api/symbologies.html. picker = new BarcodePicker(this.Context, settings); picker.OverlayView.SetViewfinderDimension(0.5f, 0.9f, 0.5f, 0.9f); picker.OverlayView.SetTorchEnabled(false); // Set listener for the scan event. picker.SetOnScanListener(this); picker.StartScanning(); //picker.Scan += (sender, args) => //{ //}; AddView(picker); //SetNativeControl(picker); } }
/// <summary> /// On element changed event /// </summary> /// <param name="e"></param> protected override void OnElementChanged(ElementChangedEventArgs <ScandItCamera> e) { base.OnElementChanged(e); //assign new elemnt value to scanned it camera _scanedItCamera = e.NewElement; if (Control == null) { try { var scanLicense = new ScanditLicense(); scanLicense.AppKey = ScanditAppKey; ScanSettings scanSettings = ScanSettings.DefaultSettings(); //set code duplication filter if (_scanedItCamera.AllowDuplicate) { scanSettings.CodeDuplicateFilter = 1500; //1.5 sec delay for duplication scanning } else { scanSettings.CodeDuplicateFilter = -1; } //Bar code symbologies scanSettings.SetSymbologyEnabled(Symbology.EAN13, true); scanSettings.SetSymbologyEnabled(Symbology.QR, true); scanSettings.SetSymbologyEnabled(Symbology.UPC12, true); scanSettings.SetSymbologyEnabled(Symbology.Code128, true); scanSettings.SetSymbologyEnabled(Symbology.Code39, true); scanSettings.SetSymbologyEnabled(Symbology.EAN8, true); //update code 128 settings var code128Settings = scanSettings.SettingsForSymbology(Symbology.Code128); var countArray = NSArray.FromObjects(4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40); code128Settings.ActiveSymbolCounts = new NSSet(countArray); //apply scan settings _picker = new BarcodePicker(scanSettings); _picker.OverlayView.SetBeepEnabled(true); _picker.OverlayView.SetVibrateEnabled(true); _picker.OverlayView.SetCameraSwitchVisibility(CameraSwitchVisibility.Never); _picker.OverlayView.GuiStyle = GuiStyle.None; //to set picker gui style if (_scanedItCamera.ShowFocus) { _picker.OverlayView.GuiStyle = GuiStyle.Default; } else { _picker.OverlayView.GuiStyle = GuiStyle.None; } _picker.DidScan += DidScan; //set native control as picker view SetNativeControl(_picker.View); //enable action for start and stop scanning if (_scanedItCamera != null) { _scanedItCamera.StartScanning = StartScanning; _scanedItCamera.StopScanning = StopScanning; } } catch (Exception ex) { Debug.WriteLine(ex); } } }