From ebdd9ab53480a37157076508e8d5bb8b8676d111 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Sun, 7 Apr 2024 07:09:49 +0800 Subject: [PATCH] =?UTF-8?q?1078-=E6=B7=BB=E5=8A=A0=E4=BA=91=E5=8F=B0?= =?UTF-8?q?=E7=84=A6=E8=B7=9D=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/jt1078/cmd/JT1078Template.java | 19 +++++++ .../iot/vmp/jt1078/proc/response/J9302.java | 50 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J9302.java diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/cmd/JT1078Template.java b/src/main/java/com/genersoft/iot/vmp/jt1078/cmd/JT1078Template.java index 2dd000a82..c21aa5076 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/cmd/JT1078Template.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/cmd/JT1078Template.java @@ -25,6 +25,8 @@ public class JT1078Template { private static final String H9206 = "9206"; private static final String H9207 = "9207"; private static final String H9301 = "9301"; + private static final String H9302 = "9302"; + private static final String H9303 = "9303"; private static final String H0001 = "0001"; private static final String H1205 = "1205"; @@ -165,6 +167,23 @@ public class JT1078Template { return SessionManager.INSTANCE.request(cmd, timeOut); } + /** + * 云台控制指令-云台调整焦距控制 + * + * @param devId 设备号 + * @param j9302 云台焦距控制参数 + */ + public String ptzZoom(String devId, J9302 j9302, Integer timeOut) { + Cmd cmd = new Cmd.Builder() + .setDevId(devId) + .setPackageNo(randomInt()) + .setMsgId(H9302) + .setRespId(H0001) + .setRs(j9302) + .build(); + return SessionManager.INSTANCE.request(cmd, timeOut); + } + private Long randomInt() { return (long) random.nextInt(1000) + 1; } diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J9302.java b/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J9302.java new file mode 100644 index 000000000..d2630ebb3 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J9302.java @@ -0,0 +1,50 @@ +package com.genersoft.iot.vmp.jt1078.proc.response; + +import com.genersoft.iot.vmp.jt1078.annotation.MsgId; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + +/** + * 云台控制指令-焦距控制 + * + */ +@MsgId(id = "9302") +public class J9302 extends Rs { + // 逻辑通道号 + private int channel; + + // 方向: 0:焦距调大; 1:焦距调小 + private int zoomDirection; + + @Override + public ByteBuf encode() { + ByteBuf buffer = Unpooled.buffer(); + buffer.writeByte(channel); + buffer.writeByte(zoomDirection); + return buffer; + } + + public int getChannel() { + return channel; + } + + public void setChannel(int channel) { + this.channel = channel; + } + + public int getZoomDirection() { + return zoomDirection; + } + + public void setZoomDirection(int zoomDirection) { + this.zoomDirection = zoomDirection; + } + + @Override + public String toString() { + return "J9302{" + + "channel=" + channel + + ", zoomDirection=" + zoomDirection + + '}'; + } +}