From 2aa73b5546a53825b8a9daf4cd694c893895959f Mon Sep 17 00:00:00 2001 From: Stephen Wolff Date: Wed, 17 Oct 2018 18:52:52 +0100 Subject: [PATCH] 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 24a893fdcf6c445be0cd97a0d6e4645a4b9f2bb8. * Update index.ts * Correct the flags and return types for the wrapper * Add reader flags. Thanks @sfaizanh --- src/@ionic-native/plugins/nfc/index.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/@ionic-native/plugins/nfc/index.ts b/src/@ionic-native/plugins/nfc/index.ts index e5532425b..f2ac36137 100644 --- a/src/@ionic-native/plugins/nfc/index.ts +++ b/src/@ionic-native/plugins/nfc/index.ts @@ -76,6 +76,15 @@ export interface NdefTag { */ @Injectable() export class NFC extends IonicNativePlugin { + FLAG_READER = { + NFC_A: 0, + NFC_B: 0x2, + NFC_F: 0x4, + NFC_V: 0x8, + NFC_BARCODE: 0x10, + SKIP_NDEF_CHECK: 0x80, + NO_PLATFORM_SOUNDS: 0x100, + }; /** * Starts the NFCNDEFReaderSession allowing iOS to scan NFC tags. * @param onSuccess @@ -286,6 +295,22 @@ export class NFC extends IonicNativePlugin { bytesToHexString(bytes: number[]): string { return; } + + /** + * Read NFC tags sending the tag data to the success callback. + */ + @Cordova({ + observable: true, + successIndex: 1, + errorIndex: 4, + clearFunction: 'disableReaderMode', + clearWithArgs: true + }) + readerMode( + flags: number, + readCallback?: Function, + errorCallback?: Function + ): void { return; } } /** * @hidden