Пример #1
0
        public nfc_device_desc_t[] list_devices(ref uint uDev)
        {
            IntPtr ip = Marshal.AllocHGlobal(272 * 16);

            LibNFC.nfc_list_devices(ip, 1, ref uDev);
            nfc_device_desc_t[] device = new nfc_device_desc_t[16];
            for (uint i = 0; i < uDev; i++)
            {
                device[i] = (nfc_device_desc_t)Marshal.PtrToStructure(new IntPtr(ip.ToInt32() + (272 * i)), typeof(nfc_device_desc_t));
            }
            Marshal.FreeHGlobal(ip);
            return(device);
        }
Пример #2
0
        public frmRFIDReader()
        {
            InitializeComponent();
            uDev   = 0;
            size   = Marshal.SizeOf(typeof(nfc_iso14443a_info_t));
            libnfc = new LibNFC();
            nfc_device_desc_t[] devices = libnfc.list_devices(ref uDev);
            nfc_device_t        con     = libnfc.connect(devices[0]);

            libnfc.initiator_init();

            libnfc.configure(LibNFC.nfc_device_option_t.NDO_ACTIVATE_FIELD, false);
            libnfc.configure(LibNFC.nfc_device_option_t.NDO_INFINITE_SELECT, false);
            libnfc.configure(LibNFC.nfc_device_option_t.NDO_HANDLE_CRC, true);
            libnfc.configure(LibNFC.nfc_device_option_t.NDO_ACTIVATE_FIELD, true);
        }