数据库新增和测温数据

master
liuguijing 1 year ago
parent 4a8178e10a
commit e4a7c18a8a

@ -61,38 +61,32 @@
<version>3.5.6</version>
</dependency>
<!--Swagger-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>${swagger.version}</version>
</dependency>
<!-- &lt;!&ndash;Swagger&ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>io.springfox</groupId>-->
<!-- <artifactId>springfox-boot-starter</artifactId>-->
<!-- <version>${swagger.version}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>io.jsonwebtoken</groupId>-->
<!-- <artifactId>jjwt</artifactId>-->
<!-- <version>${jwt.version}</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; swagger ui&ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>com.github.xiaoymin</groupId>-->
<!-- <artifactId>knife4j-spring-boot-starter</artifactId>-->
<!-- <version>${knife4j-spring-boot.version}</version>-->
<!-- </dependency>-->
<!-- swagger ui-->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>${knife4j-spring-boot.version}</version>
</dependency>
<!-- &lt;!&ndash;指定swagger-models版本解决报错&ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>io.swagger</groupId>-->
<!-- <artifactId>swagger-annotations</artifactId>-->
<!-- <version>${swagger-annotations.version}</version>-->
<!-- </dependency>-->
<!--指定swagger-models版本解决报错-->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-annotations.version}</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>${swagger-models.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>io.swagger</groupId>-->
<!-- <artifactId>swagger-models</artifactId>-->
<!-- <version>${swagger-models.version}</version>-->
<!-- </dependency>-->
<!-- Mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>

@ -1,23 +1,9 @@
package com.shxy.xyhkcamera.utils;
package com.shxy.xyhkcamera;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.core.toolkit.ArrayUtils;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import com.baomidou.mybatisplus.generator.config.GlobalConfig;
import com.baomidou.mybatisplus.generator.config.PackageConfig;
import com.baomidou.mybatisplus.generator.config.StrategyConfig;
import com.baomidou.mybatisplus.generator.config.converts.MySqlTypeConvert;
import com.baomidou.mybatisplus.generator.config.po.TableField;
import com.baomidou.mybatisplus.generator.config.rules.DateType;
import com.baomidou.mybatisplus.generator.config.rules.IColumnType;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -47,7 +33,7 @@ public class MyBatisPlusGenerator {
.controllerBuilder().enableRestStyle().enableHyphenStyle().build();
builder.serviceBuilder()
.formatServiceFileName("%sService")
.formatServiceImplFileName("%sServiceImp")
.formatServiceImplFileName("%sServiceImpl")
.build();
//entity的策略配置
builder.entityBuilder()

@ -4,7 +4,7 @@
//
//
//import CommonMethod.osSelect;
//import com.shxy.xyhkcamera.HCNetSDK;
//import com.shxy.xyhkcamera.hk.HCNetSDK;
//import com.sun.jna.Native;
//import com.sun.jna.Pointer;
//

File diff suppressed because it is too large Load Diff

@ -1,22 +1,22 @@
//
//package com.shxy.xyhkcamera.alarm;
//
//import com.shxy.xyhkcamera.HCNetSDK;
//import com.sun.jna.Pointer;
//
//
//
//public class FMSGCallBack_V31 implements HCNetSDK.FMSGCallBack_V31 {
// //报警信息回调函数
// public boolean invoke(int lCommand, HCNetSDK.NET_DVR_ALARMER pAlarmer, Pointer pAlarmInfo, int dwBufLen, Pointer pUser) {
// AlarmDataParse.alarmDataHandle(lCommand, pAlarmer, pAlarmInfo, dwBufLen, pUser);
// return true;
// }
//}
//
//
//
//
//
//
//
package com.shxy.xyhkcamera.alarm;
import com.shxy.xyhkcamera.hk.HCNetSDK;
import com.sun.jna.Pointer;
public class FMSGCallBack_V31 implements HCNetSDK.FMSGCallBack_V31 {
//报警信息回调函数
public boolean invoke(int lCommand, HCNetSDK.NET_DVR_ALARMER pAlarmer, Pointer pAlarmInfo, int dwBufLen, Pointer pUser) {
AlarmDataParse.alarmDataHandle(lCommand, pAlarmer, pAlarmInfo, dwBufLen, pUser);
return true;
}
}

@ -0,0 +1,99 @@
package com.shxy.xyhkcamera.ascest;
import com.shxy.xyhkcamera.hk.HCNetSDK;
import com.sun.jna.ptr.IntByReference;
/**
*
* 1
* 2
*/
public final class ACSManage {
/**
*
*
* @param lUserID
*/
public static void acsCfg(int lUserID) {
/**获取门禁主机参数*/
HCNetSDK.NET_DVR_ACS_CFG struAcsCfg = new HCNetSDK.NET_DVR_ACS_CFG();
struAcsCfg.dwSize = struAcsCfg.size();
struAcsCfg.write();
IntByReference intByReference = new IntByReference(0);
boolean b_GetAcsCfg = AcsMain.hCNetSDK.NET_DVR_GetDVRConfig(lUserID, HCNetSDK.NET_DVR_GET_ACS_CFG, 0xFFFFFFFF, struAcsCfg.getPointer(),
struAcsCfg.size(), intByReference);
if (b_GetAcsCfg = false) {
System.out.println("获取门禁主机参数,错误码为" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
return;
} else {
System.out.println("获取门禁主机参数成功");
struAcsCfg.read();
System.out.println("1.是否显示抓拍图片:" + struAcsCfg.byShowCapPic + "\n"); //是否显示抓拍图片, 0-不显示1-显示
System.out.println("2.是否显示卡号:" + struAcsCfg.byShowCardNo + "\n"); //是否显示卡号0-不显示1-显示
System.out.println("3.是否开启语音提示:" + struAcsCfg.byVoicePrompt + "\n"); //是否启用语音提示0-不启用1-启用
System.out.println("4.联动抓图是否上传:" + struAcsCfg.byUploadCapPic + "\n"); //联动抓拍是否上传图片0-不上传1-上传
}
/**设置门禁主机参数*/
struAcsCfg.byShowCardNo = 1; //开启显示卡号
struAcsCfg.byVoicePrompt = 0; //关闭语音提示
struAcsCfg.byUploadCapPic = 1; //开启联动抓图后,设备上抓拍的图片才会通过报警布防上传,否则没有不上传
struAcsCfg.byShowCapPic = 1;
struAcsCfg.write();
boolean b_SetAcsCfg = AcsMain.hCNetSDK.NET_DVR_SetDVRConfig(lUserID, HCNetSDK.NET_DVR_SET_ACS_CFG, 0xFFFFFFFF, struAcsCfg.getPointer(), struAcsCfg.size());
if (b_SetAcsCfg = false) {
System.out.println("设置门禁主机参数,错误码为:" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
return;
} else {
System.out.println("设置门禁主机参数成功!!!");
}
}
/**
*
*
* @param lUserID
*/
public static void getAcsStatus(int lUserID){
HCNetSDK.NET_DVR_ACS_WORK_STATUS_V50 netDvrAcsWorkStatusV50 = new HCNetSDK.NET_DVR_ACS_WORK_STATUS_V50();
netDvrAcsWorkStatusV50.dwSize = netDvrAcsWorkStatusV50.size();
netDvrAcsWorkStatusV50.write();
IntByReference intByReference = new IntByReference(0);
boolean b_GetAcsStatus = AcsMain.hCNetSDK.NET_DVR_GetDVRConfig(lUserID, HCNetSDK.NET_DVR_GET_ACS_WORK_STATUS_V50, 0xFFFFFFFF, netDvrAcsWorkStatusV50.getPointer(),
netDvrAcsWorkStatusV50.size(), intByReference);
if (b_GetAcsStatus = false) {
System.out.println("获取门禁主机工作状态,错误码为:" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
return;
} else {
System.out.println("获取门禁主机工作状态成功!!!");
netDvrAcsWorkStatusV50.read();
System.out.println("1.门锁状态(或者梯控的继电器开合状态):" + netDvrAcsWorkStatusV50.byDoorLockStatus[0] + "\n"); //门锁状态0- 正常关1- 正常开2- 短路报警3- 断路报警4- 异常报警
System.out.println("2.门状态(或者梯控的楼层状态):" + netDvrAcsWorkStatusV50.byDoorStatus[0] + "\n"); //门状态或者梯控的楼层状态1- 休眠2- 常开状态对于梯控表示自由状态3- 常闭状态对于梯控表示禁用状态4- 普通状态(对于梯控,表示受控状态)
System.out.println("3.门磁状态:" + netDvrAcsWorkStatusV50.byMagneticStatus[0] + "\n"); //门磁状态0-正常关1-正常开2-短路报警3-断路报警4-异常报警
System.out.println("4.事件报警输入状态:" + netDvrAcsWorkStatusV50.byCaseStatus[0] + "\n"); //事件报警输入状态0- 无输入1- 有输入
}
}
/**
*
* @param userID
*/
public static void remoteControlGate(int userID)
{
/**lGatewayIndex
[in] ID1-1
dwStaic
[in] 0- 1- 2- 3- 4- 5- 访6- */
boolean b_gate= AcsMain.hCNetSDK.NET_DVR_ControlGateway(userID,1,1);
if (b_gate==false)
{
System.out.println("远程控门失败,err="+ AcsMain.hCNetSDK.NET_DVR_GetLastError());
return;
}
System.out.println("远程控门成功");
return;
}
}

@ -0,0 +1,220 @@
package com.shxy.xyhkcamera.ascest;
import com.shxy.xyhkcamera.hk.HCNetSDK;
import com.shxy.xyhkcamera.utils.osSelect;
import com.sun.jna.Native;
import java.io.UnsupportedEncodingException;
public class AcsMain {
static HCNetSDK hCNetSDK = null;
static int lUserID = -1;//用户句柄
static int iCharEncodeType = 0;//设备字符集
/**
*
* @return
*/
private static boolean createSDKInstance()
{
if(hCNetSDK == null)
{
synchronized (HCNetSDK.class)
{
String strDllPath = "";
try
{
//System.setProperty("jna.debug_load", "true");
if(osSelect.isWindows())
//win系统加载库路径
strDllPath = System.getProperty("user.dir") + "\\lib\\HCNetSDK.dll";
else if(osSelect.isLinux())
//Linux系统加载库路径
strDllPath = System.getProperty("user.dir") + "/lib/libhcnetsdk.so";
hCNetSDK = (HCNetSDK) Native.loadLibrary(strDllPath, HCNetSDK.class);
}catch (Exception ex) {
System.out.println("loadLibrary: " + strDllPath + " Error: " + ex.getMessage());
return false;
}
}
}
return true;
}
/**
* @param args
* @throws UnsupportedEncodingException
* @throws InterruptedException
*/
public static void main(String[] args) throws UnsupportedEncodingException, InterruptedException {
if(hCNetSDK == null)
{
if(!createSDKInstance())
{
System.out.println("Load SDK fail");
return;
}
}
//linux系统建议调用以下接口加载组件库
if (osSelect.isLinux())
{
HCNetSDK.BYTE_ARRAY ptrByteArray1 = new HCNetSDK.BYTE_ARRAY(256);
HCNetSDK.BYTE_ARRAY ptrByteArray2 = new HCNetSDK.BYTE_ARRAY(256);
//这里是库的绝对路径,请根据实际情况修改,注意改路径必须有访问权限
String strPath1 = System.getProperty("user.dir") + "/lib/libcrypto.so.1.1";
String strPath2 = System.getProperty("user.dir") + "/lib/libssl.so.1.1";
System.arraycopy(strPath1.getBytes(), 0, ptrByteArray1.byValue, 0, strPath1.length());
ptrByteArray1.write();
hCNetSDK.NET_DVR_SetSDKInitCfg(3, ptrByteArray1.getPointer());
System.arraycopy(strPath2.getBytes(), 0, ptrByteArray2.byValue, 0, strPath2.length());
ptrByteArray2.write();
hCNetSDK.NET_DVR_SetSDKInitCfg(4, ptrByteArray2.getPointer());
String strPathCom = System.getProperty("user.dir") + "/lib/";
HCNetSDK.NET_DVR_LOCAL_SDK_PATH struComPath = new HCNetSDK.NET_DVR_LOCAL_SDK_PATH();
System.arraycopy(strPathCom.getBytes(), 0, struComPath.sPath, 0, strPathCom.length());
struComPath.write();
hCNetSDK.NET_DVR_SetSDKInitCfg(2, struComPath.getPointer());
}
hCNetSDK.NET_DVR_Init();
//开启SDK日志打印
boolean i= hCNetSDK.NET_DVR_SetLogToFile(3, "./sdklog", false);
login_V40("10.16.36.13","admin","hik12345",(short) 8000); //登陆设备
/**
*
*/
// UserManage.searchUserInfo(lUserID); //查询所有人员
// UserManage.deleteUserInfo(lUserID);
// UserManage.addUserInfo(lUserID,"test20221122"); //添加人员
/**
*
*/
// FaceManage.searchFaceInfo(lUserID,"tset123");
// FaceManage.addFaceByBinary(lUserID,"test20221122");
// FaceManage.addFaceByUrl(lUserID,"test111");
// FaceManage.deleteFaceInfo(lUserID,"test111");
// FaceManage.captureFaceInfo(lUserID);
/**
*
*/
// CardManage.searchCardInfo(lUserID,"ceshi1");
// CardManage.addCardInfo(lUserID,"12345");
// CardManage.searchCardInfo(lUserID,"test111");
// CardManage.searchAllCardInfo(lUserID);
// CardManage.deleteCardInfo(lUserID,"111");
// CardManage.deleteAllCardInfo(lUserID);
// CardManage.getAllCardNumber(lUserID);
/**
*
*/
// FingerManage.fingerCapture(lUserID);
// FingerManage.fingerCpaureByisapi(lUserID);
// FingerManage.fingerCpaureByisapi(lUserID);
// FingerManage.SearchFingerInfo(lUserID,"2222");
//指纹数据的BASE64编码
// String fingerdata="";
// FingerManage.setOneFinger(lUserID,"zhangsan",fingerdata);
// FingerManage.deleteFinger(lUserID,"zhangsan");
/**
*
*/
// EventSearch.searchAllEvent(lUserID);
//多重认证
// MutilCard.setGroupCfg(lUserID);
// MutilCard.setMultiCardCfg(lUserID);
//计划模板
// UserManage.setCardTemplate(lUserID,2);
/**
* sleep
*/
Thread.sleep(20000);
/**
*
*/
AcsMain.logout();
//释放SDK程序退出前调用
hCNetSDK.NET_DVR_Cleanup();
}
/**
*
* @param ipadress IP
* @param user
* @param psw
* @param port 8000
*/
public static void login_V40(String ipadress, String user, String psw, short port) {
//注册
HCNetSDK.NET_DVR_USER_LOGIN_INFO m_strLoginInfo = new HCNetSDK.NET_DVR_USER_LOGIN_INFO();//设备登录信息
String m_sDeviceIP = ipadress;//设备ip地址
m_strLoginInfo.sDeviceAddress = new byte[HCNetSDK.NET_DVR_DEV_ADDRESS_MAX_LEN];
System.arraycopy(m_sDeviceIP.getBytes(), 0, m_strLoginInfo.sDeviceAddress, 0, m_sDeviceIP.length());
String m_sUsername = user;//设备用户名
m_strLoginInfo.sUserName = new byte[HCNetSDK.NET_DVR_LOGIN_USERNAME_MAX_LEN];
System.arraycopy(m_sUsername.getBytes(), 0, m_strLoginInfo.sUserName, 0, m_sUsername.length());
String m_sPassword = psw;//设备密码
m_strLoginInfo.sPassword = new byte[HCNetSDK.NET_DVR_LOGIN_PASSWD_MAX_LEN];
System.arraycopy(m_sPassword.getBytes(), 0, m_strLoginInfo.sPassword, 0, m_sPassword.length());
m_strLoginInfo.wPort = port; //sdk端口
m_strLoginInfo.bUseAsynLogin = false; //是否异步登录0- 否1- 是
m_strLoginInfo.write();
HCNetSDK.NET_DVR_DEVICEINFO_V40 m_strDeviceInfo = new HCNetSDK.NET_DVR_DEVICEINFO_V40();//设备信息
lUserID = hCNetSDK.NET_DVR_Login_V40(m_strLoginInfo, m_strDeviceInfo);
if (lUserID == -1) {
System.out.println("登录失败,错误码为" + hCNetSDK.NET_DVR_GetLastError());
return;
} else {
System.out.println("登录成功!");
m_strDeviceInfo.read();
iCharEncodeType = m_strDeviceInfo.byCharEncodeType;
return;
}
}
/**
*
*
*/
public static void logout(){
/**登出和清理释放SDK资源*/
if (lUserID>=0)
{
if (!hCNetSDK.NET_DVR_Logout(lUserID))
{
System.out.println("设备注销失败,错误码:" + hCNetSDK.NET_DVR_GetLastError());
return;
}
System.out.println("设备注销成功!!!");
}
}
}//AcsMain Class结束

@ -0,0 +1,215 @@
//package com.shxy.xyhkcamera.ascest;
//
//
//import com.shxy.xyhkcamera.hk.HCNetSDK;
//import com.sun.jna.ptr.IntByReference;
//
///**
// * 卡管理,以人为中心,要先下发工号,卡号要关联在人员工号上
// */
//public final class CardManage {
//
//
//// /**
//// * 下发卡号,
//// * @param userID 用户注册ID
//// * @param cardNo 卡号
//// */
//// public static void addCardInfo(int userID,String cardNo) {
//// HCNetSDK.BYTE_ARRAY ptrByteArray = new HCNetSDK.BYTE_ARRAY(1024); //数组
//// String strInBuffer = "POST /ISAPI/AccessControl/CardInfo/Record?format=json";
//// System.arraycopy(strInBuffer.getBytes(), 0, ptrByteArray.byValue, 0, strInBuffer.length());//字符串拷贝到数组中
//// ptrByteArray.write();
////
//// int lHandler = AcsMain.hCNetSDK.NET_DVR_StartRemoteConfig(userID, HCNetSDK.NET_DVR_JSON_CONFIG, ptrByteArray.getPointer(), strInBuffer.length(), null, null);
//// if (lHandler < 0)
//// {
//// System.out.println("AddCardInfo NET_DVR_StartRemoteConfig 失败,错误码为"+AcsMain.hCNetSDK.NET_DVR_GetLastError());
//// return;
//// }
//// else{
//// System.out.println("AddCardInfo NET_DVR_StartRemoteConfig 成功!");
//// HCNetSDK.BYTE_ARRAY lpInput = new HCNetSDK.BYTE_ARRAY(1024); //数组
//// String strJsonData = "{\n" +
//// " \"CardInfo\" : {\n" +
//// " \"employeeNo\":\"ceshi1\", \n" +
//// " \"cardNo\":\""+cardNo+"\", \n" +
//// " \"cardType\":\"normalCard\"\n" +
//// " } \n" +
//// "}";
//// System.arraycopy(strJsonData.getBytes(), 0, lpInput.byValue, 0, strJsonData.length());//字符串拷贝到数组中
//// lpInput.write();
//// HCNetSDK.BYTE_ARRAY ptrOutuff = new HCNetSDK.BYTE_ARRAY(1024);
//// IntByReference pInt = new IntByReference(0);
//// while(true){
//// /*
//// 如果需要批量下发循环调用NET_DVR_SendWithRecvRemoteConfig接口进行下发不同的卡号下发结束完成后关闭下发卡号长连接
//// */
//// int dwState = AcsMain.hCNetSDK.NET_DVR_SendWithRecvRemoteConfig(lHandler, lpInput.getPointer(), lpInput.byValue.length ,ptrOutuff.getPointer(), 1024, pInt);
//// //读取返回的json并解析
//// ptrOutuff.read();
//// String strResult = new String(ptrOutuff.byValue).trim();
//// System.out.println("dwState:" + dwState + ",strResult:" + strResult);
////
//// JSONObject jsonResult = new JSONObject(strResult);
//// int statusCode = jsonResult.getInt("statusCode");
//// String statusString = jsonResult.getString("statusString");
////
//// if(dwState == -1){
//// System.out.println("NET_DVR_SendWithRecvRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
//// break;
//// }
//// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_NEED_WAIT)
//// {
//// System.out.println("配置等待");
//// try {
//// Thread.sleep(10);
//// } catch (InterruptedException e) {
//// e.printStackTrace();
//// }
//// continue;
//// }
//// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_FAILED)
//// {
//// System.out.println("下发卡号失败, json retun:" + jsonResult.toString());
//// break;
//// }
//// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_EXCEPTION)
//// {
//// System.out.println("下发卡号异常, json retun:" + jsonResult.toString());
//// break;
//// }
//// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_SUCCESS)
//// {
//// if (statusCode != 1){
//// System.out.println("下发卡号成功,但是有异常情况:" + jsonResult.toString());
//// }
//// else{
//// System.out.println("下发卡号成功, json retun:" + jsonResult.toString());
//// }
//// break;
//// }
//// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_FINISH) {
////
//// System.out.println("下发卡号完成");
//// break;
//// }
//// }
//// if(!AcsMain.hCNetSDK.NET_DVR_StopRemoteConfig(lHandler)){
//// System.out.println("NET_DVR_StopRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
//// }
//// else{
//// System.out.println("NET_DVR_StopRemoteConfig接口成功");
//// }
//// }
//// }
//
//
// /**
// * 按照人员工号查询卡号
// * @param userID
// * @param employeeNo
// */
// public static void searchCardInfo(int userID, String employeeNo)
// {
// String searchCardInfoUrl="POST /ISAPI/AccessControl/CardInfo/Search?format=json";
// String searchCardInfojson="{\n" +
// " \"CardInfoSearchCond\": {\n" +
// " \"searchID\": \"20201014001\",\n" +
// " \"searchResultPosition\": 0,\n" +
// " \"maxResults\": 30,\n" +
// " \"EmployeeNoList\" : [\n" +
// " {\n" +
// " \"employeeNo\": \""+employeeNo+"\"\n" +
// " }\n" +
// " ]\n" +
// " }\n" +
// "}";
// String result= TransIsapi.put_isapi(userID,searchCardInfoUrl,searchCardInfojson);
// System.out.println(result);
//
// }
//
// /**
// * 查询所有卡号
// * @param userID
// */
// public static void searchAllCardInfo(int userID)
// {
// String searchCardInfoUrl="POST /ISAPI/AccessControl/CardInfo/Search?format=json";
// /*
// "searchID": "", //必填,搜索记录唯一标识,用来确认上层客户端是否为同一个(倘若是同一个,设备记录内存,
// 下次搜索加快速度),string类型
// "searchResultPosition": 0, //必填,查询结果在结果列表中的起始位置,integer32类型;当记录条数很多时,
// 一次查询不能获取所有的记录,下一次查询时指定位置可以查询后面的记录
// "maxResults": 30, //必填,本次协议调用可获取的最大记录数,integer32类型如maxResults值大于设备能力集返回的范围
// 则设备按照能力集最大值返回,设备不进行报错
// */
// String searchCardInfojson="{\n" +
// " \"CardInfoSearchCond\": {\n" +
// " \"searchID\": \"20211129001\",\n" +
// " \"searchResultPosition\": 0,\n" +
// " \"maxResults\": 30\n" +
// " }\n" +
// "}";
// String result= com.shxy.xyhkcamera.asc.TransIsapi.put_isapi(userID,searchCardInfoUrl,searchCardInfojson);
// System.out.println(result);
// }
//
//
// /**
// * 根据工号删除卡号,
// * @param userID
// * @param employeeNo
// */
// public static void deleteCardInfo(int userID,String employeeNo )
// {
// String deleteCardInfoURL="PUT /ISAPI/AccessControl/CardInfo/Delete?format=json ";
// String deleteCardInfojson="{\n" +
// " \"CardInfoDelCond\" : {\n" +
// " \"EmployeeNoList\" : [ \n" +
// " {\n" +
// " \"employeeNo\": \""+employeeNo+"\" \n" +
// " }\n" +
// " ]\n" +
// " }\n" +
// "}\n";
// String result= com.shxy.xyhkcamera.asc.TransIsapi.put_isapi(userID,deleteCardInfoURL,deleteCardInfojson);
// System.out.println(result);
// }
//
//
// /**
// * 删除全部卡号信息,
// * @param userID
// */
// public static void deleteAllCardInfo(int userID)
// {
// String deleteAllCardInfoURL="PUT /ISAPI/AccessControl/CardInfo/Delete?format=json";
// String deleteAllCardInfoJson="{\"CardInfoDelCond\" : {}}";
// /*
// 如果涉及大批量卡号删除设备需要一定的时间去处理需要将超时时间设置成60sput_isapi中的NET_DVR_XML_CONFIG_INPUT中dwRecvTimeOut
// 参数设置成60000
// */
// String result= com.shxy.xyhkcamera.asc.TransIsapi.put_isapi(userID,deleteAllCardInfoURL,deleteAllCardInfoJson);
// System.out.println(result);
// }
////
////
//// /**
//// * 获取所有卡数量
//// * @param userID
//// * @return
//// */
//// public static int getAllCardNumber(int userID) {
//// String getAllCardNumberUrl="GET /ISAPI/AccessControl/CardInfo/Count?format=json";
//// String result= com.shxy.xyhkcamera.asc.TransIsapi.get_isapi(userID,getAllCardNumberUrl);
//// System.out.println(result);
//// JSONObject jsonObject=new JSONObject(result);
//// int num=jsonObject.optJSONObject("CardInfoCount").getInt("cardNumber");
//// return num;
//// }
//
//
//
//}

@ -0,0 +1,121 @@
package com.shxy.xyhkcamera.ascest;
import com.shxy.xyhkcamera.hk.HCNetSDK;
import com.sun.jna.Pointer;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
/**
*
*/
public final class EventSearch {
public static void searchAllEvent(int lUserID) throws UnsupportedEncodingException, InterruptedException {
int i = 0; //事件条数
HCNetSDK.NET_DVR_ACS_EVENT_COND struAcsEventCond = new HCNetSDK.NET_DVR_ACS_EVENT_COND();
struAcsEventCond.read();
struAcsEventCond.dwSize = struAcsEventCond.size();
//查询全部主次类型的报警
struAcsEventCond.dwMajor = 0; // 主次事件类型设为0代表查询所有事件
struAcsEventCond.dwMinor = 0; //
//开始时间
struAcsEventCond.struStartTime.dwYear = 2022;
struAcsEventCond.struStartTime.dwMonth = 4;
struAcsEventCond.struStartTime.dwDay = 27;
struAcsEventCond.struStartTime.dwHour = 9;
struAcsEventCond.struStartTime.dwMinute = 0;
struAcsEventCond.struStartTime.dwSecond = 0;
//结束时间
struAcsEventCond.struEndTime.dwYear = 2022;
struAcsEventCond.struEndTime.dwMonth = 4;
struAcsEventCond.struEndTime.dwDay = 30;
struAcsEventCond.struEndTime.dwHour = 16;
struAcsEventCond.struEndTime.dwMinute = 0;
struAcsEventCond.struEndTime.dwSecond = 0;
struAcsEventCond.wInductiveEventType = 1;
struAcsEventCond.byPicEnable = 1; //是否带图片0-不带图片1-带图片
struAcsEventCond.write();
Pointer ptrStruEventCond = struAcsEventCond.getPointer();
int m_lSearchEventHandle = AcsMain.hCNetSDK.NET_DVR_StartRemoteConfig(lUserID, HCNetSDK.NET_DVR_GET_ACS_EVENT, ptrStruEventCond, struAcsEventCond.size(), null, null);
if (m_lSearchEventHandle<=-1)
{
System.out.println("NET_DVR_StartRemoteConfig调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
}
HCNetSDK.NET_DVR_ACS_EVENT_CFG struAcsEventCfg = new HCNetSDK.NET_DVR_ACS_EVENT_CFG();
struAcsEventCfg.read();
struAcsEventCfg.dwSize = struAcsEventCfg.size();
struAcsEventCfg.write();
Pointer ptrStruEventCfg = struAcsEventCfg.getPointer();
while (true) {
System.out.println("i=" + i);
int dwEventSearch = AcsMain.hCNetSDK.NET_DVR_GetNextRemoteConfig(m_lSearchEventHandle, ptrStruEventCfg, struAcsEventCfg.size());
if (dwEventSearch <= -1) {
System.out.println("NET_DVR_GetNextRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
}
if (dwEventSearch == HCNetSDK.NET_SDK_GET_NEXT_STATUS_NEED_WAIT) {
System.out.println("配置等待....");
Thread.sleep(10);
continue;
} else if (dwEventSearch == HCNetSDK.NET_SDK_NEXT_STATUS__FINISH) {
System.out.println("获取事件完成");
break;
} else if (dwEventSearch == HCNetSDK.NET_SDK_GET_NEXT_STATUS_FAILED) {
System.out.println("获取事件出现异常");
break;
} else if (dwEventSearch == HCNetSDK.NET_SDK_GET_NEXT_STATUS_SUCCESS) {
struAcsEventCfg.read();
//获取的事件信息通过struAcsEventCfg结构体进行解析
System.out.println(i + "获取事件成功, 报警主类型:" + Integer.toHexString(struAcsEventCfg.dwMajor) + "报警次类型:" + Integer.toHexString(struAcsEventCfg.dwMinor) + "卡号:" + new String(struAcsEventCfg.struAcsEventInfo.byCardNo).trim());
/**
* dwEmployeeNo0byEmployeeNo
*/
System.out.println("工号1"+struAcsEventCfg.struAcsEventInfo.dwEmployeeNo);
System.out.println("工号2"+new String(struAcsEventCfg.struAcsEventInfo.byEmployeeNo));
//人脸温度数据,需要设备和支持测温功能
System.out.println("人脸温度:" + struAcsEventCfg.struAcsEventInfo.fCurrTemperature + "是否异常:" + struAcsEventCfg.struAcsEventInfo.byIsAbnomalTemperature);
//口罩功能,需要设备支持此功能 0-保留1-未知2-不戴口罩3-戴口罩
System.out.println("是否带口罩:"+struAcsEventCfg.struAcsEventInfo.byMask);
//人脸图片保存
if (struAcsEventCfg.dwPicDataLen>0 || struAcsEventCfg.pPicData != null )
{
FileOutputStream fout;
try {
/**
*
*/
String filename = "..\\pic\\"+i+"_event.jpg";
fout = new FileOutputStream(filename);
//将字节写入文件
long offset = 0;
ByteBuffer buffers = struAcsEventCfg.pPicData.getByteBuffer(offset, struAcsEventCfg.dwPicDataLen);
byte[] bytes = new byte[struAcsEventCfg.dwPicDataLen];
buffers.rewind();
buffers.get(bytes);
fout.write(bytes);
fout.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
i++;
continue;
}
}
i = 0;
if (!AcsMain.hCNetSDK.NET_DVR_StopRemoteConfig(m_lSearchEventHandle)) {
System.out.println("NET_DVR_StopRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
} else {
System.out.println("NET_DVR_StopRemoteConfig接口成功");
}
return;
}
}

@ -0,0 +1,490 @@
//package com.shxy.xyhkcamera.ascest;
//
//
//import com.shxy.xyhkcamera.hk.HCNetSDK;
//import com.sun.jna.Pointer;
//import com.sun.jna.ptr.IntByReference;
//
//import java.io.*;
//import java.nio.ByteBuffer;
//import java.text.SimpleDateFormat;
//import java.util.Date;
//
///**
// * 功能模块:人员管理,下发、查询、删除人脸图片,注:下发人脸图片前,先下发人员工号。
// */
//public final class FaceManage {
//
//
// /**
// * 功能:按照二进制方式下发人脸图片
// * @param userID 用户注册ID
// * @param employeeNo 人员工号
// * @throws InterruptedException
// */
// public static void addFaceByBinary(int userID,String employeeNo ) throws JSONException, InterruptedException{
// HCNetSDK.BYTE_ARRAY ptrByteArray = new HCNetSDK.BYTE_ARRAY(1024); //数组
// String strInBuffer = "PUT /ISAPI/Intelligent/FDLib/FDSetUp?format=json";
// System.arraycopy(strInBuffer.getBytes(), 0, ptrByteArray.byValue, 0, strInBuffer.length());//字符串拷贝到数组中
// ptrByteArray.write();
//
// int lHandler = AcsMain.hCNetSDK.NET_DVR_StartRemoteConfig(userID, HCNetSDK.NET_DVR_FACE_DATA_RECORD, ptrByteArray.getPointer(), strInBuffer.length(), null, null);
// if (lHandler < 0)
// {
// System.out.println("Addface NET_DVR_StartRemoteConfig 失败,错误码为"+AcsMain.hCNetSDK.NET_DVR_GetLastError());
// return;
// }
// else{
// System.out.println("Addface NET_DVR_StartRemoteConfig 成功!");
//
// HCNetSDK.NET_DVR_JSON_DATA_CFG struAddFaceDataCfg = new HCNetSDK.NET_DVR_JSON_DATA_CFG();
// struAddFaceDataCfg.read();
//
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("faceLibType", "blackFD");
// jsonObject.put("FDID", "1");
// jsonObject.put("FPID", employeeNo);//人脸下发关联的工号
//
// String strJsonData = jsonObject.toString();
// System.arraycopy(strJsonData.getBytes(), 0, ptrByteArray.byValue, 0, strJsonData.length());//字符串拷贝到数组中
// ptrByteArray.write();
// struAddFaceDataCfg.dwSize = struAddFaceDataCfg.size();
// struAddFaceDataCfg.lpJsonData = ptrByteArray.getPointer();
// struAddFaceDataCfg.dwJsonDataSize = strJsonData.length();
//
// /*****************************************
// * 从本地文件里面读取JPEG图片二进制数据
// *****************************************/
// FileInputStream picfile = null;
// int picdataLength = 0;
// try{
//
// picfile = new FileInputStream(new File(".//pic//FDLib.jpg"));
// }
// catch(FileNotFoundException e)
// {
// e.printStackTrace();
// }
//
// try{
// picdataLength = picfile.available();
// }
// catch(IOException e1)
// {
// e1.printStackTrace();
// }
// if(picdataLength < 0)
// {
// System.out.println("input file dataSize < 0");
// return;
// }
//
// HCNetSDK.BYTE_ARRAY ptrpicByte = new HCNetSDK.BYTE_ARRAY(picdataLength);
// try {
// picfile.read(ptrpicByte.byValue);
// } catch (IOException e2) {
// e2.printStackTrace();
// }
// ptrpicByte.write();
// struAddFaceDataCfg.dwPicDataSize = picdataLength;
// struAddFaceDataCfg.lpPicData = ptrpicByte.getPointer();
// struAddFaceDataCfg.write();
//
// HCNetSDK.BYTE_ARRAY ptrOutuff = new HCNetSDK.BYTE_ARRAY(1024);
//
// IntByReference pInt = new IntByReference(0);
//
// while(true){
// int dwState = AcsMain.hCNetSDK.NET_DVR_SendWithRecvRemoteConfig(lHandler, struAddFaceDataCfg.getPointer(), struAddFaceDataCfg.dwSize ,ptrOutuff.getPointer(), 1024, pInt);
// if(dwState == -1){
// System.out.println("NET_DVR_SendWithRecvRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// break;
// }
// //读取返回的json并解析
// ptrOutuff.read();
// String strResult = new String(ptrOutuff.byValue).trim();
// System.out.println("dwState:" + dwState + ",strResult:" + strResult);
//
// JSONObject jsonResult = new JSONObject(strResult);
// int statusCode = jsonResult.getInt("statusCode");
// String statusString = jsonResult.getString("statusString");
// if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_NEED_WAIT)
// {
// System.out.println("配置等待");
// Thread.sleep(10);
// continue;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_FAILED)
// {
// System.out.println("下发人脸失败, json retun:" + jsonResult.toString());
// break;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_EXCEPTION)
// {
// System.out.println("下发人脸异常, json retun:" + jsonResult.toString());
// break;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_SUCCESS)
// {//返回NET_SDK_CONFIG_STATUS_SUCCESS代表流程走通了但并不代表下发成功比如人脸图片不符合设备规范等原因所以需要解析Json报文
// if (statusCode != 1){
// System.out.println("下发人脸成功,但是有异常情况:" + jsonResult.toString());
// }
// else{
// System.out.println("下发人脸成功, json retun:" + jsonResult.toString());
// }
// break;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_FINISH) {
// //下发人脸时dwState其实不会走到这里因为设备不知道我们会下发多少个人所以长连接需要我们主动关闭
// System.out.println("下发人脸完成");
// break;
// }
// }
// if(!AcsMain.hCNetSDK.NET_DVR_StopRemoteConfig(lHandler)){
// System.out.println("NET_DVR_StopRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// }
// else{
// System.out.println("NET_DVR_StopRemoteConfig接口成功");
// }
// }
//
// }
//
//
// /**
// * 按URL方式下发人脸图片
// * @param userID 用户注销ID
// * @param employeeNo 人员工号
// * @throws JSONException
// */
// public static void addFaceByUrl(int userID,String employeeNo) throws JSONException {
// HCNetSDK.BYTE_ARRAY ptrByteArray = new HCNetSDK.BYTE_ARRAY(1024); //数组
// String strInBuffer = "PUT /ISAPI/Intelligent/FDLib/FDSetUp?format=json";
// System.arraycopy(strInBuffer.getBytes(), 0, ptrByteArray.byValue, 0, strInBuffer.length());//字符串拷贝到数组中
// ptrByteArray.write();
//
// int lHandler = AcsMain.hCNetSDK.NET_DVR_StartRemoteConfig(userID, HCNetSDK.NET_DVR_FACE_DATA_RECORD, ptrByteArray.getPointer(), strInBuffer.length(), null, null);
// if (lHandler < 0)
// {
// System.out.println("Addface NET_DVR_StartRemoteConfig 失败,错误码为"+AcsMain.hCNetSDK.NET_DVR_GetLastError());
// return;
// }
// else{
// System.out.println("Addface NET_DVR_StartRemoteConfig 成功!");
//
// HCNetSDK.NET_DVR_JSON_DATA_CFG struAddFaceDataCfg = new HCNetSDK.NET_DVR_JSON_DATA_CFG();
// struAddFaceDataCfg.read();
//
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("faceURL","http://10.17.34.106:6011/pic?7DD9D70207A9D7F576F99AC197B2D6CAface.jpg"); //人脸图片URL
// jsonObject.put("faceLibType", "blackFD");
// jsonObject.put("FDID", "1");
// jsonObject.put("FPID", employeeNo);//人脸下发关联的工号
//
// String strJsonData = jsonObject.toString();
// System.arraycopy(strJsonData.getBytes(), 0, ptrByteArray.byValue, 0, strJsonData.length());//字符串拷贝到数组中
// ptrByteArray.write();
// struAddFaceDataCfg.dwSize = struAddFaceDataCfg.size();
// struAddFaceDataCfg.lpJsonData = ptrByteArray.getPointer();
// struAddFaceDataCfg.dwJsonDataSize = strJsonData.length();
// struAddFaceDataCfg.lpPicData = null;
// struAddFaceDataCfg.dwPicDataSize=0;
// struAddFaceDataCfg.write();
// HCNetSDK.BYTE_ARRAY ptrOutuff = new HCNetSDK.BYTE_ARRAY(1024);
//
// IntByReference pInt = new IntByReference(0);
//
// while(true){
// int dwState = AcsMain.hCNetSDK.NET_DVR_SendWithRecvRemoteConfig(lHandler, struAddFaceDataCfg.getPointer(), struAddFaceDataCfg.dwSize ,ptrOutuff.getPointer(), 1024, pInt);
//
// if(dwState == -1){
// System.out.println("NET_DVR_SendWithRecvRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// break;
// }
// //读取返回的json并解析
// ptrOutuff.read();
// String strResult = new String(ptrOutuff.byValue).trim();
// System.out.println("dwState:" + dwState + ",strResult:" + strResult);
//
// JSONObject jsonResult = new JSONObject(strResult);
// int statusCode = jsonResult.getInt("statusCode");
// String statusString = jsonResult.getString("statusString");
// if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_NEED_WAIT)
// {
// System.out.println("配置等待");
// try {
// Thread.sleep(10);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// continue;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_FAILED)
// {
// System.out.println("下发人脸失败, json retun:" + jsonResult.toString());
// break;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_EXCEPTION)
// {
// System.out.println("下发人脸异常, json retun:" + jsonResult.toString());
// break;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_SUCCESS)
// {//返回NET_SDK_CONFIG_STATUS_SUCCESS代表流程走通了但并不代表下发成功比如人脸图片不符合设备规范等原因所以需要解析Json报文
// if (statusCode != 1){
// System.out.println("下发人脸成功,但是有异常情况:" + jsonResult.toString());
// }
// else{
// System.out.println("下发人脸成功, json retun:" + jsonResult.toString());
// }
// break;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_FINISH) {
// //下发人脸时dwState其实不会走到这里因为设备不知道我们会下发多少个人所以长连接需要我们主动关闭
// System.out.println("下发人脸完成");
// break;
// }
// }
// if(!AcsMain.hCNetSDK.NET_DVR_StopRemoteConfig(lHandler)){
// System.out.println("NET_DVR_StopRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// }
// else{
// System.out.println("NET_DVR_StopRemoteConfig接口成功");
// }
// }
// }
//
//
// /**
// * 查询人脸
// * @param userID
// * @param employeeNo
// * @throws JSONException
// */
// public static void searchFaceInfo(int userID,String employeeNo) throws JSONException{
// HCNetSDK.BYTE_ARRAY ptrByteArray = new HCNetSDK.BYTE_ARRAY(1024); //数组
// String strInBuffer = "POST /ISAPI/Intelligent/FDLib/FDSearch?format=json";
// System.arraycopy(strInBuffer.getBytes(), 0, ptrByteArray.byValue, 0, strInBuffer.length());//字符串拷贝到数组中
// ptrByteArray.write();
//
// int lHandler = AcsMain.hCNetSDK.NET_DVR_StartRemoteConfig(userID, HCNetSDK.NET_DVR_FACE_DATA_SEARCH, ptrByteArray.getPointer(), strInBuffer.length(), null, null);
// if (lHandler < 0)
// {
// System.out.println("SearchFaceInfo NET_DVR_StartRemoteConfig 失败,错误码为"+AcsMain.hCNetSDK.NET_DVR_GetLastError());
// return;
// }
// else{
// System.out.println("SearchFaceInfo NET_DVR_StartRemoteConfig成功!");
//
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("searchResultPosition", 0);
// jsonObject.put("maxResults", 1);
// jsonObject.put("faceLibType", "blackFD");
// jsonObject.put("FDID","1");
// jsonObject.put("FPID", employeeNo);//人脸关联的工号同下发人员时的employeeNo字段
//
// String strInbuff = jsonObject.toString();
// System.out.println("查询的json报文:" + strInbuff);
//
// //把string传递到Byte数组中后续用.getPointer()方法传入指针地址中。
// HCNetSDK.BYTE_ARRAY ptrInbuff = new HCNetSDK.BYTE_ARRAY(strInbuff.length());
// System.arraycopy(strInbuff.getBytes(), 0, ptrInbuff.byValue, 0, strInbuff.length());
// ptrInbuff.write();
//
// HCNetSDK.NET_DVR_JSON_DATA_CFG m_struJsonData = new HCNetSDK.NET_DVR_JSON_DATA_CFG();
// m_struJsonData.write();
//
// IntByReference pInt = new IntByReference(0);
//
// while(true){
// int dwState =AcsMain.hCNetSDK.NET_DVR_SendWithRecvRemoteConfig(lHandler, ptrInbuff.getPointer(), strInbuff.length(), m_struJsonData.getPointer(), m_struJsonData.size(), pInt);
// m_struJsonData.read();
// System.out.println(dwState);
// if(dwState == -1){
// System.out.println("NET_DVR_SendWithRecvRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// break;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_NEED_WAIT)
// {
// System.out.println("配置等待");
// try {
// Thread.sleep(10);
// } catch (InterruptedException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// continue;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_FAILED)
// {
// System.out.println("查询人脸失败");
// break;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_EXCEPTION)
// {
// System.out.println("查询人脸异常");
// break;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_SUCCESS)
// {
// System.out.println("查询人脸成功");
//
// //解析JSON字符串
// HCNetSDK.BYTE_ARRAY pJsonData = new HCNetSDK.BYTE_ARRAY(m_struJsonData.dwJsonDataSize);
// pJsonData.write();
// Pointer pPlateInfo = pJsonData.getPointer();
// pPlateInfo.write(0, m_struJsonData.lpJsonData.getByteArray(0, pJsonData.size()), 0, pJsonData.size());
// pJsonData.read();
// String strResult = new String(pJsonData.byValue).trim();
// System.out.println("strResult:" + strResult);
// JSONObject jsonResult = new JSONObject(strResult);
//
// int numOfMatches = jsonResult.getInt("numOfMatches");
// if(numOfMatches != 0){//确认有人脸
// JSONArray MatchList = jsonResult.getJSONArray("MatchList");
// JSONObject MatchList_1 = MatchList.optJSONObject(0);
// String FPID = MatchList_1.getString("FPID"); //获取json中人脸关联的工号
//
// FileOutputStream fout;
// try {
// fout = new FileOutputStream("..//AddFacePicture//["+ FPID +"]_FacePic.jpg");
// //将字节写入文件
// long offset = 0;
// ByteBuffer buffers = m_struJsonData.lpPicData.getByteBuffer(offset, m_struJsonData.dwPicDataSize);
// byte [] bytes = new byte[m_struJsonData.dwPicDataSize];
// buffers.rewind();
// buffers.get(bytes);
// fout.write(bytes);
// fout.close();
// } catch (FileNotFoundException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// }
// break;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_FINISH) {
// System.out.println("获取人脸完成");
// break;
// }
// }
// if(!AcsMain.hCNetSDK.NET_DVR_StopRemoteConfig(lHandler)){
// System.out.println("NET_DVR_StopRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// }
// else{
// System.out.println("NET_DVR_StopRemoteConfig接口成功");
// lHandler = -1;
// }
//
// }
//
// }
//
// /**
// * 人脸删除支持批量删除json中添加多个工号
// * @param userID
// * @param employeeNo
// */
//
// public static void deleteFaceInfo(int userID,String employeeNo)
// {
// String deleteFaceUrl="PUT /ISAPI/Intelligent/FDLib/FDSearch/Delete?format=json&FDID=1&faceLibType=blackFD";
// String deleteFaceJson="{\n" +
// " \"FPID\": [{\n" +
// " \"value\": \""+employeeNo+"\"\n" +
// " }]\n" +
// "}";
// String result= com.shxy.xyhkcamera.asc.TransIsapi.put_isapi(userID,deleteFaceUrl,deleteFaceJson);
// System.out.println("删除人员结果:"+result);
// }
//
// /**
// * 人脸采集,下发人脸采集命令,从设备中采集人脸图片保存到本地
// * @param userID 用户注册ID
// */
// public static void captureFaceInfo(int userID)
// {
// HCNetSDK.NET_DVR_CAPTURE_FACE_COND struCapCond = new HCNetSDK.NET_DVR_CAPTURE_FACE_COND();
// struCapCond.read();
// struCapCond.dwSize = struCapCond.size();
// struCapCond.write();
// int lCaptureFaceHandle = AcsMain.hCNetSDK.NET_DVR_StartRemoteConfig(userID, HCNetSDK.NET_DVR_CAPTURE_FACE_INFO, struCapCond.getPointer(), struCapCond.size(), null, null);
// if (lCaptureFaceHandle == -1) {
// System.out.println("建立采集人脸长连接失败,错误码为" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// return;
// } else {
// System.out.println("建立采集人脸长连接成功!");
// }
// //采集的人脸信息
// HCNetSDK.NET_DVR_CAPTURE_FACE_CFG struFaceInfo = new HCNetSDK.NET_DVR_CAPTURE_FACE_CFG();
// struFaceInfo.read();
// while (true) {
// int dwState = AcsMain.hCNetSDK.NET_DVR_GetNextRemoteConfig(lCaptureFaceHandle, struFaceInfo.getPointer(), struFaceInfo.size());
// struFaceInfo.read();
// if (dwState == -1) {
// System.out.println("NET_DVR_GetNextRemoteConfig采集人脸失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// break;
// } else if (dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_NEED_WAIT) {
// System.out.println("正在采集中,请等待...");
// try {
// Thread.sleep(10);
// } catch (InterruptedException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// continue;
// } else if (dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_FAILED) {
// System.out.println("采集人脸失败");
// break;
// } else if (dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_EXCEPTION) {
// //超时时间5秒内设备本地人脸采集失败就会返回失败,连接会断开
// System.out.println("采集人脸异常, 网络异常导致连接断开 ");
// break;
// } else if (dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_SUCCESS) {
// if ((struFaceInfo.dwFacePicSize > 0) && (struFaceInfo.pFacePicBuffer != null)) {
// SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss");
// String newName = sf.format(new Date());
// FileOutputStream fout;
// try {
// String filename = "..\\pic\\" + newName + "_capFaceInfo.jpg";
// fout = new FileOutputStream(filename);
// //将字节写入文件
// long offset = 0;
// ByteBuffer buffers = struFaceInfo.pFacePicBuffer.getByteBuffer(offset, struFaceInfo.dwFacePicSize);
// byte[] bytes = new byte[struFaceInfo.dwFacePicSize];
// buffers.rewind();
// buffers.get(bytes);
// fout.write(bytes);
// fout.close();
// System.out.println("采集人脸成功, 图片保存路径: " + filename);
// } catch (FileNotFoundException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// }
// break;
// } else {
// System.out.println("其他异常, dwState: " + dwState);
// break;
// }
// }
// //采集成功之后断开连接、释放资源
// if (!AcsMain.hCNetSDK.NET_DVR_StopRemoteConfig(lCaptureFaceHandle)) {
// System.out.println("NET_DVR_StopRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// } else {
// System.out.println("NET_DVR_StopRemoteConfig接口成功");
// }
// }
//
//
//
//
//
//
//}

@ -0,0 +1,378 @@
//package com.shxy.xyhkcamera.ascest;
//
//
//import com.shxy.xyhkcamera.hk.HCNetSDK;
//import com.sun.jna.Pointer;
//import com.sun.jna.ptr.IntByReference;
//
//import java.io.*;
//import java.nio.ByteBuffer;
//import java.text.SimpleDateFormat;
//import java.util.Date;
//
///**
// * 指纹管理:指纹采集,指纹下发,指纹信息查询,指纹删除
// */
//public final class FingerManage {
// /**
// * 采集指纹模块,采集指纹数据为二进制
// * @param userID
// */
// public static void fingerCapture(int userID)
// {
//
// HCNetSDK.NET_DVR_CAPTURE_FINGERPRINT_COND strFingerCond = new HCNetSDK.NET_DVR_CAPTURE_FINGERPRINT_COND();
// strFingerCond.read();
// strFingerCond.dwSize = strFingerCond.size();
// strFingerCond.byFingerPrintPicType = 1; //指纹读卡器
// strFingerCond.byFingerNo = 1; //指纹编号
// strFingerCond.write();
// int lGetFingerHandle = AcsMain.hCNetSDK.NET_DVR_StartRemoteConfig(userID, HCNetSDK.NET_DVR_CAPTURE_FINGERPRINT_INFO, strFingerCond.getPointer(), strFingerCond.dwSize, null, null);
// if (lGetFingerHandle == -1) {
// System.out.println("建立采集指纹长连接失败,错误码为:" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// return;
// } else {
// System.out.println("建立采集指纹长连接成功!");
// }
// HCNetSDK.NET_DVR_CAPTURE_FINGERPRINT_CFG strFingerCfg = new HCNetSDK.NET_DVR_CAPTURE_FINGERPRINT_CFG();
// strFingerCfg.dwSize=strFingerCfg.size();
// strFingerCfg.write();
// while (true) {
// int dwFingerState = AcsMain.hCNetSDK.NET_DVR_GetNextRemoteConfig(lGetFingerHandle, strFingerCfg.getPointer(), strFingerCfg.size());
//
// if (dwFingerState == -1) {
// System.out.println("NET_DVR_GetNextRemoteConfig采集指纹失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// break;
// } else if (dwFingerState == HCNetSDK.NET_SDK_GET_NEXT_STATUS_FAILED) {
// System.out.println("采集指纹失败");
// break;
// } else if (dwFingerState == HCNetSDK.NET_SDK_GET_NEXT_STATUS_NEED_WAIT) {
// System.out.println("正在采集指纹中,请等待...");
// try {
// Thread.sleep(10);
// } catch (InterruptedException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// continue;
// } else if (dwFingerState == HCNetSDK.NET_SDK_CONFIG_STATUS_EXCEPTION) {
// //超时时间5秒内设备本地人脸采集失败就会返回失败,连接会断开
// System.out.println("采集指纹异常, 网络异常导致连接断开 ");
// break;
// } else if (dwFingerState == HCNetSDK.NET_SDK_GET_NEXT_STATUS_SUCCESS) {
// strFingerCfg.read();
// SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss");
// String newName = sf.format(new Date());
// String fileName = newName + "_capFinger.data";
// String filePath = "..\\pic\\" + fileName;
// BufferedOutputStream bos = null;
// FileOutputStream fos = null;
// File file = null;
// try {
// File dir = new File(filePath);
// if (!dir.exists() && dir.isDirectory()) {//判断文件目录是否存在
// dir.mkdirs();
// }
// file = new File(filePath);
// fos = new FileOutputStream(file);
// bos = new BufferedOutputStream(fos);
// bos.write(strFingerCfg.byFingerData);
// System.out.println("采集指纹成功!");
// } catch (Exception e) {
// e.printStackTrace();
// } finally {
// if (bos != null) {
// try {
// bos.close();
// } catch (IOException e1) {
// e1.printStackTrace();
// }
// }
// if (fos != null) {
// try {
// fos.close();
// } catch (IOException e1) {
// e1.printStackTrace();
// }
// }
// }
// if ((strFingerCfg.dwFingerPrintPicSize > 0) && (strFingerCfg.pFingerPrintPicBuffer != null)) {
// FileOutputStream fout;
// try {
// String filename = "..\\pic\\" + newName + "_FingerPrintPic.jpg";
// fout = new FileOutputStream(filename);
// //将字节写入文件
// long offset = 0;
// ByteBuffer buffers = strFingerCfg.pFingerPrintPicBuffer.getByteBuffer(offset, strFingerCfg.dwFingerPrintPicSize);
// byte[] bytes = new byte[strFingerCfg.dwFingerPrintPicSize];
// buffers.rewind();
// buffers.get(bytes);
// fout.write(bytes);
// fout.close();
// System.out.println("采集指纹成功, 图片保存路径: " + filename);
// } catch (FileNotFoundException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// }
// break;
// } else {
// System.out.println("其他异常, dwState: " + dwFingerState);
// break;
// }
// }
// //采集成功之后断开连接、释放资源
// if (!AcsMain.hCNetSDK.NET_DVR_StopRemoteConfig(lGetFingerHandle)) {
// System.out.println("NET_DVR_StopRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// } else {
// System.out.println("NET_DVR_StopRemoteConfig接口成功");
// }
// }
//
// /**
// * 采用透传ISAPI协议方式采集指纹获取的指纹信息为BASE64编码
// */
// public static void fingerCpaureByisapi(int userID)
// {
// //采集指纹URL
// String fingerCapUrl="POST /ISAPI/AccessControl/CaptureFingerPrint";
// String XmlInput="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
// "<CaptureFingerPrintCond xmlns=\"http://www.isapi.org/ver20/XMLSchema\" version=\"2.0\">\n" +
// " <fingerNo>1</fingerNo>\n" +
// "</CaptureFingerPrintCond>";
// String result= com.shxy.xyhkcamera.asc.TransIsapi.put_isapi(userID,fingerCapUrl,XmlInput);
// System.out.println("采集指纹结果:"+result);
// }
//
//
//
// public static void setOneFinger(int userID, String employeeNo,String figerdata) throws JSONException {
// HCNetSDK.BYTE_ARRAY ptrByteArray = new HCNetSDK.BYTE_ARRAY(1024); //数组
// String strInBuffer = "POST /ISAPI/AccessControl/FingerPrint/SetUp?format=json";
// System.arraycopy(strInBuffer.getBytes(), 0, ptrByteArray.byValue, 0, strInBuffer.length());//字符串拷贝到数组中
// ptrByteArray.write();
//
// int lHandler = AcsMain.hCNetSDK.NET_DVR_StartRemoteConfig(userID, HCNetSDK.NET_DVR_JSON_CONFIG, ptrByteArray.getPointer(), strInBuffer.length(), null, null);
// if (lHandler < 0)
// {
// System.out.println("SearchFaceInfo NET_DVR_StartRemoteConfig 失败,错误码为"+AcsMain.hCNetSDK.NET_DVR_GetLastError());
// return;
// }
// else{
// System.out.println("SearchFaceInfo NET_DVR_StartRemoteConfig成功!");
//
// JSONObject jsonObject = new JSONObject();
// JSONObject j_FingerPrintCond=new JSONObject();
// j_FingerPrintCond.put("employeeNo", employeeNo);
// int[] CardReader = {1};
// j_FingerPrintCond.put("enableCardReader",CardReader); //人员工号
// j_FingerPrintCond.put("fingerPrintID", 1);
// j_FingerPrintCond.put("fingerType", "normalFP");
// j_FingerPrintCond.put("fingerData",figerdata);
// jsonObject.put("FingerPrintCfg",j_FingerPrintCond);
//
// String strInbuff = jsonObject.toString();
// System.out.println("查询的json报文:" + strInbuff);
//
// //把string传递到Byte数组中后续用.getPointer()方法传入指针地址中。
// HCNetSDK.BYTE_ARRAY ptrInbuff = new HCNetSDK.BYTE_ARRAY(strInbuff.length());
// System.arraycopy(strInbuff.getBytes(), 0, ptrInbuff.byValue, 0, strInbuff.length());
// ptrInbuff.write();
//
// HCNetSDK.NET_DVR_STRING_POINTER ptrOutbuff = new HCNetSDK.NET_DVR_STRING_POINTER(3*1024);
// ptrOutbuff.write();
//
// IntByReference pInt = new IntByReference(0);
//
// while(true){
// int dwState =AcsMain.hCNetSDK.NET_DVR_SendWithRecvRemoteConfig(lHandler, ptrInbuff.getPointer(), strInbuff.length(), ptrOutbuff.getPointer(), ptrOutbuff.size(), pInt);
// ptrOutbuff.read();
// System.out.println(dwState);
// if(dwState == -1){
// System.out.println("NET_DVR_SendWithRecvRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// break;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_NEED_WAIT)
// {
// System.out.println("配置等待");
// try {
// Thread.sleep(10);
// } catch (InterruptedException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// continue;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_FAILED)
// {
// System.out.println("下发指纹失败");
// break;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_EXCEPTION)
// {
// System.out.println("下发指纹异常");
// break;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_SUCCESS)
// {
// System.out.println("下发指纹成功");
// //解析JSON字符串
// ptrOutbuff.read();
// System.out.println("返回的报文:"+new String(ptrOutbuff.byString));
//
// break;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_FINISH) {
// System.out.println("下发指纹完成");
// break;
// }
// }
// if(!AcsMain.hCNetSDK.NET_DVR_StopRemoteConfig(lHandler)){
// System.out.println("NET_DVR_StopRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// }
// else{
// System.out.println("NET_DVR_StopRemoteConfig接口成功");
// lHandler = -1;
// }
// }
// }
//
// public static void SearchFingerInfo(int userID,String employeeNo) throws JSONException {
// HCNetSDK.BYTE_ARRAY ptrByteArray = new HCNetSDK.BYTE_ARRAY(1024); //数组
// String strInBuffer = "POST /ISAPI/AccessControl/FingerPrintUpload?format=json";
// System.arraycopy(strInBuffer.getBytes(), 0, ptrByteArray.byValue, 0, strInBuffer.length());//字符串拷贝到数组中
// ptrByteArray.write();
//
// int lHandler = AcsMain.hCNetSDK.NET_DVR_StartRemoteConfig(userID, HCNetSDK.NET_DVR_JSON_CONFIG, ptrByteArray.getPointer(), strInBuffer.length(), null, null);
// if (lHandler < 0)
// {
// System.out.println("SearchFaceInfo NET_DVR_StartRemoteConfig 失败,错误码为"+AcsMain.hCNetSDK.NET_DVR_GetLastError());
// return;
// }
// else{
// System.out.println("SearchFaceInfo NET_DVR_StartRemoteConfig成功!");
//
// JSONObject jsonObject = new JSONObject();
// JSONObject j_FingerPrintCond=new JSONObject();
// j_FingerPrintCond.put("searchID", "20211223");
// j_FingerPrintCond.put("employeeNo", employeeNo); //人员工号
// j_FingerPrintCond.put("cardReaderNo", 1);
// j_FingerPrintCond.put("fingerPrintID", 1);
// jsonObject.put("FingerPrintCond",j_FingerPrintCond);
//
// String strInbuff = jsonObject.toString();
// System.out.println("查询的json报文:" + strInbuff);
//
// //把string传递到Byte数组中后续用.getPointer()方法传入指针地址中。
// HCNetSDK.BYTE_ARRAY ptrInbuff = new HCNetSDK.BYTE_ARRAY(strInbuff.length());
// System.arraycopy(strInbuff.getBytes(), 0, ptrInbuff.byValue, 0, strInbuff.length());
// ptrInbuff.write();
//
// HCNetSDK.NET_DVR_STRING_POINTER ptrOutbuff = new HCNetSDK.NET_DVR_STRING_POINTER(3*1024);
// ptrOutbuff.write();
//
// IntByReference pInt = new IntByReference(0);
//
// while(true){
// int dwState =AcsMain.hCNetSDK.NET_DVR_SendWithRecvRemoteConfig(lHandler, ptrInbuff.getPointer(), strInbuff.length(), ptrOutbuff.getPointer(), ptrOutbuff.size(), pInt);
// ptrOutbuff.read();
// System.out.println(dwState);
// if(dwState == -1){
// System.out.println("NET_DVR_SendWithRecvRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// break;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_NEED_WAIT)
// {
// System.out.println("配置等待");
// try {
// Thread.sleep(10);
// } catch (InterruptedException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// continue;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_FAILED)
// {
// System.out.println("查询指纹失败");
// break;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_EXCEPTION)
// {
// System.out.println("查询指纹异常");
// break;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_SUCCESS)
// {
// System.out.println("查询指纹成功");
// //解析JSON字符串
// ptrOutbuff.read();
// System.out.println("查询的报文:"+new String(ptrOutbuff.byString));
//
// break;
// }
// else if(dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_FINISH) {
// System.out.println("获取指纹完成");
// break;
// }
// }
// if(!AcsMain.hCNetSDK.NET_DVR_StopRemoteConfig(lHandler)){
// System.out.println("NET_DVR_StopRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// }
// else{
// System.out.println("NET_DVR_StopRemoteConfig接口成功");
// lHandler = -1;
// }
//
// }
// }
//
// /**
// * 按工号和读卡器删除指纹,按工号是逐个删除,按读卡器是批量删除指定读卡器上所有的指纹数据
// * @param userID
// * @param employeeNo
// */
// public static void deleteFinger(int userID,String employeeNo )
// {
// int iErr = 0;
// HCNetSDK.NET_DVR_FINGER_PRINT_INFO_CTRL_V50 m_struFingerDelInfoParam = new HCNetSDK.NET_DVR_FINGER_PRINT_INFO_CTRL_V50();
// m_struFingerDelInfoParam.dwSize = m_struFingerDelInfoParam.size();
// m_struFingerDelInfoParam.byMode = 0;// 删除方式0-按卡号人员ID方式删除1-按读卡器删除
// m_struFingerDelInfoParam.struProcessMode.setType(HCNetSDK.NET_DVR_FINGER_PRINT_BYCARD_V50.class);
// for (int i = 0; i < employeeNo.length(); i++) {
// m_struFingerDelInfoParam.struProcessMode.struByCard.byEmployeeNo[i] = employeeNo.getBytes()[i];
// }
// m_struFingerDelInfoParam.struProcessMode.struByCard.byEnableCardReader[0] = 1;//指纹的读卡器信息,按位表示
// m_struFingerDelInfoParam.struProcessMode.struByCard.byFingerPrintID[0] = 1;//需要删除的指纹编号按数组下标值表示0-不删除1-删除该指纹 ,指纹编号1删除
//
//
// Pointer lpInBuffer1 = m_struFingerDelInfoParam.getPointer();
// m_struFingerDelInfoParam.write();
//
//
// int lHandle = AcsMain.hCNetSDK.NET_DVR_StartRemoteConfig(userID, HCNetSDK.NET_DVR_DEL_FINGERPRINT, lpInBuffer1, m_struFingerDelInfoParam.size(), null, null);
// if (lHandle < 0) {
// iErr = AcsMain.hCNetSDK.NET_DVR_GetLastError();
// System.out.println("NET_DVR_DEL_FINGERPRINT_CFG_V50 建立长连接失败,错误号:" + iErr);
// return;
// }
// while (true) {
// HCNetSDK.NET_DVR_FINGER_PRINT_INFO_CTRL_V50 v50 = new HCNetSDK.NET_DVR_FINGER_PRINT_INFO_CTRL_V50();
// v50.dwSize = v50.size();
// v50.write();
// int res = AcsMain.hCNetSDK.NET_DVR_GetNextRemoteConfig(lHandle, v50.getPointer(), v50.size());
// if (res == 1002) {
// AcsMain.hCNetSDK.NET_DVR_StopRemoteConfig(lHandle);
// System.out.println("删除指纹成功!!!");
// break;
// } else if (res == 1003) {
// System.out.println("接口失败,错误码:" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// AcsMain.hCNetSDK.NET_DVR_StopRemoteConfig(lHandle);
// break;
// }
// }
// }
//}

@ -0,0 +1,77 @@
package com.shxy.xyhkcamera.ascest;
import com.shxy.xyhkcamera.ascest.AcsMain;
import com.shxy.xyhkcamera.hk.HCNetSDK;
/**
* jsonbelongGroup
*/
public class MutilCard {
//设置群组参数
public static void setGroupCfg(int lUserID)
{
HCNetSDK.NET_DVR_GROUP_CFG struGroupCfg = new HCNetSDK.NET_DVR_GROUP_CFG();
struGroupCfg.read();
struGroupCfg.dwSize = struGroupCfg.size();
struGroupCfg.byEnable = 1;
struGroupCfg.byGroupName = "test".getBytes(); //
struGroupCfg.struValidPeriodCfg.byEnable = 1;
struGroupCfg.struValidPeriodCfg.struBeginTime.wYear = 2021;
struGroupCfg.struValidPeriodCfg.struBeginTime.byMonth = 1;
struGroupCfg.struValidPeriodCfg.struBeginTime.byDay = 1;
struGroupCfg.struValidPeriodCfg.struBeginTime.byHour = 0;
struGroupCfg.struValidPeriodCfg.struBeginTime.byMinute = 0;
struGroupCfg.struValidPeriodCfg.struBeginTime.bySecond = 0;
struGroupCfg.struValidPeriodCfg.struEndTime.wYear = 2037;
struGroupCfg.struValidPeriodCfg.struEndTime.byMonth = 12;
struGroupCfg.struValidPeriodCfg.struEndTime.byDay = 31;
struGroupCfg.struValidPeriodCfg.struEndTime.byHour = 23;
struGroupCfg.struValidPeriodCfg.struEndTime.byMinute = 59;
struGroupCfg.struValidPeriodCfg.struEndTime.bySecond = 59;
struGroupCfg.write();
if(!AcsMain.hCNetSDK.NET_DVR_SetDVRConfig(lUserID,2113,1,struGroupCfg.getPointer(),struGroupCfg.size()))
{
System.out.println("NET_DVR_SetDVRConfig NET_DVR_SET_GROUP_CFG失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
} else {
System.out.println("NET_DVR_SetDVRConfig NET_DVR_SET_GROUP_CFG成功");
}
}
//设置多重认证参数
/**
*
* nbyMemberNumnbySequenceNo1
* nAmBAB22byMemberNumnm
* bySequenceNo12bySequenceNo00
* @param lUserID
*/
public static void setMultiCardCfg(int lUserID)
{
HCNetSDK.NET_DVR_MULTI_CARD_CFG_V50 struMultiCardCfg = new HCNetSDK.NET_DVR_MULTI_CARD_CFG_V50();
struMultiCardCfg.read();
struMultiCardCfg.dwSize = struMultiCardCfg.size();
struMultiCardCfg.byEnable = 1;
struMultiCardCfg.bySwipeIntervalTimeout = 30; //刷卡认证超时时间
struMultiCardCfg.struGroupCfg[0].byEnable = 1;
struMultiCardCfg.struGroupCfg[0].dwTemplateNo = 1;
struMultiCardCfg.struGroupCfg[0].struGroupCombination[0].byEnable = 1;
struMultiCardCfg.struGroupCfg[0].struGroupCombination[0].byMemberNum = 2; //刷卡成员数量,群组里面需要刷卡的卡个数
struMultiCardCfg.struGroupCfg[0].struGroupCombination[0].bySequenceNo = 1; //群组刷卡次序号
struMultiCardCfg.struGroupCfg[0].struGroupCombination[0].dwGroupNo = 1; //群组编号 //刷卡认证组
struMultiCardCfg.write();
if(!AcsMain.hCNetSDK.NET_DVR_SetDVRConfig(lUserID, HCNetSDK.NET_DVR_SET_MULTI_CARD_CFG_V50,1,struMultiCardCfg.getPointer(),struMultiCardCfg.size()))
{
System.out.println("NET_DVR_SetDVRConfig NET_DVR_SET_MULTI_CARD_CFG_V50 失败,错误码:" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
} else {
System.out.println("NET_DVR_SetDVRConfig NET_DVR_SET_MULTI_CARD_CFG_V50 成功");
}
}
}

@ -0,0 +1,101 @@
package com.shxy.xyhkcamera.ascest;
import com.shxy.xyhkcamera.ascest.AcsMain;
import com.shxy.xyhkcamera.hk.HCNetSDK;
/**
* @create 2021-04-13-15:23
* ISAPI
*/
public final class TransIsapi {
public static String get_isapi(int lUserID, String url) {
HCNetSDK.NET_DVR_XML_CONFIG_INPUT struXMLInput = new HCNetSDK.NET_DVR_XML_CONFIG_INPUT();
struXMLInput.read();
HCNetSDK.BYTE_ARRAY stringRequest = new HCNetSDK.BYTE_ARRAY(1024);
stringRequest.read();
//输入ISAPI协议命令
System.arraycopy(url.getBytes(), 0, stringRequest.byValue, 0, url.length());
stringRequest.write();
struXMLInput.dwSize = struXMLInput.size();
struXMLInput.lpRequestUrl = stringRequest.getPointer();
struXMLInput.dwRequestUrlLen = url.length();
struXMLInput.lpInBuffer = null;
struXMLInput.dwInBufferSize = 0;
struXMLInput.write();
HCNetSDK.BYTE_ARRAY stringXMLOut = new HCNetSDK.BYTE_ARRAY(8 * 1024);
stringXMLOut.read();
HCNetSDK.BYTE_ARRAY struXMLStatus = new HCNetSDK.BYTE_ARRAY(1024);
struXMLStatus.read();
HCNetSDK.NET_DVR_XML_CONFIG_OUTPUT struXMLOutput = new HCNetSDK.NET_DVR_XML_CONFIG_OUTPUT();
struXMLOutput.read();
struXMLOutput.dwSize = struXMLOutput.size();
struXMLOutput.lpOutBuffer = stringXMLOut.getPointer();
struXMLOutput.dwOutBufferSize = stringXMLOut.size();
struXMLOutput.lpStatusBuffer = struXMLStatus.getPointer();
struXMLOutput.dwStatusSize = struXMLStatus.size();
struXMLOutput.write();
if (!AcsMain.hCNetSDK.NET_DVR_STDXMLConfig(lUserID, struXMLInput, struXMLOutput)) {
int iErr = AcsMain.hCNetSDK.NET_DVR_GetLastError();
System.err.println("NET_DVR_STDXMLConfig失败错误号" + iErr+"----URL:"+url);
return null;
} else {
stringXMLOut.read();
System.out.println("输出文本大小:" + struXMLOutput.dwReturnedXMLSize);
//打印输出XML文本
String strOutXML = new String(stringXMLOut.byValue).trim();
System.out.println(strOutXML);
struXMLStatus.read();
String strStatus = new String(struXMLStatus.byValue).trim();
System.out.println(strStatus);
return strOutXML;
}
}
public static String put_isapi(int lUserID, String url, String inputXml) {
HCNetSDK.NET_DVR_XML_CONFIG_INPUT struXMLInput = new HCNetSDK.NET_DVR_XML_CONFIG_INPUT();
struXMLInput.read();
HCNetSDK.BYTE_ARRAY stringRequest = new HCNetSDK.BYTE_ARRAY(1024);
stringRequest.read();
//输入ISAPI协议命令
System.arraycopy(url.getBytes(), 0, stringRequest.byValue, 0, url.length());
stringRequest.write();
struXMLInput.dwSize = struXMLInput.size();
struXMLInput.lpRequestUrl = stringRequest.getPointer();
struXMLInput.dwRequestUrlLen = url.length();
HCNetSDK.BYTE_ARRAY ptrInBuffer = new HCNetSDK.BYTE_ARRAY(inputXml.length());
ptrInBuffer.read();
System.arraycopy(inputXml.getBytes(), 0, ptrInBuffer.byValue, 0, inputXml.length());
ptrInBuffer.write();
struXMLInput.lpInBuffer = ptrInBuffer.getPointer();
struXMLInput.dwInBufferSize = inputXml.length();
struXMLInput.write();
HCNetSDK.BYTE_ARRAY stringXMLOut = new HCNetSDK.BYTE_ARRAY(8 * 1024);
stringXMLOut.read();
HCNetSDK.BYTE_ARRAY struXMLStatus = new HCNetSDK.BYTE_ARRAY(1024);
struXMLStatus.read();
HCNetSDK.NET_DVR_XML_CONFIG_OUTPUT struXMLOutput = new HCNetSDK.NET_DVR_XML_CONFIG_OUTPUT();
struXMLOutput.read();
struXMLOutput.dwSize = struXMLOutput.size();
struXMLOutput.lpOutBuffer = stringXMLOut.getPointer();
struXMLOutput.dwOutBufferSize = stringXMLOut.size();
struXMLOutput.lpStatusBuffer = struXMLStatus.getPointer();
struXMLOutput.dwStatusSize = struXMLStatus.size();
struXMLOutput.write();
if (!AcsMain.hCNetSDK.NET_DVR_STDXMLConfig(lUserID, struXMLInput, struXMLOutput)){
int iErr = AcsMain.hCNetSDK.NET_DVR_GetLastError();
System.err.println("NET_DVR_STDXMLConfig失败错误号" + iErr+"----URL:"+url);
return null;
} else {
stringXMLOut.read();
System.out.println("输出文本大小:" + struXMLOutput.dwReturnedXMLSize);
//打印输出XML文本
String strOutXML = new String(stringXMLOut.byValue).trim();
struXMLStatus.read();
String strStatus = new String(struXMLStatus.byValue).trim();
return strOutXML;
}
}
}

@ -0,0 +1,362 @@
//package com.shxy.xyhkcamera.ascest;
//
//import com.shxy.xyhkcamera.hk.HCNetSDK;
//import com.sun.jna.Pointer;
//import com.sun.jna.ptr.IntByReference;
//
//import java.io.UnsupportedEncodingException;
//
///**
// * 功能:人脸下发、查询、删除、人员计划模板配置
// */
//public class UserManage {
// /**
// * 添加人员
// *
// * @param lUserID 登录句柄
// * @param employeeNo 工号
// * @throws UnsupportedEncodingException
// * @throws InterruptedException
// * @throws JSONException
// */
// public static void addUserInfo(int lUserID, String employeeNo) throws UnsupportedEncodingException, InterruptedException, JSONException {
// HCNetSDK.BYTE_ARRAY ptrByteArray = new HCNetSDK.BYTE_ARRAY(1024); //数组
// //"POST /ISAPI/AccessControl/UserInfo/Record?format=json" 此URL也是下发人员
// String strInBuffer = "PUT /ISAPI/AccessControl/UserInfo/SetUp?format=json";
// System.arraycopy(strInBuffer.getBytes(), 0, ptrByteArray.byValue, 0, strInBuffer.length());//字符串拷贝到数组中
// ptrByteArray.write();
//
// int lHandler = AcsMain.hCNetSDK.NET_DVR_StartRemoteConfig(lUserID, HCNetSDK.NET_DVR_JSON_CONFIG, ptrByteArray.getPointer(), strInBuffer.length(), null, null);
// if (lHandler < 0) {
// System.out.println("AddUserInfo NET_DVR_StartRemoteConfig 失败,错误码为" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// return;
// } else {
// System.out.println("AddUserInfo NET_DVR_StartRemoteConfig 成功!");
//
// byte[] Name = "测试1".getBytes("utf-8"); //根据iCharEncodeType判断如果iCharEncodeType返回6则是UTF-8编码。
// //如果是0或者1或者2则是GBK编码
//
// //将中文字符编码之后用数组拷贝的方式,避免因为编码导致的长度问题
// String strInBuffer1 = "{\n" +
// " \"UserInfo\":{\n" +
// " \"employeeNo\":\""+employeeNo+"\",\n" +
// " \"name\":\"";
// String strInBuffer2 = "\",\n" +
// " \"userType\":\"normal\",\n" +
// " \"Valid\":{\n" +
// " \"enable\":true,\n" +
// " \"beginTime\":\"2019-08-01T17:30:08\",\n" +
// " \"endTime\":\"2030-08-01T17:30:08\",\n" +
// " \"timeType\":\"local\"\n" +
// " },\n" +
// " \"belongGroup\":\"1\",\n" +
// " \"doorRight\":\"1\",\n" +
// " \"RightPlan\":[\n" +
// " {\n" +
// " \"doorNo\":1,\n" +
// " \"planTemplateNo\":\"1\"\n" +
// " }\n" +
// " ]\n" +
// " }\n" +
// "}";
// int iStringSize = Name.length + strInBuffer1.length() + strInBuffer2.length();
//
// HCNetSDK.BYTE_ARRAY ptrByte = new HCNetSDK.BYTE_ARRAY(iStringSize);
// System.arraycopy(strInBuffer1.getBytes(), 0, ptrByte.byValue, 0, strInBuffer1.length());
// System.arraycopy(Name, 0, ptrByte.byValue, strInBuffer1.length(), Name.length);
// System.arraycopy(strInBuffer2.getBytes(), 0, ptrByte.byValue, strInBuffer1.length() + Name.length, strInBuffer2.length());
// ptrByte.write();
//
// System.out.println(new String(ptrByte.byValue));
//
// HCNetSDK.BYTE_ARRAY ptrOutuff = new HCNetSDK.BYTE_ARRAY(1024);
//
// IntByReference pInt = new IntByReference(0);
// while (true) {
// int dwState = AcsMain.hCNetSDK.NET_DVR_SendWithRecvRemoteConfig(lHandler, ptrByte.getPointer(), iStringSize, ptrOutuff.getPointer(), 1024, pInt);
// if (dwState == -1) {
// System.out.println("NET_DVR_SendWithRecvRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// break;
// }
// //读取返回的json并解析
// ptrOutuff.read();
// String strResult = new String(ptrOutuff.byValue).trim();
// System.out.println("dwState:" + dwState + ",strResult:" + strResult);
//
// JSONObject jsonResult = new JSONObject(strResult);
// int statusCode = jsonResult.getInt("statusCode");
// String statusString = jsonResult.getString("statusString");
// if (dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_NEED_WAIT) {
// System.out.println("配置等待");
// Thread.sleep(10);
// continue;
// } else if (dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_FAILED) {
// System.out.println("下发人员失败, json retun:" + jsonResult.toString());
// break;
// } else if (dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_EXCEPTION) {
// System.out.println("下发人员异常, json retun:" + jsonResult.toString());
// break;
// } else if (dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_SUCCESS) {//返回NET_SDK_CONFIG_STATUS_SUCCESS代表流程走通了但并不代表下发成功比如有些设备可能因为人员已存在等原因下发失败所以需要解析Json报文
// if (statusCode != 1) {
// System.out.println("下发人员成功,但是有异常情况:" + jsonResult.toString());
// } else {
// System.out.println("下发人员成功: json retun:" + jsonResult.toString());
// }
// break;
// } else if (dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_FINISH) {
// //下发人员时dwState其实不会走到这里因为设备不知道我们会下发多少个人所以长连接需要我们主动关闭
// System.out.println("下发人员完成");
// break;
// }
// }
// if (!AcsMain.hCNetSDK.NET_DVR_StopRemoteConfig(lHandler)) {
// System.out.println("NET_DVR_StopRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// } else {
// System.out.println("NET_DVR_StopRemoteConfig接口成功");
// }
// }
// }
//
// /**
// * 查询人员信息
// * @param userID
// * @throws JSONException
// */
// public static void searchUserInfo(int userID) throws JSONException {
// HCNetSDK.BYTE_ARRAY ptrByteArray = new HCNetSDK.BYTE_ARRAY(1024); //数组
// String strInBuffer = "POST /ISAPI/AccessControl/UserInfo/Search?format=json";
// System.arraycopy(strInBuffer.getBytes(), 0, ptrByteArray.byValue, 0, strInBuffer.length());//字符串拷贝到数组中
// ptrByteArray.write();
//
// int lHandler = AcsMain.hCNetSDK.NET_DVR_StartRemoteConfig(userID, HCNetSDK.NET_DVR_JSON_CONFIG, ptrByteArray.getPointer(), strInBuffer.length(), null, null);
// if (lHandler < 0) {
// System.out.println("SearchUserInfo NET_DVR_StartRemoteConfig 失败,错误码为" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// return;
// } else {
// //组装查询的JSON报文这边查询的是所有的人员
// JSONObject jsonObject = new JSONObject();
// JSONObject jsonSearchCond = new JSONObject();
//
// //如果需要查询指定的工号人员信息,把下面注释的内容去除掉即可
// /* JSONArray EmployeeNoList = new JSONArray();
// JSONObject employeeNo1 = new JSONObject();
// employeeNo1.put("employeeNo", "12346");
// JSONObject employeeNo2 = new JSONObject();
// employeeNo2.put("employeeNo", "1000");
// EmployeeNoList.put(employeeNo1);
// EmployeeNoList.put(employeeNo2);
// jsonSearchCond.put("EmployeeNoList", EmployeeNoList);*/
//
// jsonSearchCond.put("searchID", "20211126");
// jsonSearchCond.put("searchResultPosition", 0);
// jsonSearchCond.put("maxResults", 50);
// jsonObject.put("UserInfoSearchCond", jsonSearchCond);
//
// String strInbuff = jsonObject.toString();
// System.out.println("查询的json报文:" + strInbuff);
//
// //把string传递到Byte数组中后续用.getPointer()方法传入指针地址中。
// HCNetSDK.BYTE_ARRAY ptrInbuff = new HCNetSDK.BYTE_ARRAY(strInbuff.length());
// System.arraycopy(strInbuff.getBytes(), 0, ptrInbuff.byValue, 0, strInbuff.length());
// ptrInbuff.write();
//
// //定义接收结果的结构体
// HCNetSDK.BYTE_ARRAY ptrOutuff = new HCNetSDK.BYTE_ARRAY(10 * 1024);
//
// IntByReference pInt = new IntByReference(0);
//
// while (true) {
// /*
// dwOutBuffSize是输出缓冲区大小需要自定义指定大小如果接口报错错误码43.说明接收设备数据的缓冲区或存放图片缓冲区不足,应扩大缓冲区大小
// */
// int dwState = AcsMain.hCNetSDK.NET_DVR_SendWithRecvRemoteConfig(lHandler, ptrInbuff.getPointer(), strInbuff.length(), ptrOutuff.getPointer(), 20 * 1024, pInt);
// System.out.println(dwState);
// if (dwState == -1) {
// System.out.println("NET_DVR_SendWithRecvRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// break;
// } else if (dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_NEED_WAIT) {
// System.out.println("配置等待");
// try {
// Thread.sleep(10);
// } catch (InterruptedException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// continue;
// } else if (dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_FAILED) {
// System.out.println("查询人员失败");
// break;
// } else if (dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_EXCEPTION) {
// System.out.println("查询人员异常");
// break;
// } else if (dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_SUCCESS) {
// ptrOutuff.read();
// System.out.println("查询人员成功, json:" + new String(ptrOutuff.byValue).trim());
// break;
// } else if (dwState == HCNetSDK.NET_SDK_CONFIG_STATUS_FINISH) {
// System.out.println("获取人员完成");
// break;
// }
// }
//
// if (!AcsMain.hCNetSDK.NET_DVR_StopRemoteConfig(lHandler)) {
// System.out.println("NET_DVR_StopRemoteConfig接口调用失败错误码" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// } else {
// System.out.println("NET_DVR_StopRemoteConfig接口成功");
// lHandler = -1;
// }
// }
//
//
// }
//
// public static void deleteUserInfo(int userID) throws JSONException {
// //删除单个人员
//// String deleteUserjson="{\n" +
//// "\t\"UserInfoDetail\": {\t\n" +
//// "\t\t\"mode\": \"byEmployeeNo\",\t\n" +
//// "\t\t\"EmployeeNoList\": [\t\n" +
//// "\t\t\t{\n" +
//// "\t\t\t\t\"employeeNo\": \"test\"\t\n" +
//// "\t\t\t}\n" +
//// "\t\t]\n" +
//// "\n" +
//// "\t}\n" +
//// "}";
// //删除所有人员
// String deleteUserjson = "{\n" +
// "\t\"UserInfoDetail\": {\t\n" +
// "\t\t\"mode\": \"all\",\t\n" +
// "\t\t\"EmployeeNoList\": [\t\n" +
// "\t\t]\n" +
// "\n" +
// "\t}\n" +
// "}";
// String deleteUserUrl = "PUT /ISAPI/AccessControl/UserInfoDetail/Delete?format=json";
// String result = TransIsapi.put_isapi(userID, deleteUserUrl, deleteUserjson);
// System.out.println(result);
// //获取删除进度
// while (true) {
// String getDeleteProcessUrl = "GET /ISAPI/AccessControl/UserInfoDetail/DeleteProcess?format=json";
// String deleteResult = TransIsapi.get_isapi(userID, getDeleteProcessUrl);
// JSONObject jsonObject = new JSONObject(deleteResult);
// JSONObject jsonObject1 = jsonObject.getJSONObject("UserInfoDetailDeleteProcess");
// String process = jsonObject1.getString("status");
// System.out.println("process ="+process);
// if (process.equals("processing")) {
// System.out.println("正在删除");
// continue;
// } else if (process.equals("success")) {
// System.out.println("删除成功");
// break;
// }else if(process.equals("failed")){
// System.out.println("删除失败");
// break;
// }
// }
// }
//
// /**
// * 人员计划模板配置
// *
// * @param userID 用户登录句柄
// * @param iPlanTemplateNumber 计划模板编号从1开始最大值从门禁能力集获取
// */
// public static void setCardTemplate(int userID, int iPlanTemplateNumber) {
// //设置卡权限计划模板参数
// HCNetSDK.NET_DVR_PLAN_TEMPLATE_COND struPlanCond = new HCNetSDK.NET_DVR_PLAN_TEMPLATE_COND();
// struPlanCond.dwSize = struPlanCond.size();
// struPlanCond.dwPlanTemplateNumber = iPlanTemplateNumber;//计划模板编号从1开始最大值从门禁能力集获取
// struPlanCond.wLocalControllerID = 0;//就地控制器序号[1,64]0表示门禁主机
// struPlanCond.write();
// HCNetSDK.NET_DVR_PLAN_TEMPLATE struPlanTemCfg = new HCNetSDK.NET_DVR_PLAN_TEMPLATE();
// struPlanTemCfg.dwSize = struPlanTemCfg.size();
// struPlanTemCfg.byEnable = 1; //是否使能0- 否1- 是
// struPlanTemCfg.dwWeekPlanNo = 2;//周计划编号0表示无效
// struPlanTemCfg.dwHolidayGroupNo[0] = 0;//假日组编号按值表示采用紧凑型排列中间遇到0则后续无效
// byte[] byTemplateName;
// try {
// byTemplateName = "CardTemplatePlan_2".getBytes("GBK");
// //计划模板名称
// for (int i = 0; i < HCNetSDK.NAME_LEN; i++) {
// struPlanTemCfg.byTemplateName[i] = 0;
// }
// System.arraycopy(byTemplateName, 0, struPlanTemCfg.byTemplateName, 0, byTemplateName.length);
// } catch (UnsupportedEncodingException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// struPlanTemCfg.write();
// IntByReference pInt = new IntByReference(0);
// Pointer lpStatusList = pInt.getPointer();
// if (false == AcsMain.hCNetSDK.NET_DVR_SetDeviceConfig(userID, HCNetSDK.NET_DVR_SET_CARD_RIGHT_PLAN_TEMPLATE_V50, 1, struPlanCond.getPointer(), struPlanCond.size(), lpStatusList, struPlanTemCfg.getPointer(), struPlanTemCfg.size())) {
// System.out.println("NET_DVR_SET_CARD_RIGHT_PLAN_TEMPLATE_V50失败错误号" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// return;
// }
// System.out.println("NET_DVR_SET_CARD_RIGHT_PLAN_TEMPLATE_V50成功");
// //获取卡权限周计划参数
// HCNetSDK.NET_DVR_WEEK_PLAN_COND struWeekPlanCond = new HCNetSDK.NET_DVR_WEEK_PLAN_COND();
// struWeekPlanCond.dwSize = struWeekPlanCond.size();
// struWeekPlanCond.dwWeekPlanNumber = 2;
// struWeekPlanCond.wLocalControllerID = 0;
// HCNetSDK.NET_DVR_WEEK_PLAN_CFG struWeekPlanCfg = new HCNetSDK.NET_DVR_WEEK_PLAN_CFG();
// struWeekPlanCond.write();
// struWeekPlanCfg.write();
// Pointer lpCond = struWeekPlanCond.getPointer();
// Pointer lpInbuferCfg = struWeekPlanCfg.getPointer();
// if (false == AcsMain.hCNetSDK.NET_DVR_GetDeviceConfig(userID, HCNetSDK.NET_DVR_GET_CARD_RIGHT_WEEK_PLAN_V50, 1, lpCond, struWeekPlanCond.size(), lpStatusList, lpInbuferCfg, struWeekPlanCfg.size())) {
// System.out.println("NET_DVR_GET_CARD_RIGHT_WEEK_PLAN_V50失败错误号" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// return;
// }
// struWeekPlanCfg.read();
// struWeekPlanCfg.byEnable = 1; //是否使能0- 否1- 是
// /**避免时间段交叉,先初始化, 七天八小时*/
// for (int i = 0; i < 7; i++) {
// for (int j = 0; j < 8; j++) {
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[j].byEnable = 0;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[j].struTimeSegment.struBeginTime.byHour = 0;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[j].struTimeSegment.struBeginTime.byMinute = 0;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[j].struTimeSegment.struBeginTime.bySecond = 0;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[j].struTimeSegment.struEndTime.byHour = 0;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[j].struTimeSegment.struEndTime.byMinute = 0;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[j].struTimeSegment.struEndTime.bySecond = 0;
// }
// }
// /**一周7天全天24小时*/
// for (int i = 0; i < 7; i++) {
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[0].byEnable = 1;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[0].struTimeSegment.struBeginTime.byHour = 21;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[0].struTimeSegment.struBeginTime.byMinute = 0;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[0].struTimeSegment.struBeginTime.bySecond = 0;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[0].struTimeSegment.struEndTime.byHour = 23;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[0].struTimeSegment.struEndTime.byMinute = 0;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[0].struTimeSegment.struEndTime.bySecond = 0;
// }
// /**一周7天每天设置2个时间段*/
// /*for(int i=0;i<7;i++)
// {
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[0].byEnable = 1;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[0].struTimeSegment.struBeginTime.byHour = 0;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[0].struTimeSegment.struBeginTime.byMinute = 0;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[0].struTimeSegment.struBeginTime.bySecond = 0;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[0].struTimeSegment.struEndTime.byHour = 11;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[0].struTimeSegment.struEndTime.byMinute = 59;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[0].struTimeSegment.struEndTime.bySecond = 59;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[1].byEnable = 1;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[1].struTimeSegment.struBeginTime.byHour = 13;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[1].struTimeSegment.struBeginTime.byMinute = 30;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[1].struTimeSegment.struBeginTime.bySecond = 0;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[1].struTimeSegment.struEndTime.byHour = 19;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[1].struTimeSegment.struEndTime.byMinute = 59;
// struWeekPlanCfg.struPlanCfg[i].struPlanCfgDay[1].struTimeSegment.struEndTime.bySecond = 59;
// }*/
// struWeekPlanCfg.write();
// //设置卡权限周计划参数
// if (false == AcsMain.hCNetSDK.NET_DVR_SetDeviceConfig(userID, HCNetSDK.NET_DVR_SET_CARD_RIGHT_WEEK_PLAN_V50, 1, lpCond, struWeekPlanCond.size(), lpStatusList, lpInbuferCfg, struWeekPlanCfg.size())) {
// System.out.println("NET_DVR_SET_CARD_RIGHT_WEEK_PLAN_V50失败错误号" + AcsMain.hCNetSDK.NET_DVR_GetLastError());
// } else {
// System.out.println("NET_DVR_SET_CARD_RIGHT_WEEK_PLAN_V50成功");
// }
// }
//
//}

@ -1,26 +0,0 @@
//package com.shxy.xyhkcamera.configure;
//
//import com.baomidou.mybatisplus.annotation.DbType;
//import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
//import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
//import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.transaction.annotation.EnableTransactionManagement;
//
//@Configuration
//@EnableTransactionManagement
//public class MybatisPlusConfig {
//
// @Bean
// public MybatisPlusInterceptor mybatisPlusInterceptor() {
// MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// PaginationInnerInterceptor pii = new PaginationInnerInterceptor();
// pii.setDbType(DbType.MYSQL);
// pii.setMaxLimit(500L);
// interceptor.addInnerInterceptor(pii);
// return interceptor;
// }
//
//}
//

@ -1,18 +0,0 @@
package com.shxy.xyhkcamera.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
*
* </p>
*
* @author jingjing
* @since 2024-05-20
*/
@RestController
@RequestMapping("/data-eaif-hentity")
public class DataEaifHController {
}

@ -1,18 +0,0 @@
package com.shxy.xyhkcamera.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
*
* </p>
*
* @author jingjing
* @since 2024-05-20
*/
@RestController
@RequestMapping("/modev-eaif-entity")
public class ModevEaifController {
}

@ -8,8 +8,6 @@ import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
@ -24,55 +22,42 @@ import lombok.Setter;
@Getter
@Setter
@TableName("data_eaif_h")
@ApiModel(value = "DataEaifHEntity对象", description = "红外区域测温数据表")
public class DataEaifHEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("自动编号")
@TableId(value = "data_id", type = IdType.AUTO)
private Integer dataId;
@ApiModelProperty("设备ID")
@TableField("eqmid")
private Integer eqmid;
@ApiModelProperty("点、线、区域ID")
@TableField("areaid")
private Integer areaid;
@ApiModelProperty("采集时间")
@TableField("capturetime")
private LocalDateTime capturetime;
@ApiModelProperty("最大温度")
@TableField("maxtemp")
private Double maxtemp;
@ApiModelProperty("最小温度")
@TableField("mintemp")
private Double mintemp;
@ApiModelProperty("平均温度")
@TableField("avgtemp")
private Double avgtemp;
@ApiModelProperty("1=>摄氏度2=>华氏度")
@TableField("unit")
private Byte unit;
@ApiModelProperty("1->点2->线3->框")
@TableField("type")
private Byte type;
@ApiModelProperty("中间差")
@TableField("mid")
private Double mid;
@ApiModelProperty("标准方差值")
@TableField("std")
private Double std;
@TableField("isupload")
private Integer isupload;
}

@ -4,15 +4,15 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
/**
* <p>
*
*
* </p>
*
* @author jingjing
@ -21,26 +21,22 @@ import lombok.Setter;
@Getter
@Setter
@TableName("modev_eaif")
@ApiModel(value = "ModevEaifEntity对象", description = "")
public class ModevEaifEntity implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableField("eqmid")
private Integer eqmid;
@ApiModelProperty("预置点id")
@TableField("nPresetId")
private Integer nPresetId;
@ApiModelProperty("规则编号")
@TableField("nRuleId")
private Integer nRuleId;
@ApiModelProperty("规则类型")
@TableField("nMeterType")
private Integer nMeterType;
}

@ -0,0 +1,97 @@
package com.shxy.xyhkcamera.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDate;
import lombok.Getter;
import lombok.Setter;
/**
* <p>
*
* </p>
*
* @author jingjing
* @since 2024-05-20
*/
@Getter
@Setter
@TableName("modev")
public class ModevEntity implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableField("name")
private String name;
@TableField("modevtid")
private Integer modevtid;
@TableField("address")
private Integer address;
@TableField("frequency")
private Integer frequency;
@TableField("portname")
private String portname;
@TableField("zsbid")
private Integer zsbid;
@TableField("iedid")
private Integer iedid;
@TableField("equipmentmodel")
private String equipmentmodel;
@TableField("manufacture")
private String manufacture;
@TableField("factoryint")
private String factoryint;
@TableField("manufacturedate")
private LocalDate manufacturedate;
@TableField("rundate")
private LocalDate rundate;
@TableField("location")
private String location;
@TableField("note")
private String note;
@TableField("znxjdevid")
private String znxjdevid;
@TableField("ip")
private String ip;
@TableField("username")
private String username;
@TableField("pwd")
private String pwd;
@TableField("port")
private String port;
@TableField("nPresetId")
private Integer nPresetId;
@TableField("nRuleId")
private Integer nRuleId;
@TableField("nMeterType")
private Integer nMeterType;
}

@ -1,4 +1,4 @@
package com.shxy.xyhkcamera;
package com.shxy.xyhkcamera.hk;
import com.sun.jna.*;

@ -1,4 +1,4 @@
package com.shxy.xyhkcamera;
package com.shxy.xyhkcamera.hk;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
@ -21,22 +21,6 @@ public class HcNetSdkUtil {
private HCNetSDK hCNetSDK = null;
/**
*
*/
private int userID;
/**
* win32 dll
*/
@Value("${hkconfig.winpath}")
private String winPath;
/**
* linux dll
*/
@Value("${hkconfig.linuxpath}")
private String linuxPath;
static FExceptionCallBack_Imp fExceptionCallBack;
static class FExceptionCallBack_Imp implements HCNetSDK.FExceptionCallBack {

@ -1,4 +1,4 @@
package com.shxy.xyhkcamera;
package com.shxy.xyhkcamera.hk;
import com.sun.jna.Platform;
import lombok.extern.slf4j.Slf4j;

@ -1,14 +0,0 @@
package com.shxy.xyhkcamera.impl;
import com.shxy.xyhkcamera.service.TempMeasureService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class TempMeasureServiceImpl implements TempMeasureService {
@Override
public void measure() {
// hcNetSdkUtil.createSDKInstance();
}
}

@ -0,0 +1,16 @@
package com.shxy.xyhkcamera.mapper;
import com.shxy.xyhkcamera.entity.ModevEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper
* </p>
*
* @author jingjing
* @since 2024-05-20
*/
public interface ModevMapper extends BaseMapper<ModevEntity> {
}

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.shxy.xyhkcamera.mapper.ModevMapper">
</mapper>

@ -1,6 +1,8 @@
package com.shxy.xyhkcamera.schedule;
import com.shxy.xyhkcamera.service.TempMeasureService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@ -14,11 +16,13 @@ import org.springframework.stereotype.Component;
@Slf4j
public class ScheduledTask {
@Autowired
TempMeasureService tempMeasureService;
@Scheduled(fixedDelay = 60 * 60 * 1000)
public void cacyspupload() {
log.info("开始测温");
// webservcies.uploadyspData();
tempMeasureService.measure();
}
}

@ -0,0 +1,16 @@
package com.shxy.xyhkcamera.service;
import com.shxy.xyhkcamera.entity.ModevEntity;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
*
* </p>
*
* @author jingjing
* @since 2024-05-20
*/
public interface ModevService extends IService<ModevEntity> {
}

@ -15,6 +15,6 @@ import org.springframework.stereotype.Service;
* @since 2024-05-20
*/
@Service
public class DataEaifHServiceImp extends ServiceImpl<DataEaifHMapper, DataEaifHEntity> implements DataEaifHService {
public class DataEaifHServiceImpl extends ServiceImpl<DataEaifHMapper, DataEaifHEntity> implements DataEaifHService {
}

@ -15,6 +15,6 @@ import org.springframework.stereotype.Service;
* @since 2024-05-20
*/
@Service
public class ModevEaifServiceImp extends ServiceImpl<ModevEaifMapper, ModevEaifEntity> implements ModevEaifService {
public class ModevEaifServiceImpl extends ServiceImpl<ModevEaifMapper, ModevEaifEntity> implements ModevEaifService {
}

@ -0,0 +1,20 @@
package com.shxy.xyhkcamera.service.impl;
import com.shxy.xyhkcamera.entity.ModevEntity;
import com.shxy.xyhkcamera.mapper.ModevMapper;
import com.shxy.xyhkcamera.service.ModevService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
*
* </p>
*
* @author jingjing
* @since 2024-05-20
*/
@Service
public class ModevServiceImp extends ServiceImpl<ModevMapper, ModevEntity> implements ModevService {
}

@ -0,0 +1,29 @@
package com.shxy.xyhkcamera.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.shxy.xyhkcamera.entity.ModevEaifEntity;
import com.shxy.xyhkcamera.entity.ModevEntity;
import com.shxy.xyhkcamera.service.ModevEaifService;
import com.shxy.xyhkcamera.service.ModevService;
import com.shxy.xyhkcamera.service.TempMeasureService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Wrapper;
import java.util.List;
@Service
@Slf4j
public class TempMeasureServiceImpl implements TempMeasureService {
@Autowired
ModevServiceImp modevService;
@Override
public void measure() {
// hcNetSdkUtil.createSDKInstance();
// List<ModevEntity> list = modevService.list(Wrappers.lambdaQuery(ModevEntity.class).eq(ModevEntity::getModevtid, 9));
}
}

@ -1,85 +0,0 @@
package com.shxy.xyhkcamera.test;
import com.sun.jna.ptr.IntByReference;
/**
* \if ENGLISH_LANG
* Capture Picture Interface
* contains:localremotetimer and stop capture picture
* \else
*
* :
* \endif
*/
public class CapturePictureModule {
/**
* \if ENGLISH_LANG
* Remote Capture Picture
* \else
*
* \endif
*/
public static boolean remoteCapturePicture(int chn) {
return snapPicture(chn, 0, 0);
}
/**
* \if ENGLISH_LANG
* Timer Capture Picture
* \else
*
* \endif
*/
public static boolean timerCapturePicture(int chn) {
return snapPicture(chn, 1, 2);
}
/**
* \if ENGLISH_LANG
* Stop Timer Capture Picture
* \else
*
* \endif
*/
public static boolean stopCapturePicture(int chn) {
return snapPicture(chn, -1, 0);
}
/**
* \if ENGLISH_LANG
* Capture Picture (except local capture picture, others all call this interface)
* \else
* (, )
* \endif
*/
private static boolean snapPicture(int chn, int mode, int interval) {
// send caputre picture command to device
NetSDKLib.SNAP_PARAMS stuSnapParams = new NetSDKLib.SNAP_PARAMS();
stuSnapParams.Channel = chn; // channel
stuSnapParams.mode = mode; // capture picture mode
stuSnapParams.Quality = 3; // picture quality
stuSnapParams.InterSnap = interval; // timer capture picture time interval
stuSnapParams.CmdSerial = 0; // request serial
IntByReference reserved = new IntByReference(0);
if (!INetSDK.netsdk.CLIENT_SnapPictureEx(INetSDK.m_hLoginHandle, stuSnapParams, reserved)) {
System.err.printf("CLIENT_SnapPictureEx Failed!" + INetSDK.netsdk.CLIENT_GetLastError());
return false;
} else {
System.out.println("CLIENT_SnapPictureEx success");
}
return true;
}
/**
* \if ENGLISH_LANG
* Set Capture Picture Callback
* \else
*
* \endif
*/
public static void setSnapRevCallBack(NetSDKLib.fSnapRev cbSnapReceive){
INetSDK.netsdk.CLIENT_SetSnapRevCallBack(cbSnapReceive, null);
}
}

@ -1,192 +0,0 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.shxy.xyhkcamera.test;
import java.io.BufferedReader;
import java.lang.reflect.Field;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
/**
*
* @author LENOVO
*/
public class DBHelper {
private static String DRIVER="";
//private static final String URL="jdbc:mysql://192.168.1.188/dss";
private static String URL="";
private static String USER="";
private static String PASSWORD="";
public void GetText(String path){
if(DRIVER!=""){
return;
}
// 1.定义目标文件
File srcFile = new File(path);
// 2.创建一个流,指向目标文件
BufferedReader is = null;
try {
is = new BufferedReader(new FileReader(srcFile));
int i= 0;
String s = null;
while ((s = is.readLine()) != null) {// 使用readLine方法一次读一行
if(i==0){
DRIVER = s;
}
if(i==1){
URL = s;
}
if(i==2){
USER = s;
}
if(i==3){
PASSWORD = s;
}
i++;
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
// 关闭io流
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
*
* @return
*/
public Connection getConnection(){
// GetText("D://shjdconfig.txt");
GetText("/home/shjdconfig.txt");
Connection conn=null;
try {
Class.forName(DRIVER);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
conn=DriverManager.getConnection(URL, USER, PASSWORD);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return conn;
}
/**
*
* @param rs
* @param pstmt
* @param conn
*/
public void closeAll(ResultSet rs,PreparedStatement pstmt,Connection conn){
try {
if(rs!=null){
rs.close();
}
if(pstmt!=null){
pstmt.close();
}
if(conn!=null){
conn.close();
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
*
* @param sql
* @return true or false
*/
public int excuteUpdate(String sql){
int res=0;//受影响的行数
Connection conn=null;
PreparedStatement pstmt = null;
ResultSet rs=null;
try {
conn=getConnection();
pstmt=conn.prepareStatement(sql);//装载sql语句
res=pstmt.executeUpdate();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
closeAll(rs, pstmt, conn);
}
return res;
}
/**
* 使
* @param sql
* @param params
* @param cls
* @return
*/
public <T> List<T> executeQuery(String sql,List<Object> params,Class<T> cls) throws Exception{
Connection conn=null;
PreparedStatement pstmt = null;
ResultSet rs=null;
List<T> data=new ArrayList<T>();
try {
conn=getConnection();
pstmt=conn.prepareStatement(sql);//装载sql语句
if(params!=null){
//加入有?占位符,在执行之前把?占位符替换掉
for(int i=0;i<params.size();i++){
pstmt.setObject(i+1, params.get(i));
}
}
rs=pstmt.executeQuery();
//把查询出来的记录封装成对应的实体类对象
ResultSetMetaData rsd=rs.getMetaData();//获得列对象,通过此对象可以得到表的结构,包括,列名,列的个数,列的数据类型
while(rs.next()){
T m=cls.newInstance();
for(int i=0;i<rsd.getColumnCount();i++){
String col_name=rsd.getColumnName(i+1);//获得列名
Object value=rs.getObject(col_name);//获得列所对应的值
Field field=cls.getDeclaredField(col_name);
field.setAccessible(true);//给私有属性设置可访问权
field.set(m, value);//给对象的私有属性赋值
}
data.add(m);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
closeAll(rs, pstmt, conn);
}
return data;
}
}

@ -1,576 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<NonVisualComponents>
<Container class="javax.swing.JFrame" name="jFrame1">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Container class="javax.swing.JFrame" name="jFrame2">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Component class="javax.swing.ButtonGroup" name="TypeGroup">
</Component>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" value="ClientDemo"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="10" style="0"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jSplitPaneHorizontal" alignment="0" pref="16050" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jSplitPaneHorizontal" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JSplitPane" name="jSplitPaneHorizontal">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder/>
</Border>
</Property>
<Property name="dividerLocation" type="int" value="155"/>
<Property name="dividerSize" type="int" value="2"/>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanelUserInfo">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder>
<Color PropertyName="highlight" blue="ff" green="ff" red="cc" type="rgb"/>
</EtchetBorder>
</Border>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[500, 878]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="left"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabelIPAddress1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
<Component id="jTextFieldPwd" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jButtonRealPlay" min="-2" pref="87" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jButtonLogin" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabelPortNumber1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
<Component id="jTextFieldPortNumber" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPaneTree" alignment="0" max="32767" attributes="1"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabelPortNumber4" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
<Component id="nPresetIdTxt" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
<Component id="jLabelPortNumber2" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jLabelPortNumber3" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="26" pref="26" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="nRuleId" max="32767" attributes="0"/>
<Component id="nMeterType1" max="32767" attributes="0"/>
</Group>
</Group>
<Component id="jButton2" alignment="0" min="-2" pref="87" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabelIPAddress" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabelPortNumber" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jTextFieldIPAddress" max="32767" attributes="0"/>
<Component id="jTextFieldUser" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace pref="20" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabelIPAddress" min="-2" max="-2" attributes="0"/>
<Component id="jTextFieldIPAddress" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabelPortNumber" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextFieldUser" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabelIPAddress1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jTextFieldPwd" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabelPortNumber1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jTextFieldPortNumber" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jButtonLogin" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jButtonRealPlay" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="nPresetIdTxt" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabelPortNumber4" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabelPortNumber3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="nMeterType1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="nRuleId" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabelPortNumber2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton2" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
<Component id="jScrollPaneTree" min="-2" pref="167" max="-2" attributes="0"/>
<EmptySpace pref="349" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="jButtonRealPlay">
<Properties>
<Property name="text" type="java.lang.String" value="&#x9884;&#x89c8;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonRealPlayActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButtonLogin">
<Properties>
<Property name="text" type="java.lang.String" value="&#x9000;&#x51fa;&#x9884;&#x89c8;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonLoginActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabelIPAddress">
<Properties>
<Property name="text" type="java.lang.String" value="IP&#x5730;&#x5740;&#xff1a;"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextFieldUser">
<Properties>
<Property name="text" type="java.lang.String" value="admin"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextFieldIPAddress">
<Properties>
<Property name="text" type="java.lang.String" value="192.168.1.108"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabelPortNumber">
<Properties>
<Property name="text" type="java.lang.String" value="&#x7528;&#x6237;&#x540d;&#xff1a;"/>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPaneTree">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTree" name="jTreeDevice">
<Properties>
<Property name="model" type="javax.swing.tree.TreeModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="this.initialTreeModel()" type="code"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="jButton2">
<Properties>
<Property name="text" type="java.lang.String" value="&#x83b7;&#x53d6;&#x6e29;&#x5ea6;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="jTextFieldPortNumber">
<Properties>
<Property name="text" type="java.lang.String" value="37777"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabelPortNumber1">
<Properties>
<Property name="text" type="java.lang.String" value="&#x7aef;&#x53e3;&#xff1a;"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabelIPAddress1">
<Properties>
<Property name="text" type="java.lang.String" value="&#x5bc6;&#x7801;&#xff1a;"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextFieldPwd">
<Properties>
<Property name="text" type="java.lang.String" value="admin12345"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextFieldPwdActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabelPortNumber2">
<Properties>
<Property name="text" type="java.lang.String" value="&#x89c4;&#x5219;&#x7f16;&#x53f7;&#xff1a;"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="nRuleId">
<Properties>
<Property name="text" type="java.lang.String" value="0"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabelPortNumber3">
<Properties>
<Property name="text" type="java.lang.String" value="&#x6d4b;&#x6e29;&#x9879;&#x7c7b;&#x578b;&#xff1a;"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabelPortNumber4">
<Properties>
<Property name="text" type="java.lang.String" value="&#x9884;&#x7f6e;&#x70b9;&#x7f16;&#x53f7;&#xff1a;"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="nPresetIdTxt">
<Properties>
<Property name="text" type="java.lang.String" value="0"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="nMeterType1">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="1">
<StringItem index="0" value="&#x8bf7;&#x9009;&#x62e9;&#x7c7b;&#x578b;"/>
</StringArray>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JSplitPane" name="jSplitPaneVertical">
<Properties>
<Property name="dividerLocation" type="int" value="579"/>
<Property name="dividerSize" type="int" value="2"/>
<Property name="orientation" type="int" value="0"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="right"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanelRealplayArea">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder>
<Color PropertyName="color" blue="66" green="ff" red="99" type="rgb"/>
</LineBorder>
</Border>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="top"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
<Component id="Realplay" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="15366" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="28" max="-2" attributes="0"/>
<Component id="Realplay" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="49" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="java.awt.Panel" name="Realplay">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[500, 500]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="RealplayMousePressed"/>
</Events>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="500" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="500" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="jLabel1"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="right"/>
</Constraint>
</Constraints>
</Component>
<Container class="java.awt.Panel" name="panel1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="right"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="25" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="fTemperStdTxt" min="-2" pref="118" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="fTemperMidTxt" min="-2" pref="118" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="fTemperMinTxt" min="-2" pref="118" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="fTemperMaxTxt" min="-2" pref="118" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="fTemperAverTxt" min="-2" pref="118" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="nTemperUnitTxt" min="-2" pref="118" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="15659" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="59" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="nTemperUnitTxt" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="fTemperAverTxt" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="fTemperMaxTxt" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="fTemperMinTxt" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="fTemperMidTxt" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="fTemperStdTxt" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="52" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="&#x6d4b;&#x6e29;&#x5355;&#x4f4d;&#xff1a;"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="nTemperUnitTxt">
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value="&#x5e73;&#x5747;&#x6e29;&#x5ea6;&#xff1a;"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="fTemperAverTxt">
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" value="&#x4e2d;&#x95f4;&#x503c;&#xff1a;"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="fTemperMidTxt">
</Component>
<Component class="javax.swing.JTextField" name="fTemperMinTxt">
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="text" type="java.lang.String" value="&#x6700;&#x5c0f;&#x6e29;&#x5ea6;&#xff1a;"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="text" type="java.lang.String" value="&#x6700;&#x9ad8;&#x6e29;&#x5ea6;&#xff1a;"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="fTemperMaxTxt">
</Component>
<Component class="javax.swing.JTextField" name="fTemperStdTxt">
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="text" type="java.lang.String" value="&#x6807;&#x51c6;&#x65b9;&#x5dee;&#x503c;&#xff1a;"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>

File diff suppressed because it is too large Load Diff

@ -1,678 +0,0 @@
package com.shxy.xyhkcamera.test;
import java.awt.Panel;
import java.io.File;
import com.sun.jna.Native;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.examples.win32.W32API;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.StdCallLibrary.StdCallCallback;
import javax.swing.SwingUtilities;
public class INetSDK {
static NetSDKLib netsdk = NetSDKLib.NETSDK_INSTANCE;
private static NetSDKLib playsdk = NetSDKLib.CONFIG_dhplay;
// 设备信息
public static NetSDKLib.NET_DEVICEINFO_Ex m_stDeviceInfo = new NetSDKLib.NET_DEVICEINFO_Ex();
// 登陆句柄
public static NativeLong m_hLoginHandle = new NativeLong(0);
// 预览句柄
public static NativeLong m_hPlayHandle = new NativeLong(0);
// 智能订阅句柄
public static NativeLong m_hAttachHandle = new NativeLong(0);
// 下载句柄
public static NativeLong m_hDownLoadHandle = new NativeLong(0);
private static boolean bInit = false;
private static boolean bLogopen = false;
/**
* \if ENGLISH_LANG
* Init
* \else
*
* \endif
*/
public static boolean init(NetSDKLib.fDisConnect disConnect, NetSDKLib.fHaveReConnect haveReConnect) {
bInit = netsdk.CLIENT_Init(disConnect, new NativeLong(0));
if (!bInit) {
System.out.println("Initialize SDK failed");
return false;
}
//打开日志,可选
NetSDKLib.LOG_SET_PRINT_INFO setLog = new NetSDKLib.LOG_SET_PRINT_INFO();
File path = new File("./sdklog/");
if (!path.exists()) {
path.mkdir();
}
String logPath = path.getAbsoluteFile().getParent() + "\\sdklog\\" + ToolKits.getDate() + ".log";
setLog.nPrintStrategy = 0;
setLog.bSetFilePath = 1;
System.arraycopy(logPath.getBytes(), 0, setLog.szLogFilePath, 0, logPath.getBytes().length);
System.out.println(logPath);
setLog.bSetPrintStrategy = 1;
setLog.nPrintStrategy = 0;
bLogopen = netsdk.CLIENT_LogOpen(setLog);
if (!bLogopen) {
System.err.println("Failed to open NetSDK log");
}
// 设置断线重连回调接口设置过断线重连成功回调函数后当设备出现断线情况SDK内部会自动进行重连操作
// 此操作为可选操作,但建议用户进行设置
netsdk.CLIENT_SetAutoReconnect(haveReConnect, new NativeLong(0));
//设置登录超时时间和尝试次数,可选
int waitTime = 5000; //登录请求响应超时时间设置为5S
int tryTimes = 1; //登录时尝试建立链接1次
netsdk.CLIENT_SetConnectTime(waitTime, tryTimes);
// 设置更多网络参数NET_PARAM的nWaittimenConnectTryNum成员与CLIENT_SetConnectTime
// 接口设置的登录设备超时时间和尝试次数意义相同,可选
NetSDKLib.NET_PARAM netParam = new NetSDKLib.NET_PARAM();
netParam.nConnectTime = 10000; //登录时尝试建立链接的超时时间
netsdk.CLIENT_SetNetworkParam(netParam);
return true;
}
/**
* \if ENGLISH_LANG
* CleanUp
* \else
*
* \endif
*/
public static void cleanup() {
if (bLogopen) {
netsdk.CLIENT_LogClose();
}
if (bInit) {
netsdk.CLIENT_Cleanup();
}
}
/**
* \if ENGLISH_LANG
* Login Device
* \else
*
* \endif
*/
public static boolean login(String m_strIp, int m_nPort, String m_strUser, String m_strPassword) {
IntByReference nError = new IntByReference(0);
m_hLoginHandle = netsdk.CLIENT_LoginEx2(m_strIp, m_nPort, m_strUser, m_strPassword, 0, null, m_stDeviceInfo, nError);
if (m_hLoginHandle.longValue() == 0) {
System.err.printf("Login Device[%s] Port[%d]Failed. Last Error[0x%x]\n", m_strIp, m_nPort, netsdk.CLIENT_GetLastError());
} else {
System.out.println("Login Success [ " + m_strIp + " ]");
}
return m_hLoginHandle.longValue() == 0 ? false : true;
}
/**
* \if ENGLISH_LANG
* Logout Device
* \else
*
* \endif
*/
public static boolean logout() {
if (m_hLoginHandle.longValue() == 0) {
return false;
}
boolean bRet = netsdk.CLIENT_Logout(m_hLoginHandle);
if (bRet) {
m_hLoginHandle.setValue(0);
}
return bRet;
}
/**
*
*/
public static String getErrorCode() {
return Res.string().getErrorCode(netsdk.CLIENT_GetLastError());
}
/**
*
*/
public static boolean ptzControlnPresetId(int nChannelID, int lParam1, int lParam2, int lParam3, int dwStop, Pointer param4) {
return netsdk.CLIENT_DHPTZControlEx2(m_hLoginHandle, nChannelID, NetSDKLib.NET_PTZ_ControlType.NET_PTZ_POINT_MOVE_CONTROL, lParam1, lParam2, lParam3, dwStop, param4);
}
/**
* \if ENGLISH_LANG
* Start RealPlay
* \else
*
* \endif
*/
public static fRealDataCallBackEx fReal = new fRealDataCallBackEx();
public static W32API.HWND hwnd;//窗体句柄
public static boolean startRealPlay(int channel, int stream, Panel realPlayWindow) {
hwnd = new W32API.HWND(Native.getComponentPointer(realPlayWindow));
boolean bOpenRet = playsdk.PLAY_OpenStream(new NativeLong(0), null, 0, 1024 * 500);
if (bOpenRet) {
// 开始播放
boolean bPlayRet = playsdk.PLAY_Play(new NativeLong(0), hwnd);
if (bPlayRet) {
m_hPlayHandle = netsdk.CLIENT_RealPlayEx(m_hLoginHandle, channel, null, stream);
//m_hPlayHandle = netsdk.CLIENT_RealPlayEx(m_hLoginHandle, channel, Native.getComponentPointer(realPlayWindow), stream);
}
boolean real = netsdk.CLIENT_SetRealDataCallBackEx(m_hPlayHandle, fReal, m_hLoginHandle, 0x1f);
}
if (m_hPlayHandle.longValue() == 0) {
System.err.println("开始实时监视失败,错误码" + String.format("[0x%x]", netsdk.CLIENT_GetLastError()));
} else {
//boolean real = netsdk.CLIENT_SetRealDataCallBackEx(m_hPlayHandle,fReal,m_hLoginHandle,0x1f);
System.out.println("Success to start realplay");
}
return m_hPlayHandle.longValue() == 0 ? false : true;
}
//摄像头回调: 通过 startRealPlay
public static class fRealDataCallBackEx implements NetSDKLib.fRealDataCallBackEx {
public void invoke(NativeLong lRealHandle, int dwDataType, Pointer pBuffer, int dwBufSize, int param, NativeLong dwUser) {
boolean bInput = false;
if (0 != lRealHandle.intValue()) {
switch (dwDataType) {
case 0:
//原始音视频混合数据
bInput = playsdk.PLAY_InputData(new NativeLong(0), pBuffer, dwBufSize);
if (!bInput) {
System.out.println("error");
}
break;
case 1:
//标准视频数据
break;
case 2:
//yuv 数据
break;
case 3:
//pcm 音频数据
break;
case 4:
//原始音频数据
break;
default:
break;
}
}
}
}
/**
* \if ENGLISH_LANG
* Start CLIENT_QueryDevInfo
* \else
*
* \endif
*/
//Pointer a = new Pointer(MemoryBlockFactory.createMemoryBlock(4 * 10));
public static boolean CLIENT_QueryDevInfo(int nQueryType, Pointer pInBuf, Pointer pOutBuf, Pointer pReservedL, int nWaitTime) {
//m_hLoginHandle.setValue(123);
boolean Isdate = netsdk.CLIENT_QueryDevInfo(m_hLoginHandle, nQueryType, pInBuf, pOutBuf, null, 3000);
if (!Isdate) {
System.err.println("查看失败,错误码:" + String.format("[0x%x]", netsdk.CLIENT_GetLastError()));
} else {
System.out.println("Success Look");
}
return Isdate;
}
/**
* \if ENGLISH_LANG
* Start RealPlay
* \else
*
* \endif
*/
public static void stopRealPlay() {
if (m_hPlayHandle.longValue() == 0) {
return;
}
boolean bRet = netsdk.CLIENT_StopRealPlayEx(m_hPlayHandle);
if (bRet) {
m_hPlayHandle.setValue(0);
}
}
public static void SetSnapRevCallBack(NetSDKLib.fSnapRev m_SnapReceiveCB) {
//设置抓图回调函数, 图片主要在m_SnapReceiveCB中返回
netsdk.CLIENT_SetSnapRevCallBack(m_SnapReceiveCB, new NativeLong(0));
}
/**
*
*/
public static boolean snapPicture(int chn) {
// 发送抓图命令给前端设备,抓图的信息
NetSDKLib.SNAP_PARAMS stuSnapParams = new NetSDKLib.SNAP_PARAMS();
stuSnapParams.Channel = chn; //抓图通道
stuSnapParams.mode = 0; //表示请求一帧
stuSnapParams.Quality = 3;
stuSnapParams.InterSnap = 5;
stuSnapParams.CmdSerial = 0; // 请求序列号,有效值范围 0~65535超过范围会被截断为
IntByReference reserved = new IntByReference(0);
if (!netsdk.CLIENT_SnapPictureEx(m_hLoginHandle, stuSnapParams, reserved)) {
System.err.printf("CLIENT_SnapPictureEx Failed!Last Error[%x]\n", netsdk.CLIENT_GetLastError());
return false;
} else {
System.out.println("CLIENT_SnapPictureEx success");
}
return true;
}
/********************************************************************************
* *
********************************************************************************/
/**
*
*/
public static boolean ptzControlUpStart(int nChannelID, int lParam1, int lParam2) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_UP_CONTROL,
lParam1, lParam2, 0, 0);
}
public static boolean ptzControlUpEnd(int nChannelID) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_UP_CONTROL,
0, 0, 0, 1);
}
/**
*
*/
public static boolean ptzControlDownStart(int nChannelID, int lParam1, int lParam2) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_DOWN_CONTROL,
lParam1, lParam2, 0, 0);
}
public static boolean ptzControlDownEnd(int nChannelID) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_DOWN_CONTROL,
0, 0, 0, 1);
}
/**
*
*/
public static boolean ptzControlLeftStart(int nChannelID, int lParam1, int lParam2) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID, NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LEFT_CONTROL,
lParam1, lParam2, 0, 0);
}
public static boolean ptzControlLeftEnd(int nChannelID) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LEFT_CONTROL,
0, 0, 0, 1);
}
/**
*
*/
public static boolean ptzControlRightStart(int nChannelID, int lParam1, int lParam2) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_RIGHT_CONTROL,
lParam1, lParam2, 0, 0);
}
public static boolean ptzControlRightEnd(int nChannelID) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_RIGHT_CONTROL,
0, 0, 0, 1);
}
/**
*
*/
public static boolean ptzControlLeftUpStart(int nChannelID, int lParam1, int lParam2) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTTOP,
lParam1, lParam2, 0, 0);
}
public static boolean ptzControlLeftUpEnd(int nChannelID) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTTOP,
0, 0, 0, 1);
}
/**
*
*/
public static boolean ptzControlRightUpStart(int nChannelID, int lParam1, int lParam2) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTTOP,
lParam1, lParam2, 0, 0);
}
public static boolean ptzControlRightUpEnd(int nChannelID) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTTOP,
0, 0, 0, 1);
}
/**
*
*/
public static boolean ptzControlLeftDownStart(int nChannelID, int lParam1, int lParam2) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTDOWN,
lParam1, lParam2, 0, 0);
}
public static boolean ptzControlLeftDownEnd(int nChannelID) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTDOWN,
0, 0, 0, 1);
}
/**
*
*/
public static boolean ptzControlRightDownStart(int nChannelID, int lParam1, int lParam2) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTDOWN,
lParam1, lParam2, 0, 0);
}
public static boolean ptzControlRightDownEnd(int nChannelID) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTDOWN,
0, 0, 0, 1);
}
/**
* +
*/
public static boolean ptzControlZoomAddStart(int nChannelID, int lParam2) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_ADD_CONTROL,
0, lParam2, 0, 0);
}
public static boolean ptzControlZoomAddEnd(int nChannelID) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_ADD_CONTROL,
0, 0, 0, 1);
}
/**
* -
*/
public static boolean ptzControlZoomDecStart(int nChannelID, int lParam2) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_DEC_CONTROL,
0, lParam2, 0, 0);
}
public static boolean ptzControlZoomDecEnd(int nChannelID) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_DEC_CONTROL,
0, 0, 0, 1);
}
/**
* +
*/
public static boolean ptzControlFocusAddStart(int nChannelID, int lParam2) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_ADD_CONTROL,
0, lParam2, 0, 0);
}
public static boolean ptzControlFocusAddEnd(int nChannelID) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_ADD_CONTROL,
0, 0, 0, 1);
}
/**
* -
*/
public static boolean ptzControlFocusDecStart(int nChannelID, int lParam2) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_DEC_CONTROL,
0, lParam2, 0, 0);
}
public static boolean ptzControlFocusDecEnd(int nChannelID) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_DEC_CONTROL,
0, 0, 0, 1);
}
/**
* +
*/
public static boolean ptzControlIrisAddStart(int nChannelID, int lParam2) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_ADD_CONTROL,
0, lParam2, 0, 0);
}
public static boolean ptzControlIrisAddEnd(int nChannelID) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_ADD_CONTROL,
0, 0, 0, 1);
}
/**
* -
*/
public static boolean ptzControlIrisDecStart(int nChannelID, int lParam2) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_DEC_CONTROL,
0, lParam2, 0, 0);
}
public static boolean ptzControlIrisDecEnd(int nChannelID) {
return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_DEC_CONTROL,
0, 0, 0, 1);
}
/********************************************************************************
* *
********************************************************************************/
/**
*
*/
public static void Old_OpenStrobe(int bTriggerBtnClick) {
if (m_hLoginHandle.longValue() != 0) {
System.out.println("Trigger Button Action");
NetSDKLib.ALARMCTRL_PARAM param = new NetSDKLib.ALARMCTRL_PARAM();
param.nAction = bTriggerBtnClick;
; // 1触发报警0停止报警. 按钮按下
if (netsdk.CLIENT_ControlDeviceEx(m_hLoginHandle, NetSDKLib.CtrlType.CTRLTYPE_TRIGGER_ALARM_OUT, param.getPointer(), null, 3000)) {
System.out.println("控制成功");
} else {
System.err.printf("Failed to Open 0x%x", netsdk.CLIENT_GetLastError());
}
}
}
/**
*
*/
public static boolean New_OpenStrobe() {
NetSDKLib.NET_CTRL_OPEN_STROBE openStrobe = new NetSDKLib.NET_CTRL_OPEN_STROBE();
openStrobe.nChannelId = 0;
String plate = new String("浙A888888");
System.arraycopy(plate.getBytes(), 0, openStrobe.szPlateNumber, 0, plate.getBytes().length);
openStrobe.write();
if (netsdk.CLIENT_ControlDeviceEx(m_hLoginHandle, NetSDKLib.CtrlType.CTRLTYPE_CTRL_OPEN_STROBE, openStrobe.getPointer(), null, 3000)) {
System.out.println("Open Success!");
} else {
System.err.printf("Failed to Open 0x%x\n", netsdk.CLIENT_GetLastError());
return false;
}
openStrobe.read();
return true;
}
/**
*
*/
public static void New_CloseStrobe() {
NetSDKLib.NET_CTRL_CLOSE_STROBE closeStrobe = new NetSDKLib.NET_CTRL_CLOSE_STROBE();
closeStrobe.nChannelId = 0;
closeStrobe.write();
if (netsdk.CLIENT_ControlDeviceEx(m_hLoginHandle, NetSDKLib.CtrlType.CTRLTYPE_CTRL_CLOSE_STROBE, closeStrobe.getPointer(), null, 3000)) {
System.out.println("Close Success!");
} else {
System.err.printf("Failed to Close 0x%x\n", netsdk.CLIENT_GetLastError());
}
closeStrobe.read();
}
/**
*
*/
public static boolean manualSnapPicture(int chn) {
NetSDKLib.MANUAL_SNAP_PARAMETER snapParam = new NetSDKLib.MANUAL_SNAP_PARAMETER();
snapParam.nChannel = chn;
String sequence = "11111"; // 抓图序列号,必须用数组拷贝
System.arraycopy(sequence.getBytes(), 0, snapParam.bySequence, 0, sequence.getBytes().length);
snapParam.write();
boolean bRet = netsdk.CLIENT_ControlDeviceEx(m_hLoginHandle, NetSDKLib.CtrlType.CTRLTYPE_MANUAL_SNAP, snapParam.getPointer(), null, 5000);
if (!bRet) {
System.err.println("Failed to manual snap, last error " + String.format("[0x%x]", netsdk.CLIENT_GetLastError()));
return false;
} else {
System.out.println("Seccessed to manual snap");
}
snapParam.read();
return true;
}
/**
*
*
* @return
*/
public static boolean attachIVSEvent(int ChannelId, NetSDKLib.fAnalyzerDataCallBack m_AnalyzerDataCB) {
/**
*
* m_stDeviceInfo.byChanNum
* 0.
*/
int bNeedPicture = 1; // 是否需要图片
m_hAttachHandle = netsdk.CLIENT_RealLoadPictureEx(m_hLoginHandle, ChannelId, NetSDKLib.EVENT_IVS_ALL,
bNeedPicture, m_AnalyzerDataCB, null, null);
if (m_hAttachHandle.longValue() != 0) {
System.out.println("CLIENT_RealLoadPictureEx Success ChannelId : \n" + ChannelId);
} else {
System.err.printf("CLIENT_RealLoadPictureEx Failed!LastError = %x\n", netsdk.CLIENT_GetLastError());
return false;
}
return true;
}
/**
*
*/
public static void detachIVSEvent() {
if (0 != m_hAttachHandle.longValue()) {
netsdk.CLIENT_StopLoadPic(m_hAttachHandle);
System.out.println("Stop detach IVS event");
m_hAttachHandle.setValue(0);
}
}
// 查找录像文件
public static boolean queryRecordFile(int nChannelId,
NetSDKLib.NET_TIME stTimeStart,
NetSDKLib.NET_TIME stTimeEnd,
NetSDKLib.NET_RECORDFILE_INFO[] stFileInfo,
IntByReference nFindCount) {
// RecordFileType 录像类型 0:所有录像 1:外部报警 2:动态监测报警 3:所有报警 4:卡号查询 5:组合条件查询 6:录像位置与偏移量长度 8:按卡号查询图片(目前仅HB-U和NVS特殊型号的设备支持) 9:查询图片(目前仅HB-U和NVS特殊型号的设备支持) 10:按字段查询 15:返回网络数据结构(金桥网吧) 16:查询所有透明串数据录像文件
int nRecordFileType = 0;
boolean bRet = netsdk.CLIENT_QueryRecordFile(m_hLoginHandle, nChannelId, nRecordFileType, stTimeStart, stTimeEnd, null, stFileInfo, stFileInfo.length * stFileInfo[0].size(), nFindCount, 5000, false);
if (bRet) {
System.out.println("QueryRecordFile Succeed! \n" + "查询到的视频个数:" + nFindCount.getValue());
} else {
System.err.println("QueryRecordFile Failed!" + netsdk.CLIENT_GetLastError());
return false;
}
return true;
}
public static void setStreamType(int m_streamType) {
// 设置回放时的码流类型
IntByReference steamType = new IntByReference(m_streamType);// 0-主辅码流,1-主码流,2-辅码流
int emType = NetSDKLib.EM_USEDEV_MODE.NET_RECORD_STREAM_TYPE;
boolean bret = netsdk.CLIENT_SetDeviceMode(m_hLoginHandle, emType, steamType.getPointer());
if (!bret) {
System.err.printf("Set Stream Type Failed, Get last error [0x%x]\n", netsdk.CLIENT_GetLastError());
} else {
System.out.println("Set Stream Type Succeed!");
}
}
public static NativeLong downloadRecordFile(int nChannelId,
int nRecordFileType,
NetSDKLib.NET_TIME stTimeStart,
NetSDKLib.NET_TIME stTimeEnd,
String SavedFileName,
NetSDKLib.fTimeDownLoadPosCallBack cbTimeDownLoadPos) {
m_hDownLoadHandle = netsdk.CLIENT_DownloadByTimeEx(m_hLoginHandle, nChannelId, nRecordFileType,
stTimeStart, stTimeEnd, SavedFileName,
cbTimeDownLoadPos, null, null, null, null);
if (m_hDownLoadHandle.longValue() != 0) {
System.out.println("Downloading RecordFile!");
} else {
System.err.println("Download RecordFile Failed!" + netsdk.CLIENT_GetLastError());
}
return m_hDownLoadHandle;
}
public static void stopDownLoadRecordFile(NativeLong m_hDownLoadHandle) {
if (m_hDownLoadHandle.longValue() == 0) {
return;
}
netsdk.CLIENT_StopDownload(m_hDownLoadHandle);
}
}

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Form>

