tillty / flutter_nfc_acs

A Flutter plugin for reading NFC tags using the ACS ACR1255U-J1 reader
Other
2 stars 3 forks source link

Expose TagID #3

Open DennisSchm opened 6 months ago

DennisSchm commented 6 months ago

Hello,

could you consider adding the TagID to the information that is exposed, when receiving card data? I was also quite confused, why the stream returns an object called cards, when it is only one card that I am reading.

Thank you very much for your time and this great project. Greetings.

larssn commented 6 months ago

Thank you, however the plugin could use a refactor. I've gotten a lot better at making plugins over the years. Just haven't found the time.

FlutterNfcAcs.cards is called cards because it will continuously output tag IDs from whatever you present your NFC reader.

I was also quite confused, why the stream returns an object called cards, when it is only one card that I am reading. I'm also confused, which stream are you referring to? 🙂 I don't think there's any stream related to reading cards that return objects.

We use the cards stream to get TagIDs:

final cardSub = FlutterNfcAcs.cards.listen((id) {
   print(id.replaceAll(' ', ''));
});

Does that not suffice?

DennisSchm commented 6 months ago

Thank you for writing this repository in the first place. Im glad to hear you've progressed in your skills. If you ever come around refactoring the project, it will be greatly appreciated, since in my opinion this repo has a lot of potential. One of the reasons for this is, that the ACR seems to be capable of writing as well.

The naming for cards is different from my exceptions, but it makes sense to me. Thank you for the clarification.

I do use ISO14443A compliant RfId Tags and when I scan them they using the example app, the cards stream only returns zeros. When I read the IDs with an Arduino and the PN532 chip, I receive proper preprogrammed IDs. I am using the ACR1255U-J1 model. I figured that the device does not read the ID of card but the stored data on it, which in fact should be empty. Am I mistaken in my assumptions?

larssn commented 5 months ago

I'm by no means an expert in all the different tag types out there, but the types we use, the tagID is returned from the above method.

I consider this repo a minimum viable product for our specific needs, which is why it is kinda barebones.