private async Task Anticoll() { var info = await i14443a.AnticollAsync(); this.Dispatcher.Invoke(new Action(() => { txtMsg.Text = "发送的字节:" + info.GetSendByteStr(); txtMsg.Text += "\r\n接收的字节:" + info.GetRecvByteStr(); txtMsg.Text += "\r\n返回的标签 UID:" + info.GetUIDStr(); txtMsg.Text += "\r\n" + info.GetStatusStr(); })); if (info.ReturnValue == ReturnMessage.Success) { anticollCard = info.UID; } }
//选卡 private static async Task <bool> AuthKey(byte sectorNum) { await reader.ChangeToISO14443AAsync(); //请求操作 var info = await i14443a.RequestAsync(RequestMode.AllCard); if (info.ReturnValue != ReturnMessage.Success) { Console.WriteLine(info.GetStatusStr()); return(false); } //防冲突操作 var info1 = await i14443a.AnticollAsync(); if (info1.ReturnValue != ReturnMessage.Success) { Console.WriteLine(info1.GetStatusStr()); return(false); } //选卡操作 var info2 = await i14443a.SelectAsync(info1.UID); if (info2.ReturnValue == ReturnMessage.Success) { Console.WriteLine("选中标签:" + info1.GetUIDStr()); } else { Console.WriteLine(info2.GetStatusStr()); return(false); } //证实 byte[] keyA = new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; //密码 A 证实 var info3 = await i14443a.AuthKeyAsync(KeyType.KeyA, sectorNum, keyA); if (info3.ReturnValue != ReturnMessage.Success) { Console.WriteLine(info3.GetStatusStr()); return(false); } Console.WriteLine("证实成功"); return(true); }
private async Task Select() { var info = await reader.ChangeToISO14443AAsync(); this.Dispatcher.Invoke(new Action(() => { txtMsg.Text = "发送的字节:" + info.GetSendByteStr(); txtMsg.Text += "\r\n接收的字节:" + info.GetRecvByteStr(); txtMsg.Text += "\r\n" + info.GetStatusStr(); })); if (info.ReturnValue != ReturnMessage.Success) { return; } var info1 = await i14443a.RequestAsync(RequestMode.IdleCard); this.Dispatcher.Invoke(new Action(() => { txtMsg.Text += "\r\n\r\n发送的字节:" + info1.GetSendByteStr(); txtMsg.Text += "\r\n接收的字节:" + info1.GetRecvByteStr(); txtMsg.Text += "\r\n卡片类型:" + info1.GetCardTypeName(); txtMsg.Text += "\r\n" + info1.GetStatusStr(); })); if (info1.ReturnValue != ReturnMessage.Success) { return; } var info2 = await i14443a.AnticollAsync(); this.Dispatcher.Invoke(new Action(() => { txtMsg.Text += "\r\n\r\n发送的字节:" + info2.GetSendByteStr(); txtMsg.Text += "\r\n接收的字节:" + info2.GetRecvByteStr(); txtMsg.Text += "\r\n返回的标签 UID:" + info2.GetUIDStr(); txtMsg.Text += "\r\n" + info2.GetStatusStr(); })); if (info2.ReturnValue != ReturnMessage.Success) { return; } var info3 = await i14443a.SelectAsync(info2.UID); this.Dispatcher.Invoke(new Action(() => { txtMsg.Text += "\r\n\r\n发送的字节:" + info.GetSendByteStr(); txtMsg.Text += "\r\n接收的字节:" + info.GetRecvByteStr(); txtMsg.Text += "\r\n" + info.GetStatusStr(); })); if (info3.ReturnValue != ReturnMessage.Success) { return; } this.Dispatcher.Invoke(new Action(() => { txtSelCard.Text = info2.GetUIDStr(); })); }