diff --git a/BatCharging.Model/客户端发送/APDUModel.cs b/BatCharging.Model/客户端发送/APDUModel.cs
index e1f2300..63ba87f 100644
--- a/BatCharging.Model/客户端发送/APDUModel.cs
+++ b/BatCharging.Model/客户端发送/APDUModel.cs
@@ -22,6 +22,9 @@ namespace BatCharging.Model
public UInt16 LengthDomain { get; set; }
///
/// 信息域
+ ///
+ /// 除了 CMD=1202 加密能用 RSA 加密方式,
+ /// 其他报文若是加密,全部是采用 AES方式加密。
/// bit0-3 当前协议是V2.6值填0x02
///
public byte infoDomain { get; set; }
diff --git a/BatCharging.Service/ChargerMgrTool.cs b/BatCharging.Service/ChargerMgrTool.cs
index a018ac5..09f2c5e 100644
--- a/BatCharging.Service/ChargerMgrTool.cs
+++ b/BatCharging.Service/ChargerMgrTool.cs
@@ -976,7 +976,7 @@ namespace BatCharging.Service
{
if (data != null)
{
- if (data.Length > 24)
+ if (data.Length > 9)
{
{
UInt16 func = ToUInt16(data, 6);
@@ -1816,972 +1816,972 @@ namespace BatCharging.Service
}
{
- byte frameTypeNo = data[15]; //帧类型号
- byte infoNums = data[16]; //信息体个数
-
- switch (frameTypeNo)
- {
-
- #region 42主动上送充电记录
- case 42: //主动上送充电记录(有116)
- {
- ASDU baseAsdu = MsgHeadAsduDecoder.GetBaseASDUMsg(data);
- RecordCharg _record_charg = new MsgRecChaDecoder().mRecordCharg(data);
- string result = "主动上送充电记录 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result = "\r\n" + "主动上送充电记录对象:" + JsonConvert.SerializeObject(_record_charg);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- if (_result._record_charg != null)
- {
- //主动上送充电记录响应
- SendRecordChargResp(0, 0);
-
-
-
- if (_record_charg != null)
- {
- if (_result._record_charg.startTime.Trim() == _record_charg.startTime.Trim())
- {
- //是否需要主动发送给云平台充电订单
- _record_to_cloud_sended = false;
- }
- else
- {
- _result._record_charg = _record_charg;
- //是否需要主动发送给云平台充电订单
- _record_to_cloud_sended = true;
- }
- }
- }
- else
- {
- if (_record_charg != null)
- {
- _result._record_charg = _record_charg;
- //是否需要主动发送给云平台充电订单
- _record_to_cloud_sended = true;
- }
- }
- }
- break;
- #endregion 42主动上送充电记录
-
- #region 帧类型45
- case 45:
- {
- ASDU baseAsdu = MsgHeadAsduDecoder.GetBaseASDUMsg(data);
- if (baseAsdu != null)
- {
- byte recordType = baseAsdu.MsgBodyContents[0];
- switch (recordType)
- {
- case 1: //充放电机上送充电启动完成帧-4.1.6
- {
- byte sucVal = baseAsdu.MsgBodyContents[1];
- if (sucVal == 0)
- {
- _is_charged = true;
- }
- else if (sucVal == 1)
- {
- _is_charged = false;
- }
- //解析反馈的其他参数值(匹配)
- if (baseAsdu.MsgBodyContents.Count() > 20)
- {
- StartComFrame startComFrame = (new MsgStaComFraDecoder()).GetMsgStartComFrame(data);
- string result = "充放电机上送充电启动完成帧 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result = "\r\n" + "充放电机上送充电启动完成帧对象:" + JsonConvert.SerializeObject(startComFrame);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- if (startComFrame != null)
- {
- //应答充电启动完成帧
- SendStartChargingFinishedRes(0, 0);
- }
- else
- {
- //应答充电启动完成帧
- SendStartChargingFinishedRes(1, 2);
- }
- }
- break;
- }
- case 3: //充放电机上送充电停止帧-4.1.8
- {
- //此次解析有问题,需要重新审核优化
- //ChargeStopFrame chargestopframe = (new msgchastopfradecoder()).getmsgchargestopframe(data);
- //System.Diagnostics.Debug.WriteLine("充放电机上送充电停止帧(chargestopframe): "+ JsonConvert.SerializeObject(chargestopframe));
- //string result = "充放电机上送充电停止帧 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";" + "充放电机上送充电停止帧对象:" + JsonConvert.SerializeObject(chargestopframe);
- //Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- _is_can_send_stop_cmd = false;
- //应答充电停止完成帧
- SendStopChargingFinishedRes(0);
- break;
- }
-
- case 6: //3.4.2 充放电机应答站功率调节指令
- {
-
- PowerRegulateResult powerRegulateResult = (new PowerRegulateDecoder()).GetPowerRegulateResult(data);
- string result = "充放电机应答站功率调节指令 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result = "\r\n" + "充放电机应答站功率调节指令对象:" + JsonConvert.SerializeObject(powerRegulateResult);
-
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 10: //3.4.4 充放电机应答辅助控制
- {
-
- AuxiliaryPowerControlResult auxiliaryPowerControlResult = (new AuxiliaryPowerControlDecoder()).GetAuxiliaryPowerControlResult(data);
- string result = "充放电机应答辅助控制 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result = "\r\n" + "充放电机应答辅助控制对象:" + JsonConvert.SerializeObject(auxiliaryPowerControlResult);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 11: //充放电机登陆签到
- {
- ChaDisMacLoginsign chaDisMacLoginsign = (new MsgChaDisMacLogDecoder()).GetMsgChaDisMacLoginsign(data);
- string result = "充放电机登陆签到 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";" + "充放电机登陆签到:" + JsonConvert.SerializeObject(chaDisMacLoginsign);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- System.Diagnostics.Debug.WriteLine("充放电机登陆签到(ChaDisMacLoginsign): " + JsonConvert.SerializeObject(chaDisMacLoginsign));
- if (chaDisMacLoginsign != null)
- {
- //监控平台应答充电设备登录签到
- SendCharingLoginRes();
- }
- break;
- }
- case 13: //充电设备心跳上报
- {
- string result = "充电设备心跳上报 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- //监控平台心跳应答
- SendCharingHeartRes();
- break;
- }
- case 25: //充放电机应答鉴权认证-3.3.2
- {
- AuthRes auRes = (new MsgSignResDecoder()).GetAuthResMsg(data);
- string result = "充放电机应答鉴权认证 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result = "\r\n" + "充放电机应答鉴权认证对象:" + JsonConvert.SerializeObject(auRes);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
-
-
- //充电机认证确认
- if (auRes != null)
- {
- if (_result._auth_rlt != null)
- {
- if (_result._auth_rlt.F_Auth != null)
- {
- if (_result._auth_rlt.F_ID == auRes.ConnSeq)
- {
- _is_authed = true;
- _charging_status = 1;
- _result._auth_rlt.F_HaveRes = true;
- _result._auth_rlt.F_AuthRes = auRes;
- _charging_start_time = Convert.ToDateTime("2000-1-1");
- _charging_stop_time = Convert.ToDateTime("2000-1-1");
-
- }
- }
- else
- {
- _is_authed = false;
- _charging_status = 2;
- }
- }
- }
-
- break;
- }
- case 44: //3.4.6 充放电机应答监控平台掉线停止充电
- {
- //返回值为 应答结果 0成功 1失败
- byte result = (new DisconnectStopChargeDecoder()).DisconnectStopChargeResult(data);
- string result1 = "充放电机应答监控平台掉线停止充电-接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result1 = "\r\n" + "应答结果(0成功 1失败):" + result;
- Log.LogInstance.WriteLog(result1, LogType.Information, "RecvedLog");
-
- break;
- }
-
- case 46: //3.4.8 充放电机应答监控平台下发站外允许充电SOC
- {
- //返回值为 SOC限制值
- byte result = (new OutsideAllowChargeSOCDecoder()).OutsideAllowChargeSOCResult(data);
- string result1 = "充放电机应答监控平台下发站外允许充电SOC: " + "接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result1 = "\r\n" + "SOC限制值:" + result;
- Log.LogInstance.WriteLog(result1, LogType.Information, "RecvedLog");
-
- break;
- }
- case 48: //3.4.10监控网关响应尖峰平谷设置 00:成功 01:失败
- {
- byte rlt = (new MsgPeakResDecoder()).GetPeakTimePeriodResMsg(data);
- string result1 = "监控网关响应尖峰平谷设置: " + "接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result1 = "\r\n" + "尖峰平谷设置结果(00:成功 01:失败):" + rlt;
- Log.LogInstance.WriteLog(result1, LogType.Information, "RecvedLog");
-
- break;
- }
-
- case 50: // 3.5.9 监控网关上送尖峰平谷设置
- {
- SdUpPkFtValSet sdUpPkFtValSet = null;
- MsgSdUpPkFtValSetDecoder msgSdUpPkFtValSetDecoder = new MsgSdUpPkFtValSetDecoder();
- sdUpPkFtValSet = msgSdUpPkFtValSetDecoder.GetMsgSdUpPkFtValSet(data);
- string result = "监控网关上送尖峰平谷设置 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result = "\r\n" + "监控网关上送尖峰平谷设置对象:" + JsonConvert.SerializeObject(sdUpPkFtValSet);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
-
-
- case 75://4.3.10 充放电机上报模块状态
- {
- UpModelStation upModelStation = null;
- MsgUpModelStationDecoder msgUpModelStationDecoder = new MsgUpModelStationDecoder();
- upModelStation = msgUpModelStationDecoder.GetMsgUpModelStation(data);
-
- string result = "监控网关上送尖峰平谷设置 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result = "\r\n" + "监控网关上送尖峰平谷设置对象:" + JsonConvert.SerializeObject(upModelStation);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- if (upModelStation != null)
- {
-
-
- SendUpModelStationResp(0);
-
-
- }
- break;
- }
-
- case 83: //4.2.12 充放电机应答版本号
- {
- MsgAnsVerNumDecoder msgAnsVerNumDecoder = new MsgAnsVerNumDecoder();
- AnsVerNum ansVerNum = msgAnsVerNumDecoder.GetMsgAnsVerNum(data);
- string result = "充放电机应答版本号 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result = "\r\n" + "充放电机应答版本号对象:" + JsonConvert.SerializeObject(ansVerNum);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- }
- }
- break;
- }
- #endregion 45充放电机上送充电启动完成帧
-
- case 46:
- {
- ASDU baseAsdu = MsgHeadAsduDecoder.GetBaseASDUMsg(data);
- byte recordType = baseAsdu.MsgBodyContents[0];//信息体内容
-
- if (data.Length >= 36)
- {
- byte[] canData = { data[28], data[29], data[30], data[31], data[32], data[33], data[34], data[35] };
-
- switch (recordType)
- {
- #region New
-
- case 2:
- {
- _msg_recv.S2MStatus = SBMUCANDecoderUtils.Decode0X040141(canData);
- string result = "S2MStatus - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MStatus);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 3:
- {
- _msg_recv.S2MALARM1 = SBMUCANDecoderUtils.Decode0X040241(canData);
- string result = "S2MALARM1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MALARM1);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 4:
- {
- _msg_recv.S2MALARM2 = SBMUCANDecoderUtils.Decode0X040341(canData);
- string result = "S2MALARM2 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MALARM2);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 5:
- {
- _msg_recv.S2MPACKINFO = SBMUCANDecoderUtils.Decode0X040441(canData);
- string result = "S2MPACKINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MPACKINFO);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
-
- break;
- }
- case 6:
- {
- _msg_recv.S2MBRANCHCURR = SBMUCANDecoderUtils.Decode0X040541(canData);
- string result = "S2MBRANCHCURR - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBRANCHCURR);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
-
- break;
- }
- case 7:
- {
- _msg_recv.S2MRELAYSTATUS = SBMUCANDecoderUtils.Decode0X040641(canData);
- string result = "S2MRELAYSTATUS - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MRELAYSTATUS);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
-
- break;
- }
- case 8:
- {
- _msg_recv.S2MPACKCURRLMT = SBMUCANDecoderUtils.Decode0X040741(canData);
- string result = "S2MPACKCURRLMT - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MPACKCURRLMT);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
-
- break;
- }
- case 9:
- {
- _msg_recv.S2MRUNSTATUSINFO = SBMUCANDecoderUtils.Decode0X040841(canData);
- string result = "S2MRUNSTATUSINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MRUNSTATUSINFO);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
-
- break;
- }
- case 10:
- {
- _msg_recv.S2MSUMVOLT = SBMUCANDecoderUtils.Decode0X080141(canData);
- string result = "S2MSUMVOLT - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MSUMVOLT);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 11:
- {
- _msg_recv.S2MSUMTEMP = SBMUCANDecoderUtils.Decode0X080241(canData);
- string result = "S2MSUMTEMP - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MSUMTEMP);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 12:
- {
- _msg_recv.S2MCHRGACCUINFO = SBMUCANDecoderUtils.Decode0X080341(canData);
- string result = "S2MCHRGACCUINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MCHRGACCUINFO);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 13:
- {
- _msg_recv.S2MDISCHRGACCUINFO = SBMUCANDecoderUtils.Decode0X080441(canData);
- string result = "S2MDISCHRGACCUINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MDISCHRGACCUINFO);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 14:
- {
- _msg_recv.S2MRECHRGACCUINFO = SBMUCANDecoderUtils.Decode0X080541(canData);
- string result = "S2MRECHRGACCUINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MRECHRGACCUINFO);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 15:
- {
- _msg_recv.S2MISOINFO = SBMUCANDecoderUtils.Decode0X080641(canData);
- string result = "S2MISOINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MISOINFO);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 16:
- {
- _msg_recv.S2MBRACHSUMVOLT1 = SBMUCANDecoderUtils.Decode0X080741(canData);
- string result = "S2MBRACHSUMVOLT1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBRACHSUMVOLT1);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 17:
- {
- _msg_recv.S2MBRACHSUMVOLT2 = SBMUCANDecoderUtils.Decode0X080841(canData);
- string result = "S2MBRACHSUMVOLT2 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBRACHSUMVOLT2);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 18:
- {
- _msg_recv.S2MBRACHSUMVOTL3 = SBMUCANDecoderUtils.Decode0X080941(canData);
- string result = "S2MBRACHSUMVOTL3 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBRACHSUMVOTL3);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 19:
- {
- _msg_recv.S2MBRACHSUMTEMP1 = SBMUCANDecoderUtils.Decode0X081041(canData);
- string result = "S2MBRACHSUMTEMP1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBRACHSUMTEMP1);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 20:
- {
- _msg_recv.S2MBRACHSUMTEMP2 = SBMUCANDecoderUtils.Decode0X081141(canData);
- string result = "S2MBRACHSUMTEMP2 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBRACHSUMTEMP2);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 21:
- {
- _msg_recv.S2MVOLT1 = SBMUCANDecoderUtils.Decode0X0C0141(canData);
- string result = "S2MVOLT1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT1);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 22:
- {
- _msg_recv.S2MVOLT2 = SBMUCANDecoderUtils.Decode0X0C0241(canData);
- string result = "S2MVOLT2 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT2);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 23:
- {
- _msg_recv.S2MVOLT3 = SBMUCANDecoderUtils.Decode0X0C0341(canData);
- string result = "S2MVOLT3 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT3);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 24:
- {
- _msg_recv.S2MVOLT4 = SBMUCANDecoderUtils.Decode0X0C0441(canData);
- string result = "S2MVOLT4 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT4);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 25:
- {
- _msg_recv.S2MVOLT5 = SBMUCANDecoderUtils.Decode0X0C0541(canData);
- string result = "S2MVOLT5 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT5);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 26:
- {
- _msg_recv.S2MVOLT6 = SBMUCANDecoderUtils.Decode0X0C0641(canData);
- string result = "S2MVOLT6 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT6);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 27:
- {
- _msg_recv.S2MVOLT7 = SBMUCANDecoderUtils.Decode0X0C0741(canData);
- string result = "S2MVOLT7 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT7);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 28:
- {
- _msg_recv.S2MVOLT8 = SBMUCANDecoderUtils.Decode0X0C0841(canData);
- string result = "S2MVOLT8 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT8);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 29:
- {
- _msg_recv.S2MVOLT9 = SBMUCANDecoderUtils.Decode0X0C0941(canData);
- string result = "S2MVOLT9 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT9);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 30:
- {
- _msg_recv.S2MVOLT10 = SBMUCANDecoderUtils.Decode0X0C0A41(canData);
- string result = "S2MVOLT10 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT10);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 31:
- {
- _msg_recv.S2MVOLT11 = SBMUCANDecoderUtils.Decode0X0C0B41(canData);
- string result = "S2MVOLT11 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT11);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 32:
- {
- _msg_recv.S2MVOLT12 = SBMUCANDecoderUtils.Decode0X0C0C41(canData);
- string result = "S2MVOLT12 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT12);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 33:
- {
- _msg_recv.S2MVOLT13 = SBMUCANDecoderUtils.Decode0X0C0D41(canData);
- string result = "S2MVOLT13 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT13);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 34:
- {
- _msg_recv.S2MVOLT14 = SBMUCANDecoderUtils.Decode0X0C0E41(canData);
- string result = "S2MVOLT14 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT14);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 35:
- {
- _msg_recv.S2MVOLT15 = SBMUCANDecoderUtils.Decode0X0C0F41(canData);
- string result = "S2MVOLT15 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT15);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 36:
- {
- _msg_recv.S2MVOLT16 = SBMUCANDecoderUtils.Decode0X0C1041(canData);
- string result = "S2MVOLT16 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT16);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 37:
- {
- _msg_recv.S2MVOLT17 = SBMUCANDecoderUtils.Decode0X0C1141(canData);
- string result = "S2MVOLT17 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT17);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 38:
- {
- _msg_recv.S2MVOLT18 = SBMUCANDecoderUtils.Decode0X0C1241(canData);
- string result = "S2MVOLT18 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT18);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 39:
- {
- _msg_recv.S2MVOLT19 = SBMUCANDecoderUtils.Decode0X0C1341(canData);
- string result = "S2MVOLT19 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT19);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 40:
- {
- _msg_recv.S2MVOLT20 = SBMUCANDecoderUtils.Decode0X0C1441(canData);
- string result = "S2MVOLT20 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT20);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 41:
- {
- _msg_recv.S2MVOLT21 = SBMUCANDecoderUtils.Decode0X0C1541(canData);
- string result = "S2MVOLT21 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT21);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 42:
- {
- _msg_recv.S2MVOLT22 = SBMUCANDecoderUtils.Decode0X0C1641(canData);
- string result = "S2MVOLT22 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT22);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 43:
- {
- _msg_recv.S2MVOLT23 = SBMUCANDecoderUtils.Decode0X0C1741(canData);
- string result = "S2MALARM1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MALARM1);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 44:
- {
- _msg_recv.S2MVOLT24 = SBMUCANDecoderUtils.Decode0X0C1841(canData);
- string result = "S2MVOLT24 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT24);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 45:
- {
- _msg_recv.S2MVOLT25 = SBMUCANDecoderUtils.Decode0X0C1941(canData);
- string result = "S2MVOLT25 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT25);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 46:
- {
- _msg_recv.S2MVOLT26 = SBMUCANDecoderUtils.Decode0X0C1A41(canData);
- string result = "S2MVOLT26 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT26);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 47:
- {
- _msg_recv.S2MVOLT27 = SBMUCANDecoderUtils.Decode0X0C1B41(canData);
- string result = "S2MVOLT27 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT27);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 48:
- {
- _msg_recv.S2MVOLT28 = SBMUCANDecoderUtils.Decode0X0C1C41(canData);
- string result = "S2MVOLT28 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT28);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 49:
- {
- _msg_recv.S2MVOLT29 = SBMUCANDecoderUtils.Decode0X0C1D41(canData);
- string result = "S2MVOLT29 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT29);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 50:
- {
- _msg_recv.S2MVOLT30 = SBMUCANDecoderUtils.Decode0X0C1E41(canData);
- string result = "S2MVOLT30 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT30);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 51:
- {
- _msg_recv.S2MTEMP1 = SBMUCANDecoderUtils.Decode0X0C1F41(canData);
- string result = "S2MTEMP1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTEMP1);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 52:
- {
- _msg_recv.S2MTEMP2 = SBMUCANDecoderUtils.Decode0X0C2041(canData);
- string result = "S2MTEMP2 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTEMP2);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 53:
- {
- _msg_recv.S2MTEMP3 = SBMUCANDecoderUtils.Decode0X0C2141(canData);
- string result = "S2MTEMP3 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTEMP3);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 54:
- {
- _msg_recv.S2MTEMP4 = SBMUCANDecoderUtils.Decode0X0C2241(canData);
- string result = "S2MTEMP4 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTEMP4);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 55:
- {
- _msg_recv.S2MTEMP5 = SBMUCANDecoderUtils.Decode0X0C2341(canData);
- string result = "S2MTEMP5 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTEMP5);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 56:
- {
- _msg_recv.S2MTEMP6 = SBMUCANDecoderUtils.Decode0X0C2441(canData);
- string result = "S2MTEMP6 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTEMP6);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 57:
- {
- _msg_recv.S2MCSCSUMVOLT = SBMUCANDecoderUtils.Decode0X0C2541(canData);
- string result = "S2MCSCSUMVOLT - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MCSCSUMVOLT);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 58:
- {
- _msg_recv.S2MCSCSUMTEMP = SBMUCANDecoderUtils.Decode0X0C2641(canData);
- string result = "S2MCSCSUMTEMP - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MCSCSUMTEMP);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 59:
- {
- _msg_recv.S2MTIMINGINFO = SBMUCANDecoderUtils.Decode0X140141(canData);
- string result = "S2MTIMINGINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTIMINGINFO);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 142:
- {
- _msg_recv.S2MBATTENERGYINFO1 = SBMUCANDecoderUtils.Decode0X050141(canData);
- string result = "S2MBATTENERGYINFO1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBATTENERGYINFO1);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 143:
- {
- _msg_recv.S2MBATTENERGYINFO2 = SBMUCANDecoderUtils.Decode0X050241(canData);
- string result = "S2MBATTENERGYINFO2 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBATTENERGYINFO2);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 144:
- {
- _msg_recv.S2MBATTENERGYINFO3 = SBMUCANDecoderUtils.Decode0X050341(canData);
- string result = "S2MBATTENERGYINFO3 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBATTENERGYINFO3);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
- break;
- }
- case 145:
- {
- _msg_recv.S2MBATTENERGYINFO4 = SBMUCANDecoderUtils.Decode0X050441(canData);
- string result = "S2MBATTENERGYINFO4 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBATTENERGYINFO4);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 146:
- {
- _msg_recv.S2MBATTENERGYINFO5 = SBMUCANDecoderUtils.Decode0X050541(canData);
- string result = "S2MBATTENERGYINFO5 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBATTENERGYINFO5);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 147:
- {
- _msg_recv.S2MBATTENERGYINFO6 = SBMUCANDecoderUtils.Decode0X050641(canData);
- string result = "S2MBATTENERGYINFO6 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBATTENERGYINFO6);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
- case 148:
- {
- _msg_recv.S2MSYSCODE = SBMUCANDecoderUtils.Decode0X050741(canData);
- string result = "S2MSYSCODE - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
- result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MSYSCODE);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- break;
- }
-
-
- #endregion
-
- case 72://充放电机上送BMS基本参数2
- {
- BatterCycleUpBMS batterCycleUpBMS = null;
- MsgBatCycUpBMSDecoder msgBatCycUpBMSDecoder = new MsgBatCycUpBMSDecoder();
- batterCycleUpBMS = msgBatCycUpBMSDecoder.GetMsgBatterCycleUpBMS(data);
- break;
- }
- //case 74://充放电机上传BMS设备状态(只有40)
- // {
- // BatterCycleUpBMS batterCycleUpBMS = null;
- // MsgBatCycUpBMSDecoder msgBatCycUpBMSDecoder = new MsgBatCycUpBMSDecoder();
- // batterCycleUpBMS = msgBatCycUpBMSDecoder.GetMsgBatterCycleUpBMS(data);
- // break;
- // }
- default:
- {
- break;
- }
- }
-
- }
- break;
-
-
- }
- case 49:
- {
- //充放电机响应远程启动充电
- RemoteStartChargingRes startChargingRes = (new MsgStartChgResDecoder()).GetStartChargingResMsg(data);
-
- string result = "充放电机响应远程启动充电 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result = "\r\n" + "充放电机响应远程启动充电对象:" + JsonConvert.SerializeObject(startChargingRes);
-
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- if (startChargingRes != null)
- {
- if (startChargingRes.Result == 0)
- {
- _is_stoped = false;
- _charging_status = 3;
- _charging_start_time = DateTime.Now;
- }
- else
- {
- _charging_status = 4;
- _charging_start_time = Convert.ToDateTime("2000-1-1");
- }
- }
- else
- {
- _charging_status = 4;
- }
- break;
- }
- case 50:
- {
- //充放电机响应远程停止充电
- RemoteStopChargingRes stopChargingRes = (new MsgStopChgResDecoder()).GetStopChargingResMsg(data);
- string result = "充放电机响应远程停止充电 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result = "\r\n" + "充放电机响应远程停止充电对象:" + JsonConvert.SerializeObject(stopChargingRes);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- if (stopChargingRes != null)
- {
- if (stopChargingRes.Result == 0)
- {
- _is_can_send_stop_cmd = false;
- _is_stoped = true;
- _charging_status = 6;
- _is_charged = false;
- _charging_stop_time = DateTime.Now;
- }
- else
- {
- _is_stoped = false;
- _charging_status = 7;
- _charging_stop_time = Convert.ToDateTime("2000-1-1");
- }
- }
- else
- {
- _is_stoped = false;
- _charging_status = 7;
- }
- break;
- }
- case 5: //遥信
- {
- RemoteData mRemoteData = new MsgRemoteDataDecoder().BRemoteDataToValue(data);
- string result = "遥信数据上报 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result = "\r\n" + "遥信数据上报对象:" + JsonConvert.SerializeObject(mRemoteData);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- if (mRemoteData != null)
- {
- _workstate = mRemoteData.WorkDev;
- _is_fault = mRemoteData.TotalFault == 1 ? true : false;
- _is_alarm = mRemoteData.CommonAlarm == 1 ? true : false;
- _remote_data = mRemoteData;
-
- GetFalutAlarmNoList(mRemoteData);
- }
- break;
- }
- case 11: //遥测
- {
- TelemetryData mTelemetryData = new MsgTelDataDecoder().BTelemetryDataToValue(data);
- string result = "遥测数据上报 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result = "\r\n" + "遥测数据上报对象:" + JsonConvert.SerializeObject(mTelemetryData);
- Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
-
- if (mTelemetryData != null)
- {
- _telem_data = mTelemetryData;
- _soc = mTelemetryData.Soc;
- _power = mTelemetryData.HighVoltageAcquisitionVoltage * mTelemetryData.HighVoltageAcquisitionCurrent;
- }
- break;
- }
- }
+ //byte frameTypeNo = data[15]; //帧类型号
+ //byte infoNums = data[16]; //信息体个数
+
+ //switch (frameTypeNo)
+ //{
+
+ // #region 42主动上送充电记录
+ // case 42: //主动上送充电记录(有116)
+ // {
+ // ASDU baseAsdu = MsgHeadAsduDecoder.GetBaseASDUMsg(data);
+ // RecordCharg _record_charg = new MsgRecChaDecoder().mRecordCharg(data);
+ // string result = "主动上送充电记录 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ // result = "\r\n" + "主动上送充电记录对象:" + JsonConvert.SerializeObject(_record_charg);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // if (_result._record_charg != null)
+ // {
+ // //主动上送充电记录响应
+ // SendRecordChargResp(0, 0);
+
+
+
+ // if (_record_charg != null)
+ // {
+ // if (_result._record_charg.startTime.Trim() == _record_charg.startTime.Trim())
+ // {
+ // //是否需要主动发送给云平台充电订单
+ // _record_to_cloud_sended = false;
+ // }
+ // else
+ // {
+ // _result._record_charg = _record_charg;
+ // //是否需要主动发送给云平台充电订单
+ // _record_to_cloud_sended = true;
+ // }
+ // }
+ // }
+ // else
+ // {
+ // if (_record_charg != null)
+ // {
+ // _result._record_charg = _record_charg;
+ // //是否需要主动发送给云平台充电订单
+ // _record_to_cloud_sended = true;
+ // }
+ // }
+ // }
+ // break;
+ // #endregion 42主动上送充电记录
+
+ // #region 帧类型45
+ // case 45:
+ // {
+ // ASDU baseAsdu = MsgHeadAsduDecoder.GetBaseASDUMsg(data);
+ // if (baseAsdu != null)
+ // {
+ // byte recordType = baseAsdu.MsgBodyContents[0];
+ // switch (recordType)
+ // {
+ // case 1: //充放电机上送充电启动完成帧-4.1.6
+ // {
+ // byte sucVal = baseAsdu.MsgBodyContents[1];
+ // if (sucVal == 0)
+ // {
+ // _is_charged = true;
+ // }
+ // else if (sucVal == 1)
+ // {
+ // _is_charged = false;
+ // }
+ // //解析反馈的其他参数值(匹配)
+ // if (baseAsdu.MsgBodyContents.Count() > 20)
+ // {
+ // StartComFrame startComFrame = (new MsgStaComFraDecoder()).GetMsgStartComFrame(data);
+ // string result = "充放电机上送充电启动完成帧 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ // result = "\r\n" + "充放电机上送充电启动完成帧对象:" + JsonConvert.SerializeObject(startComFrame);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // if (startComFrame != null)
+ // {
+ // //应答充电启动完成帧
+ // SendStartChargingFinishedRes(0, 0);
+ // }
+ // else
+ // {
+ // //应答充电启动完成帧
+ // SendStartChargingFinishedRes(1, 2);
+ // }
+ // }
+ // break;
+ // }
+ // case 3: //充放电机上送充电停止帧-4.1.8
+ // {
+ // //此次解析有问题,需要重新审核优化
+ // //ChargeStopFrame chargestopframe = (new msgchastopfradecoder()).getmsgchargestopframe(data);
+ // //System.Diagnostics.Debug.WriteLine("充放电机上送充电停止帧(chargestopframe): "+ JsonConvert.SerializeObject(chargestopframe));
+ // //string result = "充放电机上送充电停止帧 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";" + "充放电机上送充电停止帧对象:" + JsonConvert.SerializeObject(chargestopframe);
+ // //Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // _is_can_send_stop_cmd = false;
+ // //应答充电停止完成帧
+ // SendStopChargingFinishedRes(0);
+ // break;
+ // }
+
+ // case 6: //3.4.2 充放电机应答站功率调节指令
+ // {
+
+ // PowerRegulateResult powerRegulateResult = (new PowerRegulateDecoder()).GetPowerRegulateResult(data);
+ // string result = "充放电机应答站功率调节指令 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ // result = "\r\n" + "充放电机应答站功率调节指令对象:" + JsonConvert.SerializeObject(powerRegulateResult);
+
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 10: //3.4.4 充放电机应答辅助控制
+ // {
+
+ // AuxiliaryPowerControlResult auxiliaryPowerControlResult = (new AuxiliaryPowerControlDecoder()).GetAuxiliaryPowerControlResult(data);
+ // string result = "充放电机应答辅助控制 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ // result = "\r\n" + "充放电机应答辅助控制对象:" + JsonConvert.SerializeObject(auxiliaryPowerControlResult);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 11: //充放电机登陆签到
+ // {
+ // ChaDisMacLoginsign chaDisMacLoginsign = (new MsgChaDisMacLogDecoder()).GetMsgChaDisMacLoginsign(data);
+ // string result = "充放电机登陆签到 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";" + "充放电机登陆签到:" + JsonConvert.SerializeObject(chaDisMacLoginsign);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // System.Diagnostics.Debug.WriteLine("充放电机登陆签到(ChaDisMacLoginsign): " + JsonConvert.SerializeObject(chaDisMacLoginsign));
+ // if (chaDisMacLoginsign != null)
+ // {
+ // //监控平台应答充电设备登录签到
+ // SendCharingLoginRes();
+ // }
+ // break;
+ // }
+ // case 13: //充电设备心跳上报
+ // {
+ // string result = "充电设备心跳上报 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // //监控平台心跳应答
+ // SendCharingHeartRes();
+ // break;
+ // }
+ // case 25: //充放电机应答鉴权认证-3.3.2
+ // {
+ // AuthRes auRes = (new MsgSignResDecoder()).GetAuthResMsg(data);
+ // string result = "充放电机应答鉴权认证 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ // result = "\r\n" + "充放电机应答鉴权认证对象:" + JsonConvert.SerializeObject(auRes);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+
+
+ // //充电机认证确认
+ // if (auRes != null)
+ // {
+ // if (_result._auth_rlt != null)
+ // {
+ // if (_result._auth_rlt.F_Auth != null)
+ // {
+ // if (_result._auth_rlt.F_ID == auRes.ConnSeq)
+ // {
+ // _is_authed = true;
+ // _charging_status = 1;
+ // _result._auth_rlt.F_HaveRes = true;
+ // _result._auth_rlt.F_AuthRes = auRes;
+ // _charging_start_time = Convert.ToDateTime("2000-1-1");
+ // _charging_stop_time = Convert.ToDateTime("2000-1-1");
+
+ // }
+ // }
+ // else
+ // {
+ // _is_authed = false;
+ // _charging_status = 2;
+ // }
+ // }
+ // }
+
+ // break;
+ // }
+ // case 44: //3.4.6 充放电机应答监控平台掉线停止充电
+ // {
+ // //返回值为 应答结果 0成功 1失败
+ // byte result = (new DisconnectStopChargeDecoder()).DisconnectStopChargeResult(data);
+ // string result1 = "充放电机应答监控平台掉线停止充电-接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ // result1 = "\r\n" + "应答结果(0成功 1失败):" + result;
+ // Log.LogInstance.WriteLog(result1, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+
+ // case 46: //3.4.8 充放电机应答监控平台下发站外允许充电SOC
+ // {
+ // //返回值为 SOC限制值
+ // byte result = (new OutsideAllowChargeSOCDecoder()).OutsideAllowChargeSOCResult(data);
+ // string result1 = "充放电机应答监控平台下发站外允许充电SOC: " + "接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ // result1 = "\r\n" + "SOC限制值:" + result;
+ // Log.LogInstance.WriteLog(result1, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 48: //3.4.10监控网关响应尖峰平谷设置 00:成功 01:失败
+ // {
+ // byte rlt = (new MsgPeakResDecoder()).GetPeakTimePeriodResMsg(data);
+ // string result1 = "监控网关响应尖峰平谷设置: " + "接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ // result1 = "\r\n" + "尖峰平谷设置结果(00:成功 01:失败):" + rlt;
+ // Log.LogInstance.WriteLog(result1, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+
+ // case 50: // 3.5.9 监控网关上送尖峰平谷设置
+ // {
+ // SdUpPkFtValSet sdUpPkFtValSet = null;
+ // MsgSdUpPkFtValSetDecoder msgSdUpPkFtValSetDecoder = new MsgSdUpPkFtValSetDecoder();
+ // sdUpPkFtValSet = msgSdUpPkFtValSetDecoder.GetMsgSdUpPkFtValSet(data);
+ // string result = "监控网关上送尖峰平谷设置 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ // result = "\r\n" + "监控网关上送尖峰平谷设置对象:" + JsonConvert.SerializeObject(sdUpPkFtValSet);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+
+
+ // case 75://4.3.10 充放电机上报模块状态
+ // {
+ // UpModelStation upModelStation = null;
+ // MsgUpModelStationDecoder msgUpModelStationDecoder = new MsgUpModelStationDecoder();
+ // upModelStation = msgUpModelStationDecoder.GetMsgUpModelStation(data);
+
+ // string result = "监控网关上送尖峰平谷设置 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ // result = "\r\n" + "监控网关上送尖峰平谷设置对象:" + JsonConvert.SerializeObject(upModelStation);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // if (upModelStation != null)
+ // {
+
+
+ // SendUpModelStationResp(0);
+
+
+ // }
+ // break;
+ // }
+
+ // case 83: //4.2.12 充放电机应答版本号
+ // {
+ // MsgAnsVerNumDecoder msgAnsVerNumDecoder = new MsgAnsVerNumDecoder();
+ // AnsVerNum ansVerNum = msgAnsVerNumDecoder.GetMsgAnsVerNum(data);
+ // string result = "充放电机应答版本号 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ // result = "\r\n" + "充放电机应答版本号对象:" + JsonConvert.SerializeObject(ansVerNum);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // }
+ // }
+ // break;
+ // }
+ // #endregion 45充放电机上送充电启动完成帧
+
+ // case 46:
+ // {
+ // ASDU baseAsdu = MsgHeadAsduDecoder.GetBaseASDUMsg(data);
+ // byte recordType = baseAsdu.MsgBodyContents[0];//信息体内容
+
+ // if (data.Length >= 36)
+ // {
+ // byte[] canData = { data[28], data[29], data[30], data[31], data[32], data[33], data[34], data[35] };
+
+ // switch (recordType)
+ // {
+ // #region New
+
+ // case 2:
+ // {
+ // _msg_recv.S2MStatus = SBMUCANDecoderUtils.Decode0X040141(canData);
+ // string result = "S2MStatus - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MStatus);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 3:
+ // {
+ // _msg_recv.S2MALARM1 = SBMUCANDecoderUtils.Decode0X040241(canData);
+ // string result = "S2MALARM1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MALARM1);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 4:
+ // {
+ // _msg_recv.S2MALARM2 = SBMUCANDecoderUtils.Decode0X040341(canData);
+ // string result = "S2MALARM2 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MALARM2);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 5:
+ // {
+ // _msg_recv.S2MPACKINFO = SBMUCANDecoderUtils.Decode0X040441(canData);
+ // string result = "S2MPACKINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MPACKINFO);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+
+ // break;
+ // }
+ // case 6:
+ // {
+ // _msg_recv.S2MBRANCHCURR = SBMUCANDecoderUtils.Decode0X040541(canData);
+ // string result = "S2MBRANCHCURR - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBRANCHCURR);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+
+ // break;
+ // }
+ // case 7:
+ // {
+ // _msg_recv.S2MRELAYSTATUS = SBMUCANDecoderUtils.Decode0X040641(canData);
+ // string result = "S2MRELAYSTATUS - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MRELAYSTATUS);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+
+ // break;
+ // }
+ // case 8:
+ // {
+ // _msg_recv.S2MPACKCURRLMT = SBMUCANDecoderUtils.Decode0X040741(canData);
+ // string result = "S2MPACKCURRLMT - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MPACKCURRLMT);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+
+ // break;
+ // }
+ // case 9:
+ // {
+ // _msg_recv.S2MRUNSTATUSINFO = SBMUCANDecoderUtils.Decode0X040841(canData);
+ // string result = "S2MRUNSTATUSINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MRUNSTATUSINFO);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+
+ // break;
+ // }
+ // case 10:
+ // {
+ // _msg_recv.S2MSUMVOLT = SBMUCANDecoderUtils.Decode0X080141(canData);
+ // string result = "S2MSUMVOLT - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MSUMVOLT);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 11:
+ // {
+ // _msg_recv.S2MSUMTEMP = SBMUCANDecoderUtils.Decode0X080241(canData);
+ // string result = "S2MSUMTEMP - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MSUMTEMP);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 12:
+ // {
+ // _msg_recv.S2MCHRGACCUINFO = SBMUCANDecoderUtils.Decode0X080341(canData);
+ // string result = "S2MCHRGACCUINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MCHRGACCUINFO);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 13:
+ // {
+ // _msg_recv.S2MDISCHRGACCUINFO = SBMUCANDecoderUtils.Decode0X080441(canData);
+ // string result = "S2MDISCHRGACCUINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MDISCHRGACCUINFO);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 14:
+ // {
+ // _msg_recv.S2MRECHRGACCUINFO = SBMUCANDecoderUtils.Decode0X080541(canData);
+ // string result = "S2MRECHRGACCUINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MRECHRGACCUINFO);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 15:
+ // {
+ // _msg_recv.S2MISOINFO = SBMUCANDecoderUtils.Decode0X080641(canData);
+ // string result = "S2MISOINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MISOINFO);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 16:
+ // {
+ // _msg_recv.S2MBRACHSUMVOLT1 = SBMUCANDecoderUtils.Decode0X080741(canData);
+ // string result = "S2MBRACHSUMVOLT1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBRACHSUMVOLT1);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 17:
+ // {
+ // _msg_recv.S2MBRACHSUMVOLT2 = SBMUCANDecoderUtils.Decode0X080841(canData);
+ // string result = "S2MBRACHSUMVOLT2 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBRACHSUMVOLT2);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 18:
+ // {
+ // _msg_recv.S2MBRACHSUMVOTL3 = SBMUCANDecoderUtils.Decode0X080941(canData);
+ // string result = "S2MBRACHSUMVOTL3 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBRACHSUMVOTL3);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 19:
+ // {
+ // _msg_recv.S2MBRACHSUMTEMP1 = SBMUCANDecoderUtils.Decode0X081041(canData);
+ // string result = "S2MBRACHSUMTEMP1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBRACHSUMTEMP1);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 20:
+ // {
+ // _msg_recv.S2MBRACHSUMTEMP2 = SBMUCANDecoderUtils.Decode0X081141(canData);
+ // string result = "S2MBRACHSUMTEMP2 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBRACHSUMTEMP2);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 21:
+ // {
+ // _msg_recv.S2MVOLT1 = SBMUCANDecoderUtils.Decode0X0C0141(canData);
+ // string result = "S2MVOLT1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT1);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 22:
+ // {
+ // _msg_recv.S2MVOLT2 = SBMUCANDecoderUtils.Decode0X0C0241(canData);
+ // string result = "S2MVOLT2 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT2);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 23:
+ // {
+ // _msg_recv.S2MVOLT3 = SBMUCANDecoderUtils.Decode0X0C0341(canData);
+ // string result = "S2MVOLT3 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT3);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 24:
+ // {
+ // _msg_recv.S2MVOLT4 = SBMUCANDecoderUtils.Decode0X0C0441(canData);
+ // string result = "S2MVOLT4 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT4);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 25:
+ // {
+ // _msg_recv.S2MVOLT5 = SBMUCANDecoderUtils.Decode0X0C0541(canData);
+ // string result = "S2MVOLT5 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT5);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 26:
+ // {
+ // _msg_recv.S2MVOLT6 = SBMUCANDecoderUtils.Decode0X0C0641(canData);
+ // string result = "S2MVOLT6 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT6);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 27:
+ // {
+ // _msg_recv.S2MVOLT7 = SBMUCANDecoderUtils.Decode0X0C0741(canData);
+ // string result = "S2MVOLT7 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT7);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 28:
+ // {
+ // _msg_recv.S2MVOLT8 = SBMUCANDecoderUtils.Decode0X0C0841(canData);
+ // string result = "S2MVOLT8 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT8);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 29:
+ // {
+ // _msg_recv.S2MVOLT9 = SBMUCANDecoderUtils.Decode0X0C0941(canData);
+ // string result = "S2MVOLT9 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT9);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 30:
+ // {
+ // _msg_recv.S2MVOLT10 = SBMUCANDecoderUtils.Decode0X0C0A41(canData);
+ // string result = "S2MVOLT10 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT10);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 31:
+ // {
+ // _msg_recv.S2MVOLT11 = SBMUCANDecoderUtils.Decode0X0C0B41(canData);
+ // string result = "S2MVOLT11 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT11);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 32:
+ // {
+ // _msg_recv.S2MVOLT12 = SBMUCANDecoderUtils.Decode0X0C0C41(canData);
+ // string result = "S2MVOLT12 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT12);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 33:
+ // {
+ // _msg_recv.S2MVOLT13 = SBMUCANDecoderUtils.Decode0X0C0D41(canData);
+ // string result = "S2MVOLT13 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT13);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 34:
+ // {
+ // _msg_recv.S2MVOLT14 = SBMUCANDecoderUtils.Decode0X0C0E41(canData);
+ // string result = "S2MVOLT14 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT14);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 35:
+ // {
+ // _msg_recv.S2MVOLT15 = SBMUCANDecoderUtils.Decode0X0C0F41(canData);
+ // string result = "S2MVOLT15 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT15);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 36:
+ // {
+ // _msg_recv.S2MVOLT16 = SBMUCANDecoderUtils.Decode0X0C1041(canData);
+ // string result = "S2MVOLT16 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT16);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 37:
+ // {
+ // _msg_recv.S2MVOLT17 = SBMUCANDecoderUtils.Decode0X0C1141(canData);
+ // string result = "S2MVOLT17 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT17);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 38:
+ // {
+ // _msg_recv.S2MVOLT18 = SBMUCANDecoderUtils.Decode0X0C1241(canData);
+ // string result = "S2MVOLT18 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT18);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 39:
+ // {
+ // _msg_recv.S2MVOLT19 = SBMUCANDecoderUtils.Decode0X0C1341(canData);
+ // string result = "S2MVOLT19 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT19);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 40:
+ // {
+ // _msg_recv.S2MVOLT20 = SBMUCANDecoderUtils.Decode0X0C1441(canData);
+ // string result = "S2MVOLT20 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT20);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 41:
+ // {
+ // _msg_recv.S2MVOLT21 = SBMUCANDecoderUtils.Decode0X0C1541(canData);
+ // string result = "S2MVOLT21 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT21);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 42:
+ // {
+ // _msg_recv.S2MVOLT22 = SBMUCANDecoderUtils.Decode0X0C1641(canData);
+ // string result = "S2MVOLT22 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT22);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 43:
+ // {
+ // _msg_recv.S2MVOLT23 = SBMUCANDecoderUtils.Decode0X0C1741(canData);
+ // string result = "S2MALARM1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MALARM1);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 44:
+ // {
+ // _msg_recv.S2MVOLT24 = SBMUCANDecoderUtils.Decode0X0C1841(canData);
+ // string result = "S2MVOLT24 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT24);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 45:
+ // {
+ // _msg_recv.S2MVOLT25 = SBMUCANDecoderUtils.Decode0X0C1941(canData);
+ // string result = "S2MVOLT25 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT25);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 46:
+ // {
+ // _msg_recv.S2MVOLT26 = SBMUCANDecoderUtils.Decode0X0C1A41(canData);
+ // string result = "S2MVOLT26 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT26);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 47:
+ // {
+ // _msg_recv.S2MVOLT27 = SBMUCANDecoderUtils.Decode0X0C1B41(canData);
+ // string result = "S2MVOLT27 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT27);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 48:
+ // {
+ // _msg_recv.S2MVOLT28 = SBMUCANDecoderUtils.Decode0X0C1C41(canData);
+ // string result = "S2MVOLT28 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT28);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 49:
+ // {
+ // _msg_recv.S2MVOLT29 = SBMUCANDecoderUtils.Decode0X0C1D41(canData);
+ // string result = "S2MVOLT29 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT29);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 50:
+ // {
+ // _msg_recv.S2MVOLT30 = SBMUCANDecoderUtils.Decode0X0C1E41(canData);
+ // string result = "S2MVOLT30 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT30);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 51:
+ // {
+ // _msg_recv.S2MTEMP1 = SBMUCANDecoderUtils.Decode0X0C1F41(canData);
+ // string result = "S2MTEMP1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTEMP1);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 52:
+ // {
+ // _msg_recv.S2MTEMP2 = SBMUCANDecoderUtils.Decode0X0C2041(canData);
+ // string result = "S2MTEMP2 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTEMP2);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 53:
+ // {
+ // _msg_recv.S2MTEMP3 = SBMUCANDecoderUtils.Decode0X0C2141(canData);
+ // string result = "S2MTEMP3 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTEMP3);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 54:
+ // {
+ // _msg_recv.S2MTEMP4 = SBMUCANDecoderUtils.Decode0X0C2241(canData);
+ // string result = "S2MTEMP4 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTEMP4);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 55:
+ // {
+ // _msg_recv.S2MTEMP5 = SBMUCANDecoderUtils.Decode0X0C2341(canData);
+ // string result = "S2MTEMP5 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTEMP5);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 56:
+ // {
+ // _msg_recv.S2MTEMP6 = SBMUCANDecoderUtils.Decode0X0C2441(canData);
+ // string result = "S2MTEMP6 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTEMP6);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 57:
+ // {
+ // _msg_recv.S2MCSCSUMVOLT = SBMUCANDecoderUtils.Decode0X0C2541(canData);
+ // string result = "S2MCSCSUMVOLT - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MCSCSUMVOLT);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 58:
+ // {
+ // _msg_recv.S2MCSCSUMTEMP = SBMUCANDecoderUtils.Decode0X0C2641(canData);
+ // string result = "S2MCSCSUMTEMP - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MCSCSUMTEMP);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 59:
+ // {
+ // _msg_recv.S2MTIMINGINFO = SBMUCANDecoderUtils.Decode0X140141(canData);
+ // string result = "S2MTIMINGINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTIMINGINFO);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 142:
+ // {
+ // _msg_recv.S2MBATTENERGYINFO1 = SBMUCANDecoderUtils.Decode0X050141(canData);
+ // string result = "S2MBATTENERGYINFO1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBATTENERGYINFO1);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 143:
+ // {
+ // _msg_recv.S2MBATTENERGYINFO2 = SBMUCANDecoderUtils.Decode0X050241(canData);
+ // string result = "S2MBATTENERGYINFO2 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBATTENERGYINFO2);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 144:
+ // {
+ // _msg_recv.S2MBATTENERGYINFO3 = SBMUCANDecoderUtils.Decode0X050341(canData);
+ // string result = "S2MBATTENERGYINFO3 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBATTENERGYINFO3);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+ // break;
+ // }
+ // case 145:
+ // {
+ // _msg_recv.S2MBATTENERGYINFO4 = SBMUCANDecoderUtils.Decode0X050441(canData);
+ // string result = "S2MBATTENERGYINFO4 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBATTENERGYINFO4);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 146:
+ // {
+ // _msg_recv.S2MBATTENERGYINFO5 = SBMUCANDecoderUtils.Decode0X050541(canData);
+ // string result = "S2MBATTENERGYINFO5 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBATTENERGYINFO5);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 147:
+ // {
+ // _msg_recv.S2MBATTENERGYINFO6 = SBMUCANDecoderUtils.Decode0X050641(canData);
+ // string result = "S2MBATTENERGYINFO6 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBATTENERGYINFO6);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+ // case 148:
+ // {
+ // _msg_recv.S2MSYSCODE = SBMUCANDecoderUtils.Decode0X050741(canData);
+ // string result = "S2MSYSCODE - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
+ // result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MSYSCODE);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // break;
+ // }
+
+
+ // #endregion
+
+ // case 72://充放电机上送BMS基本参数2
+ // {
+ // BatterCycleUpBMS batterCycleUpBMS = null;
+ // MsgBatCycUpBMSDecoder msgBatCycUpBMSDecoder = new MsgBatCycUpBMSDecoder();
+ // batterCycleUpBMS = msgBatCycUpBMSDecoder.GetMsgBatterCycleUpBMS(data);
+ // break;
+ // }
+ // //case 74://充放电机上传BMS设备状态(只有40)
+ // // {
+ // // BatterCycleUpBMS batterCycleUpBMS = null;
+ // // MsgBatCycUpBMSDecoder msgBatCycUpBMSDecoder = new MsgBatCycUpBMSDecoder();
+ // // batterCycleUpBMS = msgBatCycUpBMSDecoder.GetMsgBatterCycleUpBMS(data);
+ // // break;
+ // // }
+ // default:
+ // {
+ // break;
+ // }
+ // }
+
+ // }
+ // break;
+
+
+ // }
+ // case 49:
+ // {
+ // //充放电机响应远程启动充电
+ // RemoteStartChargingRes startChargingRes = (new MsgStartChgResDecoder()).GetStartChargingResMsg(data);
+
+ // string result = "充放电机响应远程启动充电 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ // result = "\r\n" + "充放电机响应远程启动充电对象:" + JsonConvert.SerializeObject(startChargingRes);
+
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // if (startChargingRes != null)
+ // {
+ // if (startChargingRes.Result == 0)
+ // {
+ // _is_stoped = false;
+ // _charging_status = 3;
+ // _charging_start_time = DateTime.Now;
+ // }
+ // else
+ // {
+ // _charging_status = 4;
+ // _charging_start_time = Convert.ToDateTime("2000-1-1");
+ // }
+ // }
+ // else
+ // {
+ // _charging_status = 4;
+ // }
+ // break;
+ // }
+ // case 50:
+ // {
+ // //充放电机响应远程停止充电
+ // RemoteStopChargingRes stopChargingRes = (new MsgStopChgResDecoder()).GetStopChargingResMsg(data);
+ // string result = "充放电机响应远程停止充电 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ // result = "\r\n" + "充放电机响应远程停止充电对象:" + JsonConvert.SerializeObject(stopChargingRes);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // if (stopChargingRes != null)
+ // {
+ // if (stopChargingRes.Result == 0)
+ // {
+ // _is_can_send_stop_cmd = false;
+ // _is_stoped = true;
+ // _charging_status = 6;
+ // _is_charged = false;
+ // _charging_stop_time = DateTime.Now;
+ // }
+ // else
+ // {
+ // _is_stoped = false;
+ // _charging_status = 7;
+ // _charging_stop_time = Convert.ToDateTime("2000-1-1");
+ // }
+ // }
+ // else
+ // {
+ // _is_stoped = false;
+ // _charging_status = 7;
+ // }
+ // break;
+ // }
+ // case 5: //遥信
+ // {
+ // RemoteData mRemoteData = new MsgRemoteDataDecoder().BRemoteDataToValue(data);
+ // string result = "遥信数据上报 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ // result = "\r\n" + "遥信数据上报对象:" + JsonConvert.SerializeObject(mRemoteData);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // if (mRemoteData != null)
+ // {
+ // _workstate = mRemoteData.WorkDev;
+ // _is_fault = mRemoteData.TotalFault == 1 ? true : false;
+ // _is_alarm = mRemoteData.CommonAlarm == 1 ? true : false;
+ // _remote_data = mRemoteData;
+
+ // GetFalutAlarmNoList(mRemoteData);
+ // }
+ // break;
+ // }
+ // case 11: //遥测
+ // {
+ // TelemetryData mTelemetryData = new MsgTelDataDecoder().BTelemetryDataToValue(data);
+ // string result = "遥测数据上报 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ // result = "\r\n" + "遥测数据上报对象:" + JsonConvert.SerializeObject(mTelemetryData);
+ // Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
+
+ // if (mTelemetryData != null)
+ // {
+ // _telem_data = mTelemetryData;
+ // _soc = mTelemetryData.Soc;
+ // _power = mTelemetryData.HighVoltageAcquisitionVoltage * mTelemetryData.HighVoltageAcquisitionCurrent;
+ // }
+ // break;
+ // }
+ //}
}
}
diff --git a/BatCharging.Service/Common/PublicProgram.cs b/BatCharging.Service/Common/PublicProgram.cs
index fd6909e..d9f7af4 100644
--- a/BatCharging.Service/Common/PublicProgram.cs
+++ b/BatCharging.Service/Common/PublicProgram.cs
@@ -1,5 +1,6 @@
using BatCharging.Model;
using System;
+using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -35,10 +36,73 @@ namespace BatCharging.Service
lstResult.AddRange(packSrcs);
//数据域
lstResult.AddRange(baseApci.dataDomain);
+
+ baseApci.checksumDomain = checksumDomain(lstResult.ToArray());
//校验和域
lstResult.Add(baseApci.checksumDomain);
}
return lstResult;
}
+
+ public static byte checksumDomain(byte[] data)
+ {
+ int checksum = 0;
+
+ for (int i = 8; i < data.Count(); i++)//这里没校验域所以不减一
+ {
+ checksum += data[i];
+ }
+
+ //foreach (byte b in data)
+ //{
+ // checksum += b;
+ //}
+ // 取校验和的低8位
+ return (byte)(checksum & 0xFF);
+ }
+ public static bool checksumDomainReceive(byte[] data)
+ {
+ bool bResult = false;
+ int checksum = 0;
+
+ for (int i = 8; i < data.Count() - 1; i++)//这里有校验域所以减一
+ {
+ checksum += data[i];
+ }
+
+ //foreach (byte b in data)
+ //{
+ // checksum += b;
+ //}
+ // 取校验和的低8位
+ if (data[data.Count()-1] == (byte)(checksum & 0xFF))
+ bResult = true;
+ return bResult;
+ }
+
+ public static ushort ComputeHeaderIpChecksum(byte[] header, int start, int length)
+ {
+
+ ushort word16;
+ long sum = 0;
+ for (int i = start; i < (length + start); i += 2)
+ {
+ word16 = (ushort)(((header[i] << 8) & 0xFF00)
+ + (header[i + 1] & 0xFF));
+ sum += (long)word16;
+ }
+
+ while ((sum >> 16) != 0)
+ {
+ sum = (sum & 0xFFFF) + (sum >> 16);
+ }
+
+ sum = ~sum;
+
+ return (ushort)sum;
+
+
+ }
+
}
}
diff --git a/BatCharging.Service/DataRlt/解析数据/MsgReceiveCMDCom.cs b/BatCharging.Service/DataRlt/解析数据/MsgReceiveCMDCom.cs
index e6b456b..428b2ec 100644
--- a/BatCharging.Service/DataRlt/解析数据/MsgReceiveCMDCom.cs
+++ b/BatCharging.Service/DataRlt/解析数据/MsgReceiveCMDCom.cs
@@ -1060,7 +1060,7 @@ namespace BatCharging.Service.DataRlt
CMD1501.value01 = ByteUtils.DToUInt16(data, 8);
CMD1501.value02 = ByteUtils.DToUInt16(data, 10);
CMD1501.value03 = Encoding.ASCII.GetString(data, 12, 32);
- CMD1501.value04 = Encoding.ASCII.GetString(data, 44, 32);
+ CMD1501.value04 = Encoding.ASCII.GetString(data, 44, 128);
}
return CMD1501;
}
diff --git a/BatCharging.Service/发送方法/ChargerSendCMD.cs b/BatCharging.Service/发送方法/ChargerSendCMD.cs
index 3f7058a..4193890 100644
--- a/BatCharging.Service/发送方法/ChargerSendCMD.cs
+++ b/BatCharging.Service/发送方法/ChargerSendCMD.cs
@@ -1839,7 +1839,7 @@ namespace BatCharging.Service
APDUModel model = new APDUModel();
model.OriginDomain1 = 0xAA;
- model.OriginDomain1 = 0xF5;
+ model.OriginDomain2 = 0xF5;
model.infoDomain = 0x02;
model.SerialNumberDomain = 0xff;
model.CMD = 1;
diff --git a/CommonClass/PubCommonClass.cs b/CommonClass/PubCommonClass.cs
index e672e55..6980cc7 100644
--- a/CommonClass/PubCommonClass.cs
+++ b/CommonClass/PubCommonClass.cs
@@ -10,6 +10,7 @@
///
public Dictionary cmd3StartAddress = new Dictionary();
+ //public Dictionary<>
public void SetCmd3StartAddress()
{
@@ -36,5 +37,64 @@
}
+ public static byte checksumDomain(byte[] data)
+ {
+ int checksum = 0;
+
+ for (int i = 8; i < data.Count(); i++)//这里没校验域所以不减一
+ {
+ checksum += data[i];
+ }
+
+ //foreach (byte b in data)
+ //{
+ // checksum += b;
+ //}
+ // 取校验和的低8位
+ return (byte)(checksum & 0xFF);
+ }
+ public static bool checksumDomainReceive(byte[] data)
+ {
+ bool bResult = false;
+ int checksum = 0;
+
+ for (int i = 8; i < data.Count() - 1; i++)//这里有校验域所以减一
+ {
+ checksum += data[i];
+ }
+
+ //foreach (byte b in data)
+ //{
+ // checksum += b;
+ //}
+ // 取校验和的低8位
+ if (data[data.Count() - 1] == (byte)(checksum & 0xFF))
+ bResult = true;
+ return bResult;
+ }
+
+ public static ushort ComputeHeaderIpChecksum(byte[] header, int start, int length)
+ {
+
+ ushort word16;
+ long sum = 0;
+ for (int i = start; i < (length + start); i += 2)
+ {
+ word16 = (ushort)(((header[i] << 8) & 0xFF00)
+ + (header[i + 1] & 0xFF));
+ sum += (long)word16;
+ }
+
+ while ((sum >> 16) != 0)
+ {
+ sum = (sum & 0xFFFF) + (sum >> 16);
+ }
+
+ sum = ~sum;
+
+ return (ushort)sum;
+
+
+ }
}
}
\ No newline at end of file
diff --git a/Module.Socket.Tool/TcpClientChargerTool.cs b/Module.Socket.Tool/TcpClientChargerTool.cs
index 3d7b7b3..e7c0b4a 100644
--- a/Module.Socket.Tool/TcpClientChargerTool.cs
+++ b/Module.Socket.Tool/TcpClientChargerTool.cs
@@ -338,7 +338,7 @@ namespace Module.Socket.Tool
{
readByte = ClientStream.Read(FixedBuffer, 0, BufferSize);
if (readByte == 0) break;
- else if (readByte >= 24)
+ else if (readByte >= 9)
{
bytesResult = GetReadResult(FixedBuffer, readByte);
}
@@ -387,7 +387,27 @@ namespace Module.Socket.Tool
Thread.Sleep(20);
}
}
+ public bool checksumDomainReceive(byte[] data)
+ {
+ bool bResult = false;
+ int checksum = 0;
+
+ for (int i = 8; i < data.Count() - 1; i++)//这里有校验域所以减一
+ {
+ checksum += data[i];
+ }
+ //foreach (byte b in data)
+ //{
+ // checksum += b;
+ //}
+ // 取校验和的低8位
+ byte b1 = (byte)(checksum & 0xFF);
+ byte b2 = data[data.Count() - 1];
+ if (data[data.Count() - 1] == (byte)(checksum & 0xFF))
+ bResult = true;
+ return bResult;
+ }
private List GetReadResult(byte[] bytes, int readLen)
{
List lstResult = new List();
@@ -415,7 +435,10 @@ namespace Module.Socket.Tool
// 使用Array.Copy方法将原始数组中的一部分复制到新数组
Array.Copy(bytesCppy, i, newBytes, 0, leng);
- lstResult.Add(newBytes);
+
+ //校验域是否正确
+ if (checksumDomainReceive(newBytes))
+ lstResult.Add(newBytes);
}
}
}