mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-25 14:37:53 +08:00
1078-设置终端参数...
This commit is contained in:
parent
62122f95f0
commit
225940825b
@ -5,8 +5,11 @@ import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConfig;
|
|||||||
import com.genersoft.iot.vmp.jt1078.bean.common.ConfigAttribute;
|
import com.genersoft.iot.vmp.jt1078.bean.common.ConfigAttribute;
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.config.*;
|
import com.genersoft.iot.vmp.jt1078.bean.config.*;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.ByteBufUtil;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
@ -22,6 +25,8 @@ import java.util.Map;
|
|||||||
@MsgId(id = "8103")
|
@MsgId(id = "8103")
|
||||||
public class J8103 extends Rs {
|
public class J8103 extends Rs {
|
||||||
|
|
||||||
|
private final static Logger log = LoggerFactory.getLogger(J8103.class);
|
||||||
|
|
||||||
private JTDeviceConfig config;
|
private JTDeviceConfig config;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -32,7 +37,7 @@ public class J8103 extends Rs {
|
|||||||
Map<Field, ConfigAttribute> fieldConfigAttributeMap = new HashMap<>();
|
Map<Field, ConfigAttribute> fieldConfigAttributeMap = new HashMap<>();
|
||||||
for (Field field : declaredFields) {
|
for (Field field : declaredFields) {
|
||||||
try{
|
try{
|
||||||
Method method = configClass.getDeclaredMethod("get" + StringUtils.capitalize(field.getName()), String.class);
|
Method method = configClass.getDeclaredMethod("get" + StringUtils.capitalize(field.getName()));
|
||||||
Object invoke = method.invoke(config);
|
Object invoke = method.invoke(config);
|
||||||
if (invoke == null) {
|
if (invoke == null) {
|
||||||
continue;
|
continue;
|
||||||
@ -42,7 +47,7 @@ public class J8103 extends Rs {
|
|||||||
fieldConfigAttributeMap.put(field, configAttribute);
|
fieldConfigAttributeMap.put(field, configAttribute);
|
||||||
}
|
}
|
||||||
}catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException e) {
|
}catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException e) {
|
||||||
throw new RuntimeException(e);
|
log.error("[设置终端参数 ] 编码失败", e );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -57,8 +62,8 @@ public class J8103 extends Rs {
|
|||||||
case "Long":
|
case "Long":
|
||||||
buffer.writeByte(4);
|
buffer.writeByte(4);
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
Long longval = (Long)field.get(config);
|
Long longVal = (Long)field.get(config);
|
||||||
buffer.writeLong(longval);
|
buffer.writeLong(longVal);
|
||||||
continue;
|
continue;
|
||||||
case "String":
|
case "String":
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
@ -90,11 +95,12 @@ public class J8103 extends Rs {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
log.error("[设置终端参数 ] 编码失败", e );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
System.out.println(ByteBufUtil.hexDump(buffer));
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user