Exemplo n.º 1
0
        private ScannerModel()
        {
            this.CurrentCamera?.ApplySettingsAsync(this.CameraSettings);

            // Create data capture context using your license key and set the camera as the frame source.
            this.DataCaptureContext = DataCaptureContext.ForLicenseKey(SCANDIT_LICENSE_KEY);
            this.DataCaptureContext.SetFrameSourceAsync(this.CurrentCamera);

            // The barcode capturing process is configured through barcode capture settings
            // which are then applied to the barcode capture instance that manages barcode recognition.
            this.BarcodeCaptureSettings = BarcodeCaptureSettings.Create();

            // The settings instance initially has all types of barcodes (symbologies) disabled.
            // For the purpose of this sample we enable a very generous set of symbologies.
            // In your own app ensure that you only enable the symbologies that your app requires as
            // every additional enabled symbology has an impact on processing times.
            HashSet <Symbology> symbologies = new HashSet <Symbology>
            {
                Symbology.Ean13Upca,
                Symbology.Ean8,
                Symbology.Upce,
                Symbology.Qr,
                Symbology.DataMatrix,
                Symbology.Code39,
                Symbology.Code128,
                Symbology.InterleavedTwoOfFive
            };

            this.BarcodeCaptureSettings.EnableSymbologies(symbologies);
            this.BarcodeCapture = BarcodeCapture.Create(this.DataCaptureContext, this.BarcodeCaptureSettings);
        }
Exemplo n.º 2
0
        private SettingsManager()
        {
            this.CurrentCamera?.ApplySettingsAsync(this.CameraSettings);

            // The barcode capturing process is configured through barcode capture settings
            // which are then applied to the barcode capture instance that manages barcode recognition.
            this.BarcodeCaptureSettings = BarcodeCaptureSettings.Create();

            // Create data capture context using your license key and set the camera as the frame source.
            this.DataCaptureContext = DataCaptureContext.ForLicenseKey(SCANDIT_LICENSE_KEY);
            this.DataCaptureContext.SetFrameSourceAsync(this.CurrentCamera);

            // Create new barcode capture mode with the settings from above.
            this.BarcodeCapture         = BarcodeCapture.Create(this.DataCaptureContext, this.BarcodeCaptureSettings);
            this.BarcodeCapture.Enabled = true;

            // Create a new overlay with the barcode capture from above, and retrieve the default brush.
            this.BarcodeCaptureOverlay = BarcodeCaptureOverlay.Create(this.BarcodeCapture, null);

            // Create a temporary RectangularViewfinder instance to get default values for width and height.
            using RectangularViewfinder tempRectangularViewfinder = RectangularViewfinder.Create();
            this.RectangularViewfinderWidth  = tempRectangularViewfinder.SizeWithUnitAndAspect.WidthAndHeight.Width;
            this.RectangularViewfinderHeight = tempRectangularViewfinder.SizeWithUnitAndAspect.WidthAndHeight.Height;

            // Create a temporary SpotlightViewfinder instance to get default values for width and height.
            using SpotlightViewfinder tempSpotlightViewfinder = SpotlightViewfinder.Create();
            this.SpotlightViewfinderWidth  = tempSpotlightViewfinder.SizeWithUnitAndAspect.WidthAndHeight.Width;
            this.SpotlightViewfinderHeight = tempSpotlightViewfinder.SizeWithUnitAndAspect.WidthAndHeight.Height;
        }
