1 | export interface BarcodeScannerOptions {
|
2 | /**
|
3 | * Prefer front camera. Supported on iOS and Android.
|
4 | */
|
5 | preferFrontCamera?: boolean;
|
6 | /**
|
7 | * Show flip camera button. Supported on iOS and Android.
|
8 | */
|
9 | showFlipCameraButton?: boolean;
|
10 | /**
|
11 | * Show torch button. Supported on iOS and Android.
|
12 | */
|
13 | showTorchButton?: boolean;
|
14 | /**
|
15 | * Disable animations. Supported on iOS only.
|
16 | */
|
17 | disableAnimations?: boolean;
|
18 | /**
|
19 | * Disable success beep. Supported on iOS only.
|
20 | */
|
21 | disableSuccessBeep?: boolean;
|
22 | /**
|
23 | * Prompt text. Supported on Android only.
|
24 | */
|
25 | prompt?: string;
|
26 | /**
|
27 | * Formats separated by commas. Defaults to all formats except `PDF_417` and `RSS_EXPANDED`.
|
28 | */
|
29 | formats?: string;
|
30 | /**
|
31 | * 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.
|
32 | */
|
33 | orientation?: string;
|
34 | /**
|
35 | * Launch with the torch switched on (if available). Supported on Android only.
|
36 | */
|
37 | torchOn?: boolean;
|
38 | /**
|
39 | * Display scanned text for X ms. 0 suppresses it entirely, default 1500. Supported on Android only.
|
40 | */
|
41 | resultDisplayDuration?: number;
|
42 | }
|
43 | /**
|
44 | * @name Barcode Scanner
|
45 | * @description
|
46 | * The Barcode Scanner Plugin opens a camera view and automatically scans a barcode, returning the data back to you.
|
47 | *
|
48 | * Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BarcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner).
|
49 | *
|
50 | * @usage
|
51 | * ```typescript
|
52 | * import { BarcodeScanner } from 'ionic-native';
|
53 | *
|
54 | *
|
55 | * BarcodeScanner.scan().then((barcodeData) => {
|
56 | * // Success! Barcode data is here
|
57 | * }, (err) => {
|
58 | * // An error occurred
|
59 | * });
|
60 | * ```
|
61 | * @interfaces
|
62 | * BarcodeScannerOptions
|
63 | */
|
64 | export declare class BarcodeScanner {
|
65 | /**
|
66 | * @private
|
67 | */
|
68 | static Encode: any;
|
69 | /**
|
70 | * Open the barcode scanner.
|
71 | * @param options {BarcodeScannerOptions} Optional options to pass to the scanner
|
72 | * @returns {Promise<any>} Returns a Promise that resolves with scanner data, or rejects with an error.
|
73 | */
|
74 | static scan(options?: BarcodeScannerOptions): Promise<any>;
|
75 | /**
|
76 | * Encodes data into a barcode.
|
77 | * NOTE: not well supported on Android
|
78 | * @param type {string} Type of encoding
|
79 | * @param data {any} Data to encode
|
80 | * @returns {Promise<any>}
|
81 | */
|
82 | static encode(type: string, data: any): Promise<any>;
|
83 | }
|