Commit e35de3be authored by 高东东's avatar 高东东

修改类型

parent b04958e5
...@@ -103,7 +103,7 @@ public class ApduQueue { ...@@ -103,7 +103,7 @@ public class ApduQueue {
data.setCreatedTime(new Date()); data.setCreatedTime(new Date());
data.setDataType(2); data.setDataType(2);
data.setInformationAddress(informationObjectAddress); data.setInformationAddress(informationObjectAddress);
IeShort shortFloat = (IeShort) informationElement[0][0]; IeFloat shortFloat = (IeFloat) informationElement[0][0];
IeQuality ieQuality = (IeQuality) informationElement[0][1]; IeQuality ieQuality = (IeQuality) informationElement[0][1];
data.setValue(String.format("%.2f",shortFloat.getValue())); data.setValue(String.format("%.2f",shortFloat.getValue()));
data.setQuality(ieQuality.toJson().toString()); data.setQuality(ieQuality.toJson().toString());
......
...@@ -4,15 +4,15 @@ import io.netty.buffer.ByteBuf; ...@@ -4,15 +4,15 @@ import io.netty.buffer.ByteBuf;
import java.io.IOException; import java.io.IOException;
public class IeShort extends InformationElement { public class IeFloat extends InformationElement {
private final float value; private final float value;
public IeShort(float value) { public IeFloat(float value) {
this.value = value; this.value = value;
} }
public IeShort(ByteBuf is) throws IOException { public IeFloat(ByteBuf is) throws IOException {
value = Float.intBitsToFloat((is.readByte() & 0xff) | ((is.readByte() & 0xff) << 8)); value = Float.intBitsToFloat((is.readByte() & 0xff) | ((is.readByte() & 0xff) << 8));
} }
......
...@@ -44,7 +44,7 @@ public class InformationObject { ...@@ -44,7 +44,7 @@ public class InformationObject {
case 9: case 9:
informationElements = new InformationElement[numberOfSequenceElements][2]; informationElements = new InformationElement[numberOfSequenceElements][2];
for (int i = 0; i < numberOfSequenceElements; i++) { for (int i = 0; i < numberOfSequenceElements; i++) {
informationElements[i][0] = new IeShort(is); informationElements[i][0] = new IeFloat(is);
informationElements[i][1] = new IeQuality(is); informationElements[i][1] = new IeQuality(is);
log.debug("9 浮点型遥测1: " + i + "--->" + informationElements[i][0].toString()); log.debug("9 浮点型遥测1: " + i + "--->" + informationElements[i][0].toString());
log.debug("9 浮点型遥测2: " + i + "--->" + informationElements[i][1].toString()); log.debug("9 浮点型遥测2: " + i + "--->" + informationElements[i][1].toString());
...@@ -64,7 +64,7 @@ public class InformationObject { ...@@ -64,7 +64,7 @@ public class InformationObject {
case 21: case 21:
informationElements = new InformationElement[numberOfSequenceElements][1]; informationElements = new InformationElement[numberOfSequenceElements][1];
for (int i = 0; i < numberOfSequenceElements; i++) { for (int i = 0; i < numberOfSequenceElements; i++) {
informationElements[i][0] = new IeShort(is); informationElements[i][0] = new IeFloat(is);
log.debug("21 浮点型遥测, 不带品质描述词的规一化值: " + i + "--->" + informationElements[i][0].toString()); log.debug("21 浮点型遥测, 不带品质描述词的规一化值: " + i + "--->" + informationElements[i][0].toString());
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment