Frame Source#

Defined in framework ScanditCaptureCore

SDCFrameSourceState#

Added in version 6.0.0

The different states a frame source can be in.

SDCFrameSourceStateOn#

Added in version 6.0.0

The frame source is on and producing frames.

SDCFrameSourceStateOff#

Added in version 6.0.0

The frame source is off and not producing frames.

SDCFrameSourceStateStarting#

Added in version 6.0.0

The frame source is currently starting (moving from SDCFrameSourceStateOff to state SDCFrameSourceStateOn). This value can not be set directly but is returned by SDCFrameSource.currentState to indicate that the frame source is currently starting.

SDCFrameSourceStateStopping#

Added in version 6.0.0

The frame source is currently stopping (moving from SDCFrameSourceStateOn to state SDCFrameSourceStateOff). This value can not be set directly but is returned by SDCFrameSource.currentState to indicate that the frame source is currently stopping.

SDCFrameSource#
@protocol SDCFrameSource <NSObject>

Added in version 6.0.0

Protocol for producers of frames. Typically this protocol is used through SDCCamera which gives access to the built-in camera on iOS. For more sophisticated use cases this protocol can be implemented by programmers to support other sources of frames, such as external cameras with proprietary APIs.

Note

The SDCFrameSource protocol is currently restricted to frame sources included in the Scandit Data Capture SDK and can not be used to implement custom frame sources.

- switchToDesiredState:completionHandler:#
- (void)switchToDesiredState:(SDCFrameSourceState)state
           completionHandler:(nullable void (^)(BOOL))completionHandler

Added in version 6.0.0

Sets the desired state of the frame source

Possible values are SDCFrameSourceStateOn/SDCFrameSourceStateOff. The frame source’s state needs to be switched to SDCFrameSourceStateOn for it to produce frames.

It is not allowed to set the desired state to SDCFrameSourceStateStarting/SDCFrameSourceStateStopping. These values are only used to report ongoing state transitions.

In case the desired state is equal to the current state, calling this method has no effect. Otherwise, a call to this method initiates a state transition from the current state to the desired state.

The state transition is asynchronous, meaning that it may not complete immediately for certain frame source implementations. When a state transition is ongoing, further changes to the desired state are delayed until the state transition completes. Only the last of the desired states will be processed; previous requested state transitions will be cancelled.

The completion handler is invoked when the state transition finishes. YES is passed to the completion handler in case the state transition is successful, NO if it either was cancelled or the state transition failed.

desiredState#
@property (nonatomic, readonly) SDCFrameSourceState desiredState

Added in version 6.0.0

Readonly attribute for accessing the desired state. Possible states are SDCFrameSourceStateOn, SDCFrameSourceStateOff.

currentState#
@property (nonatomic, readonly) SDCFrameSourceState currentState

Added in version 6.0.0

Readonly attribute for accessing the current state. Possible states are SDCFrameSourceStateOn, SDCFrameSourceStateOff, SDCFrameSourceStateStarting, SDCFrameSourceStateStopping.

The current state can not be changed directly, but is modified by switchToDesiredState:completionHandler:.

- addListener:#
- (void)addListener:(nullable id<SDCFrameSourceListener>)listener

Added in version 6.0.0

Adds the listener to this frame source.

In case the same listener is already observing this instance, calling this method will not add the listener again. The listener is stored using a weak reference and must thus be retained by the caller for it to not go out of scope.

- removeListener:#
- (void)removeListener:(nullable id<SDCFrameSourceListener>)listener

Added in version 6.0.0

Removes a previously added listener from this frame source.

In case the listener is not currently observing this instance, calling this method has no effect.

NSStringFromFrameSourceState(state)#
NSString *_Nonnull NSStringFromFrameSourceState(SDCFrameSourceState state)

Added in version 6.1.0

SDCFrameSourceStateFromJSONString(JSONString, frameSourceState)#
BOOL SDCFrameSourceStateFromJSONString(NSString *_Nonnull JSONString, SDCFrameSourceState *_Nonnull frameSourceState)

Added in version 6.1.0