nfc-pcsc icon indicating copy to clipboard operation
nfc-pcsc copied to clipboard

Empty Data

Open cfontana0 opened this issue 2 years ago • 0 comments

Hey folks! I'm trying to use the HCE feature on Android to transmit data from the phone to an ACR122 reader. I was able to read the sent information from the Android phone with another phone, so, that means that it's transmitting correctly. However, when I try to read the information using the ACR122 reader, I receive this as a data: {"type":"Buffer","data":[]}.

Any idea?

I'm running the following code:

const { NFC } = require('nfc-pcsc');
const nfc = new NFC(); // optionally you can pass logger

nfc.on('reader', reader => {
	console.log(`${reader.reader.name}  device attached`);
	reader.aid = 'D2760000850101'; // I got this from the app

	reader.on('card', card => {
		console.log(`${reader.reader.name}  card detected`, card);
		console.log("card.data: ", JSON.stringify(card.data));
	});

	reader.on('error', err => {
		console.log(`${reader.reader.name}  an error occurred`, err);
	});

	reader.on('end', () => {
		console.log(`${reader.reader.name}  device removed`);
	});

	reader.on('status', async status => {
		console.log('status ', status)
	});
});

nfc.on('error', err => {
	console.log('an error occurred', err);
});

cfontana0 avatar Nov 16 '22 14:11 cfontana0