68 lines
1.8 KiB
C#
Raw Normal View History

//using System;
//using System.Threading;
//using CoreNFC;
//using Foundation;
//using NFC;
//using NFC.ISO7816_4;
2020-09-18 02:04:58 +02:00
//namespace Borepin.iOS.CNFC
//{
// public class Card : ICard
// {
// private NFCTagReaderSession _session;
// private INFCMiFareTag _tag;
2020-09-18 02:04:58 +02:00
// public Card(NFCTagReaderSession session, INFCMiFareTag tag)
// {
// _session = session;
// _tag = tag;
// }
2020-09-18 02:04:58 +02:00
// public void Connect()
// {
// var counter = new CountdownEvent(1);
// NSError err = null;
2020-09-18 02:04:58 +02:00
// _session.ConnectTo(_tag, (error) =>
// {
// err = error;
// counter.Signal();
// });
2020-09-18 02:04:58 +02:00
// counter.Wait();
2020-09-18 02:04:58 +02:00
// if (err != null)
// {
// throw new Exception(err.LocalizedDescription);
// }
// }
2020-09-18 02:04:58 +02:00
// public void Disconnect()
// {
// // TODO: decide on which should be used
// //_session.RestartPolling();
// _session.InvalidateSession("card disconnect");
// }
2020-09-18 02:04:58 +02:00
// public APDUResponse Transmit(APDUCommand cmd)
// {
// var counter = new CountdownEvent(1);
// byte[] buf = null;
2020-09-18 02:04:58 +02:00
// _tag.SendMiFareIso7816Command(new NFCIso7816Apdu(NSData.FromArray(cmd.Data)), (response, sw1, sw2, NSError) =>
// {
// // reassembly the original apdu message
// buf = new byte[response.Length + 2];
// response.ToArray().CopyTo(buf, 0);
// buf[response.Length + 0] = sw1;
// buf[response.Length + 1] = sw2;
// counter.Signal();
// });
2020-09-18 02:04:58 +02:00
// counter.Wait();
2020-09-18 02:04:58 +02:00
// return new APDUResponse(buf);
// }
// }
//}