episage / sharp-nfc

.NET wrapper for libnfc project
15 stars 13 forks source link

Is there any example how to use? #6

Closed JONIDi12P closed 5 years ago

JONIDi12P commented 7 years ago

Is there example how to connect to device . Then read,and write? Thanks

episage commented 7 years ago

I don't provide any examples. I'm not into NFC business anymore. Please use IntelliSense autocomplete. It should be stratightforward to use from what I remember.

episage commented 7 years ago

There are just 2 classess: NFCContext and NFCDevice. Please have a look at them. They are short and concise.

JONIDi12P commented 7 years ago

@episage yeh I didnt find the func of read from nfc

episage commented 7 years ago

You need to public virtual NFCDevice OpenDevice(string name) first, then public int Pool(List<nfc_modulation> modulation, byte poolCount, byte poolingInterval, out nfc_target nfc_target) Result is in out nfc_target nfc_target AFAIR

episage commented 7 years ago

Parameters depend on what card u use

JONIDi12P commented 7 years ago

@episage what do you

Parameters depend on what card u use

can you explain please?

episage commented 7 years ago

@JONIDi12P I can't because I don't remember. I used to read these type of cards: https://www.mifare.net/en/products/chip-card-ics/mifare-desfire/ With this reader: ACR122U via USB

but there are plenty of other readers: https://www.ebay.co.uk/sch/sis.html?_itemId=111340077498&_nkw=RFID+Proximity+13+56Mhz+Mifare+ISO14443A+Entry+Access+Card+Tag+reader+USB&_trksid=p2047675.m4099.l9146

I don't have the source code so I can't recall what params I used.

I would recommend you to ask on libnfc forum because I don't have this specific knowledge.

episage commented 7 years ago

Actually, I used my second project - https://github.com/episage/SharpFreeFare to read the card. It's specific to MiFare. SharpNFC is generic. SharpFreeFare builds on top of SharpNFC.

JONIDi12P commented 7 years ago

@episage what do you mean SharpNfc is generic? this not work on card ? SharpFreeFare work only on MiFare card... what i if want another card? SharpNfc WILL not work? SharoNfc is only wrapper, it need to support on what libnfc support, not? thanks

episage commented 7 years ago

@JONIDi12P SharpNFC can be used to read anything and write anything. SharpFreeFare is a convenience library for MiFare cards. It makes reading cards less complicated.

I actually don't know how to read raw data using SharpNFC only.

JONIDi12P commented 7 years ago

@episage how do you know that SharpNfc can write and read anything if you don't use with this ? i want to understand witch card and reader this lib support please. how can i find out who wrote this code and ask him? thanks!

georgeslegros commented 3 years ago

I know this issue is kind of old but I can't get it to work. It seems like I can go all the way to the OpenDevice (which returns a pointer so I'm assuming that it is fine) but then the Pool Method never returns anything.

I am using an NfcCard that returns the following when using nfc-poll:

$ nfc-poll nfc-poll uses libnfc 1.8.0 NFC reader: pn71xx-device opened NFC device will poll during 36000 ms (20 pollings of 300 ms for 6 modulations) ISO/IEC 14443A (106 kbps) target: ATQA (SENS_RES): 00 00 UID (NFCID1): 04 05 29 6a 64 34 81 SAK (SEL_RES): 20 ATS: 75 77 81 02 00 Waiting for card removing...nfc_initiator_target_is_present: Success done.

So I know that the tag is working and that the lib is properly configured. Did you find a way to get this working?

For information, I had to install the lib using a specific driver (pn71xx) to be compatible with my device. Thanks.