Powerbuilder
所属分类:单片机开发
开发工具:PowerBuilder
文件大小:49KB
下载次数:9
上传日期:2009-07-07 10:27:26
上 传 者:
lonet
说明: IC卡读写Powerbuilder调用实例!
(IC card reader-writer example of Powerbuilder call!)
文件列表:
Powerbuilder\Hnic32.dll (90112, 2003-10-22)
Powerbuilder\test.pbl (83456, 2003-01-10)
Powerbuilder (0, 2008-12-22)
PowerBuild
------------
A).函数声明:
Function long com_open ( int comport ) Library "hnic32.dll"
Subroutine com_close ( long hcom ) Library "hnic32.dll"
Function int com_test ( long hcom) Library "hnic32.dll"
Function int icc_testcard( long hcom) Library "hnic32.dll"
Function int icc_power_on( long hcom) Library "hnic32.dll"
Function int icc_power_off( long hcom) Library "hnic32.dll"
Function int icc_type_set( long hcom, int ictype) Library "hnic32.dll"
Function int icc_password( long hcom,char password[20], int length) Library "hnic32.dll"
Function int icc_read( long hcom, ref char buffer[200],int address,int length) Library "hnic32.dll"
Function int icc_write( long hcom,char buffer[200],int address,int length) Library "hnic32.dll"
Function int icc_changc( long hcom,char buffer[200],int length) Library "hnic32.dll"
Function int icc_rdpass( long hcom,ref char buffer[20],int length) Library "hnic32.dll"
Function int ic_rdbaohu( long hcom, ref char buffer[200],int address, int length) Library "hnic32.dll"
Function int ic_wdbaohu( long hcom,char buffer[200],int address,int length) Library "hnic32.dll"
Function int icc_rdbaohu( long hcom, ref char buffer[200],int address, int length) Library "hnic32.dll"
Function int icc_wdbaohu( long hcom,char buffer[200],int address,int length) Library "hnic32.dll"
function int icc_compu4404(long hcom,char password[10]) Library "hnic32.dll"
function int icc_compe4404(long hcom,char password[10]) Library "hnic32.dll"
function int icc_read4404(long hcom,ref char buffer[52],int address,int bytes) Library "hnic32.dll"
function int icc_write4404(long hcom,char buffer[52],int address,int bytes) Library "hnic32.dll"
function int icc_erase4404(long hcom,int address,int byte) Library "hnic32.dll"
function int blown_fuse4404(long hcom,ref int err) Library "hnic32.dll"
function int icc_change4404(long hcom,char buffer[10],int passtype) Library "hnic32.dll"
function int icc_rdpass4404(long hcom,ref char buffer[30],int passtype) Library "hnic32.dll"
function int icc_compe4406(long hcom,char password[10]) Library "hnic32.dll"
function int icc_read4406(long hcom,ref char buffer[52],int address,int bytes) Library "hnic32.dll"
function int icc_write4406(long hcom,char buffer[52],int address,int bytes) Library "hnic32.dll"
function int icc_erase4406(long hcom,int address) Library "hnic32.dll"
function int blown_fuse4406(long hcom,ref int err) Library "hnic32.dll"
function int icc_change4406(long hcom,char buffer[10]) Library "hnic32.dll"
function int icc_rdpass4406(long hcom,ref char buffer[30]) Library "hnic32.dll"
Function int cpu_reset(long hcom,ref int len,ref char buf[200]) Library "hnic32.dll"
Function int cpu_power_off(long hcom) Library "hnic32.dll"
Function int cpu_access(long hcom,int slen,char send[200],ref int rlen,ref char receive[200]) Library "hnic32.dll"
Function int cpu_access_C(long hcom,int slen,char send[200],ref int rlen,ref char receive[200]) Library "hnic32.dll"
Function int cpu_selsocket(long hCom,int samso) Library "hnic32.dll"
Function int cpu_getsocket(long hCom,ref int samso) Library "hnic32.dll"
Function string cpu_message(int rtn) Library "hnic32.dll"
Function int icc_read_4m( long hcom, ref char buffer[200],int address,int length) Library "hnic32.dll"
Function int icc_write_4m( long hcom, char buffer[200],int address,int length) Library "hnic32.dll"
Function int icc_rdpassu1604( long hcom,ref char buffer[200],int area) Library "hnic32.dll"
Function int icc_rdpasse1604( long hcom,ref char buffer[200],int area) Library "hnic32.dll"
Function int icc_compu1604( long hcom,int area, char password[20]) Library "hnic32.dll"
Function int icc_compe1604( long hcom,int area, char password[20]) Library "hnic32.dll"
Function int icc_changu1604( long hcom, char buffer[20],int area) Library "hnic32.dll"
Function int icc_change1604( long hcom, char buffer[20],int area) Library "hnic32.dll"
Function int icc_read1604( long hcom, ref char buffer[200],int address,int length,int area) Library "hnic32.dll"
Function int icc_write1604( long hcom, char buffer[200],int address,int length,int area) Library "hnic32.dll"
Function int icc_rdsys1604( long hcom, ref char buffer[200],int address,int length) Library "hnic32.dll"
Function int icc_wtsys1604( long hcom, char buffer[200],int address,int length) Library "hnic32.dll"
Function int blown_fuse1604( long hcom,ref int err) Library "hnic32.dll"
Function int icc_rdpass1608( long hcom,ref char buffer[200],int area,int flag) Library "hnic32.dll"
Function int icc_comp1608( long hcom, char password[20],int area,int flag) Library "hnic32.dll"
Function int icc_changc1608( long hcom, char buffer[20],int area,int flag) Library "hnic32.dll"
Function int icc_read1608( long hcom, ref char buffer[200],int address,int length,int area) Library "hnic32.dll"
Function int icc_write1608( long hcom, char buffer[200],int address,int length,int area) Library "hnic32.dll"
Function int icc_rdsys1608( long hcom, ref char buffer[200],int address,int length) Library "hnic32.dll"
Function int icc_wtsys1608( long hcom, char buffer[200],int address,int length) Library "hnic32.dll"
Function int blown_fuse1608( long hcom,ref int err) Library "hnic32.dll"
Function int fuse_yn_1608( long hcom) Library "hnic32.dll"
Function int protect_yn_1608( long hcom,int area) Library "hnic32.dll"
Function int authe_yn_1608( long hcom,int area) Library "hnic32.dll"
Function int icc_authe1608( long hcom,char buffer[200]) Library "hnic32.dll"
Function int getver( long hcom, ref char buffer[20],ref int len) Library "hnic32.dll"
Function int reposition( long hcom, ref char buffer[100]) Library "hnic32.dll"
Function int buzzer( long hcom, int n) Library "hnic32.dll"
Function int popcard( long hcom) Library "hnic32.dll"
Function int getsoftver( long hcom, ref char buffer[20]) Library "hnic32.dll"
function int des(char key[8],char data[200],ref char rdata1[200],ref char rdata2[400],int len,int mode) Library "hnic32.dll"
=====================================================================================
B).IC卡读写例程:
(SLE4428)
int comprt,apage,areturn,atype,passlen
char inbufer[200],outbufer[200],apass[10]
long hcom
comprt=1 //串行端口号
add=40 //要读写的起始地址
atype=3 //卡型 sle4428
apass="1234" //密码
passlen=4 //密码长度
inbufer=space(20)
outbufer="1234567890abcdefg"
hcom=com_open(comprt)
areturn=com_test(hcom)
if areturn=0 then
MessageBox("信息","读写器联接正确:COM1")
else
MessageBox("错误","读写器联接失败")
return
end if
areturn=icc_testcard(hcom)
if areturn=0 then
MessageBox("信息","已插卡")
else
MessageBox("错误","未插卡")
return
end if
areturn=icc_power_on(hcom)
areturn=icc_type_set(hcom,atype)
aReturn=icc_password(hcom,apass,passlen)
if areturn=0 then
MessageBox("信息","密码校验通过")
else
MessageBox("错误","密码校验失败")
return
end if
aReturn=icc_read(hcom,inbufer,add,30)
if areturn=0 then
MessageBox("读卡",inbufer)
else
MessageBox("错误","读卡失败")
return
end if
aReturn=icc_write(hcom,outbufer,add,20)
if areturn=0 then
MessageBox("信息","写卡成功")
else
MessageBox("错误","写卡失败")
return
end if
aReturn=icc_read(hcom,inbufer,add,30)
if areturn=0 then
MessageBox("读卡",inbufer)
else
MessageBox("错误","读卡失败")
return
end if
aReturn=icc_power_off(hcom)
com_close(hcom)
=======================================================================================
C).使用说明:
[注意]在使用ReadIC,ReadICProtect等函数时,应确保所使用的缓冲区已被分配,例程中申明函数用的数组大小,除DES运算的密钥KEY必须是8个字节外,其余可根据自己的需要设定。
足够的内存空间。
近期下载者:
相关文件:
收藏者: