From e164d52e7bbc7e79c210e51a989eec3ff5d2a042 Mon Sep 17 00:00:00 2001 From: yang <2248787524@qq.com> Date: Fri, 15 Mar 2024 17:58:16 +0800 Subject: [PATCH] =?UTF-8?q?ydh=E5=85=85=E7=94=B5=E6=9C=BA=E5=8F=91?= =?UTF-8?q?=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BatCharging.Model/客户端发送/CMD207.cs | 8 +- BatCharging.Service/ChargerMgrTool.cs | 70 ++++----- BatCharging.Service/ChargerSendMsg.cs | 138 ++++++++++++++---- .../发送方法/ChargerSendCMD.cs | 131 +++++------------ Monitor.ChargeTest/FrmChargeResult.cs | 10 +- 5 files changed, 192 insertions(+), 165 deletions(-) diff --git a/BatCharging.Model/客户端发送/CMD207.cs b/BatCharging.Model/客户端发送/CMD207.cs index 6c955f7..e63ba02 100644 --- a/BatCharging.Model/客户端发送/CMD207.cs +++ b/BatCharging.Model/客户端发送/CMD207.cs @@ -19,7 +19,7 @@ namespace BatCharging.Model /// /// 充电桩编码(ASCII 编码) /// - public UInt32 value03 { get; set; } + public string value03 { get; set; } /// /// 充电枪号 /// @@ -27,15 +27,15 @@ namespace BatCharging.Model /// /// 车辆 VIN 码(ASCII 编码) /// - public byte value05 { get; set; } + public string value05 { get; set; } /// /// 车辆 VIN 绑定账号(ASCII 编码,可以是卡号/账号等,如无则填 0xff. 离线充电则由桩填写空) /// - public UInt32 value06 { get; set; } + public string value06 { get; set; } /// /// 充电流水号(ASCII 编码,验证通过平台应下发本次充电的流水号,离线的话由桩本地生成流水号。) /// - public UInt32 value07 { get; set; } + public string value07 { get; set; } /// /// 验证结果 /// 1:成功可启动充电。 diff --git a/BatCharging.Service/ChargerMgrTool.cs b/BatCharging.Service/ChargerMgrTool.cs index 3521dbb..a018ac5 100644 --- a/BatCharging.Service/ChargerMgrTool.cs +++ b/BatCharging.Service/ChargerMgrTool.cs @@ -1213,7 +1213,7 @@ namespace BatCharging.Service if (CMD202 != null) { //(CMD=9)后台服务器应答桩上传命令请求(预留) - CmnChargerParam._CHR00TCPCLIENT.Send201(); + //CmnChargerParam._CHR00TCPCLIENT.Send201(); } } @@ -1228,7 +1228,7 @@ namespace BatCharging.Service if (CMD204 != null) { //(CMD=9)后台服务器应答桩上传命令请求(预留) - CmnChargerParam._CHR00TCPCLIENT.Send203(); + //CmnChargerParam._CHR00TCPCLIENT.Send203(); } } @@ -1243,7 +1243,7 @@ namespace BatCharging.Service if (CMD206 != null) { //(CMD=9)后台服务器应答桩上传命令请求(预留) - CmnChargerParam._CHR00TCPCLIENT.Send205(); + //CmnChargerParam._CHR00TCPCLIENT.Send205(); } } @@ -1258,7 +1258,8 @@ namespace BatCharging.Service if (CMD208 != null) { //(CMD=9)后台服务器应答桩上传命令请求(预留) - CmnChargerParam._CHR00TCPCLIENT.Send207(); + + CmnChargerParam._CHR00TCPCLIENT.Send207(CMD208,"","",0,0,0,0); } } @@ -1273,7 +1274,8 @@ namespace BatCharging.Service if (CMD210 != null) { //(CMD=9)后台服务器应答桩上传命令请求(预留) - CmnChargerParam._CHR00TCPCLIENT.Send209(); + string value05 = ""; + CmnChargerParam._CHR00TCPCLIENT.Send209(CMD210,value05); } } @@ -1324,7 +1326,9 @@ namespace BatCharging.Service if (CMD402 != null) { //(CMD=9)后台服务器应答桩上传命令请求(预留) - CmnChargerParam._CHR00TCPCLIENT.Send401(); + uint startIndex = 0; + string chargingSerialNum = ""; + CmnChargerParam._CHR00TCPCLIENT.Send401(chargingSerialNum, startIndex); } } @@ -1342,7 +1346,7 @@ namespace BatCharging.Service if (CMD1002 != null) { //(CMD=9)后台服务器应答桩上传命令请求(预留) - CmnChargerParam._CHR00TCPCLIENT.Send1001(); + //CmnChargerParam._CHR00TCPCLIENT.Send1001(); } } @@ -1357,7 +1361,7 @@ namespace BatCharging.Service if (CMD1004 != null) { //(CMD=9)后台服务器应答桩上传命令请求(预留) - CmnChargerParam._CHR00TCPCLIENT.Send1003(); + //CmnChargerParam._CHR00TCPCLIENT.Send1003(); } } @@ -1372,7 +1376,7 @@ namespace BatCharging.Service if (CMD1006 != null) { //(CMD=9)后台服务器应答桩上传命令请求(预留) - CmnChargerParam._CHR00TCPCLIENT.Send1005(); + //CmnChargerParam._CHR00TCPCLIENT.Send1005(); } } @@ -1387,7 +1391,7 @@ namespace BatCharging.Service if (CMD1008 != null) { //(CMD=9)后台服务器应答桩上传命令请求(预留) - CmnChargerParam._CHR00TCPCLIENT.Send1007(); + //CmnChargerParam._CHR00TCPCLIENT.Send1007(); } } @@ -1432,7 +1436,7 @@ namespace BatCharging.Service if (CMD1022 != null) { //(CMD=9)后台服务器应答桩上传命令请求(预留) - CmnChargerParam._CHR00TCPCLIENT.Send1021(); + //CmnChargerParam._CHR00TCPCLIENT.Send1021(); } } @@ -3398,57 +3402,57 @@ namespace BatCharging.Service #region 充电信息数据 - public void Send201() + public void Send201(CMD202 CMD202, byte value06, uint value07, uint value08, uint value09, uint value10, uint value11, uint value12) { if (_chr_client != null) { if (_chr_client.Connected) { - new ChargerSendMsgUtils().Send201(_chr_client); + new ChargerSendMsgUtils().Send201(_chr_client, CMD202, value06, value07, value08, value09, value10, value11, value12); } } } - public void Send203() + public void Send203(CMD204 CMD204, uint value03, uint value04, ushort value05, ushort value06, byte value07, byte value08, byte value09, byte value10, string value11, string value12) { if (_chr_client != null) { if (_chr_client.Connected) { - new ChargerSendMsgUtils().Send203(_chr_client); + new ChargerSendMsgUtils().Send203(_chr_client, CMD204, value03, value04, value05, value06, value07, value08, value09, value10, value11, value12); } } } - public void Send205() + public void Send205(uint value03, uint value04) { if (_chr_client != null) { if (_chr_client.Connected) { - new ChargerSendMsgUtils().Send205(_chr_client); + new ChargerSendMsgUtils().Send205(_chr_client, value03, value04); } } } - public void Send207() + public void Send207(CMD208 CMD208, string value06, string value07, byte value08, byte value09, uint value10, ulong value11) { if (_chr_client != null) { if (_chr_client.Connected) { - new ChargerSendMsgUtils().Send207(_chr_client); + new ChargerSendMsgUtils().Send207(_chr_client, CMD208, value06, value07, value08, value09, value10, value11); } } } - public void Send209() + public void Send209(CMD210 CMD210, string value05) { if (_chr_client != null) { if (_chr_client.Connected) { - new ChargerSendMsgUtils().Send209(_chr_client); + new ChargerSendMsgUtils().Send209(_chr_client, CMD210, value05); } } } @@ -3482,13 +3486,13 @@ namespace BatCharging.Service #region 历史记录 - public void Send401() + public void Send401(string chargingSerialNum, uint startIndex) { if (_chr_client != null) { if (_chr_client.Connected) { - new ChargerSendMsgUtils().Send401(_chr_client); + new ChargerSendMsgUtils().Send401(_chr_client, chargingSerialNum, startIndex); } } } @@ -3497,46 +3501,46 @@ namespace BatCharging.Service #region 升级命令 - public void Send1001() + public void Send1001(int instruct) { if (_chr_client != null) { if (_chr_client.Connected) { - new ChargerSendMsgUtils().Send1001(_chr_client); + new ChargerSendMsgUtils().Send1001(_chr_client, instruct); } } } - public void Send1003() + public void Send1003(string fileName) { if (_chr_client != null) { if (_chr_client.Connected) { - new ChargerSendMsgUtils().Send1003(_chr_client); + new ChargerSendMsgUtils().Send1003(_chr_client, fileName); } } } - public void Send1005() + public void Send1005(uint fileLength) { if (_chr_client != null) { if (_chr_client.Connected) { - new ChargerSendMsgUtils().Send1005(_chr_client); + new ChargerSendMsgUtils().Send1005(_chr_client, fileLength); } } } - public void Send1007() + public void Send1007(string updata) { if (_chr_client != null) { if (_chr_client.Connected) { - new ChargerSendMsgUtils().Send1007(_chr_client); + new ChargerSendMsgUtils().Send1007(_chr_client, updata); } } } @@ -3563,13 +3567,13 @@ namespace BatCharging.Service } } - public void Send1021() + public void Send1021(uint results, string description) { if (_chr_client != null) { if (_chr_client.Connected) { - new ChargerSendMsgUtils().Send1021(_chr_client); + new ChargerSendMsgUtils().Send1021(_chr_client, results, description); } } } diff --git a/BatCharging.Service/ChargerSendMsg.cs b/BatCharging.Service/ChargerSendMsg.cs index f04cb6b..ef1870a 100644 --- a/BatCharging.Service/ChargerSendMsg.cs +++ b/BatCharging.Service/ChargerSendMsg.cs @@ -609,9 +609,23 @@ namespace BatCharging.Service /// /// /// - internal void Send201(TcpClientChargerTool tcp_client) + internal void Send201(TcpClientChargerTool tcp_client, CMD202 CMD202, byte value06, uint value07, uint value08, uint value09, uint value10, uint value11, uint value12) { - byte[] bytes = new ChargerSendCMD().SendRCMD201(out APDUModel APDUModel); + CMD201 CMD = new CMD201(); + CMD.value01 = 0; + CMD.value02 = 0; + CMD.value03 = CMD202.value05; + CMD.value04 = CMD202.value06; + CMD.value05 = CMD202.value17; + CMD.value06 = value06; + CMD.value07 = value07; + CMD.value08 = value08; + CMD.value09 = value09; + CMD.value10 = value10; + CMD.value11 = value11; + CMD.value12 = value12; + + byte[] bytes = new ChargerSendCMD().SendRCMD201(out APDUModel APDUModel, CMD); string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";"; Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); @@ -625,9 +639,24 @@ namespace BatCharging.Service /// /// /// - internal void Send203(TcpClientChargerTool tcp_client) + internal void Send203(TcpClientChargerTool tcp_client, CMD204 CMD204, uint value03, uint value04, ushort value05, ushort value06, byte value07, byte value08, byte value09, byte value10, string value11, string value12) { - byte[] bytes = new ChargerSendCMD().SendRCMD203(out APDUModel APDUModel); + CMD203 CMD = new CMD203(); + CMD.value01 = 0; + CMD.value02 = 0; + CMD.value03 = value03; + CMD.value04 = value04; + CMD.value05 = value05; + CMD.value06 = value06; + CMD.value07 = value07; + CMD.value08 = value08; + CMD.value09 = value09; + CMD.value10 = value10; + CMD.value11 = value11; + CMD.value12 = value12; + CMD.value13 = CMD204.value11; + + byte[] bytes = new ChargerSendCMD().SendRCMD203(out APDUModel APDUModel, CMD); string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";"; Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); @@ -641,9 +670,22 @@ namespace BatCharging.Service /// /// /// - internal void Send205(TcpClientChargerTool tcp_client) + internal void Send205(TcpClientChargerTool tcp_client, uint value03, uint value04) { - byte[] bytes = new ChargerSendCMD().SendRCMD205(out APDUModel APDUModel); + CMD205 CMD = new CMD205(); + CMD.value01 = 0; + CMD.value02 = 0; + CMD.value03 = value03; + if (CMD.value03 == 0) + { + CMD.value04 = value04; + } + else + { + CMD.value04 = 0; + } + + byte[] bytes = new ChargerSendCMD().SendRCMD205(out APDUModel APDUModel, CMD); string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";"; Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); @@ -657,9 +699,21 @@ namespace BatCharging.Service /// /// /// - internal void Send207(TcpClientChargerTool tcp_client) + internal void Send207(TcpClientChargerTool tcp_client, CMD208 CMD208, string value06, string value07, byte value08, byte value09, uint value10, ulong value11) { - byte[] bytes = new ChargerSendCMD().SendRCMD207(out APDUModel APDUModel); + CMD207 CMD = new CMD207(); + CMD.value01 = 0; + CMD.value02 = 0; + CMD.value03 = CMD208.value03; + CMD.value04 = CMD208.value04; + CMD.value05 = CMD208.value05; + CMD.value06 = value06; + CMD.value07 = value07; + CMD.value08 = value08; + CMD.value09 = value09; + CMD.value10 = value10; + CMD.value11 = value11; + byte[] bytes = new ChargerSendCMD().SendRCMD207(out APDUModel APDUModel, CMD); string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";"; Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); @@ -673,9 +727,15 @@ namespace BatCharging.Service /// /// /// - internal void Send209(TcpClientChargerTool tcp_client) + internal void Send209(TcpClientChargerTool tcp_client, CMD210 CMD210, string value05) { - byte[] bytes = new ChargerSendCMD().SendRCMD209(out APDUModel APDUModel); + CMD209 CMD = new CMD209(); + CMD.value01 = CMD210.value01; + CMD.value02 = CMD210.value02; + CMD.value03 = CMD210.value03; + CMD.value04 = CMD210.value04; + CMD.value05 = value05; + byte[] bytes = new ChargerSendCMD().SendRCMD209(out APDUModel APDUModel, CMD); string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";"; Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); @@ -694,7 +754,10 @@ namespace BatCharging.Service /// internal void Send301(TcpClientChargerTool tcp_client) { - byte[] bytes = new ChargerSendCMD().SendRCMD301(out APDUModel APDUModel); + CMD301 CMD = new CMD301(); + CMD.reserved1 = 0; + CMD.reserved2 = 0; + byte[] bytes = new ChargerSendCMD().SendRCMD301(out APDUModel APDUModel, CMD); string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";"; Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); @@ -709,7 +772,10 @@ namespace BatCharging.Service /// internal void Send303(TcpClientChargerTool tcp_client) { - byte[] bytes = new ChargerSendCMD().SendRCMD303(out APDUModel APDUModel); + CMD303 CMD = new CMD303(); + CMD.reserved1 = 0; + CMD.reserved2 = 0; + byte[] bytes = new ChargerSendCMD().SendRCMD303(out APDUModel APDUModel, CMD); string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";"; Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); @@ -724,9 +790,14 @@ namespace BatCharging.Service /// /// /// - internal void Send401(TcpClientChargerTool tcp_client) + internal void Send401(TcpClientChargerTool tcp_client, string chargingSerialNum, uint startIndex) { - byte[] bytes = new ChargerSendCMD().SendRCMD401(out APDUModel APDUModel); + CMD401 CMD = new CMD401(); + CMD.reserved1 = 0; + CMD.reserved2 = 0; + CMD.startingIndexOfQueryRecord = startIndex; + CMD.chargingSerialNumber = chargingSerialNum; + byte[] bytes = new ChargerSendCMD().SendRCMD401(out APDUModel APDUModel, CMD); string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";"; Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); @@ -741,9 +812,11 @@ namespace BatCharging.Service /// /// /// - internal void Send1001(TcpClientChargerTool tcp_client) + internal void Send1001(TcpClientChargerTool tcp_client, int instruct) { - byte[] bytes = new ChargerSendCMD().SendRCMD1001(out APDUModel APDUModel); + CMD1001 CMD = new CMD1001(); + CMD.eraseOrQueryInstructions = instruct; + byte[] bytes = new ChargerSendCMD().SendRCMD1001(out APDUModel APDUModel, CMD); string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";"; Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); @@ -755,9 +828,11 @@ namespace BatCharging.Service /// /// /// - internal void Send1003(TcpClientChargerTool tcp_client) + internal void Send1003(TcpClientChargerTool tcp_client, string fileName) { - byte[] bytes = new ChargerSendCMD().SendRCMD1003(out APDUModel APDUModel); + CMD1003 CMD = new CMD1003(); + CMD.fileName = fileName; + byte[] bytes = new ChargerSendCMD().SendRCMD1003(out APDUModel APDUModel, CMD); string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";"; Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); @@ -769,9 +844,11 @@ namespace BatCharging.Service /// /// /// - internal void Send1005(TcpClientChargerTool tcp_client) + internal void Send1005(TcpClientChargerTool tcp_client, uint fileLength) { - byte[] bytes = new ChargerSendCMD().SendRCMD1005(out APDUModel APDUModel); + CMD1005 CMD = new CMD1005(); + CMD.fileLength = fileLength; + byte[] bytes = new ChargerSendCMD().SendRCMD1005(out APDUModel APDUModel, CMD); string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";"; Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); @@ -783,9 +860,11 @@ namespace BatCharging.Service /// /// /// - internal void Send1007(TcpClientChargerTool tcp_client) + internal void Send1007(TcpClientChargerTool tcp_client, string updata) { - byte[] bytes = new ChargerSendCMD().SendRCMD1007(out APDUModel APDUModel); + CMD1007 CMD = new CMD1007(); + CMD.upgradeFileData = updata; + byte[] bytes = new ChargerSendCMD().SendRCMD1007(out APDUModel APDUModel, CMD); string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";"; Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); @@ -799,7 +878,9 @@ namespace BatCharging.Service /// internal void Send1009(TcpClientChargerTool tcp_client) { - byte[] bytes = new ChargerSendCMD().SendRCMD1009(out APDUModel APDUModel); + CMD1009 CMD = new CMD1009(); + CMD.Value01 = 0; + byte[] bytes = new ChargerSendCMD().SendRCMD1009(out APDUModel APDUModel, CMD); string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";"; Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); @@ -813,7 +894,9 @@ namespace BatCharging.Service /// internal void Send1011(TcpClientChargerTool tcp_client) { - byte[] bytes = new ChargerSendCMD().SendRCMD1011(out APDUModel APDUModel); + CMD1011 CMD = new CMD1011(); + CMD.reserved1 = 0; + byte[] bytes = new ChargerSendCMD().SendRCMD1011(out APDUModel APDUModel, CMD); string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";"; Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); @@ -825,9 +908,12 @@ namespace BatCharging.Service /// /// /// - internal void Send1021(TcpClientChargerTool tcp_client) + internal void Send1021(TcpClientChargerTool tcp_client, uint results, string description) { - byte[] bytes = new ChargerSendCMD().SendRCMD201(out APDUModel APDUModel); + CMD1021 CMD = new CMD1021(); + CMD.responseResults = results; + CMD.responseDescription = description; + byte[] bytes = new ChargerSendCMD().SendRCMD1021(out APDUModel APDUModel, CMD); string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";"; Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); diff --git a/BatCharging.Service/发送方法/ChargerSendCMD.cs b/BatCharging.Service/发送方法/ChargerSendCMD.cs index 02e0a41..3f7058a 100644 --- a/BatCharging.Service/发送方法/ChargerSendCMD.cs +++ b/BatCharging.Service/发送方法/ChargerSendCMD.cs @@ -625,7 +625,7 @@ namespace BatCharging.Service #region 充电信息数据 - public byte[] SendRCMD201(out APDUModel APDUModel) + public byte[] SendRCMD201(out APDUModel APDUModel, CMD201 CMD) { byte[] result = null; @@ -636,21 +636,6 @@ namespace BatCharging.Service model.SerialNumberDomain = 0xff; model.CMD = 1; model.checksumDomain = 0x01; - - CMD201 CMD = new CMD201(); - CMD.value01 = 0; - CMD.value02 = 0; - CMD.value03 = 0; - CMD.value04 = null; - CMD.value05 = 0; - CMD.value06 = 0; - CMD.value07 = 0; - CMD.value08 = 0; - CMD.value09 = 0; - CMD.value10 = 0; - CMD.value11 = 0; - CMD.value12 = 0; - model.dataDomain = GetRCMD201DataInfo(CMD); //数据域 model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度 @@ -693,7 +678,7 @@ namespace BatCharging.Service } - public byte[] SendRCMD203(out APDUModel APDUModel) + public byte[] SendRCMD203(out APDUModel APDUModel, CMD203 CMD) { byte[] result = null; @@ -705,20 +690,7 @@ namespace BatCharging.Service model.CMD = 1; model.checksumDomain = 0x01; - CMD203 CMD = new CMD203(); - CMD.value01 = 0; - CMD.value02 = 0; - CMD.value03 = 0; - CMD.value04 = 0; - CMD.value05 = 0; - CMD.value06 = 0; - CMD.value07 = 0; - CMD.value08 = 0; - CMD.value09 = 0; - CMD.value10 = 0; - CMD.value11 = null; - CMD.value12 = null; - CMD.value13 = 0; + model.dataDomain = GetRCMD203DataInfo(CMD); //数据域 model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度 @@ -763,7 +735,7 @@ namespace BatCharging.Service } - public byte[] SendRCMD205(out APDUModel APDUModel) + public byte[] SendRCMD205(out APDUModel APDUModel, CMD205 CMD) { byte[] result = null; @@ -775,11 +747,8 @@ namespace BatCharging.Service model.CMD = 1; model.checksumDomain = 0x01; - CMD205 CMD = new CMD205(); - CMD.value01 = 0; - CMD.value02 = 0; - CMD.value03 = 0; - CMD.value04 = 0; + + model.dataDomain = GetRCMD205DataInfo(CMD); //数据域 model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度 @@ -815,7 +784,7 @@ namespace BatCharging.Service } - public byte[] SendRCMD207(out APDUModel APDUModel) + public byte[] SendRCMD207(out APDUModel APDUModel, CMD207 CMD) { byte[] result = null; @@ -827,18 +796,8 @@ namespace BatCharging.Service model.CMD = 1; model.checksumDomain = 0x01; - CMD207 CMD = new CMD207(); - CMD.value01 = 0; - CMD.value02 = 0; - CMD.value03 = 0; - CMD.value04 = 0; - CMD.value05 = 0; - CMD.value06 = 0; - CMD.value07 = 0; - CMD.value08 = 0; - CMD.value09 = 0; - CMD.value10 = 0; - CMD.value11 = 0; + + model.dataDomain = GetRCMD207DataInfo(CMD); //数据域 model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度 @@ -865,11 +824,11 @@ namespace BatCharging.Service lstContent.AddRange(BitConverter.GetBytes(CMD.value01)); lstContent.AddRange(BitConverter.GetBytes(CMD.value02)); - lstContent.AddRange(BitConverter.GetBytes(CMD.value03)); + lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD.value03)); lstContent.AddRange(BitConverter.GetBytes(CMD.value04)); - lstContent.AddRange(BitConverter.GetBytes(CMD.value05)); - lstContent.AddRange(BitConverter.GetBytes(CMD.value06)); - lstContent.AddRange(BitConverter.GetBytes(CMD.value07)); + lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD.value05)); + lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD.value06)); + lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD.value07)); lstContent.AddRange(BitConverter.GetBytes(CMD.value08)); lstContent.AddRange(BitConverter.GetBytes(CMD.value09)); lstContent.AddRange(BitConverter.GetBytes(CMD.value10)); @@ -881,7 +840,7 @@ namespace BatCharging.Service } - public byte[] SendRCMD209(out APDUModel APDUModel) + public byte[] SendRCMD209(out APDUModel APDUModel, CMD209 CMD) { byte[] result = null; @@ -893,12 +852,6 @@ namespace BatCharging.Service model.CMD = 1; model.checksumDomain = 0x01; - CMD209 CMD = new CMD209(); - CMD.value01 = 0; - CMD.value02 = 0; - CMD.value03 = null; - CMD.value04 = 0; - CMD.value05 = null; model.dataDomain = GetRCMD209DataInfo(CMD); //数据域 model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度 @@ -938,7 +891,7 @@ namespace BatCharging.Service #region 直流充电桩 BMS 信息数据(预留) - public byte[] SendRCMD301(out APDUModel APDUModel) + public byte[] SendRCMD301(out APDUModel APDUModel, CMD301 CMD) { byte[] result = null; @@ -950,9 +903,7 @@ namespace BatCharging.Service model.CMD = 1; model.checksumDomain = 0x01; - CMD301 CMD = new CMD301(); - CMD.reserved1 = 0; - CMD.reserved2 = 0; + model.dataDomain = GetRCMD301DataInfo(CMD); //数据域 model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度 @@ -986,7 +937,7 @@ namespace BatCharging.Service } - public byte[] SendRCMD303(out APDUModel APDUModel) + public byte[] SendRCMD303(out APDUModel APDUModel, CMD303 CMD) { byte[] result = null; @@ -998,9 +949,7 @@ namespace BatCharging.Service model.CMD = 1; model.checksumDomain = 0x01; - CMD303 CMD = new CMD303(); - CMD.reserved1 = 0; - CMD.reserved2 = 0; + model.dataDomain = GetRCMD303DataInfo(CMD); //数据域 model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度 @@ -1035,7 +984,7 @@ namespace BatCharging.Service #endregion #region 历史记录 - public byte[] SendRCMD401(out APDUModel APDUModel) + public byte[] SendRCMD401(out APDUModel APDUModel, CMD401 CMD) { byte[] result = null; @@ -1047,11 +996,7 @@ namespace BatCharging.Service model.CMD = 1; model.checksumDomain = 0x01; - CMD401 CMD = new CMD401(); - CMD.reserved1 = 0; - CMD.reserved2 = 0; - CMD.startingIndexOfQueryRecord = 0; - CMD.chargingSerialNumber = null; + model.dataDomain = GetRCMD401DataInfo(CMD); //数据域 model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度 @@ -1088,7 +1033,7 @@ namespace BatCharging.Service #endregion #region 升级命令 - public byte[] SendRCMD1001(out APDUModel APDUModel) + public byte[] SendRCMD1001(out APDUModel APDUModel, CMD1001 CMD) { byte[] result = null; @@ -1100,8 +1045,7 @@ namespace BatCharging.Service model.CMD = 1; model.checksumDomain = 0x01; - CMD1001 CMD = new CMD1001(); - CMD.eraseOrQueryInstructions = 0; + model.dataDomain = GetRCMD1001DataInfo(CMD); //数据域 model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度 @@ -1133,7 +1077,7 @@ namespace BatCharging.Service return results; } - public byte[] SendRCMD1003(out APDUModel APDUModel) + public byte[] SendRCMD1003(out APDUModel APDUModel, CMD1003 CMD) { byte[] result = null; @@ -1145,8 +1089,7 @@ namespace BatCharging.Service model.CMD = 1; model.checksumDomain = 0x01; - CMD1003 CMD = new CMD1003(); - CMD.fileName = null; + model.dataDomain = GetRCMD1003DataInfo(CMD); //数据域 model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度 @@ -1178,7 +1121,7 @@ namespace BatCharging.Service return results; } - public byte[] SendRCMD1005(out APDUModel APDUModel) + public byte[] SendRCMD1005(out APDUModel APDUModel, CMD1005 CMD) { byte[] result = null; @@ -1190,8 +1133,7 @@ namespace BatCharging.Service model.CMD = 1; model.checksumDomain = 0x01; - CMD1005 CMD = new CMD1005(); - CMD.fileLength = 0; + model.dataDomain = GetRCMD1005DataInfo(CMD); //数据域 model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度 @@ -1223,7 +1165,7 @@ namespace BatCharging.Service return results; } - public byte[] SendRCMD1007(out APDUModel APDUModel) + public byte[] SendRCMD1007(out APDUModel APDUModel, CMD1007 CMD) { byte[] result = null; @@ -1235,8 +1177,7 @@ namespace BatCharging.Service model.CMD = 1; model.checksumDomain = 0x01; - CMD1007 CMD = new CMD1007(); - CMD.upgradeFileData = null; + model.dataDomain = GetRCMD1007DataInfo(CMD); //数据域 model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度 @@ -1268,7 +1209,7 @@ namespace BatCharging.Service return results; } - public byte[] SendRCMD1009(out APDUModel APDUModel) + public byte[] SendRCMD1009(out APDUModel APDUModel, CMD1009 CMD) { byte[] result = null; @@ -1280,8 +1221,7 @@ namespace BatCharging.Service model.CMD = 1; model.checksumDomain = 0x01; - CMD1009 CMD = new CMD1009(); - CMD.Value01 = 0; + model.dataDomain = GetRCMD1009DataInfo(CMD); //数据域 model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度 @@ -1314,7 +1254,7 @@ namespace BatCharging.Service } - public byte[] SendRCMD1011(out APDUModel APDUModel) + public byte[] SendRCMD1011(out APDUModel APDUModel, CMD1011 CMD) { byte[] result = null; @@ -1326,8 +1266,7 @@ namespace BatCharging.Service model.CMD = 1; model.checksumDomain = 0x01; - CMD1011 CMD = new CMD1011(); - CMD.reserved1 = 0; + model.dataDomain = GetRCMD1011DataInfo(CMD); //数据域 model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度 @@ -1359,7 +1298,7 @@ namespace BatCharging.Service return results; } - public byte[] SendRCMD1021(out APDUModel APDUModel) + public byte[] SendRCMD1021(out APDUModel APDUModel, CMD1021 CMD) { byte[] result = null; @@ -1371,9 +1310,7 @@ namespace BatCharging.Service model.CMD = 1; model.checksumDomain = 0x01; - CMD1021 CMD = new CMD1021(); - CMD.responseResults = 0; - CMD.responseDescription = ""; + model.dataDomain = GetRCMD1021DataInfo(CMD); //数据域 model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度 diff --git a/Monitor.ChargeTest/FrmChargeResult.cs b/Monitor.ChargeTest/FrmChargeResult.cs index bd67c00..1d7668f 100644 --- a/Monitor.ChargeTest/FrmChargeResult.cs +++ b/Monitor.ChargeTest/FrmChargeResult.cs @@ -596,27 +596,27 @@ namespace Monitor.ChargeTest private void button27_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.Send201(); + //CmnChargerParam._CHR00TCPCLIENT.Send201(); } private void button12_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.Send203(); + //CmnChargerParam._CHR00TCPCLIENT.Send203(); } private void button28_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.Send205(); + //CmnChargerParam._CHR00TCPCLIENT.Send205(); } private void button29_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.Send207(); + //CmnChargerParam._CHR00TCPCLIENT.Send207(); } private void button30_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.Send209(); + //CmnChargerParam._CHR00TCPCLIENT.Send209(); } #endregion