1 | import { IonicNativePlugin } from '@ionic-native/core';
|
2 | export interface BarcodeScannerOptions {
|
3 | /**
|
4 | * Prefer front camera. Supported on iOS and Android.
|
5 | */
|
6 | preferFrontCamera?: boolean;
|
7 | /**
|
8 | * Show flip camera button. Supported on iOS and Android.
|
9 | */
|
10 | showFlipCameraButton?: boolean;
|
11 | /**
|
12 | * Show torch button. Supported on iOS and Android.
|
13 | */
|
14 | showTorchButton?: boolean;
|
15 | /**
|
16 | * Disable animations. Supported on iOS only.
|
17 | */
|
18 | disableAnimations?: boolean;
|
19 | /**
|
20 | * Disable success beep. Supported on iOS only.
|
21 | */
|
22 | disableSuccessBeep?: boolean;
|
23 | /**
|
24 | * Prompt text. Supported on Android only.
|
25 | */
|
26 | prompt?: string;
|
27 | /**
|
28 | * Formats separated by commas. Defaults to all formats except `PDF_417` and `RSS_EXPANDED`.
|
29 | */
|
30 | formats?: string;
|
31 | /**
|
32 | * Orientation. Supported on Android only. Can be set to `portrait` or `landscape`. Defaults to none so the user can rotate the phone and pick an orientation.
|
33 | */
|
34 | orientation?: string;
|
35 | /**
|
36 | * Launch with the torch switched on (if available). Supported on Android only.
|
37 | */
|
38 | torchOn?: boolean;
|
39 | /**
|
40 | * Save scan history. Defaults to `false`. Supported on Android only.
|
41 | */
|
42 | saveHistory?: boolean;
|
43 | /**
|
44 | * Display scanned text for X ms. 0 suppresses it entirely, default 1500. Supported on Android only.
|
45 | */
|
46 | resultDisplayDuration?: number;
|
47 | }
|
48 | export interface BarcodeScanResult {
|
49 | format: 'QR_CODE' | 'DATA_MATRIX' | 'UPC_E' | 'UPC_A' | 'EAN_8' | 'EAN_13' | 'CODE_128' | 'CODE_39' | 'CODE_93' | 'CODABAR' | 'ITF' | 'RSS14' | 'RSS_EXPANDED' | 'PDF_417' | 'AZTEC' | 'MSI';
|
50 | cancelled: boolean;
|
51 | text: string;
|
52 | }
|
53 | /**
|
54 | * @name Barcode Scanner
|
55 | * @description
|
56 | * The Barcode Scanner Plugin opens a camera view and automatically scans a barcode, returning the data back to you.
|
57 | *
|
58 | * Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BarcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner).
|
59 | *
|
60 | * @usage
|
61 | * ```typescript
|
62 | * import { BarcodeScanner } from '@ionic-native/barcode-scanner/ngx';
|
63 | *
|
64 | * constructor(private barcodeScanner: BarcodeScanner) { }
|
65 | *
|
66 | * ...
|
67 | *
|
68 | *
|
69 | * this.barcodeScanner.scan().then(barcodeData => {
|
70 | * console.log('Barcode data', barcodeData);
|
71 | * }).catch(err => {
|
72 | * console.log('Error', err);
|
73 | * });
|
74 | * ```
|
75 | * @interfaces
|
76 | * BarcodeScannerOptions
|
77 | * BarcodeScanResult
|
78 | */
|
79 | export declare class BarcodeScannerOriginal extends IonicNativePlugin {
|
80 | Encode: {
|
81 | TEXT_TYPE: string;
|
82 | EMAIL_TYPE: string;
|
83 | PHONE_TYPE: string;
|
84 | SMS_TYPE: string;
|
85 | };
|
86 | /**
|
87 | * Open the barcode scanner.
|
88 | * @param {BarcodeScannerOptions} [options] Optional options to pass to the scanner
|
89 | * @returns {Promise<any>} Returns a Promise that resolves with scanner data, or rejects with an error.
|
90 | */
|
91 | scan(options?: BarcodeScannerOptions): Promise<BarcodeScanResult>;
|
92 | /**
|
93 | * Encodes data into a barcode.
|
94 | * NOTE: not well supported on Android
|
95 | * @param {string} type Type of encoding
|
96 | * @param {any} data Data to encode
|
97 | * @returns {Promise<any>}
|
98 | */
|
99 | encode(type: string, data: any): Promise<any>;
|
100 | }
|
101 |
|
102 | export declare const BarcodeScanner: BarcodeScannerOriginal; |
\ | No newline at end of file |