fix: 优化依赖包,修正测温采集和延时

hc-jna3
huangfeng 16 hours ago
parent 3f71d05990
commit 5be127b558

@ -212,13 +212,6 @@
<artifactId>jna</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>local</groupId>
<artifactId>examples</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>${pom.basedir}/lib/examples.jar</systemPath>
</dependency>
</dependencies>
<build>

@ -128,7 +128,7 @@ public class HCModule {
cond.dwSize = cond.size();
cond.byRuleID = tmId.byteValue();
cond.dwChan = channel;
cond.wInterval = 1;
cond.wInterval = 2;
cond.byMode = 1;
cond.write();
log.info("开始采集通道" + channel + ", 规则" + tmId);

@ -1,8 +1,6 @@
package com.hcsdk;
import com.sun.jna.*;
import com.sun.jna.examples.win32.W32API;
import com.sun.jna.examples.win32.W32API.HWND;
import com.sun.jna.ptr.ByteByReference;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.ShortByReference;
@ -4141,7 +4139,7 @@ DVR实现巡航数据结构
public static class NET_DVR_CLIENTINFO extends Structure {
public int lChannel;
public int lLinkMode;
public HWND hPlayWnd;
// public HWND hPlayWnd;
public String sMultiCastIP;
}
@ -4423,7 +4421,7 @@ DVR实现巡航数据结构
public NET_DVR_STREAM_INFO struIDInfo;
public NET_DVR_TIME struBeginTime;
public NET_DVR_TIME struEndTime;
public HWND hWnd;
// public HWND hWnd;
public byte byDrawFrame; //0:不抽帧1抽帧
public byte byVolumeType; //0-普通录像卷 1-存档卷
public byte byVolumeNum; //卷号,目前指存档卷号
@ -9755,9 +9753,9 @@ DVR实现巡航数据结构
public void invoke(int dwType, int lUserID, int lHandle, Pointer pUser);
}
public static interface FDrawFun extends Callback {
public void invoke(int lRealHandle, W32API.HDC hDc, int dwUser);
}
// public static interface FDrawFun extends Callback {
// public void invoke(int lRealHandle, W32API.HDC hDc, int dwUser);
// }
public static interface FStdDataCallBack extends Callback {
public void invoke(int lRealHandle, int dwDataType, ByteByReference pBuffer, int dwBufSize, int dwUser);
@ -9853,9 +9851,9 @@ DVR实现巡航数据结构
boolean NET_DVR_UnlockFileByName(int lUserID, String sUnlockFileName);
int NET_DVR_PlayBackByName(int lUserID, String sPlayBackFileName, HWND hWnd);
// int NET_DVR_PlayBackByName(int lUserID, String sPlayBackFileName, HWND hWnd);
int NET_DVR_PlayBackByTime(int lUserID, int lChannel, NET_DVR_TIME lpStartTime, NET_DVR_TIME lpStopTime, HWND hWnd);
// int NET_DVR_PlayBackByTime(int lUserID, int lChannel, NET_DVR_TIME lpStartTime, NET_DVR_TIME lpStopTime, HWND hWnd);
int NET_DVR_PlayBackByTime_V40(int lUserID, NET_DVR_VOD_PARA pVodPara);
@ -9958,7 +9956,7 @@ DVR实现巡航数据结构
boolean NET_DVR_StopRealPlay(int lRealHandle);
boolean NET_DVR_RigisterDrawFun(int lRealHandle, FDrawFun fDrawFun, int dwUser);
// boolean NET_DVR_RigisterDrawFun(int lRealHandle, FDrawFun fDrawFun, int dwUser);
boolean NET_DVR_SetPlayerBufNumber(int lRealHandle, int dwBufNum);
@ -10860,77 +10858,3 @@ DVR实现巡航数据结构
}
}
//播放库函数声明,PlayCtrl.dll
interface PlayCtrl extends Library {
public static final int STREAME_REALTIME = 0;
public static final int STREAME_FILE = 1;
boolean PlayM4_GetPort(IntByReference nPort);
boolean PlayM4_OpenStream(int nPort, ByteByReference pFileHeadBuf, int nSize, int nBufPoolSize);
boolean PlayM4_InputData(int nPort, ByteByReference pBuf, int nSize);
boolean PlayM4_CloseStream(int nPort);
boolean PlayM4_SetStreamOpenMode(int nPort, int nMode);
boolean PlayM4_Play(int nPort, HWND hWnd);
boolean PlayM4_Stop(int nPort);
boolean PlayM4_SetSecretKey(int nPort, int lKeyType, String pSecretKey, int lKeyLen);
boolean PlayM4_GetPictureSize(int nPort, IntByReference pWidth, IntByReference pHeight);
boolean PlayM4_GetJPEG(int nPort, Pointer pBitmap, int nBufSize, IntByReference pBmpSize);
int PlayM4_GetLastError(int nPort);
boolean PlayM4_SetDecCallBackExMend(int nPort, DecCallBack decCBFun, Pointer pDest, int nDestSize, int nUser);
public static interface DecCallBack extends Callback {
void invoke(int nPort, Pointer pBuf, int nSize, FRAME_INFO pFrameInfo, int nReserved1, int nReserved2);
}
public class FRAME_INFO extends Structure {
public int nWidth; /* 画面宽,单位像素。如果是音频数据,则为音频声道数 */
public int nHeight; /* 画面高,单位像素。如果是音频数据,则为样位率 */
public int nStamp; /* 时标信息,单位毫秒 */
public int nType; /* 数据类型T_AUDIO16, T_RGB32, T_YV12 */
public int nFrameRate; /* 编码时产生的图像帧率,如果是音频数据则为采样率 */
public int dwFrameNum; /* 帧号 */
}
}
//windows gdi接口,gdi32.dll in system32 folder, 在设置遮挡区域,移动侦测区域等情况下使用
interface GDI32 extends W32API {
GDI32 INSTANCE = (GDI32) Native.loadLibrary("gdi32", GDI32.class, DEFAULT_OPTIONS);
public static final int TRANSPARENT = 1;
int SetBkMode(HDC hdc, int i);
HANDLE CreateSolidBrush(int icolor);
}
//windows user32接口,user32.dll in system32 folder, 在设置遮挡区域,移动侦测区域等情况下使用
interface USER32 extends W32API {
USER32 INSTANCE = (USER32) Native.loadLibrary("user32", USER32.class, DEFAULT_OPTIONS);
public static final int BF_LEFT = 0x0001;
public static final int BF_TOP = 0x0002;
public static final int BF_RIGHT = 0x0004;
public static final int BF_BOTTOM = 0x0008;
public static final int BDR_SUNKENOUTER = 0x0002;
public static final int BF_RECT = (BF_LEFT | BF_TOP | BF_RIGHT | BF_BOTTOM);
boolean DrawEdge(HDC hdc, com.sun.jna.examples.win32.GDI32.RECT qrc, int edge, int grfFlags);
int FillRect(HDC hDC, com.sun.jna.examples.win32.GDI32.RECT lprc, HANDLE hbr);
}

