Skip to content

Commit 2aa73b5

Browse files
stephendwolffdanielsogl
authored andcommitted
feat(nfc): add NFC readerMode (#2777)
* Work on NFC reader-mode * Remove dist files, not needed in plugin development folder * Revert package changes This reverts part of commit 24a893f. * Update index.ts * Correct the flags and return types for the wrapper * Add reader flags. Thanks @sfaizanh
1 parent 99cebcb commit 2aa73b5

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/@ionic-native/plugins/nfc/index.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ export interface NdefTag {
7676
*/
7777
@Injectable()
7878
export class NFC extends IonicNativePlugin {
79+
FLAG_READER = {
80+
NFC_A: 0,
81+
NFC_B: 0x2,
82+
NFC_F: 0x4,
83+
NFC_V: 0x8,
84+
NFC_BARCODE: 0x10,
85+
SKIP_NDEF_CHECK: 0x80,
86+
NO_PLATFORM_SOUNDS: 0x100,
87+
};
7988
/**
8089
* Starts the NFCNDEFReaderSession allowing iOS to scan NFC tags.
8190
* @param onSuccess
@@ -286,6 +295,22 @@ export class NFC extends IonicNativePlugin {
286295
bytesToHexString(bytes: number[]): string {
287296
return;
288297
}
298+
299+
/**
300+
* Read NFC tags sending the tag data to the success callback.
301+
*/
302+
@Cordova({
303+
observable: true,
304+
successIndex: 1,
305+
errorIndex: 4,
306+
clearFunction: 'disableReaderMode',
307+
clearWithArgs: true
308+
})
309+
readerMode(
310+
flags: number,
311+
readCallback?: Function,
312+
errorCallback?: Function
313+
): void { return; }
289314
}
290315
/**
291316
* @hidden

0 commit comments

Comments
 (0)