diff --git a/src/@awesome-cordova-plugins/plugins/barkoder/index.ts b/src/@awesome-cordova-plugins/plugins/barkoder/index.ts new file mode 100644 index 0000000000..01b9f7d996 --- /dev/null +++ b/src/@awesome-cordova-plugins/plugins/barkoder/index.ts @@ -0,0 +1,688 @@ +import { Injectable } from '@angular/core'; +import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; + +/** + * @name Barkoder + * @description + * The barKoder Barcode Scanner SDK cordova plugin grants an easy to use solution with a great and completely customizable interface that can be instantly integrated in both iOS and Android apps. + * @usage + * + * ```typescript + * import { Barkoder } from '@awesome-cordova-plugins/barkoder/ngx'; + * + * ... + * + * constructor(private barkoder: Barkoder, private platform: Platform) { } + * + * ... + * + * this.platform.ready().then(() => { + * this.barkoder.setLicenseKey('YOUR_KEY', true) + * .then(() => { + * this.barkoder.registerWithLicenseKey('your_license_key') + * this.barkoder.initialize('your_license_key') + * }) + * .catch(e => console.log('Error starting Barkoder', e)); + * }); + * + * ``` + */ +@Plugin({ + pluginName: 'Barkoder', + plugin: 'barkoder-cordova', + pluginRef: 'Barkoder', + platforms: ['Android', 'iOS'], +}) +@Injectable() +export class Barkoder extends AwesomeCordovaNativePlugin { + /** + * Initialize the BarkoderView + */ + @Cordova() + initialize(width: number, height: number, x: number, y: number): Promise { + return; + } + + /** + * Register with license key + */ + @Cordova() + registerWithLicenseKey(licenseKey: string): Promise { + return; + } + + // - Setters + @Cordova() + setZoomFactor(zoomFactor: number): Promise { + return; + } + + @Cordova() + setFlashEnabled(enabled: boolean): Promise { + return; + } + + @Cordova() + startCamera(): Promise { + return; + } + + @Cordova() + startScanning(): Promise { + return; + } + + @Cordova() + stopScanning(): Promise { + return; + } + + @Cordova() + pauseScanning(): Promise { + return; + } + + @Cordova() + setLocationLineColor(hexColor: string): Promise { + return; + } + + @Cordova() + setLocationLineWidth(lineWidth: number): Promise { + return; + } + + @Cordova() + setRoiLineColor(hexColor: string): Promise { + return; + } + + @Cordova() + setRoiLineWidth(lineWidth: number): Promise { + return; + } + + @Cordova() + setRoiOverlayBackgroundColor(hexColor: string): Promise { + return; + } + + @Cordova() + setCloseSessionOnResultEnabled(enabled: boolean): Promise { + return; + } + + @Cordova() + setImageResultEnabled(enabled: boolean): Promise { + return; + } + + @Cordova() + setLocationInImageResultEnabled(enabled: boolean): Promise { + return; + } + + @Cordova() + setRegionOfInterest(left: number, top: number, width: number, height: number): Promise { + return; + } + + @Cordova() + setThreadsLimit(threadsLimit: number): Promise { + return; + } + + @Cordova() + setLocationInPreviewEnabled(enabled: boolean): Promise { + return; + } + + @Cordova() + setPinchToZoomEnabled(enabled: boolean): Promise { + return; + } + + @Cordova() + setRegionOfInterestVisible(regionOfInterestVisible: boolean): Promise { + return; + } + + @Cordova() + setBarkoderResolution(resolution: BarkoderResolution): Promise { + return; + } + + @Cordova() + setBeepOnSuccessEnabled(enabled: boolean): Promise { + return; + } + + @Cordova() + setVibrateOnSuccessEnabled(enabled: boolean): Promise { + return; + } + + @Cordova() + showLogMessages(showLogMessages: boolean): Promise { + return; + } + + @Cordova() + setBarcodeTypeLengthRange(type: string, min: number, max: number): Promise { + return; + } + + @Cordova() + setEncodingCharacterSet(characterSet: string): Promise { + return; + } + + @Cordova() + setDecodingSpeed(decodingSpeed: DecodingSpeed): Promise { + return; + } + + @Cordova() + setFormattingType(formattingType: FormattingType): Promise { + return; + } + + @Cordova() + setCode11ChecksumType(checksumType: Code11ChecksumType): Promise { + return; + } + + @Cordova() + setMsiChecksumType(checksumType: MsiChecksumType): Promise { + return; + } + + @Cordova() + setCode39ChecksumType(checksumType: Code39ChecksumType): Promise { + return; + } + + @Cordova() + setBarcodeTypeEnabled(type: BarcodeType, enabled: boolean): Promise { + return; + } + + @Cordova() + setMulticodeCachingEnabled(enabled: boolean): Promise { + return; + } + + @Cordova() + setMulticodeCachingDuration(duration: number): Promise { + return; + } + + @Cordova() + setMaximumResultsCount(resultsCount: number): Promise { + return; + } + + @Cordova() + setBarcodeThumbnailOnResultEnabled(enabled: boolean): Promise { + return; + } + + @Cordova() + setDuplicatesDelayMs(delayMs: number): Promise { + return; + } + + @Cordova() + setThresholdBetweenDuplicatesScans(thresholdBetweenDuplicatesScans: number): Promise { + return; + } + + @Cordova() + setUpcEanDeblurEnabled(enabled: boolean): Promise { + return; + } + + @Cordova() + setMisshaped1DEnabled(enabled: boolean): Promise { + return; + } + + @Cordova() + setEnableVINRestrictions(enableVINRestrictions: boolean): Promise { + return; + } + + @Cordova() + setDataMatrixDpmModeEnabled(enabled: boolean): Promise { + return; + } + + @Cordova() + configureBarkoder(barkoderConfig: BarkoderConfig): Promise { + return; + } + + // - Getters + @Cordova() + isFlashAvailable(): Promise { + return; + } + + @Cordova() + isCloseSessionOnResultEnabled(): Promise { + return; + } + + @Cordova() + isImageResultEnabled(): Promise { + return; + } + + @Cordova() + isLocationInImageResultEnabled(): Promise { + return; + } + + @Cordova() + isLocationInPreviewEnabled(): Promise { + return; + } + + @Cordova() + isPinchToZoomEnabled(): Promise { + return; + } + + @Cordova() + isRegionOfInterestVisible(): Promise { + return; + } + + @Cordova() + isBeepOnSuccessEnabled(): Promise { + return; + } + + @Cordova() + isVibrateOnSuccessEnabled(): Promise { + return; + } + + @Cordova() + getVersion(): Promise { + return; + } + + @Cordova() + getLocationLineColorHex(): Promise { + return; + } + + @Cordova() + getRoiLineColorHex(): Promise { + return; + } + + @Cordova() + getRoiOverlayBackgroundColorHex(): Promise { + return; + } + + @Cordova() + getMaxZoomFactor(): Promise { + return; + } + + @Cordova() + getLocationLineWidth(): Promise { + return; + } + + @Cordova() + getRoiLineWidth(): Promise { + return; + } + + @Cordova() + getRegionOfInterest(): Promise { + return; + } + + @Cordova() + getBarcodeTypeLengthRange(type: number): Promise { + return; + } + + @Cordova() + getMsiChecksumType(): Promise { + return; + } + + @Cordova() + getCode39ChecksumType(): Promise { + return; + } + + @Cordova() + getCode11ChecksumType(): Promise { + return; + } + + @Cordova() + getEncodingCharacterSet(): Promise { + return; + } + + @Cordova() + getDecodingSpeed(): Promise { + return; + } + + @Cordova() + getFormattingType(): Promise { + return; + } + + @Cordova() + getThreadsLimit(): Promise { + return; + } + + @Cordova() + getMaximumResultsCount(): Promise { + return; + } + + @Cordova() + getDuplicatesDelayMs(): Promise { + return; + } + + @Cordova() + isBarcodeTypeEnabled(type: number): Promise { + return; + } + + @Cordova() + getMulticodeCachingEnabled(): Promise { + return; + } + + @Cordova() + getMulticodeCachingDuration(): Promise { + return; + } + + @Cordova() + isUpcEanDeblurEnabled(): Promise { + return; + } + + @Cordova() + isMisshaped1DEnabled(): Promise { + return; + } + + @Cordova() + isBarcodeThumbnailOnResultEnabled(): Promise { + return; + } + + @Cordova() + getThresholdBetweenDuplicatesScans(): Promise { + return; + } + + @Cordova() + isVINRestrictionsEnabled(): Promise { + return; + } + + @Cordova() + getBarkoderResolution(): Promise { + return; + } +} + +export enum DecodingSpeed { + fast, + normal, + slow, +} + +export enum FormattingType { + disabled, + automatic, + gs1, + aamva, +} + +export enum MsiChecksumType { + disabled, + mod10, + mod11, + mod1010, + mod1110, + mod11IBM, + mod1110IBM, +} + +export enum Code39ChecksumType { + disabled, + enabled, +} + +export enum Code11ChecksumType { + disabled, + single, + double, +} + +export enum BarkoderResolution { + normal, + high, +} + +export enum BarcodeType { + aztec, + aztecCompact, + qr, + qrMicro, + code128, + code93, + code39, + codabar, + code11, + msi, + upcA, + upcE, + upcE1, + ean13, + ean8, + pdf417, + pdf417Micro, + datamatrix, + code25, + interleaved25, + itf14, + iata25, + matrix25, + datalogic25, + coop25, + code32, + telepen, + dotcode, +} + +export class BarkoderConfig { + locationLineColor?: string; + locationLineWidth?: number; + roiLineColor?: string; + roiLineWidth?: number; + roiOverlayBackgroundColor?: string; + closeSessionOnResultEnabled?: boolean; + imageResultEnabled?: boolean; + locationInImageResultEnabled?: boolean; + locationInPreviewEnabled?: boolean; + pinchToZoomEnabled?: boolean; + regionOfInterestVisible?: boolean; + barkoderResolution?: BarkoderResolution; + beepOnSuccessEnabled?: boolean; + vibrateOnSuccessEnabled?: boolean; + decoder?: DekoderConfig; + + constructor(config: Partial) { + Object.assign(this, config); + } +} + +export class DekoderConfig { + aztec?: BarcodeConfig; + aztecCompact?: BarcodeConfig; + qr?: BarcodeConfig; + qrMicro?: BarcodeConfig; + code128?: BarcodeConfigWithLength; + code93?: BarcodeConfigWithLength; + code39?: Code39BarcodeConfig; + codabar?: BarcodeConfigWithLength; + code11?: Code11BarcodeConfig; + msi?: MSIBarcodeConfig; + upcA?: BarcodeConfig; + upcE?: BarcodeConfig; + upcE1?: BarcodeConfig; + ean13?: BarcodeConfig; + ean8?: BarcodeConfig; + pdf417?: BarcodeConfig; + pdf417Micro?: BarcodeConfig; + datamatrix?: DatamatrixBarcodeConfig; + code25?: BarcodeConfig; + interleaved25?: BarcodeConfig; + itf14?: BarcodeConfig; + iata25?: BarcodeConfig; + matrix25?: BarcodeConfig; + datalogic25?: BarcodeConfig; + coop25?: BarcodeConfig; + code32?: BarcodeConfig; + telepen?: BarcodeConfig; + dotcode?: BarcodeConfig; + general?: GeneralSettings; + + constructor(config: Partial) { + Object.assign(this, config); + } +} + +export class BarcodeConfig { + enabled?: boolean; + + constructor(config: Partial) { + Object.assign(this, config); + } +} + +export class BarcodeConfigWithLength { + enabled?: boolean; + minLength?: number; + maxLength?: number; + + constructor(config: Partial) { + Object.assign(this, config); + } + + setLengthRange(minLength: number, maxLength: number) { + this.minLength = minLength; + this.maxLength = maxLength; + } +} + +export class MSIBarcodeConfig { + enabled?: boolean; + minLength?: number; + maxLength?: number; + checksum?: MsiChecksumType; + + constructor(config: Partial) { + Object.assign(this, config); + } + + setLengthRange(minLength: number, maxLength: number) { + this.minLength = minLength; + this.maxLength = maxLength; + } +} + +export class Code39BarcodeConfig { + enabled?: boolean; + minLength?: number; + maxLength?: number; + checksum?: Code39ChecksumType; + + constructor(config: Partial) { + Object.assign(this, config); + } + + setLengthRange(minLength: number, maxLength: number) { + this.minLength = minLength; + this.maxLength = maxLength; + } +} + +export class Code11BarcodeConfig { + enabled?: boolean; + minLength?: number; + maxLength?: number; + checksum?: Code11ChecksumType; + + constructor(config: Partial) { + Object.assign(this, config); + } + + setLengthRange(minLength: number, maxLength: number) { + this.minLength = minLength; + this.maxLength = maxLength; + } +} + +export class DatamatrixBarcodeConfig { + enabled?: boolean; + dpmMode?: number; + minLength?: number; + maxLength?: number; + + constructor(config: Partial) { + Object.assign(this, config); + } + + setLengthRange(minLength: number, maxLength: number) { + this.minLength = minLength; + this.maxLength = maxLength; + } +} + +export class GeneralSettings { + threadsLimit?: number; + decodingSpeed?: DecodingSpeed; + roiX?: number; + roiY?: number; + roiWidth?: number; + roiHeight?: number; + formattingType?: FormattingType; + encodingCharacterSet?: string; + maximumResultsCount?: number; + duplicatesDelayMs?: number; + multicodeCachingDuration?: number; + multicodeCachingEnabled?: boolean; + upcEanDeblur?: number; + enableMisshaped1D?: number; + + constructor(config: Partial) { + Object.assign(this, config); + } + + setROI(x: number, y: number, width: number, height: number): void { + this.roiX = x; + this.roiY = y; + this.roiWidth = width; + this.roiHeight = height; + } +}