基本信息
源码名称:IC卡 刷卡控制 实例源码下载
源码大小:0.09M
文件格式:.doc
开发语言:C#
更新时间:2015-03-15
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 10 元×
微信扫码支付:10 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
private void btnRequest_Click(object sender, EventArgs e) { short icdev = 0x0000; int status; byte type = (byte)'A'; //mifare one 卡询卡方式为A byte mode = 0x52; ushort TagType = 0; byte bcnt = 0x04; //mifare 卡都用4 IntPtr pSnr; byte len = 255; sbyte size = 0; if (!bConnectedDevice) { MessageBox.Show("没有连接设备或没有安装驱动或串口设置错误", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } pSnr = Marshal.AllocHGlobal(1024); for (int i = 0; i < 2; i ) { status = rf_antenna_sta(icdev, 0); //关闭天线 if (status != 0) continue; Sleep(20); status = rf_init_type(icdev, type); if (status != 0) continue; Sleep(20); status = rf_antenna_sta(icdev, 1); //启动天线 if (status != 0) continue; Sleep(50); status = rf_request(icdev, mode, ref TagType); //搜寻所有的卡 if (status != 0) continue; status = rf_anticoll(icdev, bcnt, pSnr, ref len); //返回卡的序列号 if (status != 0) continue; status = rf_select(icdev, pSnr, len, ref size); //锁定一张ISO14443-3 TYPE_A 卡 if (status != 0) continue; byte[] szBytes = new byte[len 1]; string str = Marshal.PtrToStringAnsi(pSnr); for (int j = 0; j < len; j ) { szBytes[j] = (byte)str[j]; } txtSearchPurse.Text = ToHexString(szBytes); break; } Marshal.FreeHGlobal(pSnr); }