1078-添加查询终端参数
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user