donsee64.dll:EST-100身份证阅读器的读卡库
donsee.64dll放到工程目录下才行(与.classpath一级),也可以放到C:\WINDOWS\system32下,具体放哪个目录具体看个人环境
测试环境:
win10 64
Eclipse IDE for Eclipse Committers (includes Incubating components)
Version: 2022-12 (4.26.0)
Build id: 20221201-1913
C:\Users\eastcoms>java -version
java version "11.0.18" 2023-01-17 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.18+9-LTS-195)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.18+9-LTS-195, mixed mode)
打开身份证阅读器端口
private void openDevice() {
hReader = (int) DonseeDevice.INSTANCE.Donsee_Open("USB");
System.out.println("hReader="+hReader);
if(hReader != 0){// 结果大于0表示成功
System.err.println("==打开接口失败==hReader="+hReader);
ta.append("==打开接口失败== hReader= "+hReader+"\r\n");
return;
}else {
ta.append("==打开接口成功=="+"\r\n");
DonseeDevice.INSTANCE.Donsee_Beep();
}
读身份证调用
private void readIDcard() {
//身份证
if(hReader!= 0){// 结果大于0表示成功
ta.setText("==打开接口失败==hReader="+hReader+"\r\n");
return;
}
long nRt = -99;
IDINFO idInfo = new IDINFO();
byte[] pszMsg = new byte[256];
byte[] bmpArry= new byte[38556];
byte[] bmpPath = filepath.getBytes();
nRt = DonseeDevice.INSTANCE.Donsee_ReadIDCard(1,filepath,idInfo,pszMsg);
System.out.println("nRt="+nRt);
if(nRt == 0) {//支持4种证件读取,请根据certType来判断,具体请参考开发文档或其他开发语言
// 支持 0、J、I、Y 四种证件,共计18项,请根据证件类型获取对应信息
// 0:居民身份证
// J:港澳台居民居住证
// I:2017版外国人永久居留身份证
// Y:新版外国人永久居留身份证
ta.append("读取成功,请根据证件类型做对应解析,证件类型标识:" + new String(idInfo.certType).trim()+"\r\n");
ta.append("\r\n"+"姓名:"+ new String(idInfo.name).trim()+"\r\n");
ta.append("性別:"+ new String(idInfo.sex).substring(0,2).trim().replace("L", "")+"\r\n");//性别这里截取一下,后面有个L
ta.append("民族:"+ new String(idInfo.people).trim()+"\r\n");
ta.append("出生日期:"+ new String(idInfo.birthday).trim()+"\r\n");
ta.append("地址:"+ new String(idInfo.address).trim()+"\r\n");
ta.append("身份证号:"+ new String(idInfo.number).trim()+"\r\n");
ta.append("签发机关:"+ new String(idInfo.organs).trim()+"\r\n");
ta.append("发卡日期:"+ new String(idInfo.signdate).trim()+"\r\n");
ta.append("有效期限:"+ new String(idInfo.validterm).trim()+"\r\n");
refreshImage();
DonseeDevice.INSTANCE.Donsee_Beep();
}else{
ta.append("读卡失败,返回值:"+nRt+"\r\n");
return;
}
}
读社保卡调用
private void readSSCard() {
if(hReader != 0){// 结果大于0表示成功
ta.setText("==打开接口失败==hReader="+hReader+"\r\n");
return;
}
long nRt = -99;
SSCardIDINFO ssCardidInfo = new SSCardIDINFO();
byte[] pszMsg = new byte[256];
int nSlotPsam = 0x11;
nRt = DonseeDevice.INSTANCE.Donsee_ReadSSCard(nSlotPsam,ssCardidInfo,pszMsg);
System.out.println("nRt="+nRt);
if(nRt == 0) {
ta.append("\r\n"+"姓名:"+ new String(ssCardidInfo.name).trim()+"\r\n");
ta.append("性別:"+ new String(ssCardidInfo.sex).substring(0,2).trim().replace("L", "")+"\r\n");//性别这里截取一下,后面有个L
ta.append("民族:"+ new String(ssCardidInfo.nation).trim()+"\r\n");
ta.append("出生日期:"+ new String(ssCardidInfo.birthday).trim()+"\r\n");
ta.append("社保卡号:"+ new String(ssCardidInfo.cardnumber).trim()+"\r\n");
ta.append("身份证号:"+ new String(ssCardidInfo.idnumber).trim()+"\r\n");
ta.append("城市代码:"+ new String(ssCardidInfo.city).trim()+"\r\n");
ta.append("发卡日期:"+ new String(ssCardidInfo.signdate).trim()+"\r\n");
ta.append("有效期限:"+ new String(ssCardidInfo.validterm).trim()+"\r\n");
ta.append("社保卡版本:"+ new String(ssCardidInfo.cardveVrsion).trim()+"\r\n");
}else{
ta.append("读卡失败,返回值:"+nRt+"\r\n");
return;
}
}