mirror of
https://gitlab.com/fabinfra/fabaccess/nfc.git
synced 2025-03-12 14:51:51 +01:00
67 lines
1.8 KiB
C#
67 lines
1.8 KiB
C#
//using System;
|
|
//using System.Threading;
|
|
//using NFC.Interfaces;
|
|
//using CoreNFC;
|
|
//using Foundation;
|
|
|
|
//namespace NFC_iOS
|
|
//{
|
|
// public class Card_iOS : ICard
|
|
// {
|
|
// private NFCTagReaderSession _session;
|
|
// private INFCMiFareTag _tag;
|
|
|
|
// public Card_iOS(NFCTagReaderSession session, INFCMiFareTag tag)
|
|
// {
|
|
// _session = session;
|
|
// _tag = tag;
|
|
// }
|
|
|
|
// public void Connect()
|
|
// {
|
|
// var counter = new CountdownEvent(1);
|
|
// NSError err = null;
|
|
|
|
// _session.ConnectTo(_tag, (error) =>
|
|
// {
|
|
// err = error;
|
|
// counter.Signal();
|
|
// });
|
|
|
|
// counter.Wait();
|
|
|
|
// if (err != null)
|
|
// {
|
|
// throw new Exception(err.LocalizedDescription);
|
|
// }
|
|
// }
|
|
|
|
// public void Disconnect()
|
|
// {
|
|
// // TODO: decide on which should be used
|
|
// //_session.RestartPolling();
|
|
// _session.InvalidateSession("card disconnect");
|
|
// }
|
|
|
|
// public APDUResponse Transmit(APDUCommand cmd)
|
|
// {
|
|
// var counter = new CountdownEvent(1);
|
|
// byte[] buf = null;
|
|
|
|
// _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();
|
|
// });
|
|
|
|
// counter.Wait();
|
|
|
|
// return new APDUResponse(buf);
|
|
// }
|
|
// }
|
|
//}
|