mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-06-11 02:53:23 +02:00
Imported NFCService
This commit is contained in:
@ -94,10 +94,6 @@
|
||||
<None Include="Properties\AndroidManifest.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\external\NFC\NFC\NFC.csproj">
|
||||
<Project>{D53A98E8-48B5-4DCE-A98E-4623EE746E16}</Project>
|
||||
<Name>NFC</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\FabAccessAPI\FabAccessAPI.csproj">
|
||||
<Project>{3251FCE9-FEA3-4662-8BEB-636BE6732D48}</Project>
|
||||
<Name>FabAccessAPI</Name>
|
||||
|
@ -100,7 +100,6 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\APIService.cs" />
|
||||
<Compile Include="Services\BrowserService.cs" />
|
||||
<Compile Include="Services\NFCService.cs" />
|
||||
<Compile Include="Services\PreferenceStorageService.cs" />
|
||||
<Compile Include="Services\SecretStorageService.cs" />
|
||||
<Compile Include="Services\VersioningService.cs" />
|
||||
@ -187,12 +186,12 @@
|
||||
<PackageReference Include="Xamarin.Essentials" Version="1.7.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\external\capnproto-dotnetcore\Capnp.Net.Runtime\Capnp.Net.Runtime.csproj">
|
||||
<Project>{c587aac3-50a7-4871-a50d-7880b6f24ef6}</Project>
|
||||
<Name>Capnp.Net.Runtime</Name>
|
||||
<ProjectReference Include="..\..\external\NFC\NFC.PCSC\NFC.PCSC.csproj">
|
||||
<Project>{6e2927dd-791f-48fa-96e1-696611fb38eb}</Project>
|
||||
<Name>NFC.PCSC</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\external\NFC\NFC\NFC.csproj">
|
||||
<Project>{D53A98E8-48B5-4DCE-A98E-4623EE746E16}</Project>
|
||||
<Project>{ac068302-655b-46b8-bc8a-971a3d685437}</Project>
|
||||
<Name>NFC</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\FabAccessAPI\FabAccessAPI.csproj">
|
||||
|
@ -54,6 +54,6 @@
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient" />
|
||||
<Capability Name="privateNetworkClientServer"/>
|
||||
<Capability Name="allJoyn"/>
|
||||
<DeviceCapability Name="pointOfService"/>
|
||||
</Capabilities>
|
||||
</Package>
|
@ -5,7 +5,8 @@ using Borepin.Service.Storage;
|
||||
using Borepin.Service.Versioning;
|
||||
using Borepin.Service;
|
||||
using Borepin.Service.Browser;
|
||||
using Borepin.Service.NFC;
|
||||
using NFC.PCSC;
|
||||
using NFC.Interfaces;
|
||||
|
||||
namespace Borepin.UWP
|
||||
{
|
||||
|
@ -1,82 +0,0 @@
|
||||
using Borepin.Service.NFC;
|
||||
using NFC;
|
||||
using NFC.Interfaces;
|
||||
using NFC_PCSC;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Borepin.UWP.Services
|
||||
{
|
||||
public class NFCService : INFCService
|
||||
{
|
||||
#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();
|
||||
}
|
||||
|
||||
public void Disconnect()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public APDUResponse Transmit(APDUCommand command)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -195,10 +195,6 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\external\NFC\NFC\NFC.csproj">
|
||||
<Project>{D53A98E8-48B5-4DCE-A98E-4623EE746E16}</Project>
|
||||
<Name>NFC</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\FabAccessAPI\FabAccessAPI.csproj">
|
||||
<Project>{3251FCE9-FEA3-4662-8BEB-636BE6732D48}</Project>
|
||||
<Name>FabAccessAPI</Name>
|
||||
|
@ -159,7 +159,6 @@
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\external\NFC\NFC\NFC.csproj" />
|
||||
<ProjectReference Include="..\..\FabAccessAPI\FabAccessAPI.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -1,50 +0,0 @@
|
||||
using NFC;
|
||||
using NFC.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Borepin.Service.NFC
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to provide hardware specific NFC Interfaces
|
||||
/// </summary>
|
||||
public interface INFCService
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates if NFC Hardware is available
|
||||
/// </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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user