@ -1,45 +0,0 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.shxy.xyhkcamera.test;
/**
*
* @author LENOVO
*/
public class Login extends javax.swing.JPanel {
/**
* Creates new form Login
*/
public Login() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
}

@ -1,124 +0,0 @@
package com.shxy.xyhkcamera.test;
import java.io.UnsupportedEncodingException;
import java.nio.CharBuffer;
import com.sun.jna.Memory;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
/** Provides a temporary allocation of an immutable C string
* (<code>const char*</code> or <code>const wchar_t*</code>) for use when
* converting a Java String into a native memory function argument.
*
* @author Todd Fast, todd.fast@sun.com
* @author twall@users.sf.net
*/
public class NativeString implements CharSequence, Comparable<Object> {
private Pointer pointer;
private boolean wide;
/** Create a native string (NUL-terminated array of <code>char</code>).<p>
* If the system property <code>jna.encoding</code> is set, its value will
* be used to encode the native string. If not set or if the encoding
* is unavailable, the default platform encoding will be used.
*/
public NativeString(String string) {
this(string, false);
}
/** Create a native string as a NUL-terminated array of <code>wchar_t</code>
* (if <code>wide</code> is true) or <code>char</code>.<p>
* If the system property <code>jna.encoding</code> is set, its value will
* be used to encode the native <code>char</code>string.
* If not set or if the encoding is unavailable, the default platform
* encoding will be used.
*
* @param string value to write to native memory
* @param wide whether to store the String as <code>wchar_t</code>
*/
public NativeString(String string, boolean wide) {
if (string == null) {
throw new NullPointerException("String must not be null");
}
// Allocate the memory to hold the string. Note, we have to
// make this 1 element longer in order to accommodate the terminating
// NUL (which is generated in Pointer.setString()).
this.wide = wide;
if (wide) {
int len = (string.length() + 1 ) * Native.WCHAR_SIZE;
pointer = new Memory(len);
pointer.setString(0, string, true);
}
else {
byte[] data = getBytes(string);
pointer = new Memory(data.length + 1);
pointer.write(0, data, 0, data.length);
pointer.setByte(data.length, (byte)0);
}
}
static byte[] getBytes(String s) {
try {
return getBytes(s, System.getProperty("jna.encoding"));
}
catch (UnsupportedEncodingException e) {
return s.getBytes();
}
}
/** Return a byte array corresponding to the given String, using the given
encoding.
*/
static byte[] getBytes(String s, String encoding) throws UnsupportedEncodingException {
if (encoding != null) {
return s.getBytes(encoding);
}
return s.getBytes();
}
public int hashCode() {
return toString().hashCode();
}
public boolean equals(Object other) {
if (other instanceof CharSequence) {
return compareTo(other) == 0;
}
return false;
}
public String toString() {
String s = wide ? "const wchar_t*" : "const char*";
s += "(" + pointer.getString(0, wide) + ")";
return s;
}
public Pointer getPointer() {
return pointer;
}
public char charAt(int index) {
return toString().charAt(index);
}
public int length() {
return toString().length();
}
public CharSequence subSequence(int start, int end) {
return CharBuffer.wrap(toString()).subSequence(start, end);
}
public int compareTo(Object other) {
if (other == null)
return 1;
return toString().compareTo(other.toString());
}
}

