From 82ab524fc42a274fe86d1ffe1100bbe0ab30ed88 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Tue, 21 May 2024 23:56:51 +0800 Subject: [PATCH] =?UTF-8?q?1078-=E9=9F=B3=E8=A7=86=E9=A2=91=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E8=AE=BE=E7=BD=AE+=E9=9F=B3=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E9=80=9A=E9=81=93=E5=88=97=E8=A1=A8=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 | 11 +- .../vmp/jt1078/bean/config/CameraTimer.java | 9 +- .../jt1078/bean/config/ChannelListParam.java | 89 +++++++ .../bean/config/CollisionAlarmParams.java | 9 +- .../bean/config/GnssPositioningMode.java | 9 +- .../bean/config/IllegalDrivingPeriods.java | 9 +- .../iot/vmp/jt1078/bean/config/JTChanel.java | 86 +++++++ .../jt1078/bean/config/JTDeviceSubConfig.java | 5 +- .../iot/vmp/jt1078/bean/config/OSDConfig.java | 144 +++++++++++ .../vmp/jt1078/bean/config/VideoParam.java | 228 ++++++++++++++++++ .../iot/vmp/jt1078/proc/request/J0104.java | 10 +- .../iot/vmp/jt1078/proc/response/J8103.java | 5 +- 12 files changed, 595 insertions(+), 19 deletions(-) create mode 100644 src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/ChannelListParam.java create mode 100644 src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/JTChanel.java create mode 100644 src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/OSDConfig.java create mode 100644 src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/VideoParam.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 d5ac5255f..1c5f65d3f 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 @@ -1,10 +1,7 @@ package com.genersoft.iot.vmp.jt1078.bean; import com.genersoft.iot.vmp.jt1078.bean.common.ConfigAttribute; -import com.genersoft.iot.vmp.jt1078.bean.config.CollisionAlarmParams; -import com.genersoft.iot.vmp.jt1078.bean.config.GnssPositioningMode; -import com.genersoft.iot.vmp.jt1078.bean.config.IllegalDrivingPeriods; -import com.genersoft.iot.vmp.jt1078.bean.config.CameraTimer; +import com.genersoft.iot.vmp.jt1078.bean.config.*; import io.swagger.v3.oas.annotations.media.Schema; /** @@ -214,6 +211,12 @@ public class JTDeviceConfig { @ConfigAttribute(id = 0x74, type="Long", description = "色度,设置范围为0 ~ 255") private Long chroma; + @ConfigAttribute(id = 0x75, type="VideoParam", description = "音视频参数设置") + private VideoParam videoParam; + + @ConfigAttribute(id = 0x76, type="ChannelListParam", description = "音视频通道列表设置") + private ChannelListParam channelListParam; + @ConfigAttribute(id = 0x80, type="Long", description = "车辆里程表读数,单位'1/10km") private Long mileage; diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/CameraTimer.java b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/CameraTimer.java index 7e8ce0b62..4c74e8d06 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/CameraTimer.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/CameraTimer.java @@ -1,5 +1,8 @@ package com.genersoft.iot.vmp.jt1078.bean.config; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + /** * 定时拍照控制 */ @@ -157,7 +160,8 @@ public class CameraTimer implements JTDeviceSubConfig{ } @Override - public byte[] encode() { + public ByteBuf encode() { + ByteBuf byteBuf = Unpooled.buffer(); byte[] bytes = new byte[4]; bytes[0] = 0; if (switchForChannel1) { @@ -195,6 +199,7 @@ public class CameraTimer implements JTDeviceSubConfig{ if (timeUnit) { bytes[3] = (byte)(bytes[3] | 1); } - return bytes; + byteBuf.writeBytes(bytes); + return byteBuf; } } diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/ChannelListParam.java b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/ChannelListParam.java new file mode 100644 index 000000000..a13d18d82 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/ChannelListParam.java @@ -0,0 +1,89 @@ +package com.genersoft.iot.vmp.jt1078.bean.config; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + +import java.util.ArrayList; +import java.util.List; + +/** + * 音视频通道列表设置 + */ +public class ChannelListParam implements JTDeviceSubConfig{ + + /** + * 音视频通道总数 + */ + private int videoAndAudioCount; + + /** + * 音频通道总数 + */ + private int audioCount; + + /** + * 视频通道总数 + */ + private int videoCount; + + private List chanelList; + + + public int getVideoAndAudioCount() { + return videoAndAudioCount; + } + + public void setVideoAndAudioCount(int videoAndAudioCount) { + this.videoAndAudioCount = videoAndAudioCount; + } + + public int getAudioCount() { + return audioCount; + } + + public void setAudioCount(int audioCount) { + this.audioCount = audioCount; + } + + public int getVideoCount() { + return videoCount; + } + + public void setVideoCount(int videoCount) { + this.videoCount = videoCount; + } + + public List getChanelList() { + return chanelList; + } + + public void setChanelList(List chanelList) { + this.chanelList = chanelList; + } + + @Override + public ByteBuf encode() { + ByteBuf byteBuf = Unpooled.buffer(); + byteBuf.writeByte(videoAndAudioCount); + byteBuf.writeByte(audioCount); + byteBuf.writeByte(videoCount); + for (JTChanel jtChanel : chanelList) { + byteBuf.writeBytes(jtChanel.encode()); + } + return byteBuf; + } + + public static ChannelListParam decode(ByteBuf byteBuf) { + ChannelListParam channelListParam = new ChannelListParam(); + channelListParam.setVideoAndAudioCount(byteBuf.readUnsignedByte()); + channelListParam.setAudioCount(byteBuf.readUnsignedByte()); + channelListParam.setVideoCount(byteBuf.readUnsignedByte()); + int total = channelListParam.getVideoAndAudioCount() + channelListParam.getVideoCount() + channelListParam.getAudioCount(); + List chanelList = new ArrayList<>(total); + for (int i = 0; i < total; i++) { + chanelList.add(JTChanel.decode(byteBuf)); + } + channelListParam.setChanelList(chanelList); + return channelListParam; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/CollisionAlarmParams.java b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/CollisionAlarmParams.java index 6154702fa..2f1787eb5 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/CollisionAlarmParams.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/CollisionAlarmParams.java @@ -1,5 +1,8 @@ package com.genersoft.iot.vmp.jt1078.bean.config; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + /** * 碰撞报警参数设置 */ @@ -32,10 +35,12 @@ public class CollisionAlarmParams implements JTDeviceSubConfig{ } @Override - public byte[] encode() { + public ByteBuf encode() { + ByteBuf byteBuf = Unpooled.buffer(); byte[] bytes = new byte[2]; bytes[0] = (byte) (collisionAlarmTime & 0xff); bytes[1] = (byte) (collisionAcceleration & 0xff); - return bytes; + byteBuf.writeBytes(bytes); + return byteBuf; } } diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/GnssPositioningMode.java b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/GnssPositioningMode.java index a9e9c5ea6..b8ce04b9c 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/GnssPositioningMode.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/GnssPositioningMode.java @@ -1,5 +1,8 @@ package com.genersoft.iot.vmp.jt1078.bean.config; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + /** * GNSS 定位模式 */ @@ -55,7 +58,8 @@ public class GnssPositioningMode implements JTDeviceSubConfig{ } @Override - public byte[] encode() { + public ByteBuf encode() { + ByteBuf byteBuf = Unpooled.buffer(); byte[] bytes = new byte[1]; bytes[0] = 0; if (gps) { @@ -70,6 +74,7 @@ public class GnssPositioningMode implements JTDeviceSubConfig{ if (gaLiLeo) { bytes[0] = (byte)(bytes[0] | 8); } - return bytes; + byteBuf.writeBytes(bytes); + return byteBuf; } } diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/IllegalDrivingPeriods.java b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/IllegalDrivingPeriods.java index 9a4b681aa..b3207dbf0 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/IllegalDrivingPeriods.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/IllegalDrivingPeriods.java @@ -1,5 +1,8 @@ package com.genersoft.iot.vmp.jt1078.bean.config; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + /** * 违规行驶时段范围 ,精确到分 */ @@ -31,7 +34,8 @@ public class IllegalDrivingPeriods implements JTDeviceSubConfig{ } @Override - public byte[] encode() { + public ByteBuf encode() { + ByteBuf byteBuf = Unpooled.buffer(); byte[] bytes = new byte[4]; String[] startTimeArray = startTime.split(":"); String[] endTimeArray = endTime.split(":"); @@ -39,6 +43,7 @@ public class IllegalDrivingPeriods implements JTDeviceSubConfig{ bytes[1] = (byte)Integer.parseInt(startTimeArray[1]); bytes[2] = (byte)Integer.parseInt(endTimeArray[0]); bytes[3] = (byte)Integer.parseInt(endTimeArray[1]); - return bytes; + byteBuf.writeBytes(bytes); + return byteBuf; } } diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/JTChanel.java b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/JTChanel.java new file mode 100644 index 000000000..ebc1868e2 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/JTChanel.java @@ -0,0 +1,86 @@ +package com.genersoft.iot.vmp.jt1078.bean.config; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + +import java.util.Stack; + +/** + * 音视频通道 + */ +public class JTChanel implements JTDeviceSubConfig{ + + /** + * 物理通道号 + */ + private int physicalChannelId; + + /** + * 逻辑通道号 + */ + private int logicChannelId; + + /** + * 通道类型: + * 0:音视频; + * 1:音频 + * 2:视频 + */ + private int channelType; + /** + * 是否连接云台: 通道类型为 0 和 2 时,此字段有效 + * 0:未连接;1:连接 + */ + private int ptzEnable; + + public int getPhysicalChannelId() { + return physicalChannelId; + } + + public void setPhysicalChannelId(int physicalChannelId) { + this.physicalChannelId = physicalChannelId; + } + + public int getLogicChannelId() { + return logicChannelId; + } + + public void setLogicChannelId(int logicChannelId) { + this.logicChannelId = logicChannelId; + } + + public int getChannelType() { + return channelType; + } + + public void setChannelType(int channelType) { + this.channelType = channelType; + } + + public int getPtzEnable() { + return ptzEnable; + } + + public void setPtzEnable(int ptzEnable) { + this.ptzEnable = ptzEnable; + } + + @Override + public ByteBuf encode() { + ByteBuf byteBuf = Unpooled.buffer(); + byteBuf.writeByte(physicalChannelId); + byteBuf.writeByte(logicChannelId); + byteBuf.writeByte(channelType); + byteBuf.writeByte(ptzEnable); + return byteBuf; + } + + public static JTChanel decode(ByteBuf byteBuf) { + JTChanel jtChanel = new JTChanel(); + jtChanel.setPhysicalChannelId(byteBuf.readUnsignedByte()); + jtChanel.setLogicChannelId(byteBuf.readUnsignedByte()); + jtChanel.setChannelType(byteBuf.readUnsignedByte()); + jtChanel.setPtzEnable(byteBuf.readUnsignedByte()); + return jtChanel; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/JTDeviceSubConfig.java b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/JTDeviceSubConfig.java index a8605b1c5..7c5f5ad14 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/JTDeviceSubConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/JTDeviceSubConfig.java @@ -1,5 +1,8 @@ package com.genersoft.iot.vmp.jt1078.bean.config; +import io.netty.buffer.ByteBuf; + public interface JTDeviceSubConfig { - byte[] encode(); + ByteBuf encode(); + } diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/OSDConfig.java b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/OSDConfig.java new file mode 100644 index 000000000..8187e262b --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/OSDConfig.java @@ -0,0 +1,144 @@ +package com.genersoft.iot.vmp.jt1078.bean.config; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + +/** + * OSD字幕叠加设置 + */ +public class OSDConfig { + + /** + * 日期和时间 + */ + private boolean time; + + /** + * 车牌号码 + */ + private boolean licensePlate; + + /** + * 逻辑通道号 + */ + private boolean channelId; + + /** + * 经纬度 + */ + private boolean position; + + /** + * 行驶记录速度 + */ + private boolean speed; + + /** + * 卫星定位速度 + */ + private boolean speedForGPS; + + /** + * 连续驾驶时间 + */ + private boolean drivingTime; + + public boolean isTime() { + return time; + } + + public void setTime(boolean time) { + this.time = time; + } + + public boolean isLicensePlate() { + return licensePlate; + } + + public void setLicensePlate(boolean licensePlate) { + this.licensePlate = licensePlate; + } + + public boolean isChannelId() { + return channelId; + } + + public void setChannelId(boolean channelId) { + this.channelId = channelId; + } + + public boolean isPosition() { + return position; + } + + public void setPosition(boolean position) { + this.position = position; + } + + public boolean isSpeed() { + return speed; + } + + public void setSpeed(boolean speed) { + this.speed = speed; + } + + public boolean isSpeedForGPS() { + return speedForGPS; + } + + public void setSpeedForGPS(boolean speedForGPS) { + this.speedForGPS = speedForGPS; + } + + public boolean isDrivingTime() { + return drivingTime; + } + + public void setDrivingTime(boolean drivingTime) { + this.drivingTime = drivingTime; + } + + public ByteBuf encode(){ + ByteBuf byteBuf = Unpooled.buffer(); + byte content = 0; + if (time) { + content = (byte)(content | 1); + } + if (licensePlate) { + content = (byte)(content | (1 << 1)); + } + if (channelId) { + content = (byte)(content | (1 << 2)); + } + if (position) { + content = (byte)(content | (1 << 3)); + } + if (speed) { + content = (byte)(content | (1 << 4)); + } + if (speedForGPS) { + content = (byte)(content | (1 << 5)); + } + if (drivingTime) { + content = (byte)(content | (1 << 6)); + } + byteBuf.writeByte(content); + byteBuf.writeByte(0); + return byteBuf; + + } + + public static OSDConfig decode(ByteBuf buf) { + OSDConfig config = new OSDConfig(); + int content = buf.readUnsignedShort(); + config.setTime((content & 1) == 1); + config.setLicensePlate((content >>> 1 & 1) == 1); + config.setChannelId((content >>> 2 & 1) == 1); + config.setPosition((content >>> 3 & 1) == 1); + config.setSpeed((content >>> 4 & 1) == 1); + config.setSpeedForGPS((content >>> 5 & 1) == 1); + config.setDrivingTime((content >>> 6 & 1) == 1); + return config; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/VideoParam.java b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/VideoParam.java new file mode 100644 index 000000000..0d27ca6ae --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/config/VideoParam.java @@ -0,0 +1,228 @@ +package com.genersoft.iot.vmp.jt1078.bean.config; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + +/** + * 违规行驶时段范围 ,精确到分 + */ +public class VideoParam implements JTDeviceSubConfig{ + /** + * 实时流编码模式 + * 0:CBR( 固定码率) ; + * 1:VBR( 可变码率) ; + * 2:ABR( 平均码率) ; + * 100 ~ 127:自定义 + */ + private int liveStreamCodeRateType; + + /** + * 实时流分辨率 + * 0:QCIF; + * 1:CIF; + * 2:WCIF; + * 3:D1; + * 4:WD1; + * 5:720P; + * 6:1 080P; + * 100 ~ 127:自定义 + */ + private int liveStreamResolving; + + /** + * 实时流关键帧间隔, 范围(1 ~ 1 000) 帧 + */ + private int liveStreamIInterval; + + /** + * 实时流目标帧率,范围(1 ~ 120) 帧 / s + */ + private int liveStreamFrameRate; + + /** + * 实时流目标码率,单位为千位每秒( kbps) + */ + private long liveStreamCodeRate; + + + /** + * 存储流编码模式 + * 0:CBR( 固定码率) ; + * 1:VBR( 可变码率) ; + * 2:ABR( 平均码率) ; + * 100 ~ 127:自定义 + */ + private int storageStreamCodeRateType; + + /** + * 存储流分辨率 + * 0:QCIF; + * 1:CIF; + * 2:WCIF; + * 3:D1; + * 4:WD1; + * 5:720P; + * 6:1 080P; + * 100 ~ 127:自定义 + */ + private int storageStreamResolving; + + /** + * 存储流关键帧间隔, 范围(1 ~ 1 000) 帧 + */ + private int storageStreamIInterval; + + /** + * 存储流目标帧率,范围(1 ~ 120) 帧 / s + */ + private int storageStreamFrameRate; + + /** + * 存储流目标码率,单位为千位每秒( kbps) + */ + private long storageStreamCodeRate; + + /** + * 字幕叠加设置 + */ + private OSDConfig osd; + + /** + * 是否启用音频输出, 0:不启用;1:启用 + */ + private int audioEnable; + + + public int getLiveStreamCodeRateType() { + return liveStreamCodeRateType; + } + + public void setLiveStreamCodeRateType(int liveStreamCodeRateType) { + this.liveStreamCodeRateType = liveStreamCodeRateType; + } + + public int getLiveStreamResolving() { + return liveStreamResolving; + } + + public void setLiveStreamResolving(int liveStreamResolving) { + this.liveStreamResolving = liveStreamResolving; + } + + public int getLiveStreamIInterval() { + return liveStreamIInterval; + } + + public void setLiveStreamIInterval(int liveStreamIInterval) { + this.liveStreamIInterval = liveStreamIInterval; + } + + public int getLiveStreamFrameRate() { + return liveStreamFrameRate; + } + + public void setLiveStreamFrameRate(int liveStreamFrameRate) { + this.liveStreamFrameRate = liveStreamFrameRate; + } + + public long getLiveStreamCodeRate() { + return liveStreamCodeRate; + } + + public void setLiveStreamCodeRate(long liveStreamCodeRate) { + this.liveStreamCodeRate = liveStreamCodeRate; + } + + public int getStorageStreamCodeRateType() { + return storageStreamCodeRateType; + } + + public void setStorageStreamCodeRateType(int storageStreamCodeRateType) { + this.storageStreamCodeRateType = storageStreamCodeRateType; + } + + public int getStorageStreamResolving() { + return storageStreamResolving; + } + + public void setStorageStreamResolving(int storageStreamResolving) { + this.storageStreamResolving = storageStreamResolving; + } + + public int getStorageStreamIInterval() { + return storageStreamIInterval; + } + + public void setStorageStreamIInterval(int storageStreamIInterval) { + this.storageStreamIInterval = storageStreamIInterval; + } + + public int getStorageStreamFrameRate() { + return storageStreamFrameRate; + } + + public void setStorageStreamFrameRate(int storageStreamFrameRate) { + this.storageStreamFrameRate = storageStreamFrameRate; + } + + public long getStorageStreamCodeRate() { + return storageStreamCodeRate; + } + + public void setStorageStreamCodeRate(long storageStreamCodeRate) { + this.storageStreamCodeRate = storageStreamCodeRate; + } + + public OSDConfig getOsd() { + return osd; + } + + public void setOsd(OSDConfig osd) { + this.osd = osd; + } + + public int getAudioEnable() { + return audioEnable; + } + + public void setAudioEnable(int audioEnable) { + this.audioEnable = audioEnable; + } + + @Override + public ByteBuf encode() { + ByteBuf byteBuf = Unpooled.buffer(); + byteBuf.writeByte(liveStreamCodeRateType); + byteBuf.writeByte(liveStreamResolving); + byteBuf.writeShort((short)(liveStreamIInterval & 0xffff)); + byteBuf.writeByte(liveStreamFrameRate); + byteBuf.writeInt((int) (liveStreamCodeRate & 0xffffffffL)); + + byteBuf.writeByte(storageStreamCodeRateType); + byteBuf.writeByte(storageStreamResolving); + byteBuf.writeShort((short)(storageStreamIInterval & 0xffff)); + byteBuf.writeByte(storageStreamFrameRate); + byteBuf.writeInt((int) (storageStreamCodeRate & 0xffffffffL)); + byteBuf.writeBytes(osd.encode()); + byteBuf.writeByte(audioEnable); + return byteBuf; + } + + public static VideoParam decode(ByteBuf buf) { + VideoParam videoParam = new VideoParam(); + videoParam.setLiveStreamCodeRateType(buf.readByte()); + videoParam.setLiveStreamResolving(buf.readByte()); + videoParam.setLiveStreamIInterval(buf.readUnsignedShort()); + videoParam.setLiveStreamFrameRate(buf.readByte()); + videoParam.setLiveStreamCodeRate(buf.readUnsignedInt()); + + videoParam.setStorageStreamCodeRateType(buf.readByte()); + videoParam.setStorageStreamResolving(buf.readByte()); + videoParam.setStorageStreamIInterval(buf.readUnsignedShort()); + videoParam.setStorageStreamFrameRate(buf.readByte()); + videoParam.setStorageStreamCodeRate(buf.readUnsignedInt()); + videoParam.setOsd(OSDConfig.decode(buf)); + videoParam.setAudioEnable(buf.readByte()); + 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 eaab30d8b..ed5e2bec6 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 @@ -5,10 +5,7 @@ import com.genersoft.iot.vmp.jt1078.annotation.MsgId; import com.genersoft.iot.vmp.jt1078.bean.JTDevice; import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConfig; import com.genersoft.iot.vmp.jt1078.bean.common.ConfigAttribute; -import com.genersoft.iot.vmp.jt1078.bean.config.CameraTimer; -import com.genersoft.iot.vmp.jt1078.bean.config.CollisionAlarmParams; -import com.genersoft.iot.vmp.jt1078.bean.config.GnssPositioningMode; -import com.genersoft.iot.vmp.jt1078.bean.config.IllegalDrivingPeriods; +import com.genersoft.iot.vmp.jt1078.bean.config.*; import com.genersoft.iot.vmp.jt1078.proc.Header; import com.genersoft.iot.vmp.jt1078.proc.response.J8001; import com.genersoft.iot.vmp.jt1078.proc.response.Rs; @@ -129,6 +126,11 @@ public class J0104 extends Re { Method methodForGnssPositioningMode = deviceConfig.getClass().getDeclaredMethod("set" + StringUtils.capitalize(field.getName()), GnssPositioningMode.class); methodForGnssPositioningMode.invoke(deviceConfig, gnssPositioningMode); continue; + case "VideoParam": + VideoParam videoParam = VideoParam.decode(buf); + Method methodForVideoParam = deviceConfig.getClass().getDeclaredMethod("set" + StringUtils.capitalize(field.getName()), VideoParam.class); + methodForVideoParam.invoke(deviceConfig, videoParam); + 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 33e72e50b..6741da118 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 @@ -88,10 +88,11 @@ public class J8103 extends Rs { case "CollisionAlarmParams": case "CameraTimer": case "GnssPositioningMode": + case "VideoParam": field.setAccessible(true); JTDeviceSubConfig subConfig = (JTDeviceSubConfig)field.get(config); - byte[] bytesForIllegalDrivingPeriods = subConfig.encode(); - buffer.writeByte(bytesForIllegalDrivingPeriods.length); + ByteBuf bytesForIllegalDrivingPeriods = subConfig.encode(); + buffer.writeByte(bytesForIllegalDrivingPeriods.readableBytes()); buffer.writeBytes(bytesForIllegalDrivingPeriods); continue; }