Barcode Capture Listener

Defined in namespace Scandit.DataCapture.Barcode.Capture

IBarcodeCaptureListener
interface IBarcodeCaptureListener

Added in version 6.8.0

Listener interface for traditional barcode capture.

OnObservationStarted()
void OnObservationStarted(BarcodeCapture barcodeCapture)

Added in version 6.8.0

Called when the listener starts observing the barcode capture instance.

OnObservationStopped()
void OnObservationStopped(BarcodeCapture barcodeCapture)

Added in version 6.8.0

Called when the listener stops observing the barcode capture instance.

OnBarcodeScanned()
void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData)

Added in version 6.8.0

Invoked whenever a code has been scanned. The newly scanned barcode can be retrieved from BarcodeCaptureSession.NewlyRecognizedBarcode.

This method is invoked from a recognition internal thread. To perform UI work, you must dispatch to the main thread first. After receiving this callback, you will typically want to start processing the scanned barcodes. Keep in mind however, that any further recognition is blocked until this method completes. Therefore, if you need to perform a time-consuming operation, like querying a database or opening an URL encoded in the barcode data, consider switching to another thread.

Sometimes, after receiving this callback, you may want to pause scanning or to stop scanning completely.

  • To pause scanning, but keep the camera (frame source) running, just set the barcode capture’s enabled property to false.

captureMode.Enabled = false;

While it’s possible to only stop the camera and keep the capture mode enabled, this may lead to additional scan events being delivered, which is typically not desired. The following lines of code show how to disable the capture mode and stop the frame source as well:

// no more didScan callbacks will be invoked after this call.
captureMode.Enabled = false;
// asynchronously turn off the camera
await captureMode.Context?.FrameSource?.SwitchToDesiredStateAsync(FrameSourceState.Off);
OnSessionUpdated()
void OnSessionUpdated(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData)

Added in version 6.8.0

Invoked after a frame has been processed by barcode capture and the session has been updated. In contrast to OnBarcodeScanned(), this method is invoked, regardless whether a code was scanned or not. If codes were recognized in this frame, this method is invoked after OnBarcodeScanned().

This method is invoked from a recognition internal thread. To perform UI work, you must dispatch to the main thread first. Further recognition is blocked until this method completes. It is thus recommended to do as little work as possible in this method.

See the documentation in OnBarcodeScanned() for information on how to properly stop recognition of barcodes.

BarcodeCaptureEventArgs
class BarcodeCaptureEventArgs : EventArgs

Added in version 6.13.0

Provides data for the BarcodeCapture.BarcodeScanned and BarcodeCapture.SessionUpdated events.

BarcodeCaptureEventArgs()
BarcodeCaptureEventArgs(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData)

Added in version 6.13.0

BarcodeCapture
BarcodeCapture BarcodeCapture { get; }

Added in version 6.13.0

Session
BarcodeCaptureSession Session { get; }

Added in version 6.13.0

FrameData
IFrameData FrameData { get; }

Added in version 6.13.0

Barcode Capture Advanced Listener

Defined in namespace Scandit.DataCapture.Barcode