Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nfc): add NFC readerMode #2777

Merged
merged 8 commits into from
Oct 17, 2018
Merged
25 changes: 25 additions & 0 deletions src/@ionic-native/plugins/nfc/index.ts
Original file line number Diff line number Diff line change
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