mirror of
https://gitlab.com/fabinfra/fabaccess/nfc.git
synced 2025-03-12 23:01:45 +01:00
33 lines
695 B
C#
33 lines
695 B
C#
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);
|
|
}
|
|
}
|
|
}
|