Exemplo n.º 3
0
        public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData)
        {
            if (!SettingsManager.Instance.ContinuousModeEnabled)
            {
                // Stop recognizing barcodes for as long as we are
                // displaying the result. There won't be any new results until
                // the capture mode is enabled again.
                // Note that disabling the capture mode does not stop
                // the camera, the camera continues to stream frames
                // until it is turned off.
                this.BarcodeCapture.Enabled = false;
            }

            this.ShowResult(session.NewlyRecognizedBarcodes, () =>
            {
                if (!SettingsManager.Instance.ContinuousModeEnabled)
                {
                    // Enable recognizing barcodes when the result
                    // is not shown anymore.
                    this.BarcodeCapture.Enabled = true;
                }
            });

            frameData.Dispose();
        }
        public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData)
        {
            if (!session.NewlyRecognizedBarcodes.Any())
            {
                return;
            }

            Barcode barcode = session.NewlyRecognizedBarcodes[0];

            // Stop recognizing barcodes for as long as we are displaying the result. There won't be any new results until
            // the capture mode is enabled again. Note that disabling the capture mode does not stop the camera, the camera
            // continues to stream frames until it is turned off.
            barcodeCapture.Enabled = false;

            // If you are not disabling barcode capture here and want to continue scanning, consider
            // setting the codeDuplicateFilter when creating the barcode capture settings to around 500
            // or even -1 if you do not want codes to be scanned more than once.

            // Get the human readable name of the symbology and assemble the result to be shown.
            SymbologyDescription description = new SymbologyDescription(barcode.Symbology);
            string result = "Scanned: " + barcode.Data + " (" + description.ReadableName + ")";

            if (MessageService == null)
            {
                MessageService = DependencyService.Get <IMessageService>();
            }

            MessageService.ShowAsync(result, () => barcodeCapture.Enabled = true);
        }
        public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData)
        {
            var barcode = session?.NewlyRecognizedBarcodes.FirstOrDefault();

            if (barcode == null || string.IsNullOrEmpty(barcode.Data))
            {
                return;
            }

            // Stop recognizing barcodes for as long as we are displaying the result. There won't be any new
            // results until the capture mode is enabled again. Note that disabling the capture mode does
            // not stop the camera, the camera continues to stream frames until it is turned off.
            this.barcodeCapture.Enabled = false;

            // If you are not disabling barcode capture here and want to continue scanning, consider
            // setting the codeDuplicateFilter when creating the barcode capture settings to around 500
            // or even -1 if you do not want codes to be scanned more than once.

            // Get the human readable name of the symbology and assemble the result to be shown.
            string symbology = SymbologyDescription.Create(barcode.Symbology).ReadableName;
            string result    = string.Format("Scanned {0} ({1})", barcode.Data, symbology);

            this.ShowResult(result);

            // Dispose the frame when you have finished processing it. If the frame is not properly disposed,
            // different issues could arise, e.g. a frozen, non-responsive, or "severely stuttering" video feed.
            frameData.Dispose();
        }
        private void InitializeAndStartBarcodeScanning()
        {
            // Create data capture context using your license key.
            this.dataCaptureContext = DataCaptureContext.ForLicenseKey(SCANDIT_LICENSE_KEY);

            // Use the default camera with the recommended camera settings for the BarcodeCapture mode
            // and set it as the frame source of the context. The camera is off by default and must be
            // turned on to start streaming frames to the data capture context for recognition.
            // See resumeFrameSource and pauseFrameSource below.
            this.camera = Camera.GetDefaultCamera();
            if (this.camera == null)
            {
                throw new NullReferenceException(
                          "Sample depends on a camera, which failed to initialize.");
            }

            // Use the settings recommended by barcode capture.
            this.dataCaptureContext.SetFrameSourceAsync(this.camera);

            // The settings instance initially has all types of barcodes (symbologies) disabled. For the purpose of this
            // sample we enable the QR symbology. In your own app ensure that you only enable the symbologies that your app
            // requires as every additional enabled symbology has an impact on processing times.
            var barcodeCaptureSettings = BarcodeCaptureSettings.Create();

            barcodeCaptureSettings.EnableSymbology(Symbology.Qr, true);

            // Create new barcode capture mode with the settings from above.
            barcodeCapture = BarcodeCapture.Create(dataCaptureContext, barcodeCaptureSettings);

            // By default, every time a barcode is scanned, a sound (if not in silent mode) and a
            // vibration are played. In the following we are setting a success feedback without sound
            // and vibration.
            barcodeCapture.Feedback.Success = new Feedback();

            // Register self as a listener to get informed whenever a new barcode got recognized.
            barcodeCapture.AddListener(this);

            // To visualize the on-going barcode capturing process on screen, setup a data capture view
            // that renders the camera preview. The view must be connected to the data capture context.
            this.dataCaptureView = DataCaptureView.Create(this, this.dataCaptureContext);

            // Add a barcode capture overlay to the data capture view to render the location of captured
            // barcodes on top of the video preview.
            // This is optional, but recommended for better visual feedback.
            overlay = BarcodeCaptureOverlay.Create(this.barcodeCapture, this.dataCaptureView);

            // Add a square viewfinder as we are only scanning square QR codes.
            overlay.Viewfinder = RectangularViewfinder.Create(RectangularViewfinderStyle.Square, RectangularViewfinderLineStyle.Light);

            // Adjust the overlay's barcode highlighting to match the new viewfinder styles and improve the visibility of feedback.
            // With 6.10 we will introduce this visual treatment as a new style for the overlay.
            this.highlightingBrush = new Brush(fillColor: Android.Graphics.Color.Transparent,
                                               strokeColor: Android.Graphics.Color.White,
                                               strokeWidth: 3);
            overlay.Brush = this.highlightingBrush;

            SetContentView(this.dataCaptureView);
        }
