using System; using System.Collections.Generic; using System.Text; namespace NFC { /// /// Abstract representation of the platform specific NFC Hardware. /// public interface IHardware { /// /// Check if the device has nfc support. /// /// Returns true if the device supports NFC. bool IsAvailable(); /// Returns all available readers. String[] GetReader(); /// /// Create a new reader instance from the specified id. /// /// Returns the spatform specific reader that corresponds to the id. /// Invalid reader id. IReader OpenReader(String readerID); } /// /// Abstraction of a platform-specifc reader that can communicate with NFC cards. /// public interface IReader { /// /// Event that will be called when a new tag was discovered. /// event EventHandler CardDiscovered; /// /// Event that will be called when a tag that is in use gets disconnected. /// event EventHandler CardLost; void start(); void stop(); } public interface ICard { /// /// Connect to Smartcard /// void Connect(); /// /// Disconnect from Smartcard /// void Disconnect(); /// /// Transmit APDU Command to Smartcard /// /// Application Protocol Data Unit Command - ISO 7816 /// Application Protocol Data Unit Response - ISO 7816 byte[] Transmit(byte[] apdu_cmd); } public class ReaderUnavailableException : Exception { } public class CardUnavailableException : Exception { } public class APDUException : Exception { public readonly byte ResponseCode; } }