• Stars
    star
    127
  • Rank 282,790 (Top 6 %)
  • Language
    C#
  • License
    MIT License
  • Created almost 9 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple library that provides to use rfid card readers.

NfcReader

A simple library that provides to use rfid card readers.

Usage

Basic usage of the library are provided. I recommend you using events which are very helpful.

Connection

//Initializing
NFCReader NFC = new NFCReader();

//Connecting
NFC.Connect(); // public bool Connect()

//Disconnecting
NFC.Disconnect(); // public void Disconnect()
//Inserted Event 
NFC.CardInserted += new NFCReader.CardEventHandler(...Some function);

//Ejected Event
NFC.CardEjected += new NFCReader.CardEventHandler(... Some function);

//Enabling Event Watching
NFC.Watch(); //public void Watch()

Read, Write Authorize

//Authorizing(which is done automatically by the read and write functions)
NFC.AuthBlock("2"); // private bool AuthBlock(String block)

//Reading
NFC.ReadBlock("2"); //public byte[] ReadBlock(String Block)

//Writing   
NFC.WriteBlock("Some string data that will not exceed block limit", "2"); //public bool WriteBlock(String Text, String Block)

ReaderList, CardUID

//Card UID
NFC.GetCardUID();

//Available Readers 
NFC.GetReadersList(); //public List<string> GetReadersList()

Example Inserted and Ejected Event Usage

public void Card_Inserted()
{
  try
  {
    if (NFC.Connect())
    {
        //Do stuff like NFC.GetCardUID(); ...
    }
    else
    {
        //Give error message about connection...
    }
  }
  catch (Exception ex)
  {
    this.SetStatusText("Hata: Bir Sorun Oluştu Tekrar Deneyiniz",false);
  }
}
public void Card_Ejected()
{
   //Do stuff...
   NFC.Disconnect();
}