Data Capture Context Listener

Defined in framework ScanditCaptureCore

DataCaptureContextListener
protocol DataCaptureContextListener : NSObjectProtocol

Added in version 6.0.0

Protocol for observing/listening to mode and status changes of a data capture context.

To observe changes of the data capture context, one or more DataCaptureContextListener may be added. These listeners provide hooks into different parts of the data capture context.

context(_:didChange:)
open func context(_ context: DataCaptureContext, didChange frameSource: (any FrameSource)?) -> Void

Added in version 6.0.0

Invoked when the data capture context changed the frame source. Also invoked if the frame source is reset to nil.

context(_:didAdd:)
open func context(_ context: DataCaptureContext, didAdd mode: any DataCaptureMode) -> Void

Added in version 6.0.0

Called when a mode got added to the context.

This also fires for a barcode capture, barcode count, barcode batch or barcode selection mode created by passing the context to its deserializer’s modeFromJson: the deserializer attaches the new mode to that context, which raises this callback exactly as an explicit addMode/setMode does.

context(_:didRemove:)
open func context(_ context: DataCaptureContext, didRemove mode: any DataCaptureMode) -> Void

Added in version 6.0.0

Called when a mode got removed from the context.

This also fires when a deserializer-attached mode is removed — including when a later deserialization replaces it. Updating a mode through updateModeFromJson keeps the same instance attached and raises neither onModeRemoved nor onModeAdded.

didStartObserving(_:)
optional func didStartObserving(_ context: DataCaptureContext) -> Void

Added in version 6.0.0

Called when the listener has been added to the data capture context and is from now on receiving events.

didStopObserving(_:)
optional func didStopObserving(_ context: DataCaptureContext) -> Void

Added in version 6.0.0

Called when the listener has been removed from the data capture context and is no longer receiving events.

context(_:didChange:)
open func context(_ context: DataCaptureContext, didChange contextStatus: ContextStatus) -> Void

Added in version 6.0.0

Called when a context status changed.