UNPKG

capacitor-plugin-scanbot-barcode-scanner-sdk

Version:

Scanbot Barcode Scanner SDK for Capacitor

1,187 lines (1,093 loc) 570 kB
'use strict'; var core = require('@capacitor/core'); class SBError extends Error { constructor(message) { super(message); } } class InvalidLicenseError extends SBError { constructor(message) { super(message); this.type = 'InvalidLicense'; } } class NullPointerError extends SBError { constructor(message) { super(message); this.type = 'NullPointer'; } } class InvalidArgumentError extends SBError { constructor(message) { super(message); this.type = 'InvalidArgument'; } } class InvalidImageRefError extends SBError { constructor(message) { super(message); this.type = 'InvalidImageRef'; } } class ComponentUnavailableError extends SBError { constructor(message) { super(message); this.type = 'ComponentUnavailable'; } } class IllegalStateError extends SBError { constructor(message) { super(message); this.type = 'IllegalState'; } } class IOError extends SBError { constructor(message) { super(message); this.type = 'IOError'; } } class InvalidDataError extends SBError { constructor(message) { super(message); this.type = 'InvalidData'; } } class OutOfMemoryError extends SBError { constructor(message) { super(message); this.type = 'OutOfMemory'; } } class TimeoutError extends SBError { constructor(message) { super(message); this.type = 'Timeout'; } } class UnknownError extends SBError { constructor(message) { super(message); this.type = 'Unknown'; } } class ProcessError extends SBError { constructor(message, code) { super(message); this.type = 'ProcessError'; this.code = code; } } /** * @internal * @hidden */ function createSBError(err) { const code = Number(err.code); const message = err.message || err.errorMessage || 'An unknown error occurred'; switch (code) { case 1: return new UnknownError(message); case 2: return new InvalidLicenseError(message); case 3: return new NullPointerError(message); case 4: return new InvalidArgumentError(message); case 5: return new InvalidImageRefError(message); case 6: return new ComponentUnavailableError(message); case 7: return new IllegalStateError(message); case 8: return new IOError(message); case 9: return new InvalidDataError(message); case 11: return new OutOfMemoryError(message); case 12: return new TimeoutError(message); default: { if (code >= 100) { return new ProcessError(message, code); } return new UnknownError(message); } } } /// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from xplatforms/schemas/barcode_scanner/SdkConfiguration.yaml /** Initialize configuration for the Scanbot SDK. */ class SdkConfiguration { /** @param source {@displayType `DeepPartial<SdkConfiguration>`} */ constructor(source = {}) { /** Optional boolean flag to enable logging. See the "Logging" section below. Default is false */ this.loggingEnabled = false; /** Optional boolean flag that enables Scanbot SDK Core native logging (default is false, Android only). Default is false */ this.enableNativeLogging = false; /** Optional directory as file URI to override the default storage base directory of the Scanbot SDK. Refer to the section "Storage" for more details. */ this.storageBaseDirectory = null; /** Optional file encryption mode, 'AES128' or 'AES256'. */ this.fileEncryptionMode = null; /** Optional file encryption password. Refer to the section "Storage Encryption" for more details. */ this.fileEncryptionPassword = null; /** If set to `true`, PerformanceHintApi is enabled, which lead to increase of performance due of increased use of top CPU cores (Android only), also increase battery usage. Default is true */ this.performanceHintApi = true; /** If set to `true`, GPU Acceleration will be enabled for Barcode Scanner, Document Scanner and Generic Document Recognizer (Android only). Default is true */ this.allowGpuAcceleration = true; /** Enables/disables XNNPACK acceleration for TensorFlow ML models, which provides highly optimized implementations of floating-point neural network operators (Android only). Default is true */ this.allowXnnpackAcceleration = true; if (source.licenseKey !== undefined) { this.licenseKey = source.licenseKey; } else { throw new Error('licenseKey must be present in constructor argument'); } if (source.loggingEnabled !== undefined) { this.loggingEnabled = source.loggingEnabled; } if (source.enableNativeLogging !== undefined) { this.enableNativeLogging = source.enableNativeLogging; } if (source.storageBaseDirectory !== undefined) { this.storageBaseDirectory = source.storageBaseDirectory != null ? source.storageBaseDirectory : null; } if (source.fileEncryptionMode !== undefined) { this.fileEncryptionMode = source.fileEncryptionMode != null ? FileEncryptionModeValues.includes(source.fileEncryptionMode) ? source.fileEncryptionMode : null : null; } if (source.fileEncryptionPassword !== undefined) { this.fileEncryptionPassword = source.fileEncryptionPassword != null ? source.fileEncryptionPassword : null; } if (source.performanceHintApi !== undefined) { this.performanceHintApi = source.performanceHintApi; } if (source.allowGpuAcceleration !== undefined) { this.allowGpuAcceleration = source.allowGpuAcceleration; } if (source.allowXnnpackAcceleration !== undefined) { this.allowXnnpackAcceleration = source.allowXnnpackAcceleration; } } } /** @hidden */ const FileEncryptionModeValues = ['AES128', 'AES256']; /// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from core/schemas/BarcodeConfigurationTypes.yaml /** @internal */ exports.BarcodeFormatConfigurationBase = void 0; (function (BarcodeFormatConfigurationBase) { /** @internal */ function from(source) { const _type = source['_type']; switch (_type) { case 'BarcodeFormatCodabarConfiguration': return new BarcodeFormatCodabarConfiguration(source); case 'BarcodeFormatCode11Configuration': return new BarcodeFormatCode11Configuration(source); case 'BarcodeFormatCode39Configuration': return new BarcodeFormatCode39Configuration(source); case 'BarcodeFormatCode93Configuration': return new BarcodeFormatCode93Configuration(source); case 'BarcodeFormatCode128Configuration': return new BarcodeFormatCode128Configuration(source); case 'BarcodeFormatCode2Of5Configuration': return new BarcodeFormatCode2Of5Configuration(source); case 'BarcodeFormatDataBarConfiguration': return new BarcodeFormatDataBarConfiguration(source); case 'BarcodeFormatDataBarExpandedConfiguration': return new BarcodeFormatDataBarExpandedConfiguration(source); case 'BarcodeFormatDataBarLimitedConfiguration': return new BarcodeFormatDataBarLimitedConfiguration(source); case 'BarcodeFormatITFConfiguration': return new BarcodeFormatItfConfiguration(source); case 'BarcodeFormatMSIPlesseyConfiguration': return new BarcodeFormatMsiPlesseyConfiguration(source); case 'BarcodeFormatUpcEanConfiguration': return new BarcodeFormatUpcEanConfiguration(source); case 'BarcodeFormatPharmaCodeConfiguration': return new BarcodeFormatPharmaCodeConfiguration(source); case 'BarcodeFormatAztecConfiguration': return new BarcodeFormatAztecConfiguration(source); case 'BarcodeFormatQRCodeConfiguration': return new BarcodeFormatQrCodeConfiguration(source); case 'BarcodeFormatPDF417Configuration': return new BarcodeFormatPdf417Configuration(source); case 'BarcodeFormatMicroPDF417Configuration': return new BarcodeFormatMicroPdf417Configuration(source); case 'BarcodeFormatDataMatrixConfiguration': return new BarcodeFormatDataMatrixConfiguration(source); case 'BarcodeFormatMaxiCodeConfiguration': return new BarcodeFormatMaxiCodeConfiguration(source); case 'BarcodeFormatAustraliaPostConfiguration': return new BarcodeFormatAustraliaPostConfiguration(source); case 'BarcodeFormatJapanPostConfiguration': return new BarcodeFormatJapanPostConfiguration(source); case 'BarcodeFormatRoyalMailConfiguration': return new BarcodeFormatRoyalMailConfiguration(source); case 'BarcodeFormatRoyalTNTPostConfiguration': return new BarcodeFormatRoyalTntPostConfiguration(source); case 'BarcodeFormatUSPSIntelligentMailConfiguration': return new BarcodeFormatUspsIntelligentMailConfiguration(source); case 'BarcodeFormatPharmaCodeTwoTrackConfiguration': return new BarcodeFormatPharmaCodeTwoTrackConfiguration(source); case 'BarcodeFormatGS1CompositeConfiguration': return new BarcodeFormatGs1CompositeConfiguration(source); case 'BarcodeFormatCommonOneDConfiguration': return new BarcodeFormatCommonOneDConfiguration(source); case 'BarcodeFormatCommonTwoDConfiguration': return new BarcodeFormatCommonTwoDConfiguration(source); case 'BarcodeFormatCommonFourStateConfiguration': return new BarcodeFormatCommonFourStateConfiguration(source); case 'BarcodeFormatCommonConfiguration': return new BarcodeFormatCommonConfiguration(source); default: throw new Error(`Unknown child class name: ${_type}`); } } BarcodeFormatConfigurationBase.from = from; })(exports.BarcodeFormatConfigurationBase || (exports.BarcodeFormatConfigurationBase = {})); /** @internal */ exports.BarcodeFormatOneDConfigurationBase = void 0; (function (BarcodeFormatOneDConfigurationBase) { /** @internal */ function from(source) { const _type = source['_type']; switch (_type) { case 'BarcodeFormatCodabarConfiguration': return new BarcodeFormatCodabarConfiguration(source); case 'BarcodeFormatCode11Configuration': return new BarcodeFormatCode11Configuration(source); case 'BarcodeFormatCode39Configuration': return new BarcodeFormatCode39Configuration(source); case 'BarcodeFormatCode93Configuration': return new BarcodeFormatCode93Configuration(source); case 'BarcodeFormatCode128Configuration': return new BarcodeFormatCode128Configuration(source); case 'BarcodeFormatCode2Of5Configuration': return new BarcodeFormatCode2Of5Configuration(source); case 'BarcodeFormatDataBarConfiguration': return new BarcodeFormatDataBarConfiguration(source); case 'BarcodeFormatDataBarExpandedConfiguration': return new BarcodeFormatDataBarExpandedConfiguration(source); case 'BarcodeFormatDataBarLimitedConfiguration': return new BarcodeFormatDataBarLimitedConfiguration(source); case 'BarcodeFormatITFConfiguration': return new BarcodeFormatItfConfiguration(source); case 'BarcodeFormatMSIPlesseyConfiguration': return new BarcodeFormatMsiPlesseyConfiguration(source); case 'BarcodeFormatUpcEanConfiguration': return new BarcodeFormatUpcEanConfiguration(source); case 'BarcodeFormatPharmaCodeConfiguration': return new BarcodeFormatPharmaCodeConfiguration(source); default: throw new Error(`Unknown child class name: ${_type}`); } } BarcodeFormatOneDConfigurationBase.from = from; })(exports.BarcodeFormatOneDConfigurationBase || (exports.BarcodeFormatOneDConfigurationBase = {})); /** Codabar barcode configuration. Add to scanner configuration to scan Codabar barcodes. */ class BarcodeFormatCodabarConfiguration { /** @param source {@displayType `DeepPartial<BarcodeFormatCodabarConfiguration>`} */ constructor(source = {}) { this._type = 'BarcodeFormatCodabarConfiguration'; /** Regular expression filter for barcode text. If the barcode text does not match the regular expression, it will not be scanned. The default is an empty string (setting is turned off). Default is "" */ this.regexFilter = ''; /** Minimum acceptable value of a result BarcodeItem's sizeScore (between 0 and 1). Barcodes with a sizeScore less than this value will not be scanned. When set to 0, barcodes are returned no matter what their size is. Default is 0 */ this.minimumSizeScore = 0.0; /** If true, we process the barcode scanning with an artificial quiet zone that we add to the input image. This flag should be used to scan sharp crops of a barcode in single-shot mode. Default is false */ this.addAdditionalQuietZone = false; /** Minimum quiet zone size on the left and right sides of a 1D barcode, measured in number of modules. The quiet zone is only for 1D barcodes with weak start/stop patterns, i.e. Iata2Of5, Industrial2Of5, Code25, Itf, Codabar, MsiPlessey and Code11. Default is 6 */ this.minimum1DQuietZoneSize = 6; /** Minimum number of frames on which a linear (1D) barcode has to be detected to be considered valid (live scanning only). Linear barcodes are more prone to false positives. Increasing the number of frames on which a barcode has to decode to the same content reduces the probability of a false positive. Default is 1 */ this.minimumNumberOfRequiredFramesWithEqualRecognitionResult = 1; /** Allows to select the balance between result accuracy (precision) and missed barcodes (recall) for linear barcodes. Default is THOROUGH */ this.oneDConfirmationMode = 'THOROUGH'; /** Minimum text length. Applied only to linear barcode formats that allow variable length. Default is 1 */ this.minimumTextLength = 1; /** Maximum text length. 0 implies no maximum. Applied only to linear barcode formats that allow variable length. Default is 0 */ this.maximumTextLength = 0; /** If true, the scanner will try extra-hard to scan barcodes with heavy blur or that are otherwise damaged. Default is true */ this.enableOneDBlurScanner = true; /** If true, return the start and end characters. Default is false */ this.returnStartEnd = false; if (source.regexFilter !== undefined) { this.regexFilter = source.regexFilter; } if (source.minimumSizeScore !== undefined) { this.minimumSizeScore = source.minimumSizeScore; } if (source.addAdditionalQuietZone !== undefined) { this.addAdditionalQuietZone = source.addAdditionalQuietZone; } if (source.minimum1DQuietZoneSize !== undefined) { this.minimum1DQuietZoneSize = source.minimum1DQuietZoneSize; } if (source.minimumNumberOfRequiredFramesWithEqualRecognitionResult !== undefined) { this.minimumNumberOfRequiredFramesWithEqualRecognitionResult = source.minimumNumberOfRequiredFramesWithEqualRecognitionResult; } if (source.oneDConfirmationMode !== undefined) { this.oneDConfirmationMode = source.oneDConfirmationMode; } if (source.minimumTextLength !== undefined) { this.minimumTextLength = source.minimumTextLength; } if (source.maximumTextLength !== undefined) { this.maximumTextLength = source.maximumTextLength; } if (source.enableOneDBlurScanner !== undefined) { this.enableOneDBlurScanner = source.enableOneDBlurScanner; } if (source.returnStartEnd !== undefined) { this.returnStartEnd = source.returnStartEnd; } } } /** Code 11 barcode configuration. Add to scanner configuration to scan Code 11 barcodes. */ class BarcodeFormatCode11Configuration { /** @param source {@displayType `DeepPartial<BarcodeFormatCode11Configuration>`} */ constructor(source = {}) { this._type = 'BarcodeFormatCode11Configuration'; /** Regular expression filter for barcode text. If the barcode text does not match the regular expression, it will not be scanned. The default is an empty string (setting is turned off). Default is "" */ this.regexFilter = ''; /** Minimum acceptable value of a result BarcodeItem's sizeScore (between 0 and 1). Barcodes with a sizeScore less than this value will not be scanned. When set to 0, barcodes are returned no matter what their size is. Default is 0 */ this.minimumSizeScore = 0.0; /** If true, we process the barcode scanning with an artificial quiet zone that we add to the input image. This flag should be used to scan sharp crops of a barcode in single-shot mode. Default is false */ this.addAdditionalQuietZone = false; /** Minimum quiet zone size on the left and right sides of a 1D barcode, measured in number of modules. The quiet zone is only for 1D barcodes with weak start/stop patterns, i.e. Iata2Of5, Industrial2Of5, Code25, Itf, Codabar, MsiPlessey and Code11. Default is 6 */ this.minimum1DQuietZoneSize = 6; /** Minimum number of frames on which a linear (1D) barcode has to be detected to be considered valid (live scanning only). Linear barcodes are more prone to false positives. Increasing the number of frames on which a barcode has to decode to the same content reduces the probability of a false positive. Default is 1 */ this.minimumNumberOfRequiredFramesWithEqualRecognitionResult = 1; /** Allows to select the balance between result accuracy (precision) and missed barcodes (recall) for linear barcodes. Default is THOROUGH */ this.oneDConfirmationMode = 'THOROUGH'; /** If true, the check digits are stripped from the result. Default is false */ this.stripCheckDigits = false; /** Minimum text length. Applied only to linear barcode formats that allow variable length. Default is 1 */ this.minimumTextLength = 1; /** Maximum text length. 0 implies no maximum. Applied only to linear barcode formats that allow variable length. Default is 0 */ this.maximumTextLength = 0; /** If true, return CODE_11 barcodes only if they have a valid checksum. Default is true */ this.checksum = true; if (source.regexFilter !== undefined) { this.regexFilter = source.regexFilter; } if (source.minimumSizeScore !== undefined) { this.minimumSizeScore = source.minimumSizeScore; } if (source.addAdditionalQuietZone !== undefined) { this.addAdditionalQuietZone = source.addAdditionalQuietZone; } if (source.minimum1DQuietZoneSize !== undefined) { this.minimum1DQuietZoneSize = source.minimum1DQuietZoneSize; } if (source.minimumNumberOfRequiredFramesWithEqualRecognitionResult !== undefined) { this.minimumNumberOfRequiredFramesWithEqualRecognitionResult = source.minimumNumberOfRequiredFramesWithEqualRecognitionResult; } if (source.oneDConfirmationMode !== undefined) { this.oneDConfirmationMode = source.oneDConfirmationMode; } if (source.stripCheckDigits !== undefined) { this.stripCheckDigits = source.stripCheckDigits; } if (source.minimumTextLength !== undefined) { this.minimumTextLength = source.minimumTextLength; } if (source.maximumTextLength !== undefined) { this.maximumTextLength = source.maximumTextLength; } if (source.checksum !== undefined) { this.checksum = source.checksum; } } } /** Code 39 barcode and derivatives configuration. Add to scanner configuration to scan Code 39, Code 32 (Italian Pharmacode), PZN7 and PZN8 (Pharmazentralnummer) barcodes. */ class BarcodeFormatCode39Configuration { /** @param source {@displayType `DeepPartial<BarcodeFormatCode39Configuration>`} */ constructor(source = {}) { this._type = 'BarcodeFormatCode39Configuration'; /** Regular expression filter for barcode text. If the barcode text does not match the regular expression, it will not be scanned. The default is an empty string (setting is turned off). Default is "" */ this.regexFilter = ''; /** Minimum acceptable value of a result BarcodeItem's sizeScore (between 0 and 1). Barcodes with a sizeScore less than this value will not be scanned. When set to 0, barcodes are returned no matter what their size is. Default is 0 */ this.minimumSizeScore = 0.0; /** If true, we process the barcode scanning with an artificial quiet zone that we add to the input image. This flag should be used to scan sharp crops of a barcode in single-shot mode. Default is false */ this.addAdditionalQuietZone = false; /** Minimum quiet zone size on the left and right sides of a 1D barcode, measured in number of modules. The quiet zone is only for 1D barcodes with weak start/stop patterns, i.e. Iata2Of5, Industrial2Of5, Code25, Itf, Codabar, MsiPlessey and Code11. Default is 6 */ this.minimum1DQuietZoneSize = 6; /** Minimum number of frames on which a linear (1D) barcode has to be detected to be considered valid (live scanning only). Linear barcodes are more prone to false positives. Increasing the number of frames on which a barcode has to decode to the same content reduces the probability of a false positive. Default is 1 */ this.minimumNumberOfRequiredFramesWithEqualRecognitionResult = 1; /** Allows to select the balance between result accuracy (precision) and missed barcodes (recall) for linear barcodes. Default is THOROUGH */ this.oneDConfirmationMode = 'THOROUGH'; /** If true, the check digits are stripped from the result. Default is false */ this.stripCheckDigits = false; /** Minimum text length. Applied only to linear barcode formats that allow variable length. Default is 1 */ this.minimumTextLength = 1; /** Maximum text length. 0 implies no maximum. Applied only to linear barcode formats that allow variable length. Default is 0 */ this.maximumTextLength = 0; /** If true, the scanner will try extra-hard to scan barcodes with heavy blur or that are otherwise damaged. Default is true */ this.enableOneDBlurScanner = true; /** If true, scan and return valid CODE_32 (Italian Pharmacode) barcodes. If false, CODE_32 barcodes are not decoded and are returned as CODE_39 instead. Default is false */ this.code32 = false; /** If true, scan CODE_39 barcodes. Default is true */ this.code39 = true; /** If true, scan PZN7 (legacy Pharmazentralnummer) barcodes. If false, PZN7 barcodes are not decoded and are returned as CODE_39 instead. Default is true */ this.pzn7 = true; /** If true, scan PZN8 (Pharmazentralnummer) barcodes. If false, PZN8 barcodes are not decoded and are returned as CODE_39 instead. Default is true */ this.pzn8 = true; /** If true, try to scan CODE_39 in extended mode. Default is false */ this.tryCode39ExtendedMode = false; /** If true, return CODE_39 barcodes only if they have a valid check digit. Default is false */ this.useCode39CheckDigit = false; if (source.regexFilter !== undefined) { this.regexFilter = source.regexFilter; } if (source.minimumSizeScore !== undefined) { this.minimumSizeScore = source.minimumSizeScore; } if (source.addAdditionalQuietZone !== undefined) { this.addAdditionalQuietZone = source.addAdditionalQuietZone; } if (source.minimum1DQuietZoneSize !== undefined) { this.minimum1DQuietZoneSize = source.minimum1DQuietZoneSize; } if (source.minimumNumberOfRequiredFramesWithEqualRecognitionResult !== undefined) { this.minimumNumberOfRequiredFramesWithEqualRecognitionResult = source.minimumNumberOfRequiredFramesWithEqualRecognitionResult; } if (source.oneDConfirmationMode !== undefined) { this.oneDConfirmationMode = source.oneDConfirmationMode; } if (source.stripCheckDigits !== undefined) { this.stripCheckDigits = source.stripCheckDigits; } if (source.minimumTextLength !== undefined) { this.minimumTextLength = source.minimumTextLength; } if (source.maximumTextLength !== undefined) { this.maximumTextLength = source.maximumTextLength; } if (source.enableOneDBlurScanner !== undefined) { this.enableOneDBlurScanner = source.enableOneDBlurScanner; } if (source.code32 !== undefined) { this.code32 = source.code32; } if (source.code39 !== undefined) { this.code39 = source.code39; } if (source.pzn7 !== undefined) { this.pzn7 = source.pzn7; } if (source.pzn8 !== undefined) { this.pzn8 = source.pzn8; } if (source.tryCode39ExtendedMode !== undefined) { this.tryCode39ExtendedMode = source.tryCode39ExtendedMode; } if (source.useCode39CheckDigit !== undefined) { this.useCode39CheckDigit = source.useCode39CheckDigit; } } } /** Code 93 barcode configuration. Add to scanner configuration to scan Code 93 barcodes. */ class BarcodeFormatCode93Configuration { /** @param source {@displayType `DeepPartial<BarcodeFormatCode93Configuration>`} */ constructor(source = {}) { this._type = 'BarcodeFormatCode93Configuration'; /** Regular expression filter for barcode text. If the barcode text does not match the regular expression, it will not be scanned. The default is an empty string (setting is turned off). Default is "" */ this.regexFilter = ''; /** Minimum acceptable value of a result BarcodeItem's sizeScore (between 0 and 1). Barcodes with a sizeScore less than this value will not be scanned. When set to 0, barcodes are returned no matter what their size is. Default is 0 */ this.minimumSizeScore = 0.0; /** If true, we process the barcode scanning with an artificial quiet zone that we add to the input image. This flag should be used to scan sharp crops of a barcode in single-shot mode. Default is false */ this.addAdditionalQuietZone = false; /** Minimum quiet zone size on the left and right sides of a 1D barcode, measured in number of modules. The quiet zone is only for 1D barcodes with weak start/stop patterns, i.e. Iata2Of5, Industrial2Of5, Code25, Itf, Codabar, MsiPlessey and Code11. Default is 6 */ this.minimum1DQuietZoneSize = 6; /** Minimum number of frames on which a linear (1D) barcode has to be detected to be considered valid (live scanning only). Linear barcodes are more prone to false positives. Increasing the number of frames on which a barcode has to decode to the same content reduces the probability of a false positive. Default is 1 */ this.minimumNumberOfRequiredFramesWithEqualRecognitionResult = 1; /** Allows to select the balance between result accuracy (precision) and missed barcodes (recall) for linear barcodes. Default is THOROUGH */ this.oneDConfirmationMode = 'THOROUGH'; /** If true, the check digits are stripped from the result. Default is false */ this.stripCheckDigits = false; /** Minimum text length. Applied only to linear barcode formats that allow variable length. Default is 1 */ this.minimumTextLength = 1; /** Maximum text length. 0 implies no maximum. Applied only to linear barcode formats that allow variable length. Default is 0 */ this.maximumTextLength = 0; /** If true, the scanner will try extra-hard to scan barcodes with heavy blur or that are otherwise damaged. Default is true */ this.enableOneDBlurScanner = true; if (source.regexFilter !== undefined) { this.regexFilter = source.regexFilter; } if (source.minimumSizeScore !== undefined) { this.minimumSizeScore = source.minimumSizeScore; } if (source.addAdditionalQuietZone !== undefined) { this.addAdditionalQuietZone = source.addAdditionalQuietZone; } if (source.minimum1DQuietZoneSize !== undefined) { this.minimum1DQuietZoneSize = source.minimum1DQuietZoneSize; } if (source.minimumNumberOfRequiredFramesWithEqualRecognitionResult !== undefined) { this.minimumNumberOfRequiredFramesWithEqualRecognitionResult = source.minimumNumberOfRequiredFramesWithEqualRecognitionResult; } if (source.oneDConfirmationMode !== undefined) { this.oneDConfirmationMode = source.oneDConfirmationMode; } if (source.stripCheckDigits !== undefined) { this.stripCheckDigits = source.stripCheckDigits; } if (source.minimumTextLength !== undefined) { this.minimumTextLength = source.minimumTextLength; } if (source.maximumTextLength !== undefined) { this.maximumTextLength = source.maximumTextLength; } if (source.enableOneDBlurScanner !== undefined) { this.enableOneDBlurScanner = source.enableOneDBlurScanner; } } } /** Code 128 barcode configuration. Add to scanner configuration to scan Code 128 barcodes. */ class BarcodeFormatCode128Configuration { /** @param source {@displayType `DeepPartial<BarcodeFormatCode128Configuration>`} */ constructor(source = {}) { this._type = 'BarcodeFormatCode128Configuration'; /** Regular expression filter for barcode text. If the barcode text does not match the regular expression, it will not be scanned. The default is an empty string (setting is turned off). Default is "" */ this.regexFilter = ''; /** Minimum acceptable value of a result BarcodeItem's sizeScore (between 0 and 1). Barcodes with a sizeScore less than this value will not be scanned. When set to 0, barcodes are returned no matter what their size is. Default is 0 */ this.minimumSizeScore = 0.0; /** If true, we process the barcode scanning with an artificial quiet zone that we add to the input image. This flag should be used to scan sharp crops of a barcode in single-shot mode. Default is false */ this.addAdditionalQuietZone = false; /** Minimum quiet zone size on the left and right sides of a 1D barcode, measured in number of modules. The quiet zone is only for 1D barcodes with weak start/stop patterns, i.e. Iata2Of5, Industrial2Of5, Code25, Itf, Codabar, MsiPlessey and Code11. Default is 6 */ this.minimum1DQuietZoneSize = 6; /** Minimum number of frames on which a linear (1D) barcode has to be detected to be considered valid (live scanning only). Linear barcodes are more prone to false positives. Increasing the number of frames on which a barcode has to decode to the same content reduces the probability of a false positive. Default is 1 */ this.minimumNumberOfRequiredFramesWithEqualRecognitionResult = 1; /** Allows to select the balance between result accuracy (precision) and missed barcodes (recall) for linear barcodes. Default is THOROUGH */ this.oneDConfirmationMode = 'THOROUGH'; /** GS1 message handling options. Default is PARSE */ this.gs1Handling = 'PARSE'; /** Minimum text length. Applied only to linear barcode formats that allow variable length. Default is 1 */ this.minimumTextLength = 1; /** Maximum text length. 0 implies no maximum. Applied only to linear barcode formats that allow variable length. Default is 0 */ this.maximumTextLength = 0; /** If true, the scanner will try extra-hard to scan barcodes with heavy blur or that are otherwise damaged. Default is true */ this.enableOneDBlurScanner = true; if (source.regexFilter !== undefined) { this.regexFilter = source.regexFilter; } if (source.minimumSizeScore !== undefined) { this.minimumSizeScore = source.minimumSizeScore; } if (source.addAdditionalQuietZone !== undefined) { this.addAdditionalQuietZone = source.addAdditionalQuietZone; } if (source.minimum1DQuietZoneSize !== undefined) { this.minimum1DQuietZoneSize = source.minimum1DQuietZoneSize; } if (source.minimumNumberOfRequiredFramesWithEqualRecognitionResult !== undefined) { this.minimumNumberOfRequiredFramesWithEqualRecognitionResult = source.minimumNumberOfRequiredFramesWithEqualRecognitionResult; } if (source.oneDConfirmationMode !== undefined) { this.oneDConfirmationMode = source.oneDConfirmationMode; } if (source.gs1Handling !== undefined) { this.gs1Handling = source.gs1Handling; } if (source.minimumTextLength !== undefined) { this.minimumTextLength = source.minimumTextLength; } if (source.maximumTextLength !== undefined) { this.maximumTextLength = source.maximumTextLength; } if (source.enableOneDBlurScanner !== undefined) { this.enableOneDBlurScanner = source.enableOneDBlurScanner; } } } /** Configuration for all 2-of-5 barcode types (except Interleaved 2-of-5, which is handled by ItfConfig). Add to scanner configuration to scan Code 25, IATA 2-of-5 and Industrial 2-of-5 barcodes. Industrial 2-of-5 barcodes are a subset of Code 25 barcodes. Any valid Industrial 2-of-5 barcode is also a valid Code 25 barcode. */ class BarcodeFormatCode2Of5Configuration { /** @param source {@displayType `DeepPartial<BarcodeFormatCode2Of5Configuration>`} */ constructor(source = {}) { this._type = 'BarcodeFormatCode2Of5Configuration'; /** Regular expression filter for barcode text. If the barcode text does not match the regular expression, it will not be scanned. The default is an empty string (setting is turned off). Default is "" */ this.regexFilter = ''; /** Minimum acceptable value of a result BarcodeItem's sizeScore (between 0 and 1). Barcodes with a sizeScore less than this value will not be scanned. When set to 0, barcodes are returned no matter what their size is. Default is 0 */ this.minimumSizeScore = 0.0; /** If true, we process the barcode scanning with an artificial quiet zone that we add to the input image. This flag should be used to scan sharp crops of a barcode in single-shot mode. Default is false */ this.addAdditionalQuietZone = false; /** Minimum quiet zone size on the left and right sides of a 1D barcode, measured in number of modules. The quiet zone is only for 1D barcodes with weak start/stop patterns, i.e. Iata2Of5, Industrial2Of5, Code25, Itf, Codabar, MsiPlessey and Code11. Default is 6 */ this.minimum1DQuietZoneSize = 6; /** Minimum number of frames on which a linear (1D) barcode has to be detected to be considered valid (live scanning only). Linear barcodes are more prone to false positives. Increasing the number of frames on which a barcode has to decode to the same content reduces the probability of a false positive. Default is 1 */ this.minimumNumberOfRequiredFramesWithEqualRecognitionResult = 1; /** Allows to select the balance between result accuracy (precision) and missed barcodes (recall) for linear barcodes. Default is THOROUGH */ this.oneDConfirmationMode = 'THOROUGH'; /** If true, the check digits are stripped from the result. Default is false */ this.stripCheckDigits = false; /** Minimum text length. Applied only to linear barcode formats that allow variable length. Default is 1 */ this.minimumTextLength = 1; /** Maximum text length. 0 implies no maximum. Applied only to linear barcode formats that allow variable length. Default is 0 */ this.maximumTextLength = 0; /** If true, scan IATA 2-of-5 barcodes. If useIATA2OF5Checksum is true, only barcodes with a valid checksum are returned. Default is true */ this.iata2of5 = true; /** If true, scan and return Code 25 (Code 2-of-5) barcodes. If industrial2of5 is also true, then valid Industrial 2-of-5 barcodes will preferentially be returned as such, instead of Code 25. Default is false */ this.code25 = false; /** If true, scan and return valid Industrial 2-of-5 barcodes. If false, but code25 is true, Industrial 2-of-5 barcodes will be returned as Code 25 barcodes. Default is true */ this.industrial2of5 = true; /** If true, return IATA_2_OF_5 barcodes only if they have a valid check digit. Default is true */ this.useIATA2OF5Checksum = true; if (source.regexFilter !== undefined) { this.regexFilter = source.regexFilter; } if (source.minimumSizeScore !== undefined) { this.minimumSizeScore = source.minimumSizeScore; } if (source.addAdditionalQuietZone !== undefined) { this.addAdditionalQuietZone = source.addAdditionalQuietZone; } if (source.minimum1DQuietZoneSize !== undefined) { this.minimum1DQuietZoneSize = source.minimum1DQuietZoneSize; } if (source.minimumNumberOfRequiredFramesWithEqualRecognitionResult !== undefined) { this.minimumNumberOfRequiredFramesWithEqualRecognitionResult = source.minimumNumberOfRequiredFramesWithEqualRecognitionResult; } if (source.oneDConfirmationMode !== undefined) { this.oneDConfirmationMode = source.oneDConfirmationMode; } if (source.stripCheckDigits !== undefined) { this.stripCheckDigits = source.stripCheckDigits; } if (source.minimumTextLength !== undefined) { this.minimumTextLength = source.minimumTextLength; } if (source.maximumTextLength !== undefined) { this.maximumTextLength = source.maximumTextLength; } if (source.iata2of5 !== undefined) { this.iata2of5 = source.iata2of5; } if (source.code25 !== undefined) { this.code25 = source.code25; } if (source.industrial2of5 !== undefined) { this.industrial2of5 = source.industrial2of5; } if (source.useIATA2OF5Checksum !== undefined) { this.useIATA2OF5Checksum = source.useIATA2OF5Checksum; } } } /** GS1 DataBar barcode configuration. Add to scanner configuration to scan GS1 DataBar-14, GS1 DataBar-14 Truncated, GS1 DataBar-14 Stacked and GS1 DataBar-14 Stacked Omnidirectional barcodes. */ class BarcodeFormatDataBarConfiguration { /** @param source {@displayType `DeepPartial<BarcodeFormatDataBarConfiguration>`} */ constructor(source = {}) { this._type = 'BarcodeFormatDataBarConfiguration'; /** Regular expression filter for barcode text. If the barcode text does not match the regular expression, it will not be scanned. The default is an empty string (setting is turned off). Default is "" */ this.regexFilter = ''; /** Minimum acceptable value of a result BarcodeItem's sizeScore (between 0 and 1). Barcodes with a sizeScore less than this value will not be scanned. When set to 0, barcodes are returned no matter what their size is. Default is 0 */ this.minimumSizeScore = 0.0; /** If true, we process the barcode scanning with an artificial quiet zone that we add to the input image. This flag should be used to scan sharp crops of a barcode in single-shot mode. Default is false */ this.addAdditionalQuietZone = false; /** Minimum quiet zone size on the left and right sides of a 1D barcode, measured in number of modules. The quiet zone is only for 1D barcodes with weak start/stop patterns, i.e. Iata2Of5, Industrial2Of5, Code25, Itf, Codabar, MsiPlessey and Code11. Default is 6 */ this.minimum1DQuietZoneSize = 6; /** Minimum number of frames on which a linear (1D) barcode has to be detected to be considered valid (live scanning only). Linear barcodes are more prone to false positives. Increasing the number of frames on which a barcode has to decode to the same content reduces the probability of a false positive. Default is 1 */ this.minimumNumberOfRequiredFramesWithEqualRecognitionResult = 1; /** Allows to select the balance between result accuracy (precision) and missed barcodes (recall) for linear barcodes. Default is THOROUGH */ this.oneDConfirmationMode = 'THOROUGH'; /** GS1 message handling options. Default is PARSE */ this.gs1Handling = 'PARSE'; if (source.regexFilter !== undefined) { this.regexFilter = source.regexFilter; } if (source.minimumSizeScore !== undefined) { this.minimumSizeScore = source.minimumSizeScore; } if (source.addAdditionalQuietZone !== undefined) { this.addAdditionalQuietZone = source.addAdditionalQuietZone; } if (source.minimum1DQuietZoneSize !== undefined) { this.minimum1DQuietZoneSize = source.minimum1DQuietZoneSize; } if (source.minimumNumberOfRequiredFramesWithEqualRecognitionResult !== undefined) { this.minimumNumberOfRequiredFramesWithEqualRecognitionResult = source.minimumNumberOfRequiredFramesWithEqualRecognitionResult; } if (source.oneDConfirmationMode !== undefined) { this.oneDConfirmationMode = source.oneDConfirmationMode; } if (source.gs1Handling !== undefined) { this.gs1Handling = source.gs1Handling; } } } /** GS1 DataBar Expanded barcode configuration. Add to scanner configuration to scan GS1 DataBar Expanded and GS1 DataBar Expanded Stacked barcodes. */ class BarcodeFormatDataBarExpandedConfiguration { /** @param source {@displayType `DeepPartial<BarcodeFormatDataBarExpandedConfiguration>`} */ constructor(source = {}) { this._type = 'BarcodeFormatDataBarExpandedConfiguration'; /** Regular expression filter for barcode text. If the barcode text does not match the regular expression, it will not be scanned. The default is an empty string (setting is turned off). Default is "" */ this.regexFilter = ''; /** Minimum acceptable value of a result BarcodeItem's sizeScore (between 0 and 1). Barcodes with a sizeScore less than this value will not be scanned. When set to 0, barcodes are returned no matter what their size is. Default is 0 */ this.minimumSizeScore = 0.0; /** If true, we process the barcode scanning with an artificial quiet zone that we add to the input image. This flag should be used to scan sharp crops of a barcode in single-shot mode. Default is false */ this.addAdditionalQuietZone = false; /** Minimum quiet zone size on the left and right sides of a 1D barcode, measured in number of modules. The quiet zone is only for 1D barcodes with weak start/stop patterns, i.e. Iata2Of5, Industrial2Of5, Code25, Itf, Codabar, MsiPlessey and Code11. Default is 6 */ this.minimum1DQuietZoneSize = 6; /** Minimum number of frames on which a linear (1D) barcode has to be detected to be considered valid (live scanning only). Linear barcodes are more prone to false positives. Increasing the number of frames on which a barcode has to decode to the same content reduces the probability of a false positive. Default is 1 */ this.minimumNumberOfRequiredFramesWithEqualRecognitionResult = 1; /** Allows to select the balance between result accuracy (precision) and missed barcodes (recall) for linear barcodes. Default is THOROUGH */ this.oneDConfirmationMode = 'THOROUGH'; /** GS1 message handling options. Default is PARSE */ this.gs1Handling = 'PARSE'; if (source.regexFilter !== undefined) { this.regexFilter = source.regexFilter; } if (source.minimumSizeScore !== undefined) { this.minimumSizeScore = source.minimumSizeScore; }