资源简介

ACR122U 读写器 对于MF0卡的读写demo,例子程序默认读写13个字节,可以根据自己的要去进行修改

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NFCReadWriteDemo
{
    public partial class Form1 : Form
    {

        public int retCode hContext hCard Protocol;
        public bool connActive = false;
        public bool validATS;
        public bool autoDet;
        public byte[] SendBuff = new byte[263];
        public byte[] RecvBuff = new byte[263];
        public int SendLen RecvLen nBytesRet reqType Aprotocol dwProtocol cbPciLength;
        public ModWinsCard.SCARD_READERSTATE RdrState;
        public ModWinsCard.SCARD_IO_REQUEST pioSendRequest;

        public bool bConnectedCard = false;

        private System.Windows.Forms.Timer timer = null;

        public Form1()
        {
            InitializeComponent();
        }

        private void ClearBuffers()
        {

            long indx;

            for (indx = 0; indx <= 262; indx++)
            {

                RecvBuff[indx] = 0;
                SendBuff[indx] = 0;

            }

        }


        private int SendAPDUandDisplay(int reqType)
        {

            int indx;
            string tmpStr;

            pioSendRequest.dwProtocol = Aprotocol;
            pioSendRequest.cbPciLength = 8;

            // Display Apdu In
            tmpStr = ““;
            for (indx = 0; indx <= SendLen - 1; indx++)
            {

                tmpStr = tmpStr + “ “ + string.Format(“{0:X2}“ SendBuff[indx]);

            }

            displayOut(2 0 tmpStr);
            retCode = ModWinsCard.SCardTransmit(hCard ref pioSendRequest ref SendBuff[0] SendLen ref pioSendRequest ref RecvBuff[0] ref RecvLen);

            if (retCode != ModWinsCard.SCARD_S_SUCCESS)
            {

                displayOut(1 retCode ““);
                return retCode;


            }

            else
            {

                tmpStr = ““;
                switch (reqType)
                {

                    case 0:
                        for (indx = (RecvLen - 2); indx <= (RecvLen - 1); indx++)
                        {

                            tmpStr = tmpStr + “ “ + string.Format(“{0:X2}“ RecvBuff[indx]);

                        }


                        if ((tmpStr).Trim() != “90 00“)
                        {

                            displayOut(4 0 “Return bytes are not acceptable.“);

                        }

                        break;

                    case 1:

                        for (indx = (RecvLen - 2); indx <= (RecvLen - 1); indx++)
                        {

                            tmpStr = tmpStr + string.Format(“{0:X2}“ RecvBuff[indx]);

                        }


                        if (tmpStr.Trim() != “90 00“)
                        {

                            t

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      28160  2014-06-25 18:25  NFCReadWriteDemo\NFCReadWriteDemo\bin\Debug\NFCReadWriteDemo.exe

     文件      38400  2014-06-25 18:25  NFCReadWriteDemo\NFCReadWriteDemo\bin\Debug\NFCReadWriteDemo.pdb

     文件      11600  2014-06-26 08:49  NFCReadWriteDemo\NFCReadWriteDemo\bin\Debug\NFCReadWriteDemo.vshost.exe

     文件        490  2012-06-02 22:34  NFCReadWriteDemo\NFCReadWriteDemo\bin\Debug\NFCReadWriteDemo.vshost.exe.manifest

     文件      28160  2014-06-27 10:32  NFCReadWriteDemo\NFCReadWriteDemo\bin\Release\NFCReadWriteDemo.exe

     文件      36352  2014-06-27 10:32  NFCReadWriteDemo\NFCReadWriteDemo\bin\Release\NFCReadWriteDemo.pdb

     文件      11600  2014-06-27 10:30  NFCReadWriteDemo\NFCReadWriteDemo\bin\Release\NFCReadWriteDemo.vshost.exe

     文件        490  2012-06-02 22:34  NFCReadWriteDemo\NFCReadWriteDemo\bin\Release\NFCReadWriteDemo.vshost.exe.manifest

     文件      17862  2014-06-27 10:32  NFCReadWriteDemo\NFCReadWriteDemo\Form1.cs

     文件      12399  2014-06-27 10:31  NFCReadWriteDemo\NFCReadWriteDemo\Form1.Designer.cs

     文件       5817  2014-06-27 10:31  NFCReadWriteDemo\NFCReadWriteDemo\Form1.resx

     文件      23754  2008-07-29 14:40  NFCReadWriteDemo\NFCReadWriteDemo\ModWinsCard.cs

     文件       3733  2014-06-25 11:57  NFCReadWriteDemo\NFCReadWriteDemo\NFCReadWriteDemo.csproj

     文件       5420  2014-06-26 08:49  NFCReadWriteDemo\NFCReadWriteDemo\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       6368  2014-06-25 18:25  NFCReadWriteDemo\NFCReadWriteDemo\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        729  2014-06-26 08:49  NFCReadWriteDemo\NFCReadWriteDemo\obj\x86\Debug\NFCReadWriteDemo.csproj.FileListAbsolute.txt

     文件        975  2014-06-25 18:25  NFCReadWriteDemo\NFCReadWriteDemo\obj\x86\Debug\NFCReadWriteDemo.csproj.GenerateResource.Cache

     文件      28160  2014-06-25 18:25  NFCReadWriteDemo\NFCReadWriteDemo\obj\x86\Debug\NFCReadWriteDemo.exe

     文件        180  2014-06-25 18:25  NFCReadWriteDemo\NFCReadWriteDemo\obj\x86\Debug\NFCReadWriteDemo.Form1.resources

     文件      38400  2014-06-25 18:25  NFCReadWriteDemo\NFCReadWriteDemo\obj\x86\Debug\NFCReadWriteDemo.pdb

     文件        180  2014-06-25 11:57  NFCReadWriteDemo\NFCReadWriteDemo\obj\x86\Debug\NFCReadWriteDemo.Properties.Resources.resources

     文件       5420  2014-06-26 13:36  NFCReadWriteDemo\NFCReadWriteDemo\obj\x86\Release\DesignTimeResolveAssemblyReferences.cache

     文件       6372  2014-06-27 10:32  NFCReadWriteDemo\NFCReadWriteDemo\obj\x86\Release\DesignTimeResolveAssemblyReferencesInput.cache

     文件        874  2014-06-27 10:31  NFCReadWriteDemo\NFCReadWriteDemo\obj\x86\Release\NFCReadWriteDemo.csproj.FileListAbsolute.txt

     文件        975  2014-06-27 10:31  NFCReadWriteDemo\NFCReadWriteDemo\obj\x86\Release\NFCReadWriteDemo.csproj.GenerateResource.Cache

     文件       9214  2014-06-27 10:31  NFCReadWriteDemo\NFCReadWriteDemo\obj\x86\Release\NFCReadWriteDemo.csprojResolveAssemblyReference.cache

     文件      28160  2014-06-27 10:32  NFCReadWriteDemo\NFCReadWriteDemo\obj\x86\Release\NFCReadWriteDemo.exe

     文件        180  2014-06-27 10:31  NFCReadWriteDemo\NFCReadWriteDemo\obj\x86\Release\NFCReadWriteDemo.Form1.resources

     文件      36352  2014-06-27 10:32  NFCReadWriteDemo\NFCReadWriteDemo\obj\x86\Release\NFCReadWriteDemo.pdb

     文件        180  2014-06-26 08:50  NFCReadWriteDemo\NFCReadWriteDemo\obj\x86\Release\NFCReadWriteDemo.Properties.Resources.resources

............此处省略23个文件信息

评论

共有 条评论