libs.nfc/NFC_PCSC/Hardware_PCSC.cs

35 lines
728 B
C#
Raw Normal View History

2021-03-30 23:27:12 +02:00
using NFC.Interfaces;
using PCSC;
namespace NFC_PCSC
{
public class Hardware_PCSC : IHardware
{
public string[] GetReaders()
{
var contextFactory = ContextFactory.Instance;
using (var context = contextFactory.Establish(SCardScope.System))
{
return context.GetReaders();
}
}
public bool IsAvailable()
{
if(GetReaders().Length == 0)
{
return false;
}
else
{
return true;
}
}
public IReader OpenReader(string readerID)
{
return new Reader_PCSC(readerID);
}
}
}