|
@@ -5,7 +5,10 @@ import com.sun.jna.Pointer;
|
5
|
5
|
import com.unis.common.HCNetSDK;
|
6
|
6
|
/*import com.unissoft.pushMsg.AlarmDSService;
|
7
|
7
|
import com.unissoft.pushMsg.AlarmDSServiceImpl;*/
|
|
8
|
+import com.unis.common.NetDVRAlarmerConvert;
|
|
9
|
+import com.unis.utils.BinaryConversionUtil;
|
8
|
10
|
import lombok.extern.slf4j.Slf4j;
|
|
11
|
+import org.springframework.beans.BeanUtils;
|
9
|
12
|
|
10
|
13
|
import java.io.FileOutputStream;
|
11
|
14
|
import java.io.IOException;
|
|
@@ -29,10 +32,34 @@ public class FMSGCallBack_V31 implements HCNetSDK.FMSGCallBack_V31 {
|
29
|
32
|
|
30
|
33
|
public void AlarmDataHandle(int lCommand, HCNetSDK.NET_DVR_ALARMER pAlarmer, Pointer pAlarmInfo, int dwBufLen, Pointer pUser) {
|
31
|
34
|
log.info("报警事件发生,进入回调");
|
32
|
|
- log.info(
|
|
35
|
+ log.info("lCommand: {}", lCommand);
|
|
36
|
+ log.info("pAlarmer: {}", JSON.toJSONString(pAlarmer));
|
|
37
|
+ log.info("pAlarmInfo: {}", JSON.toJSONString(pAlarmInfo));
|
|
38
|
+ log.info("dwBufLen: {}", dwBufLen);
|
|
39
|
+ log.info("pUser: {}", JSON.toJSONString(pUser));
|
|
40
|
+ /*log.info(
|
33
|
41
|
"lCommand {} -> pAlarmer {} -> pAlarmInfo {} -> dwBufLen {} -> pUser {}",
|
34
|
42
|
lCommand, JSON.toJSONString(pAlarmer), JSON.toJSONString(pAlarmInfo),dwBufLen,JSON.toJSONString(pUser)
|
35
|
|
- );
|
|
43
|
+ );*/
|
|
44
|
+ // bye封装对象转换
|
|
45
|
+ NetDVRAlarmerConvert convert = new NetDVRAlarmerConvert();
|
|
46
|
+ BeanUtils.copyProperties(pAlarmer, convert);
|
|
47
|
+
|
|
48
|
+ // byMacAddr
|
|
49
|
+ convert.setByMacAddr(new String(pAlarmer.getByMacAddr()));
|
|
50
|
+ // byRes2
|
|
51
|
+ convert.setByRes2(new String(pAlarmer.getByRes2()));
|
|
52
|
+ // sDeviceIP
|
|
53
|
+ convert.setSDeviceIP(new String(pAlarmer.getSDeviceIP()));
|
|
54
|
+ // sDeviceName
|
|
55
|
+ convert.setSDeviceName(new String(pAlarmer.getSDeviceName()));
|
|
56
|
+ // sSerialNumber
|
|
57
|
+ convert.setSSerialNumber(new String(pAlarmer.getSSerialNumber()));
|
|
58
|
+ // sSocketIP
|
|
59
|
+ convert.setSSocketIP(new String(pAlarmer.getSSocketIP()));
|
|
60
|
+ log.info("convert: {}", convert);
|
|
61
|
+
|
|
62
|
+
|
36
|
63
|
/*String hexString = Integer.toHexString(lCommand);
|
37
|
64
|
log.info("报警类型 hexString {}", hexString);*/
|
38
|
65
|
switch (lCommand) {
|
|
@@ -173,6 +200,7 @@ public class FMSGCallBack_V31 implements HCNetSDK.FMSGCallBack_V31 {
|
173
|
200
|
default:
|
174
|
201
|
// TODO 单报警设备 目前不需要 sAlarmType alarmNow
|
175
|
202
|
log.info("alarm type in the FMSGCallBack_V31 ->int: {}", lCommand);
|
|
203
|
+ log.info("alarm type in the FMSGCallBack_V31 ->HEX: {}", BinaryConversionUtil.toHex(lCommand));
|
176
|
204
|
// alarmDSService.pushLCommand(lCommand);
|
177
|
205
|
break;
|
178
|
206
|
}
|