1 | import { Observable } from 'rxjs/Observable';
|
2 | /**
|
3 | * @name NFC
|
4 | * @description
|
5 | * The NFC plugin allows you to read and write NFC tags. You can also beam to, and receive from, other NFC enabled devices.
|
6 | *
|
7 | * Use to
|
8 | * - read data from NFC tags
|
9 | * - write data to NFC tags
|
10 | * - send data to other NFC enabled devices
|
11 | * - receive data from NFC devices
|
12 | *
|
13 | * This plugin uses NDEF (NFC Data Exchange Format) for maximum compatibilty between NFC devices, tag types, and operating systems.
|
14 | *
|
15 | * @usage
|
16 | * ```
|
17 | * import {NFC, Ndef} from 'ionic-native';
|
18 | *
|
19 | * let message = Ndef.textRecord('Hello world');
|
20 | * NFC.share([message]).then(onSuccess).catch(onError);
|
21 | *
|
22 | * ```
|
23 | */
|
24 | export declare class NFC {
|
25 | /**
|
26 | * Registers an event listener for any NDEF tag.
|
27 | * @param onSuccess
|
28 | * @param onFailure
|
29 | * @returns {Observable<any>}
|
30 | */
|
31 | static addNdefListener(onSuccess?: Function, onFailure?: Function): Observable<any>;
|
32 | /**
|
33 | * Registers an event listener for tags matching any tag type.
|
34 | * @param onSuccess
|
35 | * @param onFailure
|
36 | * @returns {Observable<any>}
|
37 | */
|
38 | static addTagDiscoveredListener(onSuccess?: Function, onFailure?: Function): Observable<any>;
|
39 | /**
|
40 | * Registers an event listener for NDEF tags matching a specified MIME type.
|
41 | * @param mimeType
|
42 | * @param onSuccess
|
43 | * @param onFailure
|
44 | * @returns {Observable<any>}
|
45 | */
|
46 | static addMimeTypeListener(mimeType: string, onSuccess?: Function, onFailure?: Function): Observable<any>;
|
47 | /**
|
48 | * Registers an event listener for formatable NDEF tags.
|
49 | * @param onSuccess
|
50 | * @param onFailure
|
51 | * @returns {Observable<any>}
|
52 | */
|
53 | static addNdefFormatableListener(onSuccess?: Function, onFailure?: Function): Observable<any>;
|
54 | /**
|
55 | * Qrites an NdefMessage to a NFC tag.
|
56 | * @param message {any[]}
|
57 | * @returns {Promise<any>}
|
58 | */
|
59 | static write(message: any[]): Promise<any>;
|
60 | /**
|
61 | * Makes a NFC tag read only. **Warning** this is permanent.
|
62 | * @returns {Promise<any>}
|
63 | */
|
64 | static makeReadyOnly(): Promise<any>;
|
65 | /**
|
66 | * Shares an NDEF Message via peer-to-peer.
|
67 | * @param message An array of NDEF Records.
|
68 | * @returns {Promise<any>}
|
69 | */
|
70 | static share(message: any[]): Promise<any>;
|
71 | /**
|
72 | * Stop sharing NDEF data via peer-to-peer.
|
73 | * @returns {Promise<any>}
|
74 | */
|
75 | static unshare(): Promise<any>;
|
76 | /**
|
77 | * Erase a NDEF tag
|
78 | */
|
79 | static erase(): Promise<any>;
|
80 | /**
|
81 | * Send a file to another device via NFC handover.
|
82 | * @param uris A URI as a String, or an array of URIs.
|
83 | * @returns {Promise<any>}
|
84 | */
|
85 | static handover(uris: string[]): Promise<any>;
|
86 | /**
|
87 | * Stop sharing NDEF data via NFC handover.
|
88 | * @returns {Promise<any>}
|
89 | */
|
90 | static stopHandover(): Promise<any>;
|
91 | /**
|
92 | * Show the NFC settings on the device.
|
93 | * @returns {Promise<any>}
|
94 | */
|
95 | static showSettings(): Promise<any>;
|
96 | /**
|
97 | * Check if NFC is available and enabled on this device.
|
98 | * @returns {Promise<any>}
|
99 | */
|
100 | static enabled(): Promise<any>;
|
101 | /**
|
102 | * Convert bytes to string
|
103 | * @param bytes {number[]}
|
104 | * @returns {string}
|
105 | */
|
106 | static bytesToString(bytes: number[]): string;
|
107 | /**
|
108 | * Convert string to bytes
|
109 | * @param str {string}
|
110 | * @returns {number[]}
|
111 | */
|
112 | static stringToBytes(str: string): number[];
|
113 | /**
|
114 | * Convert bytes to hex string
|
115 | * @param bytes {number[]}
|
116 | * @returns {string}
|
117 | */
|
118 | static bytesToHexString(bytes: number[]): string;
|
119 | }
|
120 | /**
|
121 | * @private
|
122 | */
|
123 | export declare class Ndef {
|
124 | /**
|
125 | * @private
|
126 | */
|
127 | static pluginName: string;
|
128 | /**
|
129 | * @private
|
130 | */
|
131 | static plugin: string;
|
132 | /**
|
133 | * @private
|
134 | */
|
135 | static pluginRef: string;
|
136 | static uriRecord(uri: string): any;
|
137 | static textRecord(text: string): any;
|
138 | static mimeMediaRecord(mimeType: string, payload: string): any;
|
139 | static androidApplicationRecord(packageName: string): any;
|
140 | }
|