File diff suppressed because it is too large Load Diff

@ -1,724 +0,0 @@
package com.shxy.xyhkcamera.test;
import java.util.Locale;
import java.util.ResourceBundle;
public final class Res {
private ResourceBundle bundle;
private Res() {
switchLanguage(LanguageType.Chinese);
}
private static class StringBundleHolder {
private static Res instance = new Res();
}
public static Res string() {
return StringBundleHolder.instance;
}
public static enum LanguageType {
English,
Chinese
}
public ResourceBundle getBundle() {
return bundle;
}
/**
* \if ENGLISH_LANG
* Switch between Chinese and English
* \else
*
* \endif
*/
public void switchLanguage(LanguageType type) {
switch(type) {
case Chinese:
bundle = ResourceBundle.getBundle("res", new Locale("zh", "CN"));
break;
case English:
bundle = ResourceBundle.getBundle("res", new Locale("en", "US"));
break;
default:
break;
}
}
public String getSwitchLanguage() {
return bundle.getString("SWITCH_LANGUAGE");
}
public String getRealplay() {
return bundle.getString("REALPLAY");
}
public String getDownloadRecord() {
return bundle.getString("DOWNLOAD_RECORD");
}
public String getITSEvent() {
return bundle.getString("ITS_EVENT");
}
public String getOnline() {
return bundle.getString("ONLINE");
}
public String getDisConnectReconnecting() {
return bundle.getString("DISCONNECT_RECONNECTING");
}
public String getDisconnectLoginAgain() {
return bundle.getString("DISCONNECT_LOGIN_AGAIN");
}
public String getPromptMessage() {
return bundle.getString("PROMPT_MESSAGE");
}
public String getErrorMessage() {
return bundle.getString("ERROR_MESSAGE");
}
public String getReconnectSucceed() {
return bundle.getString("RECONNECT_SUCCEED");
}
public String getSucceed() {
return bundle.getString("SUCCEED");
}
public String getFailed() {
return bundle.getString("Failed");
}
public String getYear() {
return bundle.getString("YEAR");
}
public String getMonth() {
return bundle.getString("MONTH");
}
public String getDay() {
return bundle.getString("DAY");
}
public String getHour() {
return bundle.getString("HOUR");
}
public String getMinute() {
return bundle.getString("MINUTE");
}
public String getSecond() {
return bundle.getString("SECOND");
}
public String getSunday() {
return bundle.getString("SUNDAY");
}
public String getMonday() {
return bundle.getString("MONDAY");
}
public String getTuesday() {
return bundle.getString("TUESDAY");
}
public String getWednesday() {
return bundle.getString("WEDNESDAY");
}
public String getThursday() {
return bundle.getString("THURSDAY");
}
public String getFriday() {
return bundle.getString("FRIDAY");
}
public String getSaturday() {
return bundle.getString("SATURDAY");
}
public String[] getWeek() {
String[] weekdays = {getSunday(),
getMonday(),
getTuesday(),
getWednesday(),
getThursday(),
getFriday(),
getSaturday()
};
return weekdays;
}
public String getConfirm() {
return bundle.getString("CONFIRM");
}
public String getCancel() {
return bundle.getString("CANCEL");
}
public String getDateChooser() {
return bundle.getString("DATE_CHOOSER");
}
public String getFunctionList() {
return bundle.getString("FUNCTIONLIST");
}
/**
*
*/
public String getErrorCode(int err) {
String msg = "";
switch(err) {
case NetSDKLib.NET_INVALID_HANDLE:
msg = bundle.getString("NET_INVALID_HANDLE");
break;
case NetSDKLib.NET_USER_FLASEPWD_TRYTIME:
msg = bundle.getString("NET_USER_FLASEPWD_TRYTIME");
break;
case NetSDKLib.NET_LOGIN_ERROR_PASSWORD:
msg = bundle.getString("NET_LOGIN_ERROR_PASSWORD");
break;
case NetSDKLib.NET_LOGIN_ERROR_USER:
msg = bundle.getString("NET_LOGIN_ERROR_USER");
break;
case NetSDKLib.NET_LOGIN_ERROR_TIMEOUT:
msg = bundle.getString("NET_LOGIN_ERROR_TIMEOUT");
break;
case NetSDKLib.NET_LOGIN_ERROR_RELOGGIN:
msg = bundle.getString("NET_LOGIN_ERROR_RELOGGIN");
break;
case NetSDKLib.NET_LOGIN_ERROR_LOCKED:
msg = bundle.getString("NET_LOGIN_ERROR_LOCKED");
break;
case NetSDKLib.NET_LOGIN_ERROR_BLACKLIST:
msg = bundle.getString("NET_LOGIN_ERROR_BLACKLIST");
break;
case NetSDKLib.NET_LOGIN_ERROR_BUSY:
msg = bundle.getString("NET_LOGIN_ERROR_BUSY");
break;
case NetSDKLib.NET_LOGIN_ERROR_CONNECT:
msg = bundle.getString("NET_LOGIN_ERROR_CONNECT");
break;
case NetSDKLib.NET_LOGIN_ERROR_NETWORK:
msg = bundle.getString("NET_LOGIN_ERROR_NETWORK");
break;
case NetSDKLib.NET_NO_RECORD_FOUND:
msg = bundle.getString("NET_NO_RECORD_FOUND");
break;
case NetSDKLib.NET_OPEN_FILE_ERROR:
msg = bundle.getString("NET_OPEN_FILE_ERROR");
break;
case NetSDKLib.NET_ERROR:
msg = bundle.getString("NET_ERROR");
break;
case NetSDKLib.NET_RETURN_DATA_ERROR:
msg = bundle.getString("NET_RETURN_DATA_ERROR");
break;
case NetSDKLib.NET_LOGIN_ERROR_USER_OR_PASSOWRD:
msg = bundle.getString("NET_LOGIN_ERROR_USER_OR_PASSOWRD");
break;
default:
msg = bundle.getString("NET_ERROR");
break;
}
return msg;
}
public String getLogin() {
return bundle.getString("LOGIN");
}
public String getLogout() {
return bundle.getString("LOGOUT");
}
public String getDeviceIp() {
return bundle.getString("DEVICE_IP");
}
public String getPort() {
return bundle.getString("DEVICE_PORT");
}
public String getUserName() {
return bundle.getString("USERNAME");
}
public String getPassword() {
return bundle.getString("PASSWORD");
}
public String getLoginFailed() {
return bundle.getString("LOGIN_FAILED");
}
public String getInputDeviceIP() {
return bundle.getString("PLEASE_INPUT_DEVICE_IP");
}
public String getInputDevicePort() {
return bundle.getString("PLEASE_INPUT_DEVICE_PORT");
}
public String getInputUsername() {
return bundle.getString("PLEASE_INPUT_DEVICE_USERNAME");
}
public String getInputPassword() {
return bundle.getString("PLEASE_INPUT_DEVICE_PASSWORD");
}
public String getStartRealPlay() {
return bundle.getString("START_REALPLAY");
}
public String getStopRealPlay() {
return bundle.getString("STOP_REALPLAY");
}
public String getChannel() {
return bundle.getString("CHANNEL");
}
public String getStreamType() {
return bundle.getString("STREAM_TYPE");
}
public String getMasterAndSub() {
return bundle.getString("MASTER_AND_SUB_STREAM");
}
public String getMasterStream() {
return bundle.getString("MASTER_STREAM");
}
public String getSubStream() {
return bundle.getString("SUB_STREAM");
}
public String getSnap() {
return bundle.getString("SNAP");
}
public String getSnapPicture() {
return bundle.getString("SNAP_PICTURE");
}
public String getPTZControl() {
return bundle.getString("PTZ_CONTROL");
}
public String getLeftUp() {
return bundle.getString("LEFT_UP");
}
public String getUp() {
return bundle.getString("UP");
}
public String getRightUp() {
return bundle.getString("RIGHT_UP");
}
public String getLeft() {
return bundle.getString("LEFT");
}
public String getRight() {
return bundle.getString("RIGHT");
}
public String getLeftDown() {
return bundle.getString("LEFT_DOWN");
}
public String getDown() {
return bundle.getString("DOWN");
}
public String getRightDown() {
return bundle.getString("RIGHT_DOWN");
}
public String getSpeed() {
return bundle.getString("SPEED");
}
public String getZoomAdd() {
return bundle.getString("ZOOM_ADD");
}
public String getZoomDec() {
return bundle.getString("ZOOM_DEC");
}
public String getFocusAdd() {
return bundle.getString("FOCUS_ADD");
}
public String getFocusDec() {
return bundle.getString("FOCUS_DEC");
}
public String getIrisAdd() {
return bundle.getString("IRIS_ADD");
}
public String getIrisDec() {
return bundle.getString("IRIS_DEC");
}
public String getIndex() {
return bundle.getString("INDEX");
}
public String getEventPicture() {
return bundle.getString("EVENT_PICTURE");
}
public String getPlatePicture() {
return bundle.getString("PLATE_PICTURE");
}
public String getEventName() {
return bundle.getString("EVENT_NAME");
}
public String getLicensePlate() {
return bundle.getString("LICENSE_PLATE");
}
public String getEventTime() {
return bundle.getString("EVENT_TIME");
}
public String getPlateType() {
return bundle.getString("PLATE_TYPE");
}
public String getPlateColor() {
return bundle.getString("PLATE_COLOR");
}
public String getVehicleColor() {
return bundle.getString("VEHICLE_COLOR");
}
public String getVehicleType() {
return bundle.getString("VEHICLE_TYPE");
}
public String getVehicleSize() {
return bundle.getString("VEHICLE_SIZE");
}
public String getFileCount() {
return bundle.getString("FILE_COUNT");
}
public String getFileIndex() {
return bundle.getString("FILE_INDEX");
}
public String getGroupId() {
return bundle.getString("GROUP_ID");
}
public String getIllegalPlace() {
return bundle.getString("ILLEGAL_PLACE");
}
public String getLaneNumber() {
return bundle.getString("LANE_NUMBER");
}
public String getEventInfo() {
return bundle.getString("EVENT_INFO");
}
public String getNoPlate() {
return bundle.getString("NO_PLATENUMBER");
}
public String[] getTrafficTableName() {
String[] name = {getIndex(),
getEventName(),
getLicensePlate(),
getEventTime(),
getPlateType(),
getPlateColor(),
getVehicleColor(),
getVehicleType(),
getVehicleSize(),
getFileCount(),
getFileIndex(),
getGroupId(),
getIllegalPlace(),
getLaneNumber()};
return name;
}
public String getOperate() {
return bundle.getString("OPERATE");
}
public String getAttach() {
return bundle.getString("ATTACH");
}
public String getDetach() {
return bundle.getString("DETACH");
}
public String getOpenStrobe() {
return bundle.getString("OPEN_STROBE");
}
public String getCloseStrobe() {
return bundle.getString("CLOSE_STROBE");
}
public String getOpenStrobeFailed() {
return bundle.getString("OPEN_STROBE_FAILED");
}
public String getManualCapture() {
return bundle.getString("MANUAL_CAPTURE");
}
public String getManualCaptureSucceed() {
return bundle.getString("MANUALSNAP_SUCCEED");
}
public String getManualCaptureFailed() {
return bundle.getString("MANUALSNAP_FAILED");
}
/*
*
*/
public String getTrafficSize(int nVehicleSize) {
String vehicleClass = "";
for(int i = 0; i < 5; i++) {
if( ((byte)nVehicleSize & (1 << i)) > 0 ) {
switch (i) {
case 0:
vehicleClass = bundle.getString("LIGHT_DUTY");
break;
case 1:
vehicleClass = bundle.getString("MEDIUM");
break;
case 2:
vehicleClass = bundle.getString("OVER_SIZE");
break;
case 3:
vehicleClass = bundle.getString("MINI_SIZE");
break;
case 4:
vehicleClass = bundle.getString("LARGE_SIZE");
break;
default:
break;
}
}
}
return vehicleClass;
}
/*
*
*/
public String getEventName(int type) {
String name = "";
switch (type) {
case NetSDKLib.EVENT_IVS_TRAFFICJUNCTION: ///< 交通路口事件
name = bundle.getString("EVENT_IVS_TRAFFICJUNCTION");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_RUNREDLIGHT: ///< 闯红灯事件
name = bundle.getString("EVENT_IVS_TRAFFIC_RUNREDLIGHT");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_OVERLINE: ///< 压车道线事件
name = bundle.getString("EVENT_IVS_TRAFFIC_OVERLINE");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_RETROGRADE: ///< 逆行事件
name = bundle.getString("EVENT_IVS_TRAFFIC_RETROGRADE");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_TURNLEFT: ///< 违章左转
name = bundle.getString("EVENT_IVS_TRAFFIC_TURNLEFT");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_TURNRIGHT: ///< 违章右转
name = bundle.getString("EVENT_IVS_TRAFFIC_TURNRIGHT");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_UTURN: ///< 违章掉头
name = bundle.getString("EVENT_IVS_TRAFFIC_UTURN");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_OVERSPEED: ///< 超速
name = bundle.getString("EVENT_IVS_TRAFFIC_OVERSPEED");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_UNDERSPEED: ///< 低速
name = bundle.getString("EVENT_IVS_TRAFFIC_UNDERSPEED");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_PARKING: ///< 违章停车
name = bundle.getString("EVENT_IVS_TRAFFIC_PARKING");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_WRONGROUTE: ///< 不按车道行驶
name = bundle.getString("EVENT_IVS_TRAFFIC_WRONGROUTE");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_CROSSLANE: ///< 违章变道
name = bundle.getString("EVENT_IVS_TRAFFIC_CROSSLANE");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_OVERYELLOWLINE: ///< 压黄线
name = bundle.getString("EVENT_IVS_TRAFFIC_OVERYELLOWLINE");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_YELLOWPLATEINLANE: ///< 黄牌车占道事件
name = bundle.getString("EVENT_IVS_TRAFFIC_YELLOWPLATEINLANE");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_PEDESTRAINPRIORITY: ///< 斑马线行人优先事件
name = bundle.getString("EVENT_IVS_TRAFFIC_PEDESTRAINPRIORITY");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_MANUALSNAP: ///< 交通手动抓拍事件
name = bundle.getString("EVENT_IVS_TRAFFIC_MANUALSNAP");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_VEHICLEINROUTE: ///< 有车占道事件
name = bundle.getString("EVENT_IVS_TRAFFIC_VEHICLEINROUTE");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_VEHICLEINBUSROUTE: ///< 占用公交车道事件
name = bundle.getString("EVENT_IVS_TRAFFIC_VEHICLEINBUSROUTE");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_BACKING: ///< 违章倒车事件
name = bundle.getString("EVENT_IVS_TRAFFIC_BACKING");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_PARKINGSPACEPARKING: ///< 车位有车事件
name = bundle.getString("EVENT_IVS_TRAFFIC_PARKINGSPACEPARKING");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_PARKINGSPACENOPARKING: ///< 车位无车事件
name = bundle.getString("EVENT_IVS_TRAFFIC_PARKINGSPACENOPARKING");
break;
case NetSDKLib.EVENT_IVS_TRAFFIC_WITHOUT_SAFEBELT: ///< 交通未系安全带事件
name = bundle.getString("EVENT_IVS_TRAFFIC_WITHOUT_SAFEBELT");
break;
default:
break;
}
return name;
}
public String getRecordType() {
return bundle.getString("RECORD_TYPE");
}
public String getStartTime() {
return bundle.getString("START_TIME");
}
public String getEndTime() {
return bundle.getString("END_TIME");
}
public String[] getDownloadTableName() {
String[] name = {getIndex(),
getChannel(),
getRecordType(),
getStartTime(),
getEndTime()};
return name;
}
public String getDownloadByFile() {
return bundle.getString("DOWNLOAD_RECORD_BYFILE");
}
public String getQuery() {
return bundle.getString("QUERY");
}
public String getDownload() {
return bundle.getString("DOWNLOAD");
}
public String getStopDownload() {
return bundle.getString("STOP_DOWNLOAD");
}
public String getDownloadByTime() {
return bundle.getString("DOWNLOAD_RECORD_BYTIME");
}
public String getSelectTimeAgain() {
return bundle.getString("PLEASE_SELECT_TIME_AGAIN");
}
public String getSelectRowWithData() {
return bundle.getString("PLEASE_FIRST_SELECT_ROW_WITH_DATA");
}
public String getQueryRecord() {
return bundle.getString("PLEASE_FIRST_QUERY_RECORD");
}
public String getDownloadCompleted() {
return bundle.getString("DOWNLOAD_COMPLETED");
}
/**
*
*/
public String getRecordTypeStr(int nRecordFileType) {
String recordTypeStr = "";
switch(nRecordFileType) {
case 0:
recordTypeStr = bundle.getString("GENERAL_RECORD");
break;
case 1:
recordTypeStr = bundle.getString("ALARM_RECORD");
break;
case 2:
recordTypeStr = bundle.getString("MOTION_DETECTION");
break;
case 3:
recordTypeStr = bundle.getString("CARD_NUMBER_RECORD");
break;
default:
break;
}
return recordTypeStr;
}
public int getRecordTypeInt(String recordFileStr) {
int recordType = -1;
if(recordFileStr.equals(bundle.getString("GENERAL_RECORD"))) {
recordType = 0;
} else if(recordFileStr.equals(bundle.getString("ALARM_RECORD"))) {
recordType = 1;
} else if(recordFileStr.equals(bundle.getString("MOTION_DETECTION"))) {
recordType = 2;
} else if(recordFileStr.equals(bundle.getString("CARD_NUMBER_RECORD"))) {
recordType = 3;
}
return recordType;
}
}

