mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-06-11 11:03:23 +02:00
Added: NFC csproj
This commit is contained in:
76
NFC/IReader.cs
Normal file
76
NFC/IReader.cs
Normal file
@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace NFC
|
||||
{
|
||||
/// <summary>
|
||||
/// Abstract representation of the platform specific NFC Hardware.
|
||||
/// </summary>
|
||||
public interface IHardware
|
||||
{
|
||||
/// <summary>
|
||||
/// Check if the device has nfc support.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if the device supports NFC.</returns>
|
||||
bool IsAvailable();
|
||||
|
||||
/// <returns>Returns all available readers.</returns>
|
||||
String[] GetReader();
|
||||
|
||||
/// <summary>
|
||||
/// Create a new reader instance from the specified id.
|
||||
/// </summary>
|
||||
/// <returns>Returns the spatform specific reader that corresponds to the id.</returns>
|
||||
/// <exception cref="ArgumentException">Invalid reader id.</exception>
|
||||
IReader OpenReader(String readerID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Abstraction of a platform-specifc reader that can communicate with NFC cards.
|
||||
/// </summary>
|
||||
public interface IReader
|
||||
{
|
||||
/// <summary>
|
||||
/// Event that will be called when a new tag was discovered.
|
||||
/// </summary>
|
||||
event EventHandler CardDiscovered;
|
||||
|
||||
/// <summary>
|
||||
/// Event that will be called when a tag that is in use gets disconnected.
|
||||
/// </summary>
|
||||
event EventHandler CardLost;
|
||||
|
||||
void start();
|
||||
|
||||
void stop();
|
||||
}
|
||||
|
||||
public interface ICard
|
||||
{
|
||||
/// <summary>
|
||||
/// Connect to Smartcard
|
||||
/// </summary>
|
||||
void Connect();
|
||||
|
||||
/// <summary>
|
||||
/// Disconnect from Smartcard
|
||||
/// </summary>
|
||||
void Disconnect();
|
||||
|
||||
/// <summary>
|
||||
/// Transmit APDU Command to Smartcard
|
||||
/// </summary>
|
||||
/// <param name="apdu_cmd">Application Protocol Data Unit Command - ISO 7816</param>
|
||||
/// <returns>Application Protocol Data Unit Response - ISO 7816</returns>
|
||||
byte[] Transmit(byte[] apdu_cmd);
|
||||
}
|
||||
|
||||
public class ReaderUnavailableException : Exception { }
|
||||
|
||||
public class CardUnavailableException : Exception { }
|
||||
|
||||
public class APDUException : Exception {
|
||||
public readonly byte ResponseCode;
|
||||
}
|
||||
}
|
7
NFC/NFC.csproj
Normal file
7
NFC/NFC.csproj
Normal file
@ -0,0 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
Reference in New Issue
Block a user