Frame Source

Defined under the namespace Scandit.Datacapture.Core

FrameSourceState

Added in version 6.8.0

The different states a frame source can be in.

On

Added in version 6.8.0

The frame source is on and producing frames.

Off

Added in version 6.8.0

The frame source is off and not producing frames.

Starting

Added in version 6.8.0

The frame source is currently starting (moving from Off to state On). This value cannot be set directly but is returned by FrameSource.getCurrentState to indicate that the frame source is currently starting.

Stopping

Added in version 6.8.0

The frame source is currently stopping (moving from On to state Off). This value cannot be set directly but is returned by FrameSource.getCurrentState to indicate that the frame source is currently stopping.

Standby

Added in version 6.8.0

The frame source is in standby and not producing frames.

BootingUp

Added in version 6.8.0

The frame source is currently booting up (moving from Off to state Standby). This value cannot be set directly but is returned by FrameSource.getCurrentState to indicate that the frame source is currently booting up.

WakingUp

Added in version 6.8.0

The frame source is currently waking up (moving from Standby to state On). This value cannot be set directly but is returned by FrameSource.getCurrentState to indicate that the frame source is currently waking up.

GoingToSleep

Added in version 6.8.0

The frame source is currently going to sleep (moving from On to state Standby). This value cannot be set directly but is returned by FrameSource.getCurrentState to indicate that the frame source is currently going to sleep.

ShuttingDown

Added in version 6.8.0

The frame source is currently shutting down (moving from Standby to state Off). This value cannot be set directly but is returned by FrameSource.getCurrentState to indicate that the frame source is currently shutting down.

FrameSource
interface FrameSource

Added in version 6.8.0

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

Note

The FrameSource interface is currently restricted to frame sources included in the Scandit Data Capture SDK and cannot be used to implement custom frame sources.

switchToDesiredState(desiredState)
switchToDesiredState(desiredState: FrameSourceState): Promise<void>

Added in version 6.8.0

Sets the desired state of the frame source

Possible values are FrameSourceState.On/FrameSourceState.Off. The frame source’s state needs to be switched to FrameSourceState.On for it to produce frames.

It is not allowed to set the desired state to FrameSourceState.Starting/FrameSourceState.Stopping. 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. True is passed to the completion handler in case the state transition is successful, false if it either was cancelled or the state transition failed.

desiredState
readonly desiredState: FrameSourceState

Added in version 6.8.0

Readonly attribute for accessing the desired state. Possible states are FrameSourceState.On, FrameSourceState.Off, FrameSourceState.Standby.

getCurrentState()
getCurrentState(): Promise<FrameSourceState>

Added in version 6.8.0

Readonly attribute for accessing the current state. Possible states are FrameSourceState.On, FrameSourceState.Off, FrameSourceState.Standby, FrameSourceState.Starting, FrameSourceState.Stopping, FrameSourceState.BootingUp, FrameSourceState.WakingUp, FrameSourceState.GoingToSleep, FrameSourceState.ShuttingDown.

The current state cannot be changed directly, but is modified by switchToDesiredState().

addListener(listener)
addListener(listener: FrameSourceListener): void

Added in version 6.8.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.

removeListener(listener)
removeListener(listener: FrameSourceListener): void

Added in version 6.8.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.