mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-05-10 11:53:27 +02:00
More NFCService
This commit is contained in:
parent
6e436b5c8c
commit
446dd850a3
@ -1,5 +1,7 @@
|
|||||||
using Borepin.Service.NFC;
|
using Borepin.Service.NFC;
|
||||||
|
using NFC;
|
||||||
using NFC.Interfaces;
|
using NFC.Interfaces;
|
||||||
|
using NFC_PCSC;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -10,17 +12,69 @@ namespace Borepin.UWP.Services
|
|||||||
{
|
{
|
||||||
public class NFCService : INFCService
|
public class NFCService : INFCService
|
||||||
{
|
{
|
||||||
public ICard GetCard()
|
#region Private Members
|
||||||
|
IHardware _Hardware;
|
||||||
|
IReader _Reader;
|
||||||
|
ICard _Card;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
public NFCService(IHardware hardware = null)
|
||||||
|
{
|
||||||
|
if(hardware == null)
|
||||||
|
{
|
||||||
|
_Hardware = new Hardware_PCSC();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_Hardware = hardware;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
public bool IsAvailable
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool IsEnabled
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsConnected
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _Reader != null && _Card != null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
public IList<string> GetReaderIDs()
|
||||||
|
{
|
||||||
|
return new List<string>(_Hardware.GetReaders());
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public void Connect(string readerID)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IHardware GetHardware()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IReader GetReader()
|
public APDUResponse Transmit(APDUCommand command)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using NFC.Interfaces;
|
using NFC;
|
||||||
|
using NFC.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -10,8 +11,40 @@ namespace Borepin.Service.NFC
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface INFCService
|
public interface INFCService
|
||||||
{
|
{
|
||||||
IHardware GetHardware();
|
/// <summary>
|
||||||
IReader GetReader();
|
/// Indicates if NFC Hardware is available
|
||||||
ICard GetCard();
|
/// </summary>
|
||||||
|
bool IsAvailable { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates if NFC Hardware is enabled
|
||||||
|
/// </summary>
|
||||||
|
bool IsEnabled { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates if NFC Card is connected
|
||||||
|
/// </summary>
|
||||||
|
bool IsConnected { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a list of availible NFC ReaderIDs
|
||||||
|
/// </summary>
|
||||||
|
IList<string> GetReaderIDs();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Connect with ReaderID to NFC Card
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="readerID">ReaderID from GetReaderIDs</param>
|
||||||
|
void Connect(string readerID);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disconnects Reader from NFC Card
|
||||||
|
/// </summary>
|
||||||
|
void Disconnect();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Transmit APDUCommand to Card if connected
|
||||||
|
/// </summary>
|
||||||
|
APDUResponse Transmit(APDUCommand command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
external/NFC
vendored
2
external/NFC
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 4420dbf1b1e820d94d6adaa2b65a851ac582be8f
|
Subproject commit 327472bea06316a6d439b6b0224ffedd2c6f1bbc
|
Loading…
x
Reference in New Issue
Block a user