1078-解析104中
This commit is contained in:
@@ -2,6 +2,8 @@ package com.genersoft.iot.vmp.jt1078.proc.request;
|
||||
|
||||
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.proc.Header;
|
||||
import com.genersoft.iot.vmp.jt1078.proc.response.J8001;
|
||||
import com.genersoft.iot.vmp.jt1078.proc.response.Rs;
|
||||
@@ -10,7 +12,10 @@ import com.genersoft.iot.vmp.jt1078.session.Session;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 查询终端参数应答
|
||||
@@ -26,6 +31,20 @@ public class J0104 extends Re {
|
||||
protected Rs decode0(ByteBuf buf, Header header, Session session) {
|
||||
respNo = buf.readUnsignedShort();
|
||||
paramLength = (int)buf.readUnsignedByte();
|
||||
if (paramLength <= 0) {
|
||||
return null;
|
||||
}
|
||||
JTDeviceConfig deviceConfig = new JTDeviceConfig();
|
||||
Field[] fields = deviceConfig.getClass().getFields();
|
||||
Map<Byte, Field> allFieldMap = new HashMap<>();
|
||||
for (Field field : fields) {
|
||||
field.setAccessible(true);
|
||||
ConfigAttribute configAttribute = field.getAnnotation(ConfigAttribute.class);
|
||||
if (configAttribute != null) {
|
||||
allFieldMap.put(configAttribute.id(), field);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println(respNo);
|
||||
System.out.println(paramLength);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user