Frame Source

Defined in namespace Scandit.DataCapture.Core.Source

FrameSourceState

Added in version 6.16.0

The different states a frame source can be in.

On

Added in version 6.16.0

The frame source is on and producing frames.

Off

Added in version 6.16.0

The frame source is off and not producing frames.

Starting

Added in version 6.16.0

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

Stopping

Added in version 6.16.0

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

Standby

Added in version 6.16.0

The frame source is in standby and not producing frames.

BootingUp

Added in version 6.16.0

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

WakingUp

Added in version 6.16.0

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

GoingToSleep

Added in version 6.16.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 IFrameSource.CurrentState to indicate that the frame source is currently going to sleep.

ShuttingDown

Added in version 6.16.0

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

IFrameSource
interface IFrameSource

Added in version 6.16.0

Interface for producers of frames. Typically this interface is used through Camera which gives access to the built-in camera on .NET for Android. 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 IFrameSource interface is currently restricted to frame sources included in the Scandit Data Capture SDK and cannot be used to implement custom frame sources.

SwitchToDesiredStateAsync()
Task<bool> SwitchToDesiredStateAsync(FrameSourceState state)

Added in version 6.16.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
FrameSourceState DesiredState { get; }

Added in version 6.16.0

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

CurrentState
FrameSourceState CurrentState { get; }

Added in version 6.16.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 SwitchToDesiredStateAsync().

AddListener()
void AddListener(IFrameSourceListener listener)

Added in version 6.16.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()
void RemoveListener(IFrameSourceListener listener)

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