Exemplo n.º 7
0
        protected void InitializeAndStartBarcodeScanning()
        {
            // Create data capture context using your license key.
            this.dataCaptureContext = DataCaptureContext.ForLicenseKey(SCANDIT_LICENSE_KEY);

            // Use the default camera and set it as the frame source of the context.
            // The camera is off by default and must be turned on to start streaming frames to the data
            // capture context for recognition.
            // See resumeFrameSource and pauseFrameSource below.
            this.camera = Camera.GetDefaultCamera();
            if (this.camera != null)
            {
                // Use the settings recommended by barcode capture.
                this.camera.ApplySettingsAsync(BarcodeCapture.RecommendedCameraSettings);
                this.dataCaptureContext.SetFrameSourceAsync(this.camera);
            }

            BarcodeCaptureSettings barcodeCaptureSettings = BarcodeCaptureSettings.Create();

            // The settings instance initially has all types of barcodes (symbologies) disabled.
            // For the purpose of this sample we enable the QR symbology. In your own app ensure
            // that you only enable the symbologies that your app requires as every additional
            // enabled symbology has an impact on processing times.
            barcodeCaptureSettings.EnableSymbology(Symbology.Qr, true);

            // Create new barcode capture mode with the settings from above.
            this.barcodeCapture = BarcodeCapture.Create(this.dataCaptureContext, barcodeCaptureSettings);

            // By default, every time a barcode is scanned, a sound (if not in silent mode) and a
            // vibration are played. In the following we are setting a success feedback without sound
            // and vibration.
            this.barcodeCapture.Feedback.Success = new Feedback(vibration: null, sound: null);

            // Register self as a listener to get informed whenever a new barcode got recognized.
            this.barcodeCapture.AddListener(this);

            // To visualize the on-going barcode capturing process on screen, setup a data capture view
            // that renders the camera preview. The view must be connected to the data capture context.
            this.dataCaptureView = DataCaptureView.Create(this.dataCaptureContext, this.View.Bounds);
            this.dataCaptureView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight |
                                                    UIViewAutoresizing.FlexibleWidth;
            this.View.AddSubview(this.dataCaptureView);

            this.overlay            = BarcodeCaptureOverlay.Create(this.barcodeCapture, this.dataCaptureView);
            this.overlay.Viewfinder = RectangularViewfinder.Create(RectangularViewfinderStyle.Square, RectangularViewfinderLineStyle.Light);

            // Adjust the overlay's barcode highlighting to match the new viewfinder styles and improve the visibility of feedback.
            // With 6.10 we will introduce this visual treatment as a new style for the overlay.
            this.highlightingBrush = new Brush(fillColor: UIColor.Clear,
                                               strokeColor: UIColor.White,
                                               strokeWidth: 3);
            overlay.Brush = this.highlightingBrush;

            this.dataCaptureView.AddOverlay(this.overlay);
        }
Exemplo n.º 8
0
        public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData)
        {
            if (session.NewlyRecognizedBarcodes.Any())
            {
                if (!this.ContinuousScanningEnabled)
                {
                    this.PauseScanning();
                }

                Barcode barcode = session.NewlyRecognizedBarcodes[0];
                this.listener?.ShowDialog(barcode);
            }
        }
Exemplo n.º 9
0
        public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData)
        {
            if (session.NewlyRecognizedBarcodes.Any())
            {
                if (!this.ContinuousScanningEnabled)
                {
                    this.PauseScanning();
                }

                Barcode barcode = session.NewlyRecognizedBarcodes[0];
                using SymbologyDescription description = SymbologyDescription.Create(barcode.Symbology);
                this.listener?.ShowDialog(description.ReadableName, barcode.Data, barcode.SymbolCount);
            }
        }
