private void button15_Click(object sender, EventArgs e) { try { byte[] data = CPUCardHelper.ConverToBytes(txtCMd.Text); ApduCommand cmd = new ApduCommand(data); txtLog.AppendText("解析命令:" + cmd.ToString()); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public override byte[] ProcessCommandApdu(byte[] commandApdu, Bundle extras) { try { ApduCommand command = new ApduCommand(); command.Deserialize(commandApdu); Logger.Log(command.ToString()); switch (command.INS) { case (byte)EMVInstructionEnum.Select: //PPSE or applet select if (Formatting.ByteArrayToHexString(command.CommandData) == PPSE_NAME) { return(ppseSelectResponse); } else if (Formatting.ByteArrayToHexString(command.CommandData) == APPLET_AID) { return(appletSelectResponse); } else { return(BitConverter.GetBytes((int)ISO7816ReturnCodes.SW_INS_NOT_SUPPORTED)); } case (byte)EMVInstructionEnum.GetProcessingOptions: return(DoGPO(commandApdu)); default: return(BitConverter.GetBytes((int)ISO7816ReturnCodes.SW_INS_NOT_SUPPORTED)); } } catch (Exception ex) { return(BitConverter.GetBytes((int)ISO7816ReturnCodes.SW_INS_NOT_SUPPORTED)); } }