码迷,mamicode.com
首页 > 其他好文 > 详细

发送指令

时间:2015-02-08 11:30:13      阅读:143      评论:0      收藏:0      [点我收藏+]

标签:

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);
}

发送指令

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!