From fce96def9fae1a5799fc82b7e6dd6c8bd6d9e8b5 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 15 Apr 2024 00:40:36 +0800 Subject: [PATCH] =?UTF-8?q?1078-=E6=B7=BB=E5=8A=A0=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=BB=88=E7=AB=AF=E5=8F=82=E6=95=B0?= 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/J8104.java | 21 +++++++++++ .../service/impl/jt1078ServiceImpl.java | 36 ++++++++++--------- 3 files changed, 58 insertions(+), 18 deletions(-) create mode 100644 src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J8104.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 43f6edfad..72c49b4a4 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 @@ -263,7 +263,24 @@ public class JT1078Template { * * @param devId 设备号 */ - public String getDeviceConfig(String devId, J8106 j8106, Integer timeOut) { + public String getDeviceConfig(String devId, J8104 j8104, Integer timeOut) { + + Cmd cmd = new Cmd.Builder() + .setDevId(devId) + .setPackageNo(randomInt()) + .setMsgId(H8104) + .setRespId(H0104) + .setRs(j8104) + .build(); + return SessionManager.INSTANCE.request(cmd, timeOut); + } + + /** + * 查询指定终端参数 + * + * @param devId 设备号 + */ + public String getDeviceSpecifyConfig(String devId, J8106 j8106, Integer timeOut) { Cmd cmd = new Cmd.Builder() .setDevId(devId) diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J8104.java b/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J8104.java new file mode 100644 index 000000000..be860ebfc --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J8104.java @@ -0,0 +1,21 @@ +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; + +import java.util.Arrays; + +/** + * 查询终端参数 + */ +@MsgId(id = "8104") +public class J8104 extends Rs { + + @Override + public ByteBuf encode() { + ByteBuf buffer = Unpooled.buffer(); + return buffer; + } + +} diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/jt1078ServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/jt1078ServiceImpl.java index b98a60205..bca93e480 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/jt1078ServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/jt1078ServiceImpl.java @@ -501,25 +501,27 @@ public class jt1078ServiceImpl implements Ijt1078Service { return; } if (params == null || params.length == 0) { - return; - } - byte[] paramBytes = new byte[params.length]; - for (int i = 0; i < params.length; i++) { - try { - Field field = JTDeviceConfig.class.getDeclaredField(params[i]); - if (field.isAnnotationPresent(ConfigAttribute.class) ) { - ConfigAttribute configAttribute = field.getAnnotation(ConfigAttribute.class); - byte id = configAttribute.id(); - String description = configAttribute.description(); - System.out.println(description + ": " + id); - paramBytes[i] = configAttribute.id(); + J8104 j8104 = new J8104(); + jt1078Template.getDeviceConfig(deviceId, j8104, 6); + }else { + byte[] paramBytes = new byte[params.length]; + for (int i = 0; i < params.length; i++) { + try { + Field field = JTDeviceConfig.class.getDeclaredField(params[i]); + if (field.isAnnotationPresent(ConfigAttribute.class) ) { + ConfigAttribute configAttribute = field.getAnnotation(ConfigAttribute.class); + byte id = configAttribute.id(); + String description = configAttribute.description(); + System.out.println(description + ": " + id); + paramBytes[i] = configAttribute.id(); + } + } catch (NoSuchFieldException e) { + throw new RuntimeException(e); } - } catch (NoSuchFieldException e) { - throw new RuntimeException(e); } + J8106 j8106 = new J8106(); + j8106.setParams(paramBytes); + jt1078Template.getDeviceSpecifyConfig(deviceId, j8106, 6); } - J8106 j8106 = new J8106(); - j8106.setParams(paramBytes); - jt1078Template.getDeviceConfig(deviceId, j8106, 6); } }