Added: NFC csproj

This commit is contained in:
TheJoKlLa 2020-09-15 10:47:46 +02:00
parent 8366ea0f64
commit 2034c08d33
3 changed files with 110 additions and 1 deletions

View File

@ -9,12 +9,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Borepin.Android", "Borepin\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Borepin.iOS", "Borepin\Borepin.iOS\Borepin.iOS.csproj", "{9985ED2B-0642-4DAC-98C3-F546196A1E36}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Borepin", "Borepin\Borepin\Borepin.csproj", "{F93856BD-0C8D-4469-A8DB-6E513002BFD7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Borepin", "Borepin\Borepin\Borepin.csproj", "{F93856BD-0C8D-4469-A8DB-6E513002BFD7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Borepin.GTK", "Borepin\Borepin.GTK\Borepin.GTK.csproj", "{61D956D2-5819-4736-BBD8-AD8208DE6A62}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Borepin.macOS", "Borepin\Borepin.macOS\Borepin.macOS.csproj", "{3EC23FE7-395E-4BBC-B56B-9455354BDA34}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NFC", "NFC\NFC.csproj", "{72DAC306-D4B2-4DBF-9C32-317203FD5D61}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -223,6 +225,30 @@ Global
{3EC23FE7-395E-4BBC-B56B-9455354BDA34}.Release|x64.Build.0 = Release|Any CPU
{3EC23FE7-395E-4BBC-B56B-9455354BDA34}.Release|x86.ActiveCfg = Release|Any CPU
{3EC23FE7-395E-4BBC-B56B-9455354BDA34}.Release|x86.Build.0 = Release|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Debug|ARM.ActiveCfg = Debug|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Debug|ARM.Build.0 = Debug|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Debug|iPhone.Build.0 = Debug|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Debug|x64.ActiveCfg = Debug|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Debug|x64.Build.0 = Debug|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Debug|x86.ActiveCfg = Debug|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Debug|x86.Build.0 = Debug|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Release|Any CPU.Build.0 = Release|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Release|ARM.ActiveCfg = Release|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Release|ARM.Build.0 = Release|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Release|iPhone.ActiveCfg = Release|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Release|iPhone.Build.0 = Release|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Release|x64.ActiveCfg = Release|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Release|x64.Build.0 = Release|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Release|x86.ActiveCfg = Release|Any CPU
{72DAC306-D4B2-4DBF-9C32-317203FD5D61}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

76
NFC/IReader.cs Normal file
View 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
View File

@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>