Compare commits

...

2 Commits

4 changed files with 230 additions and 82 deletions

View File

@ -28,6 +28,11 @@ public class Result<T> implements Serializable {
*/
private Integer code = 0;
/**
* 状态
*/
private int state;
/**
* 返回数据对象 data
*/
@ -42,49 +47,61 @@ public class Result<T> implements Serializable {
}
public static <T> Result<T> ok() {
return ok("", null);
return ok("", null, 0);
}
public static <T> Result<T> ok(String msg) {
return ok(msg, null);
return ok(msg, null, 0);
}
public static <T> Result<T> ok(T data) {
return ok("", data);
return ok("", data, 0);
}
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);
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);
}
public static <T> Result<T> error(String msg) {
return error(CommonConst.SC_500, msg, null);
return error(CommonConst.SC_500, msg, null, 0);
}
public static <T> Result<T> error(ErrorEnum errorEnum) {
return error(errorEnum.getCode(), errorEnum.getMessage(), null);
return error(errorEnum.getCode(), errorEnum.getMessage(), null, 0);
}
public static <T> Result<T> error(int code, String message) {
return error(code, message, null);
return error(code, message, null, 0);
}
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;
}
}

View File

@ -20,77 +20,160 @@ public class CardReaderServiceImpl implements CardReaderService {
@Override
public Result IDCardReader() {
Long handle = null;
int handle = 0;
UserInfoVO userInfo = null;
try {
log.info("[CardReaderServiceImpl][IDCardReader][26]: 开始连接指定设备与电脑端口,即打开端口");
// 连接指定设备与电脑端口即打开端口
handle = cardReaderSdk.ICC_Reader_Open("USB1");
log.info("连接指定设备与电脑端口,即打开端口:{}", handle);
log.info("[CardReaderServiceImpl][IDCardReader][29]: 连接指定设备与电脑端口,即打开端口,返回句柄: {}", handle);
long startTime = System.currentTimeMillis();
log.info("[CardReaderServiceImpl][IDCardReader][32]: 开始循环读取 ID 卡信息,开始时间: {}", startTime);
while (true) {
try {
Long idCard = cardReaderSdk.PICC_Reader_ReadIDCard(handle);
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);*/
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("创建 UserInfoVO 对象时发生异常", e);
log.info("[CardReaderServiceImpl][IDCardReader][60]: 创建 UserInfoVO 对象时发生异常", e);
}
long elapsedTime = System.currentTimeMillis() - startTime;
log.info("[CardReaderServiceImpl][IDCardReader][64]: 已过去时间: {} 毫秒", elapsedTime);
if (elapsedTime >= waitingTime) {
log.info("读取 ID 卡信息超时,等待了 {} 秒。", waitingTime);
log.info("[CardReaderServiceImpl][IDCardReader][66]: 读取 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 != null) {
if (handle != 0) {
log.info("[CardReaderServiceImpl][IDCardReader][82]: 开始关闭端口,句柄: {}", handle);
// 不管什么情况最终都要关闭端口
cardReaderSdk.ICC_Reader_Close(handle);
log.info("[CardReaderServiceImpl][IDCardReader][85]: 端口关闭成功");
}
}
}
@Override
public Result SocialSecurityCardReader() {
Long handle = null;
int handle = 0;
try {
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][94]: 开始连接指定设备与电脑端口,即打开端口");
// 连接指定设备与电脑端口即打开端口
handle = cardReaderSdk.ICC_Reader_Open("USB1");
log.info("连接指定设备与电脑端口,即打开端口:{}", handle);
// 读基本信息
String bas = cardReaderSdk.iReadCardBas(3);
log.info("读基本信息:{}", bas);
String[] split = bas.split("\\|");
SocialSecurityCardInfoVO socialSecurityCardInfoVO = new SocialSecurityCardInfoVO();
// 区号代码截取
socialSecurityCardInfoVO.setAreaCode(split[0].substring(split[0].length() - 6));
socialSecurityCardInfoVO.setSocialSecurityNo(split[1]);
socialSecurityCardInfoVO.setCardNumber(split[2]);
socialSecurityCardInfoVO.setIdentificationCode(split[3]);
socialSecurityCardInfoVO.setName(split[4]);
socialSecurityCardInfoVO.setCardResetInformation(split[5]);
socialSecurityCardInfoVO.setSpecificationVersion(split[6]);
socialSecurityCardInfoVO.setIssuanceDate(split[7]);
socialSecurityCardInfoVO.setExpireDate(split[8]);
socialSecurityCardInfoVO.setTerminalNumber(split[9]);
socialSecurityCardInfoVO.setTerminalDeviceNumber(split[10]);
return Result.ok(socialSecurityCardInfoVO);
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 对象");
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.error("Error occurred during card reader operation: ", e);
if (handle != null) {
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][171]: Error occurred during card reader operation: ", e);
if (handle != 0) {
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][173]: 开始关闭端口,句柄: {}", handle);
// 关闭端口
cardReaderSdk.ICC_Reader_Close(handle);
log.info("[CardReaderServiceImpl][SocialSecurityCardReader][176]: 端口关闭成功");
}
return Result.error("操作失败:" + e.getMessage());
}

View File

@ -1,10 +1,12 @@
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("SSSE32", CardReaderSdk.class);
CardReaderSdk INSTANCE = (CardReaderSdk) Native.loadLibrary(GetLibraryPath_Helper.GetLibraryPath(), CardReaderSdk.class);
/**
* 连接指定设备与电脑端口即打开端口
@ -12,7 +14,7 @@ public interface CardReaderSdk extends Library {
* @param devName 接口名称USB1
* @return >0成功<=0失败
*/
Long ICC_Reader_Open(String devName);
int ICC_Reader_Open(String devName);
/**
@ -21,7 +23,7 @@ public interface CardReaderSdk extends Library {
* @param ReaderHandle ICCReaderOpen函数所返回的值
* @return =0成功非0失败
*/
Long ICC_Reader_Close(Long ReaderHandle);
int ICC_Reader_Close(int ReaderHandle);
/**
@ -31,7 +33,7 @@ public interface CardReaderSdk extends Library {
* @param time 蜂鸣时间以毫秒为单位
* @return =0成功非0失败
*/
Long ICC_PosBeep(Long ReaderHandle, Long time);
int ICC_PosBeep(int ReaderHandle, int time);
/**
@ -39,7 +41,7 @@ public interface CardReaderSdk extends Library {
*
* @return 设备及动态库版本信息 =0成功非0失败
*/
Long ICC_Reader_Libinfo();
int ICC_Reader_Libinfo();
/**
@ -50,7 +52,7 @@ public interface CardReaderSdk extends Library {
* @param length 要读取的数据的长度
* @return 读取的数据 =0成功非0失败
*/
Long ICC_Reader_ReadEEPROM(Long ReaderHandle, int offset, int length);
int ICC_Reader_ReadEEPROM(int ReaderHandle, int offset, int length);
/**
@ -62,7 +64,7 @@ public interface CardReaderSdk extends Library {
* @param buffer 待写入的数据
* @return =0成功非0失败
*/
Long ICC_Reader_WriteEEPROM(Long ReaderHandle, int offset, int length, String buffer);
int ICC_Reader_WriteEEPROM(int ReaderHandle, int offset, int length, String buffer);
/**
@ -87,7 +89,7 @@ public interface CardReaderSdk extends Library {
* @return =0成功非0失败
*/
@Deprecated
Long ICC_Reader_DispSound(Long ReaderHandle, String voiceType);
int ICC_Reader_DispSound(int ReaderHandle, String voiceType);
/**
@ -103,7 +105,7 @@ public interface CardReaderSdk extends Library {
* 0x3x非接CPU卡
* @return 上电返回ATR值数据格式为十六进制字符串
*/
Long ICC_Reader_PowerOnHEX(Long ReaderHandle, String ICCSlotNo);
int ICC_Reader_PowerOnHEX(int ReaderHandle, String ICCSlotNo);
/**
@ -119,7 +121,7 @@ public interface CardReaderSdk extends Library {
* 0x3x非接CPU卡
* @return =0成功非0失败
*/
Long ICC_Reader_PowerOff(Long ReaderHandle, String ICCSlotNo);
int ICC_Reader_PowerOff(int ReaderHandle, String ICCSlotNo);
/**
@ -135,7 +137,7 @@ public interface CardReaderSdk extends Library {
* 0x3x非接CPU卡
* @return = 0 表示卡座有卡,其他见状态码
*/
Long ICC_Reader_GetStatus(Long ReaderHandle, String ICCSlotNo);
int ICC_Reader_GetStatus(int ReaderHandle, String ICCSlotNo);
/**
@ -152,7 +154,7 @@ public interface CardReaderSdk extends Library {
* @param CommandAPDU APDU命令数据以十六进制字符串形式输入
* @return 大于 0 表示执行成功,其值为 Response_APDU 的数据长度.否则表示执行失败
*/
Long ICC_Reader_ApplicationHEX(Long ReaderHandle, String ICCSlotNo, String CommandAPDU);
int ICC_Reader_ApplicationHEX(int ReaderHandle, String ICCSlotNo, String CommandAPDU);
/**
@ -161,7 +163,7 @@ public interface CardReaderSdk extends Library {
* @param ReaderHandle ICCReaderOpen函数所返回的值
* @return 返回卡片上电信息 = 0 表示成功,非0失败
*/
Long ICC_Reader_4428_PowerOnHEX(Long ReaderHandle);
int ICC_Reader_4428_PowerOnHEX(int ReaderHandle);
/**
@ -170,7 +172,7 @@ public interface CardReaderSdk extends Library {
* @param ReaderHandle ICCReaderOpen函数所返回的值
* @return = 0 表示成功,非0失败
*/
Long ICC_Reader_4442_PowerOff(Long ReaderHandle);
int ICC_Reader_4442_PowerOff(int ReaderHandle);
/**
@ -181,7 +183,7 @@ public interface CardReaderSdk extends Library {
* @param len 数据长度offset+len需小于256
* @return 返回卡片读取信息 = 0 表示成功,非0失败
*/
Long ICC_Reader_4428_ReadHEX(Long ReaderHandle, int offset, int len);
int ICC_Reader_4428_ReadHEX(int ReaderHandle, int offset, int len);
/**
@ -193,7 +195,7 @@ public interface CardReaderSdk extends Library {
* @param data 待写入卡片数据
* @return 返回卡片读取信息 = 0 表示成功,非0失败
*/
Long ICC_Reader_4428_WriteHEX(Long ReaderHandle, int offset, int len, String data);
int ICC_Reader_4428_WriteHEX(int ReaderHandle, int offset, int len, String data);
/**
@ -203,7 +205,7 @@ public interface CardReaderSdk extends Library {
* @param keyHex 卡密钥
* @return = 0 表示成功,非0失败
*/
Long ICC_Reader_4442_Verify(Long ReaderHandle, String keyHex);
int ICC_Reader_4442_Verify(int ReaderHandle, String keyHex);
/** ----- 非接触操作函数 -------------- */
/**
@ -212,7 +214,7 @@ public interface CardReaderSdk extends Library {
* @param ReaderHandle ICCReaderOpen函数所返回的值
* @return = 0 表示成功,非0失败
*/
Long PICC_Reader_Request(Long ReaderHandle);
int PICC_Reader_Request(int ReaderHandle);
/**
@ -222,7 +224,7 @@ public interface CardReaderSdk extends Library {
* @param flag 00-关场强 01-开场强
* @return = 0 表示成功,非0失败
*/
Long PICC_Reader_RFControl(Long ReaderHandle, String flag);
int PICC_Reader_RFControl(int ReaderHandle, String flag);
/** --------------- 非接 CPU 卡操作函数 ------------ */
@ -233,7 +235,7 @@ public interface CardReaderSdk extends Library {
* @return 输出上电成功返回的卡片复位信息(ATS) 返回ATS长度大于0 表示成功,其他失败
*/
@Deprecated
Long PICC_Reader_PowerOnTypeAHEX(Long ReaderHandle);
int PICC_Reader_PowerOnTypeAHEX(int ReaderHandle);
/**
@ -243,7 +245,7 @@ public interface CardReaderSdk extends Library {
* @return 输出上电成功返回的卡片复位信息(ATS) 返回ATS长度大于0 表示成功,其他失败
*/
@Deprecated
Long PICC_Reader_PowerOnTypeBHEX(Long ReaderHandle);
int PICC_Reader_PowerOnTypeBHEX(int ReaderHandle);
/**
* 非接触 CPU 卡执行APDU命令命令以十六进制字符串传输SSSE32.dll暴露函数中未发现该函数但是文档中有
@ -254,7 +256,7 @@ public interface CardReaderSdk extends Library {
* 大于 0 表示执行成功,其值为 Response_APDU 的数据长度.否则表示执行失败
*/
@Deprecated
Long PICC_Reader_ApplicationHEX(Long ReaderHandle, String CommandAPDU);
int PICC_Reader_ApplicationHEX(int ReaderHandle, String CommandAPDU);
/** ---------------- 二代证/外国人居留证/港澳台居住证 --------------- */
@ -264,7 +266,7 @@ public interface CardReaderSdk extends Library {
* @param ReaderHandle ICCReaderOpen函数所返回的值
* @return 返回身份证物理ID信息 = 0 表示成功,非0失败
*/
Long PICC_Reader_Read_CardID(Long ReaderHandle, byte[] response);
int PICC_Reader_Read_CardID(int ReaderHandle, byte[] response);
/**
@ -273,7 +275,7 @@ public interface CardReaderSdk extends Library {
* @param ReaderHandle ICCReaderOpen函数所返回的值
* @return 返回错误信息 = 0 表示成功,非0失败
*/
Long PICC_Reader_ReadIDCard(Long ReaderHandle);
int PICC_Reader_ReadIDCard(int ReaderHandle, byte[] response);
/** 以下函数须在 “PICC_Reader_ReadIDCard” 函数执行成功之后调用,否则获取不到有效信息 */
/**
@ -284,99 +286,99 @@ public interface CardReaderSdk extends Library {
* 2港澳台居民居住证
* 4新外国人永久居留证
*/
Integer GetCardType();
int GetCardType();
/**
* 姓名(类型为 1 时表示外国人中文姓名)
*/
Integer GetName(byte[] outParam);
int GetName(byte[] outParam);
/**
* 性别
*/
Integer GetSex(byte[] outParam);
int GetSex(byte[] outParam);
/**
* 民族
*/
Integer GetNation(byte[] outParam);
int GetNation(byte[] outParam);
/**
* 出生日期
*/
Integer GetBirth(byte[] outParam);
int GetBirth(byte[] outParam);
/**
* 住址
*/
Integer GetAddress(byte[] outParam);
int GetAddress(byte[] outParam);
/**
* 公民身份证号码(类型为 1时表示外国人居留证号码)
*/
Integer GetCertNo(byte[] outParam);
int GetCertNo(byte[] outParam);
/**
* 签发机关
*/
Integer GetDepartemt(byte[] outParam);
int GetDepartemt(byte[] outParam);
/**
* 有效起始日期
*/
Integer GetEffectDate(byte[] outParam);
int GetEffectDate(byte[] outParam);
/**
* 有效截止日期
*/
Integer GetExpireDate(byte[] outParam);
int GetExpireDate(byte[] outParam);
/**
* bmp 格式照片数据
*/
String GetBmpFileData(byte[] outParam);
int GetBmpFileData(byte[] outParam);
/**
* 生成照片
* TODO 入参参考文中3.4.1
*/
Integer GetBmpFile(byte[] outParam);
int GetBmpFile(byte[] outParam);
/**
* 是否含存在指纹信息存在时返回 512 或者 1024
* 不存在时返回 0
*/
Integer IsFingerExist();
int IsFingerExist();
/**
* 获取指纹数据成功时返回获取到的字节长度
*/
Integer GetFingerprint(byte[] outParam);
int GetFingerprint(byte[] outParam);
/**
* 外国人英文姓名
*/
Integer GetEnName(byte[] outParam);
int GetEnName(byte[] outParam);
/**
* 外国人国籍代码符合GB/T2659-2000规定
*/
Integer GetNationalityCode(byte[] outParam);
int GetNationalityCode(byte[] outParam);
/**
* 港澳台通行证号码
*/
Integer GetTXZHM(byte[] outParam);
int GetTXZHM(byte[] outParam);
/**
* 港澳台通行证签发次数
*/
Integer GetTXZQFCS(byte[] outParam);
int GetTXZQFCS(byte[] outParam);
/**
* 外国人换证次数
*/
Integer GetHZCS(byte[] outParam);
int GetHZCS(byte[] outParam);
/** ------------ 社保卡 ---------*/
/**
@ -389,7 +391,7 @@ public interface CardReaderSdk extends Library {
* 4-自动寻卡非接触式操作卡优先
* @return
*/
String iReadCardBas(Integer iType);
int iReadCardBas(int iType, byte[] data);
/**
* 基于加密机的读基本信息步骤一
@ -402,7 +404,7 @@ public interface CardReaderSdk extends Library {
* 4-自动寻卡非接触式操作卡优先
* @return
*/
Long iReadCardBas_HSM_Step1(Integer iType);
int iReadCardBas_HSM_Step1(int iType, byte[] data);
/**
* 基于加密机的读基本信息步骤二
@ -414,5 +416,51 @@ public interface CardReaderSdk extends Library {
* 原始信息16 拼接组成各数据项之间以|分割且最后一个数据项以|结尾
* @return
*/
Long iReadCardBas_HSM_Step2(String pKey, byte[] outParam);
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);
}

Binary file not shown.