Exemplo n.º 10
0
        public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData)
        {
            if (session.NewlyRecognizedBarcodes.Count == 0)
            {
                return;
            }

            var barcode = session.NewlyRecognizedBarcodes[0];

            // If the code scanned doesn't start with "09:", we will just ignore it and continue
            // scanning.
            if (barcode.Data?.StartsWith("09:") == false)
            {
                // We temporarily change the brush, used to highlight recognized barcodes, to a
                // transparent brush.
                this.overlay.Brush = Brush.TransparentBrush;
                return;
            }

            // If the code is recognized, we want to make sure to use a brush to highlight
            // the code.
            this.overlay.Brush = this.highlightingBrush;

            // We also want to emit a feedback (vibration and, if enabled, sound).
            this.feedback.Emit();

            // Stop recognizing barcodes for as long as we are displaying the result. There won't be any new
            // results until the capture mode is enabled again. Note that disabling the capture mode does
            // not stop the camera, the camera continues to stream frames until it is turned off.
            this.barcodeCapture.Enabled = false;

            // If you are not disabling barcode capture here and want to continue scanning, consider
            // setting the codeDuplicateFilter when creating the barcode capture settings to around 500
            // or even -1 if you do not want codes to be scanned more than once.

            // Get the human readable name of the symbology and assemble the result to be shown.
            string symbology = SymbologyDescription.Create(barcode.Symbology).ReadableName;
            string result    = string.Format("Scanned {0} ({1})", barcode.Data, symbology);

            this.ShowResult(result);

            // Dispose the frame when you have finished processing it. If the frame is not properly disposed,
            // different issues could arise, e.g. a frozen, non-responsive, or "severely stuttering" video feed.
            frameData.Dispose();
        }
        public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData data)
        {
            if (session.NewlyRecognizedBarcodes.Count == 0)
            {
                return;
            }

            var barcode = session.NewlyRecognizedBarcodes[0];

            // If the code scanned doesn't start with "09:", we will just ignore it and continue
            // scanning.
            if (barcode.Data?.StartsWith("09:") == false)
            {
                // We temporarily change the brush, used to highlight recognized barcodes, to a
                // transparent brush.
                overlay.Brush = Brush.TransparentBrush;
                return;
            }

            // If the code is recognized, we want to make sure to use a brush to highlight the code.
            overlay.Brush = this.highlightingBrush;

            // We also want to emit a feedback (vibration and, if enabled, sound).
            feedback.Emit();

            // Stop recognizing barcodes for as long as we are displaying the result. There won't be any
            // new results until the capture mode is enabled again. Note that disabling the capture mode
            // does not stop the camera, the camera continues to stream frames until it is turned off.
            barcodeCapture.Enabled = false;

            // If you are not disabling barcode capture here and want to continue scanning, consider
            // setting the codeDuplicateFilter when creating the barcode capture settings to around 500
            // or even -1 if you do not want codes to be scanned more than once.

            // Get the human readable name of the symbology and assemble the result to be shown.
            using (var description = SymbologyDescription.Create(barcode.Symbology))
            {
                var result = "Scanned: " + barcode.Data + " (" + description.ReadableName + ")";

                RunOnUiThread(() => ShowResult(result));
            }
        }
        public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData)
        {
            if (!session.NewlyRecognizedBarcodes.Any())
            {
                return;
            }

            Barcode barcode = session.NewlyRecognizedBarcodes[0];

            // If the code scanned doesn't start with "09:", we will just ignore it and continue
            // scanning.
            if (barcode.Data?.StartsWith("09:") == false)
            {
                this.RejectedCode?.Invoke(this, EventArgs.Empty);
                return;
            }

            this.AcceptedCode?.Invoke(this, EventArgs.Empty);

            // We also want to emit a feedback (vibration and, if enabled, sound).
            this.Feedback.Emit();

            // Stop recognizing barcodes for as long as we are displaying the result. There won't be any new results until
            // the capture mode is enabled again. Note that disabling the capture mode does not stop the camera, the camera
            // continues to stream frames until it is turned off.
            barcodeCapture.Enabled = false;

            // If you are not disabling barcode capture here and want to continue scanning, consider
            // setting the codeDuplicateFilter when creating the barcode capture settings to around 500
            // or even -1 if you do not want codes to be scanned more than once.

            // Get the human readable name of the symbology and assemble the result to be shown.
            SymbologyDescription description = new SymbologyDescription(barcode.Symbology);
            string result = "Scanned: " + barcode.Data + " (" + description.ReadableName + ")";

            if (MessageService == null)
            {
                MessageService = DependencyService.Get <IMessageService>();
            }

            MessageService.ShowAsync(result, () => barcodeCapture.Enabled = true);
        }
        public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData)
        {
            if (!session.NewlyRecognizedBarcodes.Any())
            {
                return;
            }

            Barcode barcode = session.NewlyRecognizedBarcodes[0];

            // Stop recognizing barcodes for as long as we are displaying the result. There won't be any new results until
            // the capture mode is enabled again. Note that disabling the capture mode does not stop the camera, the camera
            // continues to stream frames until it is turned off.
            barcodeCapture.Enabled = false;

            // If you are not disabling barcode capture here and want to continue scanning, consider
            // setting the codeDuplicateFilter when creating the barcode capture settings to around 500
            // or even -1 if you do not want codes to be scanned more than once.

            // Get the human readable name of the symbology and assemble the result to be shown.
            string symbology = SymbologyDescription.Create(barcode.Symbology).ReadableName;
            string result    = "Scanned: " + barcode.Data + " (" + symbology + ")";

            RunOnUiThread(() => ShowResults(result));
        }
        private ScannerModel()
        {
            this.CurrentCamera?.ApplySettingsAsync(this.CameraSettings);

            // Create data capture context using your license key and set the camera as the frame source.
            this.DataCaptureContext = DataCaptureContext.ForLicenseKey(SCANDIT_LICENSE_KEY);
            this.DataCaptureContext.SetFrameSourceAsync(this.CurrentCamera);

            // The barcode capturing process is configured through barcode capture settings
            // which are then applied to the barcode capture instance that manages barcode recognition.
            this.BarcodeCaptureSettings = BarcodeCaptureSettings.Create();

            // The settings instance initially has all types of barcodes (symbologies) disabled. For the purpose of this
            // sample we enable the QR symbology. In your own app ensure that you only enable the symbologies that your app
            // requires as every additional enabled symbology has an impact on processing times.
            this.BarcodeCaptureSettings.EnableSymbology(Symbology.Qr, true);

            this.BarcodeCapture = BarcodeCapture.Create(this.DataCaptureContext, this.BarcodeCaptureSettings);

            // By default, every time a barcode is scanned, a sound (if not in silent mode) and a
            // vibration are played. In the following we are setting a success feedback without sound
            // and vibration.
            this.BarcodeCapture.Feedback.Success = new Feedback(vibration: null, sound: null);
        }
 public void OnSessionUpdated(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData)
 {
 }
 public void OnObservationStopped(BarcodeCapture barcodeCapture)
 {
 }
        private void InitializeAndStartBarcodeScanning()
        {
            // Create data capture context using your license key.
            this.dataCaptureContext = DataCaptureContext.ForLicenseKey(SCANDIT_LICENSE_KEY);

            // Use the default camera and set it as the frame source of the context.
            // The camera is off by default and must be turned on to start streaming frames to the data
            // capture context for recognition.
            // See resumeFrameSource and pauseFrameSource below.
            this.camera = Camera.GetDefaultCamera();
            if (this.camera != null)
            {
                // Use the settings recommended by barcode capture.
                this.camera.ApplySettingsAsync(BarcodeCapture.RecommendedCameraSettings);
                this.dataCaptureContext.SetFrameSourceAsync(this.camera);
            }

            // The barcode capturing process is configured through barcode capture settings
            // which are then applied to the barcode capture instance that manages barcode recognition.
            BarcodeCaptureSettings barcodeCaptureSettings = BarcodeCaptureSettings.Create();

            // The settings instance initially has all types of barcodes (symbologies) disabled.
            // For the purpose of this sample we enable a very generous set of symbologies.
            // In your own app ensure that you only enable the symbologies that your app requires as
            // every additional enabled symbology has an impact on processing times.
            HashSet <Symbology> symbologies = new HashSet <Symbology>();

            symbologies.Add(Symbology.Ean13Upca);
            symbologies.Add(Symbology.Ean8);
            symbologies.Add(Symbology.Upce);
            symbologies.Add(Symbology.Qr);
            symbologies.Add(Symbology.DataMatrix);
            symbologies.Add(Symbology.Code39);
            symbologies.Add(Symbology.Code128);
            symbologies.Add(Symbology.InterleavedTwoOfFive);

            barcodeCaptureSettings.EnableSymbologies(symbologies);

            // Some linear/1d barcode symbologies allow you to encode variable-length data.
            // By default, the Scandit Data Capture 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 for one of the
            // variable-length symbologies.
            SymbologySettings symbologySettings =
                barcodeCaptureSettings.GetSymbologySettings(Symbology.Code39);

            ICollection <short> activeSymbolCounts = new HashSet <short>(
                new short[] { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 });

            symbologySettings.ActiveSymbolCounts = activeSymbolCounts;

            // Create new barcode capture mode with the settings from above.
            this.barcodeCapture = BarcodeCapture.Create(this.dataCaptureContext, barcodeCaptureSettings);
            // Register self as a listener to get informed whenever a new barcode got recognized.
            barcodeCapture.AddListener(this);

            // To visualize the on-going barcode capturing process on screen, setup a data capture view
            // that renders the camera preview. The view must be connected to the data capture context.
            this.dataCaptureView = DataCaptureView.Create(this, this.dataCaptureContext);

            // Add a barcode capture overlay to the data capture view to render the location of captured
            // barcodes on top of the video preview.
            // This is optional, but recommended for better visual feedback.
            BarcodeCaptureOverlay overlay = BarcodeCaptureOverlay.Create(this.barcodeCapture, this.dataCaptureView);

            overlay.Viewfinder = RectangularViewfinder.Create();

            SetContentView(this.dataCaptureView);
        }
 public void OnObservationStarted(BarcodeCapture barcodeCapture)
 {
     //NOP
 }
