From c44fb75adce8def586acef5793428b56e177780d Mon Sep 17 00:00:00 2001 From: Vlado Velichkovski Date: Tue, 27 Dec 2016 13:23:05 +0100 Subject: [PATCH] feat(nfc): add new functions (#853) Added: - bytesToHexString - stringToBytes - bytesToString Fixed: - addTagDiscoveredListener --- src/plugins/nfc.ts | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/plugins/nfc.ts b/src/plugins/nfc.ts index 7b04238565..b27fd0cddb 100644 --- a/src/plugins/nfc.ts +++ b/src/plugins/nfc.ts @@ -47,19 +47,18 @@ export class NFC { /** * Registers an event listener for tags matching any tag type. - * @param mimeType * @param onSuccess * @param onFailure * @returns {Observable} */ @Cordova({ observable: true, - successIndex: 1, - errorIndex: 4, + successIndex: 0, + errorIndex: 3, clearFunction: 'removeTagDiscoveredListener', clearWithArgs: true }) - static addTagDiscoveredListener(mimeType: string, onSuccess?: Function, onFailure?: Function): Observable {return; } + static addTagDiscoveredListener(onSuccess?: Function, onFailure?: Function): Observable {return; } /** * Registers an event listener for NDEF tags matching a specified MIME type. @@ -152,6 +151,27 @@ export class NFC { */ @Cordova() static enabled(): Promise {return; } + /** + * Convert bytes to string + * @param bytes {number[]} + * @returns {string} + */ + @Cordova({ sync: true }) + static bytesToString(bytes: number[]): string {return; } + /** + * Convert string to bytes + * @param str {string} + * @returns {string} + */ + @Cordova({ sync: true }) + static stringToBytes(str: string): number[] {return; }; + /** + * Convert bytes to hex string + * @param bytes {number[]} + * @returns {string} + */ + @Cordova({ sync: true }) + static bytesToHexString(bytes: number[]): string {return; }; } /**