Skip to content

Commit

Permalink
feat(nfc): add NFC readerMode (#2777)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
stephendwolff authored and danielsogl committed Oct 17, 2018
1 parent 99cebcb commit 2aa73b5
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/@ionic-native/plugins/nfc/index.ts
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2aa73b5

Please sign in to comment.