Class BarcodeCameraViewModel
-
- All Implemented Interfaces:
-
io.scanbot.sdk.ui.utils.Router
,io.scanbot.sdk.ui.view.barcode.IBarcodeCameraView.ViewModel
public final class BarcodeCameraViewModel implements IBarcodeCameraView.ViewModel, Router
ViewModel for BarcodeCameraView.
-
-
Field Summary
Fields Modifier and Type Field Description private final <Error class: unknown class><Boolean>
cameraOpened
private final <Error class: unknown class><Boolean>
stopNewFrames
private final <Error class: unknown class><IBarcodeCameraView.ViewModel.ConfirmationState>
confirmationState
private final <Error class: unknown class><Boolean>
flash
private final <Error class: unknown class><Boolean>
autoSnapEnabled
private final <Error class: unknown class><IBarcodeFilter>
barcodeFilter
private final ScanbotBarcodeDetector
scanner
-
Constructor Summary
Constructors Constructor Description BarcodeCameraViewModel(ScanbotBarcodeDetector scanner, SaveBarcodeTakenPictureUseCase saveBarcodeTakenPictureUseCase, SaveBarcodePreviewFrameUseCase saveBarcodePreviewFrameUseCase, BarcodeScanningSession barcodeScanningSession, IDispatchersProvider dispatchersProvider)
-
Method Summary
Modifier and Type Method Description <Error class: unknown class><Boolean>
getCameraOpened()
<Error class: unknown class><Boolean>
getStopNewFrames()
<Error class: unknown class><IBarcodeCameraView.ViewModel.ConfirmationState>
getConfirmationState()
<Error class: unknown class><Boolean>
getFlash()
<Error class: unknown class><Boolean>
getAutoSnapEnabled()
<Error class: unknown class><IBarcodeFilter>
getBarcodeFilter()
ScanbotBarcodeDetector
getScanner()
final Unit
pause()
Unit
onCameraOpened()
Camera has been opened. Unit
onCancelClicked()
User wants to cancel snapping. Unit
setAutoStopOnSuccess(Boolean enabled)
Set if presenter need to stop snapping after first success. Unit
onFlashClicked()
User wants to change flash mode. Unit
setConfirmationDialogEnabled(Boolean enabled)
Enables or disables showing of the confirmation dialog after barcode scanning. Unit
onResultConfirmationPending()
User was shown scanning result confirmation dialogue and we are waiting for his response. Unit
onConfirmationRemoved()
View has removed confirmation dialog (to restart scanning), preview resumed. Unit
onRestartScanning()
Scanning result confirmation dialogue finished. Unit
onResultConfirmed(BarcodeScanningResult result)
Barcode scanning result was confirmed in the confirmation dialog. Unit
barcodeScanned(FrameHandlerResult<BarcodeScanningResult, SdkLicenseError> result)
User have scanned barcode Unit
onSelectionOverlayBarcodeClicked(BarcodeItem barcodeItem)
When the barcode was clicked on the Barcode selection overlay layer Unit
pageSnapped(ByteArray image, Integer imageOrientation)
User have snapped an image final Unit
setFlashEnabled(Boolean flashEnabled)
Enables/disables flash. Unit
setAutoCancelTimeout(Integer timeoutInSeconds)
Sets auto close timer in seconds. Unit
setInitialScanDelayMs(Long ms)
Sets initial scan timeout in ms. Unit
setDelayAfterScanMs(Long ms)
Sets a delay after scan in ms. Unit
setAutomaticSelectionEnabled(Boolean enabled)
If true - first successfully detected barcode will be automatically selected in AR overlay and returned as a result, false - default AR overlay behaviour. final Unit
setBarcodeImageGenerationType(BarcodeImageGenerationType barcodeImageGenerationType)
Set barcode image generation mode Unit
setBarcodeFormatsFilter(List<BarcodeFormat> barcodeFormats)
Set barcode format to scan Unit
setAcceptedDocumentFormats(List<BarcodeDocumentFormat> formats)
Sets list of BarcodeDocumentFormat to scan Unit
setMinimumTextLength(Integer minimumTextLength)
Set minimum required text length of the detected barcode. Unit
setMaximumTextLength(Integer maximumTextLength)
Set maximum text length of the detected barcode. Unit
setMinimum1DQuietZoneSize(Integer minimum1DQuietZoneSize)
Set minimum required quiet zone on the barcode. Unit
setGs1HandlingMode(Gs1Handling gs1Handling)
GS1 Codes Handling mode. Unit
setMsiPlesseyChecksumAlgorithms(EnumSet<MSIPlesseyChecksumAlgorithm> msiPlesseyChecksumAlgorithms)
The checksum algorithms for MSI Plessey barcodes. Unit
setStripCheckDigits(Boolean stripCheckDigits)
If true, check digits for UPC, EAN and MSI Plessey codes are removed from result. Unit
setLowPowerMode(Boolean lowPowerMode)
If true
, enabled the mode which slightly decreases the scanning quality and the energy consumption, and increases the scanning speed.Unit
setUseIata2Of5Checksum(Boolean useIata2Of5Checksum)
If true
, the IATA 2 of 5 barcode checksum is used.Unit
setUseCode11Checksum(Boolean useCode11Checksum)
If true
, the Code 11 barcode checksum is used.Unit
setAustraliaPostCustomerFormat(AustraliaPostCustomerFormat australiaPostCustomerFormat)
The australia post customer format. Unit
setEngineMode(EngineMode engineMode)
Allows to set custom EngineMode for the barcode detection EngineMode.NextGen is used by default Unit
setBarcodeFilter(IBarcodeFilter barcodeFilter)
Set the IBarcodeFilter
implementation instance to filter accepted scanned barcodes.-
-
Constructor Detail
-
BarcodeCameraViewModel
BarcodeCameraViewModel(ScanbotBarcodeDetector scanner, SaveBarcodeTakenPictureUseCase saveBarcodeTakenPictureUseCase, SaveBarcodePreviewFrameUseCase saveBarcodePreviewFrameUseCase, BarcodeScanningSession barcodeScanningSession, IDispatchersProvider dispatchersProvider)
-
-
Method Detail
-
getCameraOpened
<Error class: unknown class><Boolean> getCameraOpened()
-
getStopNewFrames
<Error class: unknown class><Boolean> getStopNewFrames()
-
getConfirmationState
<Error class: unknown class><IBarcodeCameraView.ViewModel.ConfirmationState> getConfirmationState()
-
getAutoSnapEnabled
<Error class: unknown class><Boolean> getAutoSnapEnabled()
-
getBarcodeFilter
<Error class: unknown class><IBarcodeFilter> getBarcodeFilter()
-
getScanner
ScanbotBarcodeDetector getScanner()
-
onCameraOpened
Unit onCameraOpened()
Camera has been opened.
-
onCancelClicked
Unit onCancelClicked()
User wants to cancel snapping.
-
setAutoStopOnSuccess
Unit setAutoStopOnSuccess(Boolean enabled)
Set if presenter need to stop snapping after first success.
-
onFlashClicked
Unit onFlashClicked()
User wants to change flash mode.
-
setConfirmationDialogEnabled
Unit setConfirmationDialogEnabled(Boolean enabled)
Enables or disables showing of the confirmation dialog after barcode scanning. By default it is disabled.
-
onResultConfirmationPending
Unit onResultConfirmationPending()
User was shown scanning result confirmation dialogue and we are waiting for his response.
-
onConfirmationRemoved
Unit onConfirmationRemoved()
View has removed confirmation dialog (to restart scanning), preview resumed. ViewModel is now to adjust its state accordingly.
-
onRestartScanning
Unit onRestartScanning()
Scanning result confirmation dialogue finished.
-
onResultConfirmed
Unit onResultConfirmed(BarcodeScanningResult result)
Barcode scanning result was confirmed in the confirmation dialog.
-
barcodeScanned
Unit barcodeScanned(FrameHandlerResult<BarcodeScanningResult, SdkLicenseError> result)
User have scanned barcode
-
onSelectionOverlayBarcodeClicked
Unit onSelectionOverlayBarcodeClicked(BarcodeItem barcodeItem)
When the barcode was clicked on the Barcode selection overlay layer
-
pageSnapped
Unit pageSnapped(ByteArray image, Integer imageOrientation)
User have snapped an image
- Parameters:
image
- snapped imageimageOrientation
- snapped image orientation
-
setFlashEnabled
final Unit setFlashEnabled(Boolean flashEnabled)
Enables/disables flash.
-
setAutoCancelTimeout
Unit setAutoCancelTimeout(Integer timeoutInSeconds)
Sets auto close timer in seconds. 0 = disabled and it is the default value.
-
setInitialScanDelayMs
Unit setInitialScanDelayMs(Long ms)
Sets initial scan timeout in ms. 0 = disabled and it is the default value
-
setDelayAfterScanMs
Unit setDelayAfterScanMs(Long ms)
Sets a delay after scan in ms. 0 = disabled and it is the default value
-
setAutomaticSelectionEnabled
Unit setAutomaticSelectionEnabled(Boolean enabled)
If true - first successfully detected barcode will be automatically selected in AR overlay and returned as a result, false - default AR overlay behaviour. By default - false.
-
setBarcodeImageGenerationType
final Unit setBarcodeImageGenerationType(BarcodeImageGenerationType barcodeImageGenerationType)
Set barcode image generation mode
- Parameters:
barcodeImageGenerationType
- Defines what kind of the image will be generated
-
setBarcodeFormatsFilter
Unit setBarcodeFormatsFilter(List<BarcodeFormat> barcodeFormats)
Set barcode format to scan
- Parameters:
barcodeFormats
- List of BarcodeFormat to scan
-
setAcceptedDocumentFormats
Unit setAcceptedDocumentFormats(List<BarcodeDocumentFormat> formats)
Sets list of BarcodeDocumentFormat to scan
- Parameters:
formats
- accepted document formats
-
setMinimumTextLength
Unit setMinimumTextLength(Integer minimumTextLength)
Set minimum required text length of the detected barcode. The default value is 0 (the setting is turned off). NOTE: Currently works for ITF and MSI Plessey barcodes only!
-
setMaximumTextLength
Unit setMaximumTextLength(Integer maximumTextLength)
Set maximum text length of the detected barcode. Setting to zero removes the limit. The default value is 0 (the setting is turned off). NOTE: Currently works for ITF and MSI Plessey barcodes only!
-
setMinimum1DQuietZoneSize
Unit setMinimum1DQuietZoneSize(Integer minimum1DQuietZoneSize)
Set minimum required quiet zone on the barcode. Measured in modules (the size of a minimal bar on the barcode). The default value is 10. NOTE: Currently works for ITF and MSI Plessey barcodes only!
-
setGs1HandlingMode
Unit setGs1HandlingMode(Gs1Handling gs1Handling)
GS1 Codes Handling mode. The default value is Gs1Handling.PARSE.
-
setMsiPlesseyChecksumAlgorithms
Unit setMsiPlesseyChecksumAlgorithms(EnumSet<MSIPlesseyChecksumAlgorithm> msiPlesseyChecksumAlgorithms)
The checksum algorithms for MSI Plessey barcodes. The default value is MSIPlesseyChecksumAlgorithm.Mod10.
-
setStripCheckDigits
Unit setStripCheckDigits(Boolean stripCheckDigits)
If true, check digits for UPC, EAN and MSI Plessey codes are removed from result. Has no effect if both single and double digit MSI Plessey checksums are enabled. The default is
false
-
setLowPowerMode
Unit setLowPowerMode(Boolean lowPowerMode)
If
true
, enabled the mode which slightly decreases the scanning quality and the energy consumption, and increases the scanning speed. Iffalse
- mode is disabled. The default isfalse
-
setUseIata2Of5Checksum
Unit setUseIata2Of5Checksum(Boolean useIata2Of5Checksum)
If
true
, the IATA 2 of 5 barcode checksum is used. Default istrue
-
setUseCode11Checksum
Unit setUseCode11Checksum(Boolean useCode11Checksum)
If
true
, the Code 11 barcode checksum is used. Default istrue
-
setAustraliaPostCustomerFormat
Unit setAustraliaPostCustomerFormat(AustraliaPostCustomerFormat australiaPostCustomerFormat)
The australia post customer format. The default value is AustraliaPostCustomerFormat.ALPHA_NUMERIC.
-
setEngineMode
Unit setEngineMode(EngineMode engineMode)
Allows to set custom EngineMode for the barcode detection EngineMode.NextGen is used by default
- Parameters:
engineMode
- of the detector to use
-
setBarcodeFilter
Unit setBarcodeFilter(IBarcodeFilter barcodeFilter)
Set the
IBarcodeFilter
implementation instance to filter accepted scanned barcodes.
-
-
-
-