Exemplo n.º 19
0
        protected void InitializeAndStartBarcodeScanning()
        {
            // Create data capture context using your license key.
            this.dataCaptureContext = DataCaptureContext.ForLicenseKey(SCANDIT_LICENSE_KEY);

            // Use the default camera and set it as the frame source of the context.
            // The camera is off by default and must be turned on to start streaming frames to the data
            // capture context for recognition.
            // See resumeFrameSource and pauseFrameSource below.
            this.camera = Camera.GetDefaultCamera();
            if (this.camera != null)
            {
                // Use the settings recommended by barcode capture.
                this.camera.ApplySettingsAsync(BarcodeCapture.RecommendedCameraSettings);
                this.dataCaptureContext.SetFrameSourceAsync(this.camera);
            }

            BarcodeCaptureSettings barcodeCaptureSettings = BarcodeCaptureSettings.Create();

            // The settings instance initially has all types of barcodes (symbologies) disabled.
            // For the purpose of this sample we enable a very generous set of symbologies.
            // In your own app ensure that you only enable the symbologies that your app requires as
            // every additional enabled symbology has an impact on processing times.
            HashSet <Symbology> symbologies = new HashSet <Symbology>()
            {
                Symbology.Ean13Upca,
                Symbology.Ean8,
                Symbology.Upce,
                Symbology.Qr,
                Symbology.DataMatrix,
                Symbology.Code39,
                Symbology.Code128,
                Symbology.InterleavedTwoOfFive
            };

            barcodeCaptureSettings.EnableSymbologies(symbologies);

            // Some linear/1d barcode symbologies allow you to encode variable-length data.
            // By default, the Scandit Data Capture 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 for one of the
            // variable-length symbologies.
            SymbologySettings symbologySettings =
                barcodeCaptureSettings.GetSymbologySettings(Symbology.Code39);

            HashSet <short> activeSymbolCounts = new HashSet <short>(
                new short[] { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 });

            symbologySettings.ActiveSymbolCounts = activeSymbolCounts;

            // Create new barcode capture mode with the settings from above.
            this.barcodeCapture = BarcodeCapture.Create(this.dataCaptureContext, barcodeCaptureSettings);

            // Register self as a listener to get informed whenever a new barcode got recognized.
            this.barcodeCapture.AddListener(this);

            // To visualize the on-going barcode capturing process on screen, setup a data capture view
            // that renders the camera preview. The view must be connected to the data capture context.
            this.dataCaptureView = DataCaptureView.Create(this.dataCaptureContext, this.View.Bounds);
            this.dataCaptureView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight |
                                                    UIViewAutoresizing.FlexibleWidth;
            this.View.AddSubview(this.dataCaptureView);

            this.overlay            = BarcodeCaptureOverlay.Create(this.barcodeCapture, this.dataCaptureView);
            this.overlay.Viewfinder = RectangularViewfinder.Create(RectangularViewfinderStyle.Square, RectangularViewfinderLineStyle.Light);

            // Adjust the overlay's barcode highlighting to match the new viewfinder styles and improve the visibility of feedback.
            // With 6.10 we will introduce this visual treatment as a new style for the overlay.
            overlay.Brush = new Brush(fillColor: UIColor.Clear,
                                      strokeColor: UIColor.White,
                                      strokeWidth: 3);

            this.dataCaptureView.AddOverlay(this.overlay);
        }
 public void OnSessionUpdated(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData)
 {
     // Dispose the frame when you have finished processing it. If the frame is not properly disposed,
     // different issues could arise, e.g. a frozen, non-responsive, or "severely stuttering" video feed.
     frameData.Dispose();
 }