Commit c508da20 by 谢海旭

单元测试补充

1 parent 239544d0
...@@ -41,7 +41,6 @@ public class UploadRealTimeRspHandler implements TcpHandler<UploadRealtimeDataRs ...@@ -41,7 +41,6 @@ public class UploadRealTimeRspHandler implements TcpHandler<UploadRealtimeDataRs
upData.setStatus(data.getStatus()); upData.setStatus(data.getStatus());
upData.setIfReturn(data.getIfReturn()); upData.setIfReturn(data.getIfReturn());
upData.setIfCharging(data.getIfCharging()); upData.setIfCharging(data.getIfCharging());
// TODO 检查是否需要反转
upData.setOutputVoltage(Ocpp16Helper.bytesBinToBigDecimal(data.getOutputVoltage(), 1)); upData.setOutputVoltage(Ocpp16Helper.bytesBinToBigDecimal(data.getOutputVoltage(), 1));
upData.setOutputCurrent(Ocpp16Helper.bytesBinToBigDecimal(data.getOutputCurrent(), 1)); upData.setOutputCurrent(Ocpp16Helper.bytesBinToBigDecimal(data.getOutputCurrent(), 1));
upData.setGunWireTemperature(data.getGunWireTemperature()); upData.setGunWireTemperature(data.getGunWireTemperature());
......
...@@ -5,6 +5,7 @@ import cn.com.glsx.charging.modules.gbt.ocpp16.Ocpp16Helper; ...@@ -5,6 +5,7 @@ import cn.com.glsx.charging.modules.gbt.ocpp16.Ocpp16Helper;
import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.client.TcpClient; import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.client.TcpClient;
import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.data.RealTimeRspData; import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.data.RealTimeRspData;
import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.protocol.UploadRealtimeDataRsp; import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.protocol.UploadRealtimeDataRsp;
import cn.com.glsx.charging.util.ByteUtils;
/** /**
...@@ -15,7 +16,6 @@ import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.protocol.UploadRealtimeDataRs ...@@ -15,7 +16,6 @@ import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.protocol.UploadRealtimeDataRs
public class UploadRealTimeDataTest { public class UploadRealTimeDataTest {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
Ocpp16Helper.scan(); Ocpp16Helper.scan();
String host = "localhost"; String host = "localhost";
int port = 8888; int port = 8888;
...@@ -23,31 +23,29 @@ public class UploadRealTimeDataTest { ...@@ -23,31 +23,29 @@ public class UploadRealTimeDataTest {
TcpClient client = ClientMain.getInstance(host, port); TcpClient client = ClientMain.getInstance(host, port);
Thread.sleep(3000); Thread.sleep(3000);
UploadRealtimeDataRsp req = new UploadRealtimeDataRsp();
RealTimeRspData data = new RealTimeRspData(); RealTimeRspData data = new RealTimeRspData();
data.setTransactionSerialNumber(Ocpp16Helper.strToBcd("00000000000000000000000000000000", data.getTransactionSerialNumber())); data.setTransactionSerialNumber(Ocpp16Helper.strToBcd("00000000000000000000000000000000", data.getTransactionSerialNumber()));
data.setPileId(Ocpp16Helper.strToBcd("55031412782305", data.getPileId())); data.setPileId(Ocpp16Helper.strToBcd("55031412782305", data.getPileId()));
data.setGunNumber((byte)1); data.setGunNumber(Ocpp16Helper.strToBcd("1"));
data.setStatus((byte)0); data.setStatus((byte)0x00);
data.setIfReturn((byte)1); data.setIfReturn((byte)0x01);
data.setIfCharging((byte)1); data.setIfCharging((byte)0x01);
byte[] outputVoltage = new byte[]{(byte) 0x02, 0x00}; data.setOutputVoltage(ByteUtils.fromHex("1362"));//4962 496.2
data.setOutputVoltage(outputVoltage); data.setOutputCurrent(ByteUtils.fromHex("0030"));//48 4.8
byte[] outputCurrent = new byte[]{(byte) 0x00, 0x00}; data.setGunWireTemperature((byte)0x57);//87 偏移量-50
data.setOutputCurrent(outputCurrent); data.setGunWireNumber(ByteUtils.fromHex("0000000000000000"));
data.setGunWireTemperature((byte)0); data.setSoc((byte)0x00);
byte[] gunWireNumber = new byte[]{(byte) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; data.setBatteryHighestTemperature((byte)0x57);//87 偏移量-50
data.setGunWireNumber(gunWireNumber); data.setAccumulatedChargingTime(ByteUtils.fromHex("0002"));
data.setSoc((byte)0); data.setTimeLeft(ByteUtils.fromHex("003C")); // 60 min
data.setBatteryHighestTemperature((byte)0); data.setChargingDegree(ByteUtils.fromHex("00000258"));// 0.06kwh 精确到小数点后四位
data.setAccumulatedChargingTime(outputCurrent); data.setLossChargingDegree(ByteUtils.fromHex("00000064")); // 0.01kwh 100 精确到小数点后四位
data.setTimeLeft(outputCurrent); data.setChargingMoney(ByteUtils.fromHex("00000640")); // 0.16元 精确到小数点后四位
byte[] chargingDegree = new byte[]{(byte) 0x00, 0x00, 0x00, 0x00}; data.setHardwareMalfunction(ByteUtils.fromHex("0000"));
data.setChargingDegree(chargingDegree);
data.setLossChargingDegree(chargingDegree); UploadRealtimeDataRsp req = new UploadRealtimeDataRsp();
data.setChargingMoney(chargingDegree);
data.setHardwareMalfunction(outputCurrent);
req.setData(data); req.setData(data);
client.sendSync(req); client.sendSync(req);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!