Class BarcodeCounterFrameHandler
-
- All Implemented Interfaces:
public class BarcodeCounterFrameHandler extends FrameHandler
Performs barcode/QR code detection on camera preview frames. Outputs results via BarcodeCounterFrameHandler.ResultHandler (addResultHandler).
Preview frame considered intercepted if at least one BarcodeCounterFrameHandler.ResultHandler returns
true
from BarcodeCounterFrameHandler.ResultHandler.handle
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
BarcodeCounterFrameHandler.ResultHandler
Continuously notified about barcode/QR code detection results.
public abstract class
BarcodeCounterFrameHandler.BarcodeCounterResultHandler
Successor-class needed for cross-platform implementation.
-
Field Summary
Fields Modifier and Type Field Description private BarcodeCounterFrameHandler.ResultHandler
viewHandler
private Boolean
isEnabled
-
Constructor Summary
Constructors Constructor Description BarcodeCounterFrameHandler(ScanbotBarcodeDetector barcodeDetector)
-
Method Summary
Modifier and Type Method Description final BarcodeCounterFrameHandler.ResultHandler
getViewHandler()
final Unit
setViewHandler(BarcodeCounterFrameHandler.ResultHandler viewHandler)
Boolean
isEnabled()
Set true
to enable barcode/QR code detection.Unit
setEnabled(Boolean isEnabled)
Set true
to enable barcode/QR code detection.Boolean
handleFrame(FrameHandler.Frame previewFrame)
Invoked for every new camera preview frame. final Unit
resetViewState()
Reset subscribed view component to initial state. final Unit
addResultHandler(BarcodeCounterFrameHandler.ResultHandler handler)
Registers result handler which will be notified about barcode/QR code detection results. final Unit
performSingleShotDetection()
Enable detector to one time detection on Frame. final Unit
removeResultHandler(BarcodeCounterFrameHandler.ResultHandler handler)
Unregisters handler. final Unit
setBarcodeFilter(IBarcodeFilter filter)
Set implementation of IBarcodeFilter, that will be applied to every frame after detection and filter frames with undesired data. final static BarcodeCounterFrameHandler
attach(IScanbotCameraView cameraView, ScanbotBarcodeDetector barcodeDetector)
Convenience method for creating new BarcodeCounterFrameHandler and adding it as FrameHandler to given camera view. -
-
Constructor Detail
-
BarcodeCounterFrameHandler
BarcodeCounterFrameHandler(ScanbotBarcodeDetector barcodeDetector)
-
-
Method Detail
-
getViewHandler
final BarcodeCounterFrameHandler.ResultHandler getViewHandler()
-
setViewHandler
final Unit setViewHandler(BarcodeCounterFrameHandler.ResultHandler viewHandler)
-
isEnabled
Boolean isEnabled()
Set
true
to enable barcode/QR code detection.false
to disable barcode/QR code detection is disabled, i.e. incoming frames are skipped.
-
setEnabled
Unit setEnabled(Boolean isEnabled)
Set
true
to enable barcode/QR code detection.false
to disable barcode/QR code detection is disabled, i.e. incoming frames are skipped.
-
handleFrame
@Synchronized() Boolean handleFrame(FrameHandler.Frame previewFrame)
Invoked for every new camera preview frame.
- Parameters:
previewFrame
- captured preview frame data
-
resetViewState
final Unit resetViewState()
Reset subscribed view component to initial state.
-
addResultHandler
final Unit addResultHandler(BarcodeCounterFrameHandler.ResultHandler handler)
Registers result handler which will be notified about barcode/QR code detection results.
Results are coming on the worker thread. Don't forget to move execution to main thread before updating UI.
- Parameters:
handler
- handler to register.
-
performSingleShotDetection
final Unit performSingleShotDetection()
Enable detector to one time detection on Frame.
-
removeResultHandler
final Unit removeResultHandler(BarcodeCounterFrameHandler.ResultHandler handler)
Unregisters handler.
- Parameters:
handler
- handler to unregister.
-
setBarcodeFilter
final Unit setBarcodeFilter(IBarcodeFilter filter)
Set implementation of IBarcodeFilter, that will be applied to every frame after detection and filter frames with undesired data.
NOTE: here, for BarcodeScanner (as opposed to BatchBarcodeScanner) only IBarcodeFilter.acceptsBarcode filtering method will be used.
- Parameters:
filter
- IBarcodeFilter implementation.
-
attach
final static BarcodeCounterFrameHandler attach(IScanbotCameraView cameraView, ScanbotBarcodeDetector barcodeDetector)
Convenience method for creating new BarcodeCounterFrameHandler and adding it as FrameHandler to given camera view.
- Parameters:
cameraView
- camera view to which new barcode/QR code detector will be attachedbarcodeDetector
- ScanbotBarcodeDetector which performs barcode detection and recognition
-
-
-
-