|
|
@@ -7,10 +7,11 @@ import com.sun.jna.Structure;
|
|
|
import com.sun.jna.ptr.IntByReference;
|
|
|
import com.sun.jna.win32.StdCallLibrary;
|
|
|
|
|
|
+import java.nio.charset.Charset;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.time.ZoneId;
|
|
|
import java.time.ZoneOffset;
|
|
|
import java.time.ZonedDateTime;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
|
|
|
/**
|
|
|
@@ -20,6 +21,10 @@ import java.util.Date;
|
|
|
* @date 2019/3/7
|
|
|
*/
|
|
|
public interface DahuaLibrary extends Library {
|
|
|
+ /**
|
|
|
+ * 默认编码
|
|
|
+ */
|
|
|
+ Charset DEFAULT_CHARSET = Charset.forName("GBK");
|
|
|
/**
|
|
|
* 通用字符串长度4
|
|
|
*/
|
|
|
@@ -283,66 +288,70 @@ public interface DahuaLibrary extends Library {
|
|
|
/**
|
|
|
* 登陆网络环境设置
|
|
|
*/
|
|
|
- @Structure.FieldOrder({"bReserved", "byNetType", "byPlaybackBufSize", "byReserved1", "nConnectBufSize",
|
|
|
- "nConnectTime", "nConnectTryNum", "nGetConnInfoTime", "nGetDevInfoTime", "nPicBufSize", "nSearchRecordTime",
|
|
|
- "nWaittime", "nsubConnectSpaceTime", "nsubDisconnetTime"})
|
|
|
+ @Structure.FieldOrder({"nWaittime", "nConnectTime", "nConnectTryNum", "nSubConnectSpaceTime", "nGetDevInfoTime",
|
|
|
+ "nConnectBufSize", "nGetConnInfoTime", "nSearchRecordTime", "nsubDisconnetTime", "byNetType",
|
|
|
+ "byPlaybackBufSize", "bDetectDisconnTime", "bKeepLifeInterval", "nPicBufSize", "bReserved"})
|
|
|
class NET_PARAM extends Structure {
|
|
|
/**
|
|
|
- * 保留字段
|
|
|
+ * 等待超时时间(毫秒为单位),为0默认5000ms
|
|
|
*/
|
|
|
- public byte[] bReserved = new byte[4];
|
|
|
+ public int nWaittime;
|
|
|
/**
|
|
|
- * 网络类型,0-LAN, 1-WAN
|
|
|
+ * 连接超时时间(毫秒为单位),为0默认1500ms
|
|
|
*/
|
|
|
- public byte byNetType;
|
|
|
+ public int nConnectTime;
|
|
|
/**
|
|
|
- * 回放数据接收缓冲大小(M为单位),为0默认为4M
|
|
|
+ * 连接尝试次数,为0默认1次
|
|
|
*/
|
|
|
- public byte byPlaybackBufSize;
|
|
|
+ public int nConnectTryNum;
|
|
|
/**
|
|
|
- * 保留字段
|
|
|
+ * 子连接之间的等待时间(毫秒为单位),为0默认10ms
|
|
|
*/
|
|
|
- public byte[] byReserved1 = new byte[2];
|
|
|
+ public int nSubConnectSpaceTime;
|
|
|
+ /**
|
|
|
+ * 获取设备信息超时时间,为0默认1000ms
|
|
|
+ */
|
|
|
+ public int nGetDevInfoTime;
|
|
|
/**
|
|
|
* 每个连接接收数据缓冲大小(字节为单位),为0默认250*1024
|
|
|
*/
|
|
|
public int nConnectBufSize;
|
|
|
/**
|
|
|
- * 连接超时时间(毫秒为单位),为0默认1500ms
|
|
|
+ * 获取子连接信息超时时间(毫秒为单位),为0默认1000ms
|
|
|
*/
|
|
|
- public int nConnectTime;
|
|
|
+ public int nGetConnInfoTime;
|
|
|
/**
|
|
|
- * 连接尝试次数,为0默认1次
|
|
|
+ * 按时间查询录像文件的超时时间(毫秒为单位),为0默认为3000ms
|
|
|
*/
|
|
|
- public int nConnectTryNum;
|
|
|
+ public int nSearchRecordTime;
|
|
|
/**
|
|
|
- * 获取子连接信息超时时间(毫秒为单位),为0默认1000ms
|
|
|
+ * 检测子链接断线等待时间(毫秒为单位),为0默认为60000ms
|
|
|
*/
|
|
|
- public int nGetConnInfoTime;
|
|
|
+ public int nsubDisconnetTime;
|
|
|
/**
|
|
|
- * 获取设备信息超时时间,为0默认1000ms
|
|
|
+ * 网络类型,0-LAN, 1-WAN
|
|
|
*/
|
|
|
- public int nGetDevInfoTime;
|
|
|
+ public byte byNetType;
|
|
|
/**
|
|
|
- * 实时图片接收缓冲大小(字节为单位),为0默认为2*1024*1024
|
|
|
+ * 回放数据接收缓冲大小(M为单位),为0默认为4M
|
|
|
*/
|
|
|
- public int nPicBufSize;
|
|
|
+ public byte byPlaybackBufSize;
|
|
|
/**
|
|
|
- * 按时间查询录像文件的超时时间(毫秒为单位),为0默认为3000ms
|
|
|
+ * 心跳检测断线时间(单位为秒),为0默认为60s,最小时间为2s
|
|
|
*/
|
|
|
- public int nSearchRecordTime;
|
|
|
+ public byte bDetectDisconnTime;
|
|
|
/**
|
|
|
- * 等待超时时间(毫秒为单位),为0默认5000ms
|
|
|
+ * 心跳包发送间隔(单位为秒),为0默认为10s,最小间隔为2s
|
|
|
*/
|
|
|
- public int nWaittime;
|
|
|
+ public byte bKeepLifeInterval;
|
|
|
/**
|
|
|
- * 子连接之间的等待时间(毫秒为单位),为0默认10ms
|
|
|
+ * 实时图片接收缓冲大小(字节为单位),为0默认为2*1024*1024
|
|
|
*/
|
|
|
- public int nsubConnectSpaceTime;
|
|
|
+ public int nPicBufSize;
|
|
|
/**
|
|
|
- * 检测子链接断线等待时间(毫秒为单位),为0默认为60000ms
|
|
|
+ * 保留字段
|
|
|
*/
|
|
|
- public int nsubDisconnetTime;
|
|
|
+ public byte[] bReserved = new byte[4];
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -704,25 +713,13 @@ public interface DahuaLibrary extends Library {
|
|
|
/**
|
|
|
* 设备信息
|
|
|
*/
|
|
|
- @Structure.FieldOrder({"Reserved", "bReserved", "byLeftLogTimes", "byLimitLoginTime", "nAlarmInPortNum",
|
|
|
- "nAlarmOutPortNum", "nChanNum", "nDVRType", "nDiskNum", "nLockLeftTime", "sSerialNumber"})
|
|
|
+ @Structure.FieldOrder({"sSerialNumber", "nAlarmInPortNum", "nAlarmOutPortNum", "nDiskNum", "nDVRType",
|
|
|
+ "nChanNum", "byLimitLoginTime", "byLeftLogTimes", "bReserved", "nLockLeftTime", "Reserved"})
|
|
|
class NET_DEVICEINFO_Ex extends Structure {
|
|
|
/**
|
|
|
- * 保留
|
|
|
- */
|
|
|
- public byte[] Reserved = new byte[24];
|
|
|
- /**
|
|
|
- * 保留字节
|
|
|
- */
|
|
|
- public byte[] bReserved = new byte[2];
|
|
|
- /**
|
|
|
- * 当登陆失败原因为密码错误时,通过此参数通知用户,剩余登陆次数,为0时表示此参数无效
|
|
|
- */
|
|
|
- public byte byLeftLogTimes;
|
|
|
- /**
|
|
|
- * 在线超时时间,为0表示不限制登陆,非0表示限制的分钟数
|
|
|
+ * 序列号
|
|
|
*/
|
|
|
- public byte byLimitLoginTime;
|
|
|
+ public byte[] sSerialNumber = new byte[DH_SERIALNO_LEN];
|
|
|
/**
|
|
|
* DVR报警输入个数
|
|
|
*/
|
|
|
@@ -732,9 +729,9 @@ public interface DahuaLibrary extends Library {
|
|
|
*/
|
|
|
public int nAlarmOutPortNum;
|
|
|
/**
|
|
|
- * DVR通道个数
|
|
|
+ * DVR硬盘个数
|
|
|
*/
|
|
|
- public int nChanNum;
|
|
|
+ public int nDiskNum;
|
|
|
/**
|
|
|
* DVR类型
|
|
|
*
|
|
|
@@ -742,17 +739,46 @@ public interface DahuaLibrary extends Library {
|
|
|
*/
|
|
|
public int nDVRType;
|
|
|
/**
|
|
|
- * DVR硬盘个数
|
|
|
+ * DVR通道个数
|
|
|
*/
|
|
|
- public int nDiskNum;
|
|
|
+ public int nChanNum;
|
|
|
+ /**
|
|
|
+ * 在线超时时间,为0表示不限制登陆,非0表示限制的分钟数
|
|
|
+ */
|
|
|
+ public byte byLimitLoginTime;
|
|
|
+ /**
|
|
|
+ * 当登陆失败原因为密码错误时,通过此参数通知用户,剩余登陆次数,为0时表示此参数无效
|
|
|
+ */
|
|
|
+ public byte byLeftLogTimes;
|
|
|
+ /**
|
|
|
+ * 保留字节
|
|
|
+ */
|
|
|
+ public byte[] bReserved = new byte[2];
|
|
|
/**
|
|
|
* 当登陆失败,用户解锁剩余时间(秒数), -1表示设备未设置该参数
|
|
|
*/
|
|
|
public int nLockLeftTime;
|
|
|
/**
|
|
|
- * 序列号
|
|
|
+ * 保留
|
|
|
*/
|
|
|
- public byte[] sSerialNumber = new byte[DH_SERIALNO_LEN];
|
|
|
+ public byte[] Reserved = new byte[24];
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String toString() {
|
|
|
+ return "NET_DEVICEINFO_Ex{" +
|
|
|
+ "sSerialNumber=" + new String(sSerialNumber) +
|
|
|
+ ", nAlarmInPortNum=" + nAlarmInPortNum +
|
|
|
+ ", nAlarmOutPortNum=" + nAlarmOutPortNum +
|
|
|
+ ", nDiskNum=" + nDiskNum +
|
|
|
+ ", nDVRType=" + nDVRType +
|
|
|
+ ", nChanNum=" + nChanNum +
|
|
|
+ ", byLimitLoginTime=" + (byLimitLoginTime & 0xff) +
|
|
|
+ ", byLeftLogTimes=" + (byLeftLogTimes & 0xff) +
|
|
|
+ ", bReserved=" + new String(bReserved) +
|
|
|
+ ", nLockLeftTime=" + nLockLeftTime +
|
|
|
+ ", Reserved=" + Arrays.toString(Reserved) +
|
|
|
+ '}';
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -862,10 +888,10 @@ public interface DahuaLibrary extends Library {
|
|
|
@Override
|
|
|
public String toString() {
|
|
|
return "DH_EVENT_FILE_INFO{" +
|
|
|
- "bCount=" + bCount +
|
|
|
- ", bIndex=" + bIndex +
|
|
|
- ", bFileTag=" + bFileTag +
|
|
|
- ", bFileType=" + bFileType +
|
|
|
+ "bCount=" + (bCount & 0xff) +
|
|
|
+ ", bIndex=" + (bIndex & 0xff) +
|
|
|
+ ", bFileTag=" + (bFileTag & 0xff) +
|
|
|
+ ", bFileType=" + (bFileType & 0xff) +
|
|
|
", stuFileTime=" + stuFileTime +
|
|
|
", nGroupId=" + nGroupId +
|
|
|
'}';
|
|
|
@@ -1445,6 +1471,7 @@ public interface DahuaLibrary extends Library {
|
|
|
", PTS=" + PTS +
|
|
|
", UTC=" + UTC +
|
|
|
", nEventID=" + nEventID +
|
|
|
+ ", stuObject=" + stuObject +
|
|
|
", stuFileInfo=" + stuFileInfo +
|
|
|
", emEventType=" + emEventType +
|
|
|
", bStatus=" + bStatus +
|
|
|
@@ -1463,8 +1490,8 @@ public interface DahuaLibrary extends Library {
|
|
|
", emAttendanceState=" + emAttendanceState +
|
|
|
", szClassNumber=" + new String(szClassNumber) +
|
|
|
", szPhoneNumber=" + new String(szPhoneNumber) +
|
|
|
- ", szCardName=" + new String(szCardName) +
|
|
|
- ", uSimilarity=" + uSimilarity +
|
|
|
+ ", szCardName=" + new String(szCardName, DEFAULT_CHARSET) +
|
|
|
+ ", uSimilarity=" + (uSimilarity & 0x0ffffffff) +
|
|
|
'}';
|
|
|
}
|
|
|
}
|
|
|
@@ -1474,10 +1501,20 @@ public interface DahuaLibrary extends Library {
|
|
|
*/
|
|
|
@Structure.FieldOrder({"left", "top", "right", "bottom"})
|
|
|
class DH_RECT extends Structure {
|
|
|
- public long left;
|
|
|
- public long top;
|
|
|
- public long right;
|
|
|
- public long bottom;
|
|
|
+ public NativeLong left;
|
|
|
+ public NativeLong top;
|
|
|
+ public NativeLong right;
|
|
|
+ public NativeLong bottom;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String toString() {
|
|
|
+ return "DH_RECT{" +
|
|
|
+ "left=" + left.longValue() +
|
|
|
+ ", top=" + top.longValue() +
|
|
|
+ ", right=" + right.longValue() +
|
|
|
+ ", bottom=" + bottom.longValue() +
|
|
|
+ '}';
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1487,6 +1524,14 @@ public interface DahuaLibrary extends Library {
|
|
|
class DH_POINT extends Structure {
|
|
|
public short nx;
|
|
|
public short ny;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String toString() {
|
|
|
+ return "DH_POINT{" +
|
|
|
+ "nx=" + nx +
|
|
|
+ ", ny=" + ny +
|
|
|
+ '}';
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1511,11 +1556,11 @@ public interface DahuaLibrary extends Library {
|
|
|
/**
|
|
|
* 图片宽度, 单位:像素
|
|
|
*/
|
|
|
- public int wWidth;
|
|
|
+ public short wWidth;
|
|
|
/**
|
|
|
* 图片高度, 单位:像素
|
|
|
*/
|
|
|
- public int wHeight;
|
|
|
+ public short wHeight;
|
|
|
/**
|
|
|
* 文件路径
|
|
|
*/
|
|
|
@@ -1534,6 +1579,21 @@ public interface DahuaLibrary extends Library {
|
|
|
* 小图左上角在大图的位置,使用绝对坐标系
|
|
|
*/
|
|
|
public DH_POINT stuPoint;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String toString() {
|
|
|
+ return "DH_PIC_INFO{" +
|
|
|
+ "dwOffSet=" + dwOffSet +
|
|
|
+ ", dwFileLenth=" + dwFileLenth +
|
|
|
+ ", wWidth=" + wWidth +
|
|
|
+ ", wHeight=" + wHeight +
|
|
|
+ ", pszFilePath='" + pszFilePath + '\'' +
|
|
|
+ ", bIsDetected=" + bIsDetected +
|
|
|
+ ", bReserved=" + new String(bReserved) +
|
|
|
+ ", nFilePathLen=" + nFilePathLen +
|
|
|
+ ", stuPoint=" + stuPoint +
|
|
|
+ '}';
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1792,11 +1852,11 @@ public interface DahuaLibrary extends Library {
|
|
|
/**
|
|
|
* 车辆子品牌 需要通过映射表得到真正的子品牌 映射表详见开发手册
|
|
|
*/
|
|
|
- public int wColorLogoIndex;
|
|
|
+ public short wColorLogoIndex;
|
|
|
/**
|
|
|
* 车辆子品牌 需要通过映射表得到真正的子品牌 映射表详见开发手册
|
|
|
*/
|
|
|
- public int wSubBrand;
|
|
|
+ public short wSubBrand;
|
|
|
public byte byReserved1;
|
|
|
/**
|
|
|
* 是否有物体对应图片文件信息
|
|
|
@@ -1854,11 +1914,11 @@ public interface DahuaLibrary extends Library {
|
|
|
/**
|
|
|
* 开始时文件偏移, 单位: 字节(物体开始出现时,视频帧在原始视频文件中相对于文件起始处的偏移)
|
|
|
*/
|
|
|
- public int nBeginFileOffset;
|
|
|
+ public long nBeginFileOffset;
|
|
|
/**
|
|
|
* 结束时文件偏移, 单位: 字节(物体消逝时,视频帧在原始视频文件中相对于文件起始处的偏移)
|
|
|
*/
|
|
|
- public int nEndFileOffset;
|
|
|
+ public long nEndFileOffset;
|
|
|
/**
|
|
|
* 物体颜色相似度,取值范围:0-100,数组下标值代表某种颜色,详见EM_COLOR_TYPE
|
|
|
*/
|
|
|
@@ -1882,7 +1942,49 @@ public interface DahuaLibrary extends Library {
|
|
|
/**
|
|
|
* 车辆品牌年款 需要通过映射表得到真正的年款 映射表详见开发手册
|
|
|
*/
|
|
|
- public int wBrandYear;
|
|
|
+ public short wBrandYear;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String toString() {
|
|
|
+ return "DH_MSG_OBJECT{" +
|
|
|
+ "nObjectID=" + nObjectID +
|
|
|
+ ", szObjectType=" + new String(szObjectType) +
|
|
|
+ ", nConfidence=" + nConfidence +
|
|
|
+ ", nAction=" + nAction +
|
|
|
+ ", BoundingBox=" + BoundingBox +
|
|
|
+ ", Center=" + Center +
|
|
|
+ ", nPolygonNum=" + nPolygonNum +
|
|
|
+ ", Contour=" + Arrays.toString(Contour) +
|
|
|
+ ", rgbaMainColor=" + rgbaMainColor +
|
|
|
+ ", szText=" + new String(szText) +
|
|
|
+ ", szObjectSubType=" + new String(szObjectSubType) +
|
|
|
+ ", wColorLogoIndex=" + wColorLogoIndex +
|
|
|
+ ", wSubBrand=" + wSubBrand +
|
|
|
+ ", byReserved1=" + byReserved1 +
|
|
|
+ ", bPicEnble=" + bPicEnble +
|
|
|
+ ", stPicInfo=" + stPicInfo +
|
|
|
+ ", bShotFrame=" + bShotFrame +
|
|
|
+ ", bColor=" + bColor +
|
|
|
+ ", byReserved2=" + byReserved2 +
|
|
|
+ ", byTimeType=" + byTimeType +
|
|
|
+ ", stuCurrentTime=" + stuCurrentTime +
|
|
|
+ ", stuStartTime=" + stuStartTime +
|
|
|
+ ", stuEndTime=" + stuEndTime +
|
|
|
+ ", stuOriginalBoundingBox=" + stuOriginalBoundingBox +
|
|
|
+ ", stuSignBoundingBox=" + stuSignBoundingBox +
|
|
|
+ ", dwCurrentSequence=" + dwCurrentSequence +
|
|
|
+ ", dwBeginSequence=" + dwBeginSequence +
|
|
|
+ ", dwEndSequence=" + dwEndSequence +
|
|
|
+ ", nBeginFileOffset=" + nBeginFileOffset +
|
|
|
+ ", nEndFileOffset=" + nEndFileOffset +
|
|
|
+ ", byColorSimilar=" + new String(byColorSimilar) +
|
|
|
+ ", byUpperBodyColorSimilar=" + new String(byUpperBodyColorSimilar) +
|
|
|
+ ", byLowerBodyColorSimilar=" + new String(byLowerBodyColorSimilar) +
|
|
|
+ ", nRelativeID=" + nRelativeID +
|
|
|
+ ", szSubText=" + new String(szSubText) +
|
|
|
+ ", wBrandYear=" + wBrandYear +
|
|
|
+ '}';
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|