Compare commits
No commits in common. "e31bb24b4aed335ccfb36e748e5fe6fbe19fd84c" and "274bbc1167c75a508a7fb7202e366a5c2408f8ea" have entirely different histories.
e31bb24b4a
...
274bbc1167
|
@ -28,11 +28,6 @@ public class Result<T> implements Serializable {
|
|||
*/
|
||||
private Integer code = 0;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private int state;
|
||||
|
||||
/**
|
||||
* 返回数据对象 data
|
||||
*/
|
||||
|
@ -47,61 +42,49 @@ public class Result<T> implements Serializable {
|
|||
}
|
||||
|
||||
public static <T> Result<T> ok() {
|
||||
return ok("", null, 0);
|
||||
return ok("", null);
|
||||
}
|
||||
|
||||
public static <T> Result<T> ok(String msg) {
|
||||
return ok(msg, null, 0);
|
||||
return ok(msg, null);
|
||||
}
|
||||
|
||||
public static <T> Result<T> ok(T data) {
|
||||
return ok("", data, 0);
|
||||
return ok("", data);
|
||||
}
|
||||
|
||||
public static <T> Result<T> ok(String msg, T data) {
|
||||
return ok(msg, data, 0);
|
||||
}
|
||||
|
||||
public static <T> Result<T> ok(String msg, T data, int state) {
|
||||
Result<T> r = new Result<T>();
|
||||
r.setSuccess(true);
|
||||
r.setCode(CommonConst.SC_200);
|
||||
r.setMessage(msg);
|
||||
r.setResult(data);
|
||||
r.setState(state);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(String msg, T data) {
|
||||
return error(CommonConst.SC_500, msg, data, 0);
|
||||
}
|
||||
public static <T> Result<T> error(String msg, int state) {
|
||||
return error(CommonConst.SC_500, msg, null, state);
|
||||
return error(CommonConst.SC_500, msg, data);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(String msg) {
|
||||
return error(CommonConst.SC_500, msg, null, 0);
|
||||
return error(CommonConst.SC_500, msg, null);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(ErrorEnum errorEnum) {
|
||||
return error(errorEnum.getCode(), errorEnum.getMessage(), null, 0);
|
||||
return error(errorEnum.getCode(), errorEnum.getMessage(), null);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(int code, String message) {
|
||||
return error(code, message, null, 0);
|
||||
return error(code, message, null);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(int code, String msg, T data) {
|
||||
return error(code, msg, data, 0);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(int code, String msg, T data, int state) {
|
||||
Result<T> r = new Result<T>();
|
||||
r.setCode(code);
|
||||
r.setMessage(msg);
|
||||
r.setSuccess(false);
|
||||
r.setResult(data);
|
||||
r.setState(state);
|
||||
return r;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,160 +20,77 @@ public class CardReaderServiceImpl implements CardReaderService {
|
|||
|
||||
@Override
|
||||
public Result IDCardReader() {
|
||||
int handle = 0;
|
||||
Long handle = null;
|
||||
UserInfoVO userInfo = null;
|
||||
try {
|
||||
log.info("[CardReaderServiceImpl][IDCardReader][26]: 开始连接指定设备与电脑端口,即打开端口");
|
||||
// 连接指定设备与电脑端口,即打开端口
|
||||
handle = cardReaderSdk.ICC_Reader_Open("USB1");
|
||||
log.info("[CardReaderServiceImpl][IDCardReader][29]: 连接指定设备与电脑端口,即打开端口,返回句柄: {}", handle);
|
||||
log.info("连接指定设备与电脑端口,即打开端口:{}", handle);
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
log.info("[CardReaderServiceImpl][IDCardReader][32]: 开始循环读取 ID 卡信息,开始时间: {}", startTime);
|
||||
while (true) {
|
||||
try {
|
||||
byte[] bytes = new byte[1024];
|
||||
log.info("[CardReaderServiceImpl][IDCardReader][36]: 尝试读取 ID 卡");
|
||||
int idCard = cardReaderSdk.PICC_Reader_ReadIDCard(handle, bytes);
|
||||
log.info("[CardReaderServiceImpl][IDCardReader][38]: 读取 ID 卡,返回值: {}", idCard);
|
||||
log.info("[CardReaderServiceImpl][IDCardReader][39]: 尝试创建 UserInfoVO 对象");
|
||||
/*byte[] address = new byte[1024];
|
||||
Integer i = cardReaderSdk.GetAddress(address);
|
||||
System.out.println(i);
|
||||
java.lang.String strAddress = new java.lang.String(address, "GBK");
|
||||
System.out.println("地址:" + strAddress);*/
|
||||
|
||||
/*byte[] bmpFile = new byte[4096];
|
||||
int s = cardReaderSdk.GetBmpFileData(bmpFile);
|
||||
System.out.println(s);
|
||||
java.lang.String strBmpFile = new java.lang.String(bmpFile, "GBK");
|
||||
System.out.println("地址:" + strBmpFile);*/
|
||||
|
||||
Long idCard = cardReaderSdk.PICC_Reader_ReadIDCard(handle);
|
||||
userInfo = new UserInfoVO(cardReaderSdk);
|
||||
log.info("[CardReaderServiceImpl][IDCardReader][53]: 创建 UserInfoVO 对象成功,姓名: {}", userInfo.getName());
|
||||
if (!"".equals(userInfo.getName()) && userInfo.getName() != null) {
|
||||
log.info("[CardReaderServiceImpl][IDCardReader][55]: 成功读取到用户姓名,退出循环");
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 处理创建 UserInfoVO 时可能出现的异常
|
||||
log.info("[CardReaderServiceImpl][IDCardReader][60]: 创建 UserInfoVO 对象时发生异常", e);
|
||||
log.info("创建 UserInfoVO 对象时发生异常", e);
|
||||
}
|
||||
|
||||
long elapsedTime = System.currentTimeMillis() - startTime;
|
||||
log.info("[CardReaderServiceImpl][IDCardReader][64]: 已过去时间: {} 毫秒", elapsedTime);
|
||||
if (elapsedTime >= waitingTime) {
|
||||
log.info("[CardReaderServiceImpl][IDCardReader][66]: 读取 ID 卡信息超时,等待了 {} 秒。", waitingTime);
|
||||
log.info("读取 ID 卡信息超时,等待了 {} 秒。", waitingTime);
|
||||
return Result.error("读取 ID 卡信息超时,请重试。");
|
||||
}
|
||||
try {
|
||||
log.info("[CardReaderServiceImpl][IDCardReader][70]: 线程休眠 100 毫秒,避免 CPU 空转");
|
||||
// 短暂休眠,避免 CPU 空转
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) {
|
||||
log.info("[CardReaderServiceImpl][IDCardReader][74]: 线程休眠被中断,重新设置中断状态");
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
log.info("[CardReaderServiceImpl][IDCardReader][78]: 成功读取到用户信息,返回结果");
|
||||
return Result.ok(userInfo);
|
||||
} finally {
|
||||
if (handle != 0) {
|
||||
log.info("[CardReaderServiceImpl][IDCardReader][82]: 开始关闭端口,句柄: {}", handle);
|
||||
if (handle != null) {
|
||||
// 不管什么情况最终都要关闭端口
|
||||
cardReaderSdk.ICC_Reader_Close(handle);
|
||||
log.info("[CardReaderServiceImpl][IDCardReader][85]: 端口关闭成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result SocialSecurityCardReader() {
|
||||
int handle = 0;
|
||||
Long handle = null;
|
||||
try {
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][94]: 开始连接指定设备与电脑端口,即打开端口");
|
||||
// 连接指定设备与电脑端口,即打开端口
|
||||
handle = cardReaderSdk.ICC_Reader_Open("USB1");
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][97]: 连接指定设备与电脑端口,即打开端口,返回句柄: {}", handle);
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][100]: 开始循环读取社保卡信息,开始时间: {}", startTime);
|
||||
|
||||
while (true) {
|
||||
byte[] data = new byte[1024];
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][104]: 尝试读取社保卡基本信息");
|
||||
int i = cardReaderSdk.iReadCardBas(3, data);
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][106]: 读取社保卡基本信息,返回值: {}", i);
|
||||
|
||||
if (i == 0) {
|
||||
java.lang.String bas = new java.lang.String(data, "GBK");
|
||||
java.lang.String[] split = bas.split("\\|");
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][111]: 读基本信息,结果: {}", bas);
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][112]: 开始分割基本信息");
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][113]: 基本信息分割完成,分割后的数组长度: {}", split.length);
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][114]: 开始创建 SocialSecurityCardInfoVO 对象");
|
||||
log.info("连接指定设备与电脑端口,即打开端口:{}", handle);
|
||||
// 读基本信息
|
||||
String bas = cardReaderSdk.iReadCardBas(3);
|
||||
log.info("读基本信息:{}", bas);
|
||||
String[] split = bas.split("\\|");
|
||||
SocialSecurityCardInfoVO socialSecurityCardInfoVO = new SocialSecurityCardInfoVO();
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][116]: 开始截取区号代码");
|
||||
// 区号代码截取
|
||||
socialSecurityCardInfoVO.setAreaCode(split[0].substring(split[0].length() - 6));
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][119]: 区号代码截取完成,结果: {}", socialSecurityCardInfoVO.getAreaCode());
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][120]: 开始设置社保卡号");
|
||||
socialSecurityCardInfoVO.setSocialSecurityNo(split[1]);
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][122]: 社保卡号设置完成,结果: {}", socialSecurityCardInfoVO.getSocialSecurityNo());
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][123]: 开始设置卡号");
|
||||
socialSecurityCardInfoVO.setCardNumber(split[2]);
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][125]: 卡号设置完成,结果: {}", socialSecurityCardInfoVO.getCardNumber());
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][126]: 开始设置识别码");
|
||||
socialSecurityCardInfoVO.setIdentificationCode(split[3]);
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][128]: 识别码设置完成,结果: {}", socialSecurityCardInfoVO.getIdentificationCode());
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][129]: 开始设置姓名");
|
||||
socialSecurityCardInfoVO.setName(split[4]);
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][131]: 姓名设置完成,结果: {}", socialSecurityCardInfoVO.getName());
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][132]: 开始设置卡重置信息");
|
||||
socialSecurityCardInfoVO.setCardResetInformation(split[5]);
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][134]: 卡重置信息设置完成,结果: {}", socialSecurityCardInfoVO.getCardResetInformation());
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][135]: 开始设置规格版本");
|
||||
socialSecurityCardInfoVO.setSpecificationVersion(split[6]);
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][137]: 规格版本设置完成,结果: {}", socialSecurityCardInfoVO.getSpecificationVersion());
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][138]: 开始设置发卡日期");
|
||||
socialSecurityCardInfoVO.setIssuanceDate(split[7]);
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][140]: 发卡日期设置完成,结果: {}", socialSecurityCardInfoVO.getIssuanceDate());
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][141]: 开始设置过期日期");
|
||||
socialSecurityCardInfoVO.setExpireDate(split[8]);
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][143]: 过期日期设置完成,结果: {}", socialSecurityCardInfoVO.getExpireDate());
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][144]: 开始设置终端号");
|
||||
socialSecurityCardInfoVO.setTerminalNumber(split[9]);
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][146]: 终端号设置完成,结果: {}", socialSecurityCardInfoVO.getTerminalNumber());
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][147]: 开始设置终端设备号");
|
||||
socialSecurityCardInfoVO.setTerminalDeviceNumber(split[10]);
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][149]: 终端设备号设置完成,结果: {}", socialSecurityCardInfoVO.getTerminalDeviceNumber());
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][150]: 成功读取社保卡信息,返回结果");
|
||||
return Result.ok(socialSecurityCardInfoVO);
|
||||
}
|
||||
|
||||
long elapsedTime = System.currentTimeMillis() - startTime;
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][155]: 已过去时间: {} 毫秒", elapsedTime);
|
||||
if (elapsedTime >= waitingTime) {
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][157]: 读取社保卡信息超时,等待了 {} 毫秒。", waitingTime);
|
||||
return Result.error("读取社保卡信息超时,请重试。");
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][162]: 线程休眠 100 毫秒,避免 CPU 空转");
|
||||
// 短暂休眠,避免 CPU 空转
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) {
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][166]: 线程休眠被中断,重新设置中断状态");
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][171]: Error occurred during card reader operation: ", e);
|
||||
if (handle != 0) {
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][173]: 开始关闭端口,句柄: {}", handle);
|
||||
log.error("Error occurred during card reader operation: ", e);
|
||||
if (handle != null) {
|
||||
// 关闭端口
|
||||
cardReaderSdk.ICC_Reader_Close(handle);
|
||||
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][176]: 端口关闭成功");
|
||||
}
|
||||
return Result.error("操作失败:" + e.getMessage());
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package com.dpkj.modules.cardReader.utils;
|
||||
|
||||
import com.dpkj.modules.autoReplyPrint.utils.AutoReplyPrint;
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Platform;
|
||||
|
||||
public interface CardReaderSdk extends Library {
|
||||
CardReaderSdk INSTANCE = (CardReaderSdk) Native.loadLibrary(GetLibraryPath_Helper.GetLibraryPath(), CardReaderSdk.class);
|
||||
CardReaderSdk INSTANCE = (CardReaderSdk) Native.loadLibrary("SSSE32", CardReaderSdk.class);
|
||||
|
||||
/**
|
||||
* 连接指定设备与电脑端口,即打开端口
|
||||
|
@ -14,7 +12,7 @@ public interface CardReaderSdk extends Library {
|
|||
* @param devName 接口名称,如”USB1”
|
||||
* @return >0成功,<=0失败
|
||||
*/
|
||||
int ICC_Reader_Open(String devName);
|
||||
Long ICC_Reader_Open(String devName);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -23,7 +21,7 @@ public interface CardReaderSdk extends Library {
|
|||
* @param ReaderHandle ICCReaderOpen函数所返回的值
|
||||
* @return =0成功,非0失败
|
||||
*/
|
||||
int ICC_Reader_Close(int ReaderHandle);
|
||||
Long ICC_Reader_Close(Long ReaderHandle);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -33,7 +31,7 @@ public interface CardReaderSdk extends Library {
|
|||
* @param time 蜂鸣时间,以毫秒为单位
|
||||
* @return =0成功,非0失败
|
||||
*/
|
||||
int ICC_PosBeep(int ReaderHandle, int time);
|
||||
Long ICC_PosBeep(Long ReaderHandle, Long time);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -41,7 +39,7 @@ public interface CardReaderSdk extends Library {
|
|||
*
|
||||
* @return 设备及动态库版本信息 =0成功,非0失败
|
||||
*/
|
||||
int ICC_Reader_Libinfo();
|
||||
Long ICC_Reader_Libinfo();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -52,7 +50,7 @@ public interface CardReaderSdk extends Library {
|
|||
* @param length 要读取的数据的长度
|
||||
* @return 读取的数据 =0成功,非0失败
|
||||
*/
|
||||
int ICC_Reader_ReadEEPROM(int ReaderHandle, int offset, int length);
|
||||
Long ICC_Reader_ReadEEPROM(Long ReaderHandle, int offset, int length);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -64,7 +62,7 @@ public interface CardReaderSdk extends Library {
|
|||
* @param buffer 待写入的数据
|
||||
* @return =0成功,非0失败
|
||||
*/
|
||||
int ICC_Reader_WriteEEPROM(int ReaderHandle, int offset, int length, String buffer);
|
||||
Long ICC_Reader_WriteEEPROM(Long ReaderHandle, int offset, int length, String buffer);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -89,7 +87,7 @@ public interface CardReaderSdk extends Library {
|
|||
* @return =0成功,非0失败
|
||||
*/
|
||||
@Deprecated
|
||||
int ICC_Reader_DispSound(int ReaderHandle, String voiceType);
|
||||
Long ICC_Reader_DispSound(Long ReaderHandle, String voiceType);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -105,7 +103,7 @@ public interface CardReaderSdk extends Library {
|
|||
* 0x3x:非接CPU卡
|
||||
* @return 上电返回ATR值,数据格式为十六进制字符串
|
||||
*/
|
||||
int ICC_Reader_PowerOnHEX(int ReaderHandle, String ICCSlotNo);
|
||||
Long ICC_Reader_PowerOnHEX(Long ReaderHandle, String ICCSlotNo);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -121,7 +119,7 @@ public interface CardReaderSdk extends Library {
|
|||
* 0x3x:非接CPU卡
|
||||
* @return =0成功,非0失败
|
||||
*/
|
||||
int ICC_Reader_PowerOff(int ReaderHandle, String ICCSlotNo);
|
||||
Long ICC_Reader_PowerOff(Long ReaderHandle, String ICCSlotNo);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -137,7 +135,7 @@ public interface CardReaderSdk extends Library {
|
|||
* 0x3x:非接CPU卡
|
||||
* @return = 0 表示卡座有卡,其他见状态码
|
||||
*/
|
||||
int ICC_Reader_GetStatus(int ReaderHandle, String ICCSlotNo);
|
||||
Long ICC_Reader_GetStatus(Long ReaderHandle, String ICCSlotNo);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -154,7 +152,7 @@ public interface CardReaderSdk extends Library {
|
|||
* @param CommandAPDU APDU命令数据,以十六进制字符串形式输入
|
||||
* @return 大于 0 表示执行成功,其值为 Response_APDU 的数据长度.否则表示执行失败
|
||||
*/
|
||||
int ICC_Reader_ApplicationHEX(int ReaderHandle, String ICCSlotNo, String CommandAPDU);
|
||||
Long ICC_Reader_ApplicationHEX(Long ReaderHandle, String ICCSlotNo, String CommandAPDU);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -163,7 +161,7 @@ public interface CardReaderSdk extends Library {
|
|||
* @param ReaderHandle ICCReaderOpen函数所返回的值
|
||||
* @return 返回卡片上电信息 = 0 表示成功,非0失败
|
||||
*/
|
||||
int ICC_Reader_4428_PowerOnHEX(int ReaderHandle);
|
||||
Long ICC_Reader_4428_PowerOnHEX(Long ReaderHandle);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -172,7 +170,7 @@ public interface CardReaderSdk extends Library {
|
|||
* @param ReaderHandle ICCReaderOpen函数所返回的值
|
||||
* @return = 0 表示成功,非0失败
|
||||
*/
|
||||
int ICC_Reader_4442_PowerOff(int ReaderHandle);
|
||||
Long ICC_Reader_4442_PowerOff(Long ReaderHandle);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -183,7 +181,7 @@ public interface CardReaderSdk extends Library {
|
|||
* @param len 数据长度,offset+len需小于256
|
||||
* @return 返回卡片读取信息 = 0 表示成功,非0失败
|
||||
*/
|
||||
int ICC_Reader_4428_ReadHEX(int ReaderHandle, int offset, int len);
|
||||
Long ICC_Reader_4428_ReadHEX(Long ReaderHandle, int offset, int len);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -195,7 +193,7 @@ public interface CardReaderSdk extends Library {
|
|||
* @param data 待写入卡片数据
|
||||
* @return 返回卡片读取信息 = 0 表示成功,非0失败
|
||||
*/
|
||||
int ICC_Reader_4428_WriteHEX(int ReaderHandle, int offset, int len, String data);
|
||||
Long ICC_Reader_4428_WriteHEX(Long ReaderHandle, int offset, int len, String data);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -205,7 +203,7 @@ public interface CardReaderSdk extends Library {
|
|||
* @param keyHex 卡密钥
|
||||
* @return = 0 表示成功,非0失败
|
||||
*/
|
||||
int ICC_Reader_4442_Verify(int ReaderHandle, String keyHex);
|
||||
Long ICC_Reader_4442_Verify(Long ReaderHandle, String keyHex);
|
||||
|
||||
/** ----- 非接触操作函数 -------------- */
|
||||
/**
|
||||
|
@ -214,7 +212,7 @@ public interface CardReaderSdk extends Library {
|
|||
* @param ReaderHandle ICCReaderOpen函数所返回的值
|
||||
* @return = 0 表示成功,非0失败
|
||||
*/
|
||||
int PICC_Reader_Request(int ReaderHandle);
|
||||
Long PICC_Reader_Request(Long ReaderHandle);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -224,7 +222,7 @@ public interface CardReaderSdk extends Library {
|
|||
* @param flag 00-关场强 01-开场强
|
||||
* @return = 0 表示成功,非0失败
|
||||
*/
|
||||
int PICC_Reader_RFControl(int ReaderHandle, String flag);
|
||||
Long PICC_Reader_RFControl(Long ReaderHandle, String flag);
|
||||
|
||||
|
||||
/** --------------- 非接 CPU 卡操作函数 ------------ */
|
||||
|
@ -235,7 +233,7 @@ public interface CardReaderSdk extends Library {
|
|||
* @return 输出上电成功返回的卡片复位信息(ATS) 返回ATS长度,大于0 表示成功,其他失败
|
||||
*/
|
||||
@Deprecated
|
||||
int PICC_Reader_PowerOnTypeAHEX(int ReaderHandle);
|
||||
Long PICC_Reader_PowerOnTypeAHEX(Long ReaderHandle);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -245,7 +243,7 @@ public interface CardReaderSdk extends Library {
|
|||
* @return 输出上电成功返回的卡片复位信息(ATS) 返回ATS长度,大于0 表示成功,其他失败
|
||||
*/
|
||||
@Deprecated
|
||||
int PICC_Reader_PowerOnTypeBHEX(int ReaderHandle);
|
||||
Long PICC_Reader_PowerOnTypeBHEX(Long ReaderHandle);
|
||||
|
||||
/**
|
||||
* 非接触 CPU 卡执行APDU命令,命令以十六进制字符串传输(SSSE32.dll暴露函数中未发现该函数,但是文档中有)
|
||||
|
@ -256,7 +254,7 @@ public interface CardReaderSdk extends Library {
|
|||
* 大于 0 表示执行成功,其值为 Response_APDU 的数据长度.否则表示执行失败
|
||||
*/
|
||||
@Deprecated
|
||||
int PICC_Reader_ApplicationHEX(int ReaderHandle, String CommandAPDU);
|
||||
Long PICC_Reader_ApplicationHEX(Long ReaderHandle, String CommandAPDU);
|
||||
|
||||
|
||||
/** ---------------- 二代证/外国人居留证/港澳台居住证 --------------- */
|
||||
|
@ -266,7 +264,7 @@ public interface CardReaderSdk extends Library {
|
|||
* @param ReaderHandle ICCReaderOpen函数所返回的值
|
||||
* @return 返回身份证物理ID信息 = 0 表示成功,非0失败
|
||||
*/
|
||||
int PICC_Reader_Read_CardID(int ReaderHandle, byte[] response);
|
||||
Long PICC_Reader_Read_CardID(Long ReaderHandle, byte[] response);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -275,7 +273,7 @@ public interface CardReaderSdk extends Library {
|
|||
* @param ReaderHandle ICCReaderOpen函数所返回的值
|
||||
* @return 返回错误信息 = 0 表示成功,非0失败
|
||||
*/
|
||||
int PICC_Reader_ReadIDCard(int ReaderHandle, byte[] response);
|
||||
Long PICC_Reader_ReadIDCard(Long ReaderHandle);
|
||||
|
||||
/** 以下函数须在 “PICC_Reader_ReadIDCard” 函数执行成功之后调用,否则获取不到有效信息 */
|
||||
/**
|
||||
|
@ -286,99 +284,99 @@ public interface CardReaderSdk extends Library {
|
|||
* 2:港澳台居民居住证
|
||||
* 4:新外国人永久居留证
|
||||
*/
|
||||
int GetCardType();
|
||||
Integer GetCardType();
|
||||
|
||||
/**
|
||||
* 姓名(类型为 1 时表示:外国人中文姓名)
|
||||
*/
|
||||
int GetName(byte[] outParam);
|
||||
Integer GetName(byte[] outParam);
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
int GetSex(byte[] outParam);
|
||||
Integer GetSex(byte[] outParam);
|
||||
|
||||
/**
|
||||
* 民族
|
||||
*/
|
||||
int GetNation(byte[] outParam);
|
||||
Integer GetNation(byte[] outParam);
|
||||
|
||||
/**
|
||||
* 出生日期
|
||||
*/
|
||||
int GetBirth(byte[] outParam);
|
||||
Integer GetBirth(byte[] outParam);
|
||||
|
||||
/**
|
||||
* 住址
|
||||
*/
|
||||
int GetAddress(byte[] outParam);
|
||||
Integer GetAddress(byte[] outParam);
|
||||
|
||||
/**
|
||||
* 公民身份证号码(类型为 1时表示:外国人居留证号码)
|
||||
*/
|
||||
int GetCertNo(byte[] outParam);
|
||||
Integer GetCertNo(byte[] outParam);
|
||||
|
||||
/**
|
||||
* 签发机关
|
||||
*/
|
||||
int GetDepartemt(byte[] outParam);
|
||||
Integer GetDepartemt(byte[] outParam);
|
||||
|
||||
/**
|
||||
* 有效起始日期
|
||||
*/
|
||||
int GetEffectDate(byte[] outParam);
|
||||
Integer GetEffectDate(byte[] outParam);
|
||||
|
||||
/**
|
||||
* 有效截止日期
|
||||
*/
|
||||
int GetExpireDate(byte[] outParam);
|
||||
Integer GetExpireDate(byte[] outParam);
|
||||
|
||||
/**
|
||||
* bmp 格式照片数据
|
||||
*/
|
||||
int GetBmpFileData(byte[] outParam);
|
||||
String GetBmpFileData(byte[] outParam);
|
||||
|
||||
/**
|
||||
* 生成照片
|
||||
* TODO 入参参考文中3.4.1
|
||||
*/
|
||||
int GetBmpFile(byte[] outParam);
|
||||
Integer GetBmpFile(byte[] outParam);
|
||||
|
||||
/**
|
||||
* 是否含存在指纹信息:存在时返回 512 或者 1024
|
||||
* 不存在时返回 0
|
||||
*/
|
||||
int IsFingerExist();
|
||||
Integer IsFingerExist();
|
||||
|
||||
/**
|
||||
* 获取指纹数据:成功时返回获取到的字节长度
|
||||
*/
|
||||
int GetFingerprint(byte[] outParam);
|
||||
Integer GetFingerprint(byte[] outParam);
|
||||
|
||||
/**
|
||||
* 外国人英文姓名
|
||||
*/
|
||||
int GetEnName(byte[] outParam);
|
||||
Integer GetEnName(byte[] outParam);
|
||||
|
||||
/**
|
||||
* 外国人国籍代码,符合GB/T2659-2000规定
|
||||
*/
|
||||
int GetNationalityCode(byte[] outParam);
|
||||
Integer GetNationalityCode(byte[] outParam);
|
||||
|
||||
/**
|
||||
* 港澳台通行证号码
|
||||
*/
|
||||
int GetTXZHM(byte[] outParam);
|
||||
Integer GetTXZHM(byte[] outParam);
|
||||
|
||||
/**
|
||||
* 港澳台通行证签发次数
|
||||
*/
|
||||
int GetTXZQFCS(byte[] outParam);
|
||||
Integer GetTXZQFCS(byte[] outParam);
|
||||
|
||||
/**
|
||||
* 外国人换证次数
|
||||
*/
|
||||
int GetHZCS(byte[] outParam);
|
||||
Integer GetHZCS(byte[] outParam);
|
||||
|
||||
/** ------------ 社保卡 ---------*/
|
||||
/**
|
||||
|
@ -391,7 +389,7 @@ public interface CardReaderSdk extends Library {
|
|||
* 4-自动寻卡,非接触式操作卡优先
|
||||
* @return
|
||||
*/
|
||||
int iReadCardBas(int iType, byte[] data);
|
||||
String iReadCardBas(Integer iType);
|
||||
|
||||
/**
|
||||
* 基于加密机的读基本信息(步骤一)
|
||||
|
@ -404,7 +402,7 @@ public interface CardReaderSdk extends Library {
|
|||
* 4-自动寻卡,非接触式操作卡优先
|
||||
* @return
|
||||
*/
|
||||
int iReadCardBas_HSM_Step1(int iType, byte[] data);
|
||||
Long iReadCardBas_HSM_Step1(Integer iType);
|
||||
|
||||
/**
|
||||
* 基于加密机的读基本信息(步骤二)
|
||||
|
@ -416,51 +414,5 @@ public interface CardReaderSdk extends Library {
|
|||
* 原始信息(16 位)拼接组成)。各数据项之间以“|”分割,且最后一个数据项以“|”结尾。
|
||||
* @return
|
||||
*/
|
||||
public int iReadCardBas_HSM_Step2(byte[] pKey, byte[] pOutInfo);
|
||||
|
||||
public static class GetLibraryPath_Helper {
|
||||
public GetLibraryPath_Helper() {
|
||||
}
|
||||
|
||||
private static String GetLibraryPath() {
|
||||
// if (Platform.isWindows()) {
|
||||
// return Platform.is64Bit() ? "/win32-x86-64/QXSSSE32_x64.dll" : "/win32-x86-64/QXSSSE32_x64.dll";
|
||||
// } else if (Platform.isLinux()) {
|
||||
// return Platform.is64Bit() ? "/win32-x86-64/QXSSSE32_x64.so" : "/win32-x86-64/QXSSSE32_x64.so";
|
||||
// } else {
|
||||
// return Platform.isMac() ? "/win32-x86-64/QXSSSE32_x64.so" : "/win32-x86-64/QXSSSE32_x64.so";
|
||||
// }
|
||||
return "/win32-x86-64/SSSE32.dll";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//社保卡
|
||||
public int PICC_Reader_SSCardInfo1(int ReaderHandle,
|
||||
byte[] SBKH,
|
||||
byte[] SHBZHM,
|
||||
byte[] XM,
|
||||
byte[] XB,
|
||||
byte[] CSRQ
|
||||
|
||||
);
|
||||
|
||||
//身份证
|
||||
public int PICC_Reader_ReadIDInfo(int ReaderHandle,
|
||||
String filepath,
|
||||
byte[] pName,
|
||||
byte[] pSex,
|
||||
byte[] pNation,
|
||||
byte[] pBirth,
|
||||
byte[] pAddress,
|
||||
byte[] pCertNo,
|
||||
byte[] pDepartment ,
|
||||
byte[] pEffectData,
|
||||
byte[] pExpire,
|
||||
byte[] pErrMsg);
|
||||
|
||||
public int ICC_SelscetScan(int ReaderHandle, byte[] pCodeInfo , int [] lent);
|
||||
|
||||
|
||||
public int iGetDevUID(byte[] pOutInfo);
|
||||
Long iReadCardBas_HSM_Step2(String pKey, byte[] outParam);
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue