Frame Source

Defined in framework ScanditDataCaptureCore

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 cannot 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 cannot be set directly but is returned by SDCFrameSource.currentState to indicate that the frame source is currently stopping.

SDCFrameSourceStateStandby

Added in version 6.7.0

The frame source is in standby and not producing frames. See the advanced camera guide on the standby state for further information.

SDCFrameSourceStateBootingUp

Added in version 6.7.0

The frame source is currently booting up (moving from SDCFrameSourceStateOff to state SDCFrameSourceStateStandby). This value cannot be set directly but is returned by SDCFrameSource.currentState to indicate that the frame source is currently booting up.

SDCFrameSourceStateWakingUp

Added in version 6.7.0

The frame source is currently waking up (moving from SDCFrameSourceStateStandby to state SDCFrameSourceStateOn). This value cannot be set directly but is returned by SDCFrameSource.currentState to indicate that the frame source is currently waking up.

SDCFrameSourceStateGoingToSleep

Added in version 6.7.0

The frame source is currently going to sleep (moving from SDCFrameSourceStateOn to state SDCFrameSourceStateStandby). This value cannot be set directly but is returned by SDCFrameSource.currentState to indicate that the frame source is currently going to sleep.

SDCFrameSourceStateShuttingDown

Added in version 6.7.0

The frame source is currently shutting down (moving from SDCFrameSourceStateStandby to state SDCFrameSourceStateOff). This value cannot be set directly but is returned by SDCFrameSource.currentState to indicate that the frame source is currently shutting down.

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 cannot 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 either on a background or on the calling thread. 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, SDCFrameSourceStateStandby.

currentState
@property (nonatomic, readonly) SDCFrameSourceState currentState

Added in version 6.0.0

Readonly attribute for accessing the current state. Possible states are SDCFrameSourceStateOn, SDCFrameSourceStateOff, SDCFrameSourceStateStandby, SDCFrameSourceStateStarting, SDCFrameSourceStateStopping, SDCFrameSourceStateBootingUp, SDCFrameSourceStateWakingUp, SDCFrameSourceStateGoingToSleep, SDCFrameSourceStateShuttingDown.

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

- addListener:
- (void)addListener:(nonnull 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:(nonnull 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