发送指令

CString CLZYHDlg::SendCommd(CString Command)
{
BYTE BackBuf[1024];
memset(BackBuf,0,1024);
int BackbufLen = 0;

BYTE _SIMNo;

BYTE WriteDataBuf[1024];
memset(WriteDataBuf,0x00,sizeof(WriteDataBuf));
int WriteDataBufLen;

BYTE buf[1024];
memset(buf,0,1024);

WriteDataBufLen = Command.GetLength() / 2;
if (WriteDataBufLen == 0)
{
AfxMessageBox("Please input the APDU command string!");
return "";
}
if (GetDECData(buf,Command))
{
AfxMessageBox("nThe data to wrote is not validity!");
return "";
}

for (int i=0;i< Command.GetLength() /2 ;i++)
{
WriteDataBuf[i] = buf[i];
}
WriteDataBufLen = Command.GetLength() /2;

unsigned char rlen,recdata[1024];
memset(recdata,0x00,1024);

int st = phtwd_cpuapdu(icdev,WriteDataBufLen,WriteDataBuf,&rlen,recdata);
if (st != 0)
{
MessageBox("failed");
return "";
}
return Lication(recdata,rlen);
}

原文地址:https://www.cnblogs.com/dengpeng1004/p/4279766.html