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>cameraOpenedprivate final <Error class: unknown class><Boolean>stopNewFramesprivate final <Error class: unknown class><IBarcodeCameraView.ViewModel.ConfirmationState>confirmationStateprivate final <Error class: unknown class><Boolean>flashprivate final <Error class: unknown class><Boolean>autoSnapEnabledprivate final <Error class: unknown class><IBarcodeFilter>barcodeFilterprivate final BarcodeScannerscanner
-
Constructor Summary
Constructors Constructor Description BarcodeCameraViewModel(BarcodeScanner 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()BarcodeScannergetScanner()final Unitpause()UnitonCameraOpened()Camera has been opened. UnitonCancelClicked()User wants to cancel snapping. UnitsetAutoStopOnSuccess(Boolean enabled)Set if presenter need to stop snapping after first success. UnitonFlashClicked()User wants to change flash mode. UnitsetConfirmationDialogEnabled(Boolean enabled)Enables or disables showing of the confirmation dialog after barcode scanning. UnitonResultConfirmationPending()User was shown scanning result confirmation dialogue and we are waiting for his response. UnitonConfirmationRemoved()View has removed confirmation dialog (to restart scanning), preview resumed. UnitonRestartScanning()Scanning result confirmation dialogue finished. UnitonResultConfirmed(BarcodeScannerResult result)Barcode scanning result was confirmed in the confirmation dialog. UnitbarcodeScanned(FrameHandlerResult<BarcodeScannerResult, SdkLicenseError> result)User have scanned barcode. UnitonSelectionOverlayBarcodeClicked(BarcodeItem barcodeItem)When the barcode was clicked on the Barcode selection overlay layer. UnitpageSnapped(ByteArray image, Integer imageOrientation)User have snapped an image. final UnitsetFlashEnabled(Boolean flashEnabled)Enables/disables flash. UnitsetAutoCancelTimeout(Integer timeoutInSeconds)Sets auto close timer in seconds. UnitsetInitialScanDelayMs(Long ms)Sets initial scan timeout in ms. UnitsetDelayAfterScanMs(Long ms)Sets a delay after scan in ms. UnitsetAutomaticSelectionEnabled(Boolean enabled)If true- first successfully scanned barcode will be automatically selected in AR overlay and returned as a result,false- default AR overlay behaviour.UnitsetBarcodeFormatsFilter(List<BarcodeFormat> barcodeFormats)Set barcode format to scan UnitsetExtractedDocumentFormats(List<BarcodeDocumentFormat> formats)Sets list of BarcodeDocumentFormat to scan UnitsetMinimumTextLength(Integer minimumTextLength)Set minimum required text length of the scanned barcode. UnitsetMaximumTextLength(Integer maximumTextLength)Set maximum text length of the scanned barcode. UnitsetMinimum1DQuietZoneSize(Integer minimum1DQuietZoneSize)Set minimum required quiet zone on the barcode. UnitsetGs1HandlingMode(Gs1Handling gs1Handling)GS1 Codes Handling mode. UnitsetMsiPlesseyChecksumAlgorithms(List<MsiPlesseyChecksumAlgorithm> msiPlesseyChecksumAlgorithms)The checksum algorithms for MSI Plessey barcodes. UnitsetStripCheckDigits(Boolean stripCheckDigits)If true, check digits for UPC, EAN and MSI Plessey codes are removed from result. UnitsetLowPowerMode(Boolean lowPowerMode)If true, enabled the mode which slightly decreases the scanning quality and the energy consumption, and increases the scanning speed.UnitsetUseIata2Of5Checksum(Boolean useIata2Of5Checksum)If true, the IATA 2 of 5 barcode checksum is used.UnitsetUseCode11Checksum(Boolean useCode11Checksum)If true, the Code 11 barcode checksum is used.UnitsetAustraliaPostCustomerFormat(AustraliaPostCustomerFormat australiaPostCustomerFormat)The australia post customer format. UnitsetEngineMode(BarcodeScannerEngineMode engineMode)Allows to set custom BarcodeScannerEngineMode for the barcode scanning. UnitsetBarcodeFilter(IBarcodeFilter barcodeFilter)Set the IBarcodeFilterimplementation instance to filter accepted scanned barcodes.-
-
Constructor Detail
-
BarcodeCameraViewModel
BarcodeCameraViewModel(BarcodeScanner 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
BarcodeScanner 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(BarcodeScannerResult result)
Barcode scanning result was confirmed in the confirmation dialog.
-
barcodeScanned
Unit barcodeScanned(FrameHandlerResult<BarcodeScannerResult, 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 scanned barcode will be automatically selected in AR overlay and returned as a result,false- default AR overlay behaviour.The default value is
false.
-
setBarcodeFormatsFilter
Unit setBarcodeFormatsFilter(List<BarcodeFormat> barcodeFormats)
Set barcode format to scan
- Parameters:
barcodeFormats- List of BarcodeFormat to scan
-
setExtractedDocumentFormats
Unit setExtractedDocumentFormats(List<BarcodeDocumentFormat> formats)
Sets list of BarcodeDocumentFormat to scan
- Parameters:
formats- extracted document formats
-
setMinimumTextLength
Unit setMinimumTextLength(Integer minimumTextLength)
Set minimum required text length of the scanned 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 scanned 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(List<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(BarcodeScannerEngineMode engineMode)
Allows to set custom BarcodeScannerEngineMode for the barcode scanning.
BarcodeScannerEngineMode.NEXT_GEN is used by default.
- Parameters:
engineMode- of the barcode scanner to use
-
setBarcodeFilter
Unit setBarcodeFilter(IBarcodeFilter barcodeFilter)
Set the
IBarcodeFilterimplementation instance to filter accepted scanned barcodes.
-
-
-
-