public bool initiator_select_passive_target(ref nfc_target_t selected)
        {
            IntPtr           ip   = Marshal.AllocHGlobal(89);
            nfc_modulation_t nm   = nfc_modulation_t.NM_ISO14443A_106;
            bool             bRet = nfc_initiator_select_passive_target(_handle, nm, IntPtr.Zero, 0, ip);

            if (bRet)
            {
                selected = (nfc_target_t)Marshal.PtrToStructure(ip, typeof(nfc_target_t));
            }
            Marshal.FreeHGlobal(ip);
            return(bRet);
        }
        public nfc_target_t[] initiator_list_passive_target_iso14443a(ref uint targets)
        {
            nfc_target_t[]   ant = new nfc_target_t[16];
            IntPtr           ip  = Marshal.AllocHGlobal(89 * 16);
            nfc_modulation_t nm  = nfc_modulation_t.NM_ISO14443A_106 | nfc_modulation_t.NM_JEWEL_106;

            nfc_initiator_list_passive_targets(_handle, nm, ip, 16, ref targets);
            for (uint i = 0; i < targets; i++)
            {
                ant[i] = (nfc_target_t)Marshal.PtrToStructure(new IntPtr(ip.ToInt32() + (89 * i)), typeof(nfc_target_t));
            }
            Marshal.FreeHGlobal(ip);
            return(ant);
        }
        private void WorkThreadFunction(object sender, DoWorkEventArgs e)
        {
            nfc_target_t target = new nfc_target_t();

            while ((libnfc.initiator_select_passive_target(ref target)) == false)
            {
                ;
            }

            string sUID = "";

            for (int i = 0; i < target.nti.nai.szUidLen; i++)
            {
                sUID += Convert.ToString(target.nti.nai.abtUid[i], 16).PadLeft(2, '0');
            }

            SATSystem.getInstance().mRFIDTagID = sUID;
            SATSystem.getInstance().mExitCode  = 1;
            System.Media.SystemSounds.Beep.Play();
            System.Threading.Thread.Sleep(1000);
        }