Frame Source

Defined in package com.scandit.datacapture.core.source

FrameSourceState

Added in version 6.0.0

The different states a frame source can be in.

ON

Added in version 6.0.0

The frame source is on and producing frames.

OFF

Added in version 6.0.0

The frame source is off and not producing frames.

STARTING

Added in version 6.0.0

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

STOPPING

Added in version 6.0.0

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

STANDBY

Added in version 6.6.0

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

BOOTING_UP

Added in version 6.6.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.currentState to indicate that the frame source is currently booting up.

WAKING_UP

Added in version 6.6.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.currentState to indicate that the frame source is currently waking up.

GOING_TO_SLEEP

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

SHUTTING_DOWN

Added in version 6.6.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.currentState to indicate that the frame source is currently shutting down.

FrameSource
interface FrameSource

Added in version 6.0.0

Interface for producers of frames. Typically this interface is used through Camera which gives access to the built-in camera on 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 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, whenDone)
void switchToDesiredState(FrameSourceState desiredState,
        Callback<@NonNull Boolean> whenDone)

Added in version 6.0.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 getDesiredState()

Added in version 6.0.0

Readonly attribute for accessing the desired state. Possible states are FrameSourceState.ON, FrameSourceState.OFF, FrameSourceState.STANDBY.

currentState
FrameSourceState getCurrentState()

Added in version 6.0.0

Readonly attribute for accessing the current state. Possible states are FrameSourceState.ON, FrameSourceState.OFF, FrameSourceState.STANDBY, FrameSourceState.STARTING, FrameSourceState.STOPPING, FrameSourceState.BOOTING_UP, FrameSourceState.WAKING_UP, FrameSourceState.GOING_TO_SLEEP, FrameSourceState.SHUTTING_DOWN.

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

addListener(listener)
void addListener(@NonNull FrameSourceListener 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.

removeListener(listener)
void removeListener(@NonNull FrameSourceListener 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.