@ -14,6 +14,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class StaticVariable {
public static boolean ready = false;
public static String jarPath = "";
public static Iec104Server iec104Server = null;
public static Iec104Client realTime104Client = null;

@ -37,8 +37,9 @@ public class CacheTask {
StaticVariable.doneWarnMap.clear();
}
@Scheduled(initialDelay = 30 * 1000, fixedDelay = 60 * 1000)
@Scheduled(initialDelay = 60 * 1000, fixedDelay = 60 * 1000)
public void refreshRule() {
StaticVariable.ready = true;
try {
List<WarnRule> list = ruleService.listAll(null);
for (WarnRule item : list) {

@ -50,6 +50,9 @@ public class Client61850Task {
@Scheduled(cron = "0 * * * * ?")
public void collectAll() {
if (!StaticVariable.ready) {
return;
}
if (!enable) {
return;
}

@ -3,6 +3,7 @@ package com.xydl.cac.task;
import com.xydl.cac.entity.ModevType;
import com.xydl.cac.entity.NSensor;
import com.xydl.cac.entity.ThermalConfig;
import com.xydl.cac.model.StaticVariable;
import com.xydl.cac.repository.NSensorRepository;
import com.xydl.cac.service.ModevTypeService;
import com.xydl.cac.service.ThermalConfigService;
@ -39,6 +40,9 @@ public class ClientThermalTask {
@Scheduled(cron = "0 * * * * ?")
public void collectAll() {
if (!StaticVariable.ready) {
return;
}
ThermalConfig config = configService.getConfig();
if (config == null) {
return;

@ -35,9 +35,9 @@ public class HCRemoteConfigCallBack implements HCNetSDK.FRemoteConfigCallBack {
max, min, aver, time);
done = true;
} else if (1 == data.byRuleCalibType || 2 == data.byRuleCalibType) {
max = data.struLinePolygonThermCfg.fAverageTemperature;
aver = data.struLinePolygonThermCfg.fAverageTemperature;
min = data.struLinePolygonThermCfg.fMinTemperature;
aver = data.struLinePolygonThermCfg.fMaxTemperature;
max = data.struLinePolygonThermCfg.fMaxTemperature;
log.info("海康热成像采集到max=" + max + ", min=" + min + ", aver=" + aver);
service.save(item.getTableName(), item.getDevId(),
max, min, aver, time);

@ -27,6 +27,7 @@ public class HCThermalService {
ThermalConfig _config;
int shutdown = 0;
int maxWait = 20;
@PreDestroy
private void preDestroy() {
@ -56,7 +57,7 @@ public class HCThermalService {
r = HCModule.startRemoteConfig(_callBack, 2, item.getTmId());
if (r) {
int sec = 0;
while (shutdown == 0 && sec < 20 && !_callBack.done) {
while (shutdown == 0 && sec < maxWait && !_callBack.done) {
try {
Thread.sleep(1000);
sec++;

Loading…
Cancel
Save