mirror of
https://gitlab.com/fabinfra/fabaccess/nfc.git
synced 2025-03-13 07:11:46 +01:00
35 lines
728 B
C#
35 lines
728 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);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|