From 8be697991194f0be5c059d58794763145384c025 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 24 May 2024 00:15:52 +0800 Subject: [PATCH] =?UTF-8?q?1078-=E5=9B=BE=E5=83=8F=E5=88=86=E6=9E=90?= =?UTF-8?q?=E6=8A=A5=E8=AD=A6=E5=8F=82=E6=95=B0=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/jt1078/bean/JTDeviceConfig.java | 24 ++++++++- .../jt1078/bean/config/AnalyzeAlarmParam.java | 53 +++++++++++++++++++ .../vmp/jt1078/bean/config/AwakenParam.java | 11 ++++ .../iot/vmp/jt1078/proc/request/J0104.java | 5 ++ .../iot/vmp/jt1078/proc/response/J8103.java | 1 + 5 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/AnalyzeAlarmParam.java create mode 100644 src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/AwakenParam.java diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTDeviceConfig.java b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTDeviceConfig.java index ad3bdc4e2..ab6737bc7 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTDeviceConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTDeviceConfig.java @@ -223,9 +223,15 @@ public class JTDeviceConfig { @ConfigAttribute(id = 0x79, type="AlarmRecordingParam", description = "特殊报警录像参数设置") private AlarmRecordingParam alarmRecordingParam; - @ConfigAttribute(id = 0x79, type="VideoAlarmBit", description = "视频相关报警屏蔽字") + @ConfigAttribute(id = 0x7a, type="VideoAlarmBit", description = "视频相关报警屏蔽字") private VideoAlarmBit videoAlarmBit; + @ConfigAttribute(id = 0x7b, type="AnalyzeAlarmParam", description = "图像分析报警参数设置") + private AnalyzeAlarmParam analyzeAlarmParam; + + @ConfigAttribute(id = 0x7c, type="AwakenParam", description = "终端休眠唤醒模式设置") + private AwakenParam awakenParam; + @ConfigAttribute(id = 0x80, type="Long", description = "车辆里程表读数,单位'1/10km") private Long mileage; @@ -283,6 +289,14 @@ public class JTDeviceConfig { private Integer canUploadIntervalForChannel2; + public AnalyzeAlarmParam getAnalyzeAlarmParam() { + return analyzeAlarmParam; + } + + public void setAnalyzeAlarmParam(AnalyzeAlarmParam analyzeAlarmParam) { + this.analyzeAlarmParam = analyzeAlarmParam; + } + public Long getKeepaliveInterval() { return keepaliveInterval; } @@ -971,6 +985,14 @@ public class JTDeviceConfig { this.alarmRecordingParam = alarmRecordingParam; } + public VideoAlarmBit getVideoAlarmBit() { + return videoAlarmBit; + } + + public void setVideoAlarmBit(VideoAlarmBit videoAlarmBit) { + this.videoAlarmBit = videoAlarmBit; + } + @Override public String toString() { return "JTDeviceConfig{" + diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/AnalyzeAlarmParam.java b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/AnalyzeAlarmParam.java new file mode 100644 index 000000000..090b2c587 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/AnalyzeAlarmParam.java @@ -0,0 +1,53 @@ +package com.genersoft.iot.vmp.jt1078.bean.config; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + +/** + * 视频分析报警参数 + */ +public class AnalyzeAlarmParam implements JTDeviceSubConfig{ + + /** + * 车辆核载人数 + */ + private int numberForPeople; + + + /** + * 疲劳程度阈值 + */ + private int fatigueThreshold; + + + public int getNumberForPeople() { + return numberForPeople; + } + + public void setNumberForPeople(int numberForPeople) { + this.numberForPeople = numberForPeople; + } + + public int getFatigueThreshold() { + return fatigueThreshold; + } + + public void setFatigueThreshold(int fatigueThreshold) { + this.fatigueThreshold = fatigueThreshold; + } + + @Override + public ByteBuf encode() { + ByteBuf byteBuf = Unpooled.buffer(); + byteBuf.writeByte(numberForPeople); + byteBuf.writeByte(fatigueThreshold); + return byteBuf; + } + + public static AnalyzeAlarmParam decode(ByteBuf byteBuf) { + AnalyzeAlarmParam analyzeAlarmParam = new AnalyzeAlarmParam(); + analyzeAlarmParam.setNumberForPeople(byteBuf.readUnsignedByte()); + analyzeAlarmParam.setFatigueThreshold(byteBuf.readUnsignedByte()); + return analyzeAlarmParam; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/AwakenParam.java b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/AwakenParam.java new file mode 100644 index 000000000..6f84e2945 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/AwakenParam.java @@ -0,0 +1,11 @@ +package com.genersoft.iot.vmp.jt1078.bean.config; + +import io.netty.buffer.ByteBuf; + +public class AwakenParam implements JTDeviceSubConfig{ + + @Override + public ByteBuf encode() { + return null; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/proc/request/J0104.java b/src/main/java/com/genersoft/iot/vmp/jt1078/proc/request/J0104.java index aba37dea1..2d1c58455 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/proc/request/J0104.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/proc/request/J0104.java @@ -150,6 +150,11 @@ public class J0104 extends Re { Method methodForVideoAlarmBit = deviceConfig.getClass().getDeclaredMethod("set" + StringUtils.capitalize(field.getName()), VideoAlarmBit.class); methodForVideoAlarmBit.invoke(deviceConfig, videoAlarmBit); continue; + case "AnalyzeAlarmParam": + AnalyzeAlarmParam analyzeAlarmParam = AnalyzeAlarmParam.decode(buf); + Method methodForAnalyzeAlarmParam = deviceConfig.getClass().getDeclaredMethod("set" + StringUtils.capitalize(field.getName()), AnalyzeAlarmParam.class); + methodForAnalyzeAlarmParam.invoke(deviceConfig, analyzeAlarmParam); + continue; default: System.err.println(field.getGenericType().getTypeName()); continue; diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J8103.java b/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J8103.java index f7aad5bf1..feaff82e5 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J8103.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J8103.java @@ -94,6 +94,7 @@ public class J8103 extends Rs { case "AlarmRecordingParam": case "AlarmShielding": case "VideoAlarmBit": + case "AnalyzeAlarmParam": field.setAccessible(true); JTDeviceSubConfig subConfig = (JTDeviceSubConfig)field.get(config); ByteBuf bytesForIllegalDrivingPeriods = subConfig.encode();