Esempio n. 1
0
        NfcApi.SCARD_READERSTATE[] initializeReaderState(IntPtr hContext, List <string> readerNameList)
        {
            NfcApi.SCARD_READERSTATE[] readerStateArray = new NfcApi.SCARD_READERSTATE[readerNameList.Count];
            int i = 0;

            foreach (string readerName in readerNameList)
            {
                readerStateArray[i].dwCurrentState = NfcConstant.SCARD_STATE_UNAWARE;
                readerStateArray[i].szReader       = readerName;
                i++;
            }
            uint ret = NfcApi.SCardGetStatusChange(hContext, 100 /*msec*/, readerStateArray, readerStateArray.Length);

            if (ret != NfcConstant.SCARD_S_SUCCESS)
            {
                throw new ApplicationException("リーダーの初期状態の取得に失敗。code = " + ret);
            }

            return(readerStateArray);
        }
Esempio n. 2
0
        NfcApi.SCARD_READERSTATE[] readerStateChange(IntPtr hContext, List <string> readerNameList)
        {
            NfcApi.SCARD_READERSTATE[] readerStateArray = new NfcApi.SCARD_READERSTATE[readerNameList.Count];
            int i = 0;

            foreach (string readerName in readerNameList)
            {
                readerStateArray[i].dwCurrentState = NfcConstant.SCARD_STATE_UNAWARE;
                readerStateArray[i].szReader       = readerName;
                i++;
            }
            uint ret = NfcApi.SCardGetStatusChange(hContext, 100 /*msec*/, readerStateArray, readerStateArray.Length);

            if (ret != NfcConstant.SCARD_S_SUCCESS)
            {
                Debug.Log("error...");
            }
            if (nfc_state == NfcConstant.NFC_STATE_DISCONNECT)
            {
                Debug.Log("リーダーの状態の取得に失敗。code = " + ret);
            }
            return(readerStateArray);
        }