@ -1,75 +0,0 @@
package com.shxy.xyhkcamera.test;
import java.io.File;
public class SavePath {
private SavePath() {}
private static class SavePathHolder {
private static SavePath instance = new SavePath();
}
public static SavePath getSavePath() {
return SavePathHolder.instance;
}
String s_captureSavePath = "./Capture/" + ToolKits.getDate() + "/"; // 抓拍图片保存路径
String s_imageSavePath = "./Image/" + ToolKits.getDate() + "/"; // 图片保存路径
String s_recordFileSavePath = "./RecordFile/" + ToolKits.getDate() + "/"; // 录像保存路径
/*
*
*/
public String getSaveSnapPath() {
File path1 = new File("./Capture/");
if (!path1.exists()) {
path1.mkdir();
}
File path2 = new File(s_captureSavePath);
if (!path2.exists()) {
path2.mkdir();
}
String strFileName = s_captureSavePath + ToolKits.getDate() + ".jpg";
return strFileName;
}
/*
*
*/
public String getSaveTrafficImagePath() {
File path1 = new File("./Image/");
if (!path1.exists()) {
path1.mkdir();
}
File path = new File(s_imageSavePath);
if (!path.exists()) {
path.mkdir();
}
return s_imageSavePath;
}
/*
*
*/
public String getSaveRecordFilePath() {
File path1 = new File("./RecordFile/");
if (!path1.exists()) {
path1.mkdir();
}
File path2 = new File(s_recordFileSavePath);
if (!path2.exists()) {
path2.mkdir();
}
String SavedFileName = s_recordFileSavePath + ToolKits.getDate() + ".dav"; // 默认保存路径
return SavedFileName;
}
}

@ -1,194 +0,0 @@
package com.shxy.xyhkcamera.test;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.io.FileOutputStream;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
public class ToolKits {
/***************************************************************************************************
* *
***************************************************************************************************/
public static void GetPointerData(Pointer pNativeData, Structure pJavaStu) {
GetPointerDataToStruct(pNativeData, 0, pJavaStu);
}
public static void GetPointerDataToStruct(Pointer pNativeData, long OffsetOfpNativeData, Structure pJavaStu) {
pJavaStu.write();
Pointer pJavaMem = pJavaStu.getPointer();
pJavaMem.write(0, pNativeData.getByteArray(OffsetOfpNativeData, pJavaStu.size()), 0, pJavaStu.size());
pJavaStu.read();
}
public static void GetPointerDataToStructArr(Pointer pNativeData, Structure[] pJavaStuArr) {
long offset = 0;
for (int i = 0; i < pJavaStuArr.length; ++i) {
GetPointerDataToStruct(pNativeData, offset, pJavaStuArr[i]);
offset += pJavaStuArr[i].size();
}
}
/**
*
*
* @param pNativeData
* @param pJavaStuArr
*/
public static void SetStructArrToPointerData(Structure[] pJavaStuArr, Pointer pNativeData) {
long offset = 0;
for (int i = 0; i < pJavaStuArr.length; ++i) {
SetStructDataToPointer(pJavaStuArr[i], pNativeData, offset);
offset += pJavaStuArr[i].size();
}
}
public static void SetStructDataToPointer(Structure pJavaStu, Pointer pNativeData, long OffsetOfpNativeData) {
pJavaStu.write();
Pointer pJavaMem = pJavaStu.getPointer();
pNativeData.write(OffsetOfpNativeData, pJavaMem.getByteArray(0, pJavaStu.size()), 0, pJavaStu.size());
}
public static void savePicture(byte[] pBuf, String sDstFile) {
try {
FileOutputStream fos = new FileOutputStream(sDstFile);
fos.write(pBuf);
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void savePicture(byte[] pBuf, int dwBufOffset, int dwBufSize, String sDstFile) {
try {
FileOutputStream fos = new FileOutputStream(sDstFile);
fos.write(pBuf, dwBufOffset, dwBufSize);
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void savePicture(Pointer pBuf, int dwBufSize, String sDstFile) {
try {
FileOutputStream fos = new FileOutputStream(sDstFile);
fos.write(pBuf.getByteArray(0, dwBufSize), 0, dwBufSize);
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void savePicture(Pointer pBuf, int dwBufOffset, int dwBufSize, String sDstFile) {
try {
FileOutputStream fos = new FileOutputStream(sDstFile);
fos.write(pBuf.getByteArray(dwBufOffset, dwBufSize), 0, dwBufSize);
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
// 将Pointer值转为byte[]
public static String GetPointerDataToByteArr(Pointer pointer) {
String str = "";
if (pointer == null) {
return str;
}
int length = 0;
byte[] bufferPlace = new byte[1];
for (int i = 0; i < 2048; i++) {
pointer.read(i, bufferPlace, 0, 1);
if (bufferPlace[0] == '\0') {
length = i;
break;
}
}
if (length > 0) {
byte[] buffer = new byte[length];
pointer.read(0, buffer, 0, length);
try {
str = new String(buffer, "GBK").trim();
} catch (UnsupportedEncodingException e) {
return str;
}
}
return str;
}
// 获取当前时间
public static String getDate() {
SimpleDateFormat simpleDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String date = simpleDate.format(new java.util.Date()).replace(" ", "_").replace(":", "-");
return date;
}
// 限制JTextField 长度,以及内容
public static void limitTextFieldLength(final JTextField jTextField, final int size) {
jTextField.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
String number = "0123456789" + (char) 8;
if (number.indexOf(e.getKeyChar()) < 0 || jTextField.getText().trim().length() >= size) {
e.consume();
return;
}
}
@Override
public void keyReleased(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
}
});
}
// 获取当前窗口
public static JFrame getFrame(ActionEvent e) {
JButton btn = (JButton) e.getSource();
JFrame frame = (JFrame) btn.getRootPane().getParent();
return frame;
}
// 获取操作平台信息
public static String getLoadLibrary(String library) {
String path = "";
String os = System.getProperty("os.name");
if (os.toLowerCase().startsWith("win")) {
path = "./libs/";
} else if (os.toLowerCase().startsWith("linux")) {
path = "";
}
return (path + library);
}
public static String getOsName() {
String osName = "";
String os = System.getProperty("os.name");
if (os.toLowerCase().startsWith("win")) {
osName = "win";
} else if (os.toLowerCase().startsWith("linux")) {
osName = "linux";
}
return osName;
}
}

@ -1,32 +0,0 @@
package com.shxy.xyhkcamera.test;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import com.sun.jna.Platform;
public class Utils {
public Utils() {
}
// 读取当前目录下的路径配置文件
public static String readConfigProperties(String key) {
Properties properties = new Properties();
String rootPath = System.getProperty("user.dir").replace("\\", "/"); // 获取当前目录
FileInputStream inputStream = null;
try {
inputStream = new FileInputStream(rootPath + "/config.properties");
properties.load(inputStream);
} catch (FileNotFoundException e) {
e.printStackTrace();
}catch (IOException e) {
e.printStackTrace();
}
return properties.getProperty(key);
}
}

@ -0,0 +1,16 @@
package com.shxy.xyhkcamera.utils;
/**
* @author
* @create 2022-01-19-16:40
*/
public class osSelect {
public static boolean isLinux() {
return System.getProperty("os.name").toLowerCase().contains("linux");
}
public static boolean isWindows() {
return System.getProperty("os.name").toLowerCase().contains("windows");
}
}

@ -5,9 +5,6 @@ server:
servlet:
# 应用的访问路径
context-path: /xymanager
hkconfig:
winpath: D:\\Workspace\\HK\\HCNetSDK.dll
linuxpath: ere
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
@ -20,6 +17,10 @@ hkconfig:
# Tomcat启动初始化的线程数默认值10
min-spare: 100
hkconfig:
winpath: D:\\Workspace\\HK\\HCNetSDK.dll
linuxpath: ere
spring:
task:
scheduling:
@ -31,7 +32,7 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
url: jdbc:mysql://192.168.1.190:3306/iec104?allowMultiQueries=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://192.168.1.190:3306/cac?allowMultiQueries=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: 123456
# 初始连接数

@ -1,15 +1,33 @@
package com.shxy.xyhkcamera;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.shxy.xyhkcamera.entity.ModevEntity;
import com.shxy.xyhkcamera.hk.HCNetSDK;
import com.shxy.xyhkcamera.hk.HcNetSdkUtil;
import com.shxy.xyhkcamera.mapper.DataEaifHMapper;
import com.shxy.xyhkcamera.mapper.ModevMapper;
import com.shxy.xyhkcamera.service.ModevService;
import com.shxy.xyhkcamera.service.TempMeasureService;
import com.shxy.xyhkcamera.service.impl.ModevServiceImp;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.IntByReference;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.List;
@SpringBootTest
class XyhkcameraApplicationTests {
@Autowired
HcNetSdkUtil hcNetSdkUtil;
@Autowired
ModevServiceImp modevService;
@Autowired
ModevMapper modevMapper;
private int handle;
@Test
@ -29,26 +47,45 @@ class XyhkcameraApplicationTests {
int admin = hcNetSdkUtil.login_V40("192.168.1.64", (short) 8000, "admin", "SHxy@510");
if (admin != -1) {
HCNetSDK.NET_DVR_REALTIME_THERMOMETRY_COND cond = new HCNetSDK.NET_DVR_REALTIME_THERMOMETRY_COND();
cond.read();
cond.dwSize = cond.size();
cond.byRuleID = 1;
cond.byRuleID = 0;
cond.dwChan = 2;
cond.write();
HCNetSDK.FRemoteConfigCallBack cbStateCallBack = new HCNetSDK.FRemoteConfigCallBack() {
@Override
public void invoke(int dwType, Pointer lpBuffer, int dwBufLen, Pointer pUserData) {
System.out.println("报警事件类型: lCommand:" + Integer.toHexString(dwType));
HCNetSDK.NET_DVR_THERMOMETRY_UPLOAD byte_array1 = new HCNetSDK.NET_DVR_THERMOMETRY_UPLOAD();
byte_array1.write();
Pointer pbyte_array1 = byte_array1.getPointer();
pbyte_array1.write(0, lpBuffer.getByteArray(0, byte_array1.size()), 0, byte_array1.size());
byte_array1.read();
System.out.println("dfsdafd");
System.out.println("dfsafasd");
instance.NET_DVR_StopRemoteConfig(handle);
// instance.NET_DVR_StopRemoteConfig(handle);
}
};
handle = instance.NET_DVR_StartRemoteConfig(admin, HCNetSDK.NET_DVR_GET_REALTIME_THERMOMETRY, cond.getPointer(), cond.size(), cbStateCallBack, null);
if (handle < 0) {
System.out.println(instance.NET_DVR_GetLastError());
int i = instance.NET_DVR_GetLastError();
IntByReference intByReference = new IntByReference(i);
System.out.println(i + " " + instance.NET_DVR_GetErrorMsg(intByReference));
}
System.out.println("fdsafa");
}
// tempMeasureService.measure();
// List<ModevEntity> list = modevService.list(Wrappers.lambdaQuery(ModevEntity.class).eq(ModevEntity::getModevtid, 10));
// System.out.println(list);
// List<ModevEntity> modevEntities = modevMapper.selectList(Wrappers.lambdaQuery(ModevEntity.class).eq(ModevEntity::getModevtid, 10));
// System.out.println(modevEntities);
}
}

Loading…
Cancel
Save