| @@ -95,6 +95,7 @@ public class DaHua implements IHardwareEquipment { | |||||
| boolean ret = LoginModule.netsdk.CLIENT_ControlDeviceEx(info.getLoginHandle(), | boolean ret = LoginModule.netsdk.CLIENT_ControlDeviceEx(info.getLoginHandle(), | ||||
| NetSDKLib.CtrlType.CTRLTYPE_CTRL_ACCESS_OPEN, pointer, null, 10000); | NetSDKLib.CtrlType.CTRLTYPE_CTRL_ACCESS_OPEN, pointer, null, 10000); | ||||
| if (!ret) { | if (!ret) { | ||||
| System.err.println("开门失败!" + ToolKits.getErrorCodePrint()); | |||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -227,6 +228,8 @@ public class DaHua implements IHardwareEquipment { | |||||
| if(recordNo != 0){ | if(recordNo != 0){ | ||||
| if(GateModule.deleteCardV2(info.getLoginHandle(),recordNo) && GateModule.deleteFaceInfoV2(info.getLoginHandle(),employeeNo)){ | if(GateModule.deleteCardV2(info.getLoginHandle(),recordNo) && GateModule.deleteFaceInfoV2(info.getLoginHandle(),employeeNo)){ | ||||
| return true; | return true; | ||||
| }else{ | |||||
| System.err.println("删除人员失败!" + ToolKits.getErrorCodePrint()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -242,6 +245,9 @@ public class DaHua implements IHardwareEquipment { | |||||
| private boolean addUserFace(String userId,byte[] imageBytes){ | private boolean addUserFace(String userId,byte[] imageBytes){ | ||||
| Memory memory = ToolKits.readPictureBytes(imageBytes); | Memory memory = ToolKits.readPictureBytes(imageBytes); | ||||
| boolean b = GateModule.addFaceInfoV2(info.getLoginHandle(),userId, memory); | boolean b = GateModule.addFaceInfoV2(info.getLoginHandle(),userId, memory); | ||||
| if(!b){ | |||||
| System.err.println("添加人脸失败!" + ToolKits.getErrorCodePrint()); | |||||
| } | |||||
| return b; | return b; | ||||
| } | } | ||||
| @@ -254,6 +260,9 @@ public class DaHua implements IHardwareEquipment { | |||||
| private boolean updateUserFace(String userId,byte[] imageBytes){ | private boolean updateUserFace(String userId,byte[] imageBytes){ | ||||
| Memory memory = ToolKits.readPictureBytes(imageBytes); | Memory memory = ToolKits.readPictureBytes(imageBytes); | ||||
| boolean b = GateModule.modifyFaceInfoV2(info.getLoginHandle(),userId, memory); | boolean b = GateModule.modifyFaceInfoV2(info.getLoginHandle(),userId, memory); | ||||
| if(!b){ | |||||
| System.err.println("更新人脸失败!" + ToolKits.getErrorCodePrint()); | |||||
| } | |||||
| return b; | return b; | ||||
| } | } | ||||
| @@ -269,7 +278,9 @@ public class DaHua implements IHardwareEquipment { | |||||
| String endTime = userFaceInfo.getEndTime(); | String endTime = userFaceInfo.getEndTime(); | ||||
| String cardNo = userFaceInfo.getCardNo(); | String cardNo = userFaceInfo.getCardNo(); | ||||
| boolean b = GateModule.insertCardV2(info.getLoginHandle(),cardNo, employeeNo, employeeName, "", 0, 0, 0, 0, 1, startTime, endTime); | boolean b = GateModule.insertCardV2(info.getLoginHandle(),cardNo, employeeNo, employeeName, "", 0, 0, 0, 0, 1, startTime, endTime); | ||||
| if(!b){ | |||||
| System.err.println("添加用户卡失败!" + ToolKits.getErrorCodePrint()); | |||||
| } | |||||
| return b; | return b; | ||||
| } | } | ||||
| @@ -288,6 +299,9 @@ public class DaHua implements IHardwareEquipment { | |||||
| int recordNo = this.findRecordNo(employeeNo); | int recordNo = this.findRecordNo(employeeNo); | ||||
| boolean b = GateModule.modifyCardV2(info.getLoginHandle(),recordNo,cardNo, employeeNo, employeeName, "", 0, 0, 0, 0, 1, startTime, endTime); | boolean b = GateModule.modifyCardV2(info.getLoginHandle(),recordNo,cardNo, employeeNo, employeeName, "", 0, 0, 0, 0, 1, startTime, endTime); | ||||
| if(!b){ | |||||
| System.err.println("更新用户卡失败!" + ToolKits.getErrorCodePrint()); | |||||
| } | |||||
| return b; | return b; | ||||
| } | } | ||||
| @@ -298,6 +312,7 @@ public class DaHua implements IHardwareEquipment { | |||||
| NetSDKLib.LLong findHandle = GateModule.findCardV2(this.info.getLoginHandle(), "", employeeNo); | NetSDKLib.LLong findHandle = GateModule.findCardV2(this.info.getLoginHandle(), "", employeeNo); | ||||
| this.info.setFindHandle(findHandle); | this.info.setFindHandle(findHandle); | ||||
| if(findHandle.longValue() == 0) { | if(findHandle.longValue() == 0) { | ||||
| System.err.println("获取用户卡查询句柄失败!" + ToolKits.getErrorCodePrint()); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -305,6 +320,7 @@ public class DaHua implements IHardwareEquipment { | |||||
| while(true) { | while(true) { | ||||
| NetSDKLib.NET_RECORDSET_ACCESS_CTL_CARD[] pstRecord = GateModule.findNextCardV2(this.info.getFindHandle(),nFindCount); | NetSDKLib.NET_RECORDSET_ACCESS_CTL_CARD[] pstRecord = GateModule.findNextCardV2(this.info.getFindHandle(),nFindCount); | ||||
| if(pstRecord == null) { | if(pstRecord == null) { | ||||
| System.err.println("查询用户卡失败!" + ToolKits.getErrorCodePrint()); | |||||
| break; | break; | ||||
| } | } | ||||
| @@ -332,6 +348,7 @@ public class DaHua implements IHardwareEquipment { | |||||
| NetSDKLib.LLong findHandle = GateModule.findCardV2(this.info.getLoginHandle(), "", ""); | NetSDKLib.LLong findHandle = GateModule.findCardV2(this.info.getLoginHandle(), "", ""); | ||||
| this.info.setFindHandle(findHandle); | this.info.setFindHandle(findHandle); | ||||
| if(findHandle.longValue() == 0) { | if(findHandle.longValue() == 0) { | ||||
| System.err.println("获取用户卡查询句柄失败!" + ToolKits.getErrorCodePrint()); | |||||
| return userFaceInfoList; | return userFaceInfoList; | ||||
| } | } | ||||
| @@ -339,6 +356,7 @@ public class DaHua implements IHardwareEquipment { | |||||
| while(true) { | while(true) { | ||||
| NetSDKLib.NET_RECORDSET_ACCESS_CTL_CARD[] pstRecord = GateModule.findNextCardV2(this.info.getFindHandle(),nFindCount); | NetSDKLib.NET_RECORDSET_ACCESS_CTL_CARD[] pstRecord = GateModule.findNextCardV2(this.info.getFindHandle(),nFindCount); | ||||
| if(pstRecord == null) { | if(pstRecord == null) { | ||||
| System.err.println("查询用户卡失败!" + ToolKits.getErrorCodePrint()); | |||||
| break; | break; | ||||
| } | } | ||||
| @@ -370,6 +388,8 @@ public class DaHua implements IHardwareEquipment { | |||||
| public boolean clearAllPerson(){ | public boolean clearAllPerson(){ | ||||
| if(GateModule.clearCardV2(this.info.getLoginHandle()) && GateModule.clearFaceInfoV2(this.info.getLoginHandle())){ | if(GateModule.clearCardV2(this.info.getLoginHandle()) && GateModule.clearFaceInfoV2(this.info.getLoginHandle())){ | ||||
| return true; | return true; | ||||
| }else{ | |||||
| System.err.println("清除所有用户数据失败!" + ToolKits.getErrorCodePrint()); | |||||
| } | } | ||||
| return false; | return false; | ||||
| @@ -380,6 +400,9 @@ public class DaHua implements IHardwareEquipment { | |||||
| public boolean login() { | public boolean login() { | ||||
| NetSDKLib.LLong lLong = LoginModule.login2(info.getIp(),info.getPort(),info.getUsername(),info.getPassword()); | NetSDKLib.LLong lLong = LoginModule.login2(info.getIp(),info.getPort(),info.getUsername(),info.getPassword()); | ||||
| this.info.setLoginHandle(lLong); | this.info.setLoginHandle(lLong); | ||||
| if(lLong.longValue() == 0){ | |||||
| System.err.println("登录失败!" + ToolKits.getErrorCodePrint()); | |||||
| } | |||||
| return true; | return true; | ||||
| } | } | ||||