You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1767 lines
94 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HybirdFrameworkEntity
{
public class Decode
{
public void decode(string IP,string port,byte[] data)
{
switch (IP)
{
case "1":
break;
case "2":
break;
case "3":
break;
case "4":
break;
case "5":
break;
}
int func = (ushort)(data[6] + (data[6 + 1] << 8));
switch (func)
{
#region 协议格式
case 2:
{
CMD2 CMD2 = ConCMD2(data);
string result = "(CMD=2)充电桩参数整形设置/查询应答 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "(CMD=2)充电桩参数整形设置/查询应答对象:" + JsonConvert.SerializeObject(CMD2);
////Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 4:
{
CMD4 CMD4 = ConCMD4(data);
string result = "(CMD=4)充电桩参数字符形设置/查询应答 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "(CMD=4)充电桩参数字符形设置/查询应答对象:" + JsonConvert.SerializeObject(CMD4);
////Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 6:
{
CMD6 CMD6 = ConCMD6(data);
string result = "(CMD=6)充电桩对后台控制命令应答- 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "(CMD=6)充电桩对后台控制命令应答对象:" + JsonConvert.SerializeObject(CMD6);
////Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 8:
{
CMD8 CMD8 = ConCMD8(data);
string result = "(CMD=8) 充电桩对后台下发的充电桩开启充电控制应答 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "(CMD=8) 充电桩对后台下发的充电桩开启充电控制应答对象:" + JsonConvert.SerializeObject(CMD8);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 10:
{
CMD10 CMD10 = ConCMD10(data);
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD10);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
#endregion
#region 充电桩主动上传数据
case 102:
{
CMD102 CMD102 = ConCMD102(data);
string result = "(CMD=10)充电桩上传心跳包信息 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "(CMD=10)充电桩上传心跳包信息对象:" + JsonConvert.SerializeObject(CMD102);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 104:
{
CMD104 CMD104 = ConCMD104(data);
string result = "(CMD=10)充电桩状态信息包上报 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "(CMD=10)充电桩状态信息包上报对象:" + JsonConvert.SerializeObject(CMD104);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 106:
{
CMD106 CMD106 = ConCMD106(data);
string result = "(CMD=10)充电桩签到信息上报 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "(CMD=10)充电桩签到信息上报对象:" + JsonConvert.SerializeObject(CMD106);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 108:
{
CMD108 CMD108 = ConCMD108(data);
string result = "(CMD=10)充电桩告警信息上报(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "(CMD=10)充电桩告警信息上报(预留)对象:" + JsonConvert.SerializeObject(CMD108);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 110:
{
CMD110 CMD110 = ConCMD110(data);
string result = "(CMD=10)充电桩上报充电启动完成命令(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "(CMD=10)充电桩上报充电启动完成命令(预留)对象:" + JsonConvert.SerializeObject(CMD110);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 112:
{
CMD112 CMD112 = ConCMD112(data);
string result = "(CMD=10)充电桩模块信息上报(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "(CMD=10)充电桩模块信息上报对象:" + JsonConvert.SerializeObject(CMD112);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 114:
{
CMD114 CMD114 = ConCMD114(data);
string result = "(CMD=10)充电桩应答服务器查询最近一次充电各时段信息 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "(CMD=10)充电桩应答服务器查询最近一次充电各时段信息对象:" + JsonConvert.SerializeObject(CMD114);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
#endregion
#region 充电信息数据
case 202:
case 222:
{
CMD202 CMD202 = ConCMD202((UInt16)func, data);
string result = "充电桩上报充电记录信息 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "上报充电记录信息对象:" + JsonConvert.SerializeObject(CMD202);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 204:
{
CMD204 CMD204 = ConCMD204(data);
string result = "充电桩充电上传用户账户查询报文 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩充电上传用户账户查询报文对象:" + JsonConvert.SerializeObject(CMD204);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 206:
{
CMD206 CMD206 = ConCMD206(data);
string result = "充电桩充电上传用户密码验证报文 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩充电上传用户密码验证报文对象:" + JsonConvert.SerializeObject(CMD206);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 208:
{
CMD208 CMD208 = ConCMD208(data);
string result = "充电桩上报“即插即充”启动充电请求 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩上报“即插即充”启动充电请求对象:" + JsonConvert.SerializeObject(CMD208);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 210:
{
CMD210 CMD210 = ConCMD210(data);
string result = "充电桩上报“即插即充”启动充电结果 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩上报“即插即充”启动充电结果:" + JsonConvert.SerializeObject(CMD210);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
#endregion
#region 直流充电桩 BMS 信息数据(预留)
case 302:
{
CMD302 CMD302 = ConCMD302(data);
string result = "充电桩上报BMS信息 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩上报BMS信息对象" + JsonConvert.SerializeObject(CMD302);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 304:
{
CMD304 CMD304 = ConCMD304(data);
string result = "充电桩上报BMS信息(预留-暂时不用) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩上报BMS信息(预留-暂时不用)对象:" + JsonConvert.SerializeObject(CMD304);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
#endregion
#region 历史记录
case 402:
case 422:
{
CMD402 CMD402 = ConCMD402((UInt16)func, data);
string result = "充电桩上报历史的充电记录 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩上报历史的充电记录:" + JsonConvert.SerializeObject(CMD402);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
#endregion
#region 升级命令
case 1002:
{
CMD1002 CMD1002 = ConCMD1002(data);
string result = "充电桩回复服务器下发擦除指令 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩回复服务器下发擦除指令对象:" + JsonConvert.SerializeObject(CMD1002);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 1004:
{
CMD1004 CMD1004 = ConCMD1004(data);
string result = "充电桩应答服务器下发升级文件名指令 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩应答服务器下发升级文件名指令对象:" + JsonConvert.SerializeObject(CMD1004);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 1006:
{
CMD1006 CMD1006 = ConCMD1006(data);
string result = "充电桩应答服务器下发升级文件大小指令 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩应答服务器下发升级文件大小指令对象:" + JsonConvert.SerializeObject(CMD1006);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 1008:
{
CMD1008 CMD1008 = ConCMD1008(data);
string result = "充电桩应答服务器下发升级文件数据指令 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩应答服务器下发升级文件数据指令对象:" + JsonConvert.SerializeObject(CMD1008);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 1010:
{
CMD1010 CMD1010 = ConCMD1010(data);
string result = "充电桩应答服务器下发升级文件数据结束指令 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩应答服务器下发升级文件数据结束指令对象:" + JsonConvert.SerializeObject(CMD1010);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 1012:
{
CMD1012 CMD1012 = ConCMD1012(data);
string result = "充电桩应答服务器下发重启指令- 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩应答服务器下发重启指令对象:" + JsonConvert.SerializeObject(CMD1012);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 1022:
{
CMD1022 CMD1022 = ConCMD1022(data);
string result = "充电桩主动请求升级命令 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩主动请求升级命令对象:" + JsonConvert.SerializeObject(CMD1022);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
#endregion
#region 与计费策略相关的指令
case 1102:
{
CMD1102 CMD1102 = ConCMD1102(data);
string result = "充电桩应答后台服务器查询24时电费计价策略信息- 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩应答后台服务器查询24时电费计价策略信息对象" + JsonConvert.SerializeObject(CMD1102);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 1104:
{
CMD1104 CMD1104 = ConCMD1104(data);
string result = "充电桩应答后台服务器设置24时电费计价策略信息 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩应答后台服务器设置24时电费计价策略信息对象" + JsonConvert.SerializeObject(CMD1104);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 1106:
{
CMD1106 CMD1106 = ConCMD1106(data);
string result = "充电桩应答后台服务器设置分时段计价策略信息 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩应答后台服务器设置分时段计价策略信息对象:" + JsonConvert.SerializeObject(CMD1106);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 1108:
{
CMD1108 CMD1108 = ConCMD1108(data);
string result = "充电桩回复分时电费计价策略信息 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩回复分时电费计价策略信息对象:" + JsonConvert.SerializeObject(CMD1108);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
#endregion
#region 白名单报文
case 1302:
{
CMD1302 CMD1302 = ConCMD1302(data);
string result = "充电桩应答白名单操作日志数据包 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩应答白名单操作日志数据包对象:" + JsonConvert.SerializeObject(CMD1302);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
#endregion
#region FTP远程升级和FTP方式日志上传
case 1402:
{
CMD1402 CMD1402 = ConCMD1402(data);
string result = "充电桩应答服务器下发FTP远程升级命令- 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩应答服务器下发FTP远程升级命令对象" + JsonConvert.SerializeObject(CMD1402);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 1403:
{
CMD1403 CMD1403 = ConCMD1403(data);
string result = "充电桩应答FTP升级包下载进度 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩应答FTP升级包下载进度对象" + JsonConvert.SerializeObject(CMD1403);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 1407:
{
CMD1407 CMD1407 = ConCMD1407(data);
string result = "充电桩应答服务器下发获取充电桩日志命令 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩应答服务器下发获取充电桩日志命令对象:" + JsonConvert.SerializeObject(CMD1407);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
#endregion
#region 协议方式日志上传
case 1501:
{
CMD1501 CMD1501 = ConCMD1501(data);
string result = "(CMD=1501申请上传文件 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "(CMD=1501申请上传文件对象" + JsonConvert.SerializeObject(CMD1501);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 1503:
{
CMD1503 CMD1503 = ConCMD1503(data);
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1503);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
case 1505://接收完成,要保存关闭
{
CMD1505 CMD1505 = ConCMD1505(data);
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1505);
//Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
#endregion
}
}
public CMD2 ConCMD2(byte[] data)
{
CMD2 CMD2 = null;
if (data != null && data.Length > 0)
{
CMD2 = new CMD2();
CMD2.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD2.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD2.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD2.Type = data[44];
CMD2.SAddress = ByteUtils.DToUInt32(data, 45);
CMD2.SNum = data[50];
CMD2.SResult = data[51];
CMD2.SData = Encoding.ASCII.GetString(data, 52, (data.Length - 52));
}
return CMD2;
}
public CMD4 ConCMD4(byte[] data)
{
CMD4 CMD4 = null;
if (data != null && data.Length > 0)
{
CMD4 = new CMD4();
CMD4.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD4.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD4.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD4.Type = data[44];
CMD4.SAddress = ByteUtils.DToUInt32(data, 45);
CMD4.SResult = data[49];
CMD4.SData = Encoding.ASCII.GetString(data, 50, (data.Length - 51));
}
return CMD4;
}
public CMD6 ConCMD6(byte[] data)
{
CMD6 CMD6 = null;
if (data != null && data.Length > 0)
{
CMD6 = new CMD6();
CMD6.value01 = ByteUtils.DToUInt16(data, 8);
CMD6.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD6.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD6.ChargMuzzle = data[44];
CMD6.CommandMark = ByteUtils.DToUInt32(data, 45);
CMD6.CommandNum = data[49];
CMD6.CommandResult = data[50];
}
return CMD6;
}
public CMD8 ConCMD8(byte[] data)
{
CMD8 CMD8 = null;
if (data != null && data.Length > 0)
{
CMD8 = new CMD8();
CMD8.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD8.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD8.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD8.ChargMuzzle = data[44];
CMD8.CommandResult = ByteUtils.DToUInt16(data, 45);
CMD8.ChargSerialNum = Encoding.ASCII.GetString(data, 49, 32);
}
return CMD8;
}
public CMD10 ConCMD10(byte[] data)
{
CMD10 CMD10 = null;
if (data != null && data.Length > 0)
{
CMD10 = new CMD10();
CMD10.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD10.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD10.ASCIINum = Encoding.ASCII.GetString(data, 12, 32); ;
CMD10.ChargGunNum = data[44];
CMD10.RequestStaIP = ByteUtils.DToUInt32(data, 45);
CMD10.Parameter = (float)((ByteUtils.DToUInt32(data, 49)) * 0.01);
}
return CMD10;
}
public CMD102 ConCMD102(byte[] data)
{
CMD102 CMD102 = null;
if (data != null && data.Length > 0)
{
CMD102 = new CMD102();
CMD102.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD102.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD102.ASCIINum = Encoding.ASCII.GetString(data, 12, 32); ;
CMD102.HeartNum = ByteUtils.DToUInt16(data, 44);
CMD102.GunStatus[0] = data[46];
CMD102.GunStatus[1] = data[47];
CMD102.GunStatus[2] = data[48];
CMD102.GunStatus[3] = data[49];
CMD102.GunStatus[4] = data[50];
CMD102.GunStatus[5] = data[51];
CMD102.GunStatus[6] = data[52];
CMD102.GunStatus[7] = data[53];
CMD102.GunStatus[8] = data[54];
CMD102.GunStatus[9] = data[55];
CMD102.GunStatus[10] = data[56];
CMD102.GunStatus[11] = data[57];
CMD102.GunStatus[12] = data[58];
CMD102.GunStatus[13] = data[59];
CMD102.GunStatus[14] = data[60];
CMD102.GunStatus[15] = data[61];
}
return CMD102;
}
public CMD104 ConCMD104(byte[] data)
{
CMD104 CMD104 = null;
if (data != null && data.Length > 0)
{
CMD104 = new CMD104();
CMD104.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD104.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD104.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD104.ChargGunNum = data[44];
CMD104.ChargNum = data[45];
CMD104.ChargGunType = data[46];
CMD104.WorkState = data[47];
CMD104.SOCNOW = data[48];
CMD104.MaxAlarmCode = Encoding.ASCII.GetString(data, 49, 4);
CMD104.ConnecteState = data[53];
CMD104.TotalCost = (float)(ByteUtils.DToUInt32(data, 54) * 0.01);
CMD104.Reserved3 = ByteUtils.DToUInt32(data, 58);
CMD104.Reserved4 = ByteUtils.DToUInt32(data, 62);
if (data[46] == 1)
{
CMD104.DcChargVoltage = ByteUtils.DToUInt16(data, 66);
CMD104.DcChargCurrent = ByteUtils.DToUInt16(data, 68);
CMD104.BMSDemVoltage = ByteUtils.DToUInt16(data, 70);
CMD104.BMSDemCurrent = ByteUtils.DToUInt16(data, 72);
}
else
{
CMD104.DcChargVoltage = 0;
CMD104.DcChargCurrent = 0;
CMD104.BMSDemVoltage = 0;
CMD104.BMSDemCurrent = 0;
}
CMD104.BMSchargMode = data[74];
CMD104.AcChargVoltageA = ByteUtils.DToUInt16(data, 75);
CMD104.AcChargVoltageB = ByteUtils.DToUInt16(data, 77);
CMD104.AcChargVoltageC = ByteUtils.DToUInt16(data, 79);
CMD104.AcChargCurrentA = ByteUtils.DToUInt16(data, 81);
CMD104.AcChargCurrentB = ByteUtils.DToUInt16(data, 83);
CMD104.AcChargCurrentC = ByteUtils.DToUInt16(data, 85);
CMD104.RemainTime = ByteUtils.DToUInt16(data, 87);
CMD104.ChargTime = ByteUtils.DToUInt32(data, 89);
CMD104.TotalChargkwh = ByteUtils.DToUInt32(data, 93);
CMD104.StartAmmeterValue = (float)(ByteUtils.DToUInt32(data, 97) * 0.01);
CMD104.AmmeterValue = (float)(ByteUtils.DToUInt32(data, 101) * 0.01);
CMD104.ChargStartMode = data[105];
CMD104.ChargStrategy = data[106];
CMD104.ChargStrategyPara = ByteUtils.DToUInt32(data, 107);
CMD104.AppointmentSign = data[111];
CMD104.ChargID = Encoding.ASCII.GetString(data, 112, 32);
CMD104.OutTime = data[144];
CMD104.StartTime = Encoding.ASCII.GetString(data, 145, 8);
CMD104.InitialBalance = ByteUtils.DToUInt32(data, 153);
CMD104.Reserved5 = ByteUtils.DToUInt32(data, 157);
CMD104.ChargPower = (float)(ByteUtils.DToUInt32(data, 161) * 0.1);
CMD104.Reserved6 = ByteUtils.DToUInt32(data, 165);
CMD104.Reserved7 = ByteUtils.DToUInt32(data, 169);
CMD104.Reserved8 = ByteUtils.DToUInt32(data, 173);
CMD104.OutletTemp = data[177];
CMD104.Temperature = data[178];
CMD104.ChargGunTemp = data[179];
CMD104.VINNum = Encoding.ASCII.GetString(data, 180, 18);
CMD104.DoorState = data[198];
CMD104.ChargSerialNum = Encoding.ASCII.GetString(data, 199, 32);
CMD104.TotalElectricity = ByteUtils.DToUInt32(data, 231);
CMD104.ServiceCharge = ByteUtils.DToUInt32(data, 235);
CMD104.HomingState = data[239];
CMD104.GroundLockedState = data[240];
CMD104.KilojoulesElec = data[241];
CMD104.DcACElectricity = ((float)(ByteUtils.DToUInt32(data, 242) * 0.001)).ToString("F1");
CMD104.ChargMode = data[246];
CMD104.ChargeOrDisSign = data[247];
}
return CMD104;
}
public CMD106 ConCMD106(byte[] data)
{
CMD106 CMD106 = null;
if (data != null && data.Length > 0)
{
CMD106 = new CMD106();
CMD106.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD106.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD106.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD106.Sign = data[44];
CMD106.ChargVersion = ByteUtils.DToUInt32(data, 45);
CMD106.ChargProType = ByteUtils.DToUInt16(data, 49);
CMD106.StartNum = ByteUtils.DToUInt32(data, 51);
CMD106.DataUploadMode = data[55];
CMD106.SignInterval = ByteUtils.DToUInt16(data, 56);
CMD106.RunVariable = data[58];
CMD106.ChargGunNum = data[59];
CMD106.HeartReportCycle = data[60];
CMD106.TimeoutNum = data[61];
CMD106.RecordNum = ByteUtils.DToUInt32(data, 62);
CMD106.SystemTime = Encoding.ASCII.GetString(data, 66, 8);
CMD106.Reserved3 = Encoding.ASCII.GetString(data, 74, 8);
CMD106.Reserved4 = Encoding.ASCII.GetString(data, 82, 8);
CMD106.Reserved5 = Encoding.ASCII.GetString(data, 90, 8);
CMD106.RandomNum = ByteUtils.DToUInt32(data, 98);
CMD106.ProtocolVersion = ByteUtils.DToUInt16(data, 102);
CMD106.WhiteVersionNum = ByteUtils.DToUInt16(data, 104);
CMD106.DeviceType = data[108];
CMD106.AssetCoding = Encoding.ASCII.GetString(data, 109, 32);
}
return CMD106;
}
public CMD108 ConCMD108(byte[] data)
{
CMD108 CMD108 = null;
if (data != null && data.Length > 0)
{
CMD108 = new CMD108();
CMD108.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD108.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD108.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD108.AlarmBitInfo = Encoding.ASCII.GetString(data, 44, 32);
}
return CMD108;
}
public CMD110 ConCMD110(byte[] data)
{
CMD110 CMD110 = null;
if (data != null && data.Length > 0)
{
CMD110 = new CMD110();
CMD110.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD110.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD110.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD110.ChargGunNum = data[44];
CMD110.ChargeFail = ByteUtils.DToUInt32(data, 45);
CMD110.SendMessage = ByteUtils.DToUInt16(data, 49);
CMD110.Reserved3 = ByteUtils.DToUInt16(data, 51);
CMD110.Reserved4 = ByteUtils.DToUInt32(data, 53);
byte version1 = data[58];
byte version2 = data[59];
byte version3 = data[60];
CMD110.BRMBMSVersionNum = "v" + version1.ToString() + version2.ToString() + version3.ToString();
CMD110.BRMBatteryType = data[61];
CMD110.BRMRatedCapacity = ByteUtils.DToUInt32(data, 62);
CMD110.BRMRatedVoltage = ByteUtils.DToUInt32(data, 66);
CMD110.BRMBatteryManu = ByteUtils.DToUInt32(data, 70);
CMD110.BRMBatteryPackID = ByteUtils.DToUInt32(data, 74);
CMD110.BRMDateYear = ByteUtils.DToUInt16(data, 78);
CMD110.BRMDateMonth = data[80];
CMD110.BRMDateDay = data[81];
CMD110.BRMChargeCount = ByteUtils.DToUInt32(data, 82);
CMD110.BRMTitleMark = data[86];
CMD110.Reserved5 = data[87];
CMD110.BRMVINID = Encoding.ASCII.GetString(data, 88, 17);
byte VersionSerialNum = data[105];
byte day = data[106];
byte month = data[107];
ushort year = ByteUtils.DToUInt16(data, 108);
CMD110.BRMBMSSoftVerNum = VersionSerialNum.ToString() + year.ToString() + "年" + month.ToString() + "月" + day.ToString() + "日";
CMD110.MaxChargVoltage = (float)(ByteUtils.DToUInt32(data, 113) * 0.1);
CMD110.MaxChargCurrent = (float)(ByteUtils.DToUInt32(data, 117) * 0.1);
CMD110.TotalEnergy = (float)(ByteUtils.DToUInt32(data, 121) * 0.1);
CMD110.MaxTotalVoltage = (float)(ByteUtils.DToUInt32(data, 125) * 0.1);
CMD110.MaxTemp = data[129];
CMD110.ChargeState = (float)(ByteUtils.DToUInt16(data, 130) * 0.1);
CMD110.CellVoltage = (float)(ByteUtils.DToUInt32(data, 132) * 0.1);
CMD110.ChargSerialNum = Encoding.ASCII.GetString(data, 136, 32);
}
return CMD110;
}
public CMD112 ConCMD112(byte[] data)
{
CMD112 CMD112 = null;
if (data != null && data.Length > 0)
{
CMD112 = new CMD112();
CMD112.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD112.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD112.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD112.ReportMode = data[44];
CMD112.ModuleNum = data[45];
CMD112.ModuleType = data[46];
CMD112.ACModuleversion1 = ByteUtils.DToUInt16(data, 47);
CMD112.DCModuleversion1 = ByteUtils.DToUInt16(data, 49);
CMD112.ModuleState1 = data[51];
CMD112.ModuleOutVoltage1 = ByteUtils.DToUInt16(data, 52);
CMD112.ModuleOutCurrent1 = ByteUtils.DToUInt16(data, 54);
CMD112.ModuleAlarm1 = ByteUtils.DToUInt32(data, 56);
CMD112.ACModuleversion2 = ByteUtils.DToUInt16(data, 60);
CMD112.DCModuleversion2 = ByteUtils.DToUInt16(data, 62);
CMD112.ModuleState2 = data[64];
CMD112.ModuleOutVoltage2 = ByteUtils.DToUInt16(data, 65);
CMD112.ModuleOutCurrent2 = ByteUtils.DToUInt16(data, 67);
CMD112.ModuleAlarm2 = ByteUtils.DToUInt32(data, 69);
}
return CMD112;
}
public CMD114 ConCMD114(byte[] data)
{
CMD114 CMD114 = null;
if (data != null && data.Length > 0)
{
CMD114 = new CMD114();
CMD114.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD114.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD114.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD114.ChargGunNum = data[44];
CMD114.WorkState = data[45];
CMD114.StartChargTime = Encoding.ASCII.GetString(data, 46, 8);
/*
7 54
8 56
9 58
10 60
11 62
12 64
13 66
14 68
15 70
16 72
17 74
18 76
19 78
20 80
21 82
22 84
23 86
24 88
25 90
26 92
27 94
28 96
29 98
30 100
31 102
32 104
33 106
34 108
35 110
36 112
37 114
38 116
39 118
40 120
41 122
42 124
43 126
44 128
45 130
46 132
47 134
48 136
49 138
50 140
51 142
52 144
53 146
54 148
*/
CMD114.Charge01 = ByteUtils.DToUInt16(data, 54);
CMD114.Charge02 = ByteUtils.DToUInt16(data, 56);
CMD114.Charge03 = ByteUtils.DToUInt16(data, 58);
CMD114.Charge04 = ByteUtils.DToUInt16(data, 60);
CMD114.Charge05 = ByteUtils.DToUInt16(data, 62);
CMD114.Charge06 = ByteUtils.DToUInt16(data, 64);
CMD114.Charge07 = ByteUtils.DToUInt16(data, 66);
CMD114.Charge08 = ByteUtils.DToUInt16(data, 68);
CMD114.Charge09 = ByteUtils.DToUInt16(data, 70);
CMD114.Charge10 = ByteUtils.DToUInt16(data, 72);
CMD114.Charge11 = ByteUtils.DToUInt16(data, 74);
CMD114.Charge12 = ByteUtils.DToUInt16(data, 76);
CMD114.Charge13 = ByteUtils.DToUInt16(data, 78);
CMD114.Charge14 = ByteUtils.DToUInt16(data, 80);
CMD114.Charge15 = ByteUtils.DToUInt16(data, 82);
CMD114.Charge16 = ByteUtils.DToUInt16(data, 84);
CMD114.Charge17 = ByteUtils.DToUInt16(data, 86);
CMD114.Charge18 = ByteUtils.DToUInt16(data, 88);
CMD114.Charge19 = ByteUtils.DToUInt16(data, 90);
CMD114.Charge20 = ByteUtils.DToUInt16(data, 92);
CMD114.Charge21 = ByteUtils.DToUInt16(data, 94);
CMD114.Charge22 = ByteUtils.DToUInt16(data, 96);
CMD114.Charge23 = ByteUtils.DToUInt16(data, 98);
CMD114.Charge24 = ByteUtils.DToUInt16(data, 100);
CMD114.Charge25 = ByteUtils.DToUInt16(data, 102);
CMD114.Charge26 = ByteUtils.DToUInt16(data, 104);
CMD114.Charge27 = ByteUtils.DToUInt16(data, 106);
CMD114.Charge29 = ByteUtils.DToUInt16(data, 108);
CMD114.Charge30 = ByteUtils.DToUInt16(data, 110);
CMD114.Charge31 = ByteUtils.DToUInt16(data, 112);
CMD114.Charge32 = ByteUtils.DToUInt16(data, 114);
CMD114.Charge33 = ByteUtils.DToUInt16(data, 116);
CMD114.Charge34 = ByteUtils.DToUInt16(data, 118);
CMD114.Charge35 = ByteUtils.DToUInt16(data, 120);
CMD114.Charge36 = ByteUtils.DToUInt16(data, 122);
CMD114.Charge37 = ByteUtils.DToUInt16(data, 124);
CMD114.Charge38 = ByteUtils.DToUInt16(data, 126);
CMD114.Charge39 = ByteUtils.DToUInt16(data, 128);
CMD114.Charge40 = ByteUtils.DToUInt16(data, 130);
CMD114.Charge41 = ByteUtils.DToUInt16(data, 132);
}
return CMD114;
}
public CMD202 ConCMD202(uint func, byte[] data)
{
CMD202 CMD202 = null;
if (data != null && data.Length > 0)
{
CMD202 = new CMD202();
CMD202.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD202.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD202.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD202.PosType = data[44];
CMD202.ChargGun = data[45];
CMD202.ChargID = Encoding.ASCII.GetString(data, 46, 32);
CMD202.StartTime = Encoding.ASCII.GetString(data, 78, 8);
CMD202.EndTime = Encoding.ASCII.GetString(data, 86, 8);
CMD202.TimeSpan = ByteUtils.DToUInt32(data, 94);
CMD202.SOCStart = data[98];
CMD202.SOCEnd = data[99];
CMD202.EndReason = ByteUtils.DToUInt32(data, 100);
if (func == 202)
{
CMD202.ChargCapacityNow = (ByteUtils.DToUInt32(data, 104) * 0.01).ToString("F2");
CMD202.SAmmeterValue = (ByteUtils.DToUInt32(data, 108) * 0.01).ToString("F2");
CMD202.EAmmeterValue = (ByteUtils.DToUInt32(data, 112) * 0.01).ToString("F2");
CMD202.ChargCapacity01 = ByteUtils.DToUInt16(data, 167).ToString();
CMD202.ChargCapacity02 = ByteUtils.DToUInt16(data, 169).ToString();
CMD202.ChargCapacity03 = ByteUtils.DToUInt16(data, 171).ToString();
CMD202.ChargCapacity04 = ByteUtils.DToUInt16(data, 173).ToString();
CMD202.ChargCapacity05 = ByteUtils.DToUInt16(data, 175).ToString();
CMD202.ChargCapacity06 = ByteUtils.DToUInt16(data, 177).ToString();
CMD202.ChargCapacity07 = ByteUtils.DToUInt16(data, 179).ToString();
CMD202.ChargCapacity08 = ByteUtils.DToUInt16(data, 181).ToString();
CMD202.ChargCapacity09 = ByteUtils.DToUInt16(data, 183).ToString();
CMD202.ChargCapacity10 = ByteUtils.DToUInt16(data, 185).ToString();
CMD202.ChargCapacity11 = ByteUtils.DToUInt16(data, 187).ToString();
CMD202.ChargCapacity12 = ByteUtils.DToUInt16(data, 189).ToString();
CMD202.ChargCapacity13 = ByteUtils.DToUInt16(data, 191).ToString();
CMD202.ChargCapacity14 = ByteUtils.DToUInt16(data, 193).ToString();
CMD202.ChargCapacity15 = ByteUtils.DToUInt16(data, 195).ToString();
CMD202.ChargCapacity16 = ByteUtils.DToUInt16(data, 197).ToString();
CMD202.ChargCapacity17 = ByteUtils.DToUInt16(data, 199).ToString();
CMD202.ChargCapacity18 = ByteUtils.DToUInt16(data, 201).ToString();
CMD202.ChargCapacity19 = ByteUtils.DToUInt16(data, 203).ToString();
CMD202.ChargCapacity20 = ByteUtils.DToUInt16(data, 205).ToString();
CMD202.ChargCapacity21 = ByteUtils.DToUInt16(data, 207).ToString();
CMD202.ChargCapacity22 = ByteUtils.DToUInt16(data, 209).ToString();
CMD202.ChargCapacity23 = ByteUtils.DToUInt16(data, 211).ToString();
CMD202.ChargCapacity24 = ByteUtils.DToUInt16(data, 213).ToString();
CMD202.ChargCapacity25 = ByteUtils.DToUInt16(data, 215).ToString();
CMD202.ChargCapacity26 = ByteUtils.DToUInt16(data, 217).ToString();
CMD202.ChargCapacity27 = ByteUtils.DToUInt16(data, 219).ToString();
CMD202.ChargCapacity28 = ByteUtils.DToUInt16(data, 221).ToString();
CMD202.ChargCapacity29 = ByteUtils.DToUInt16(data, 223).ToString();
CMD202.ChargCapacity30 = ByteUtils.DToUInt16(data, 225).ToString();
CMD202.ChargCapacity31 = ByteUtils.DToUInt16(data, 227).ToString();
CMD202.ChargCapacity32 = ByteUtils.DToUInt16(data, 229).ToString();
CMD202.ChargCapacity33 = ByteUtils.DToUInt16(data, 231).ToString();
CMD202.ChargCapacity34 = ByteUtils.DToUInt16(data, 233).ToString();
CMD202.ChargCapacity35 = ByteUtils.DToUInt16(data, 235).ToString();
CMD202.ChargCapacity36 = ByteUtils.DToUInt16(data, 237).ToString();
CMD202.ChargCapacity37 = ByteUtils.DToUInt16(data, 239).ToString();
CMD202.ChargCapacity38 = ByteUtils.DToUInt16(data, 241).ToString();
CMD202.ChargCapacity39 = ByteUtils.DToUInt16(data, 243).ToString();
CMD202.ChargCapacity40 = ByteUtils.DToUInt16(data, 245).ToString();
CMD202.ChargCapacity41 = ByteUtils.DToUInt16(data, 247).ToString();
CMD202.ChargCapacity42 = ByteUtils.DToUInt16(data, 249).ToString();
CMD202.ChargCapacity43 = ByteUtils.DToUInt16(data, 251).ToString();
CMD202.ChargCapacity44 = ByteUtils.DToUInt16(data, 253).ToString();
CMD202.ChargCapacity45 = ByteUtils.DToUInt16(data, 255).ToString();
CMD202.ChargCapacity46 = ByteUtils.DToUInt16(data, 257).ToString();
CMD202.ChargCapacity47 = ByteUtils.DToUInt16(data, 259).ToString();
CMD202.ChargCapacity48 = ByteUtils.DToUInt16(data, 261).ToString();
CMD202.StartMode = data[263];
CMD202.ChargSerialNum = Encoding.ASCII.GetString(data, 264, 32);
CMD202.ChargServiceCost = ByteUtils.DToUInt32(data, 296);
CMD202.KilElectricity = data[300];
CMD202.ParallelMark = data[301];
CMD202.ChargeOrDisMark = data[302];
CMD202.MeterEncData = Encoding.ASCII.GetString(data, 303, 34);
CMD202.MeterNum = Encoding.ASCII.GetString(data, 337, 6);
CMD202.MeterProVersion = ByteUtils.DToUInt16(data, 343);
CMD202.EncMode = data[345];
}
else if (func == 222)
{
CMD202.ChargCapacityNow = (ByteUtils.DToUInt32(data, 104) * 0.001).ToString("F3");
CMD202.SAmmeterValue = (ByteUtils.DToUInt32(data, 108) * 0.001).ToString("F3");
CMD202.EAmmeterValue = (ByteUtils.DToUInt32(data, 112) * 0.001).ToString("F3");
CMD202.ChargCapacity01 = (ByteUtils.DToUInt32(data, 167) * 0.001).ToString("F3");
CMD202.ChargCapacity02 = (ByteUtils.DToUInt32(data, 171) * 0.001).ToString("F3");
CMD202.ChargCapacity03 = (ByteUtils.DToUInt32(data, 175) * 0.001).ToString("F3");
CMD202.ChargCapacity04 = (ByteUtils.DToUInt32(data, 179) * 0.001).ToString("F3");
CMD202.ChargCapacity05 = (ByteUtils.DToUInt32(data, 183) * 0.001).ToString("F3");
CMD202.ChargCapacity06 = (ByteUtils.DToUInt32(data, 187) * 0.001).ToString("F3");
CMD202.ChargCapacity07 = (ByteUtils.DToUInt32(data, 191) * 0.001).ToString("F3");
CMD202.ChargCapacity08 = (ByteUtils.DToUInt32(data, 195) * 0.001).ToString("F3");
CMD202.ChargCapacity09 = (ByteUtils.DToUInt32(data, 199) * 0.001).ToString("F3");
CMD202.ChargCapacity10 = (ByteUtils.DToUInt32(data, 203) * 0.001).ToString("F3");
CMD202.ChargCapacity11 = (ByteUtils.DToUInt32(data, 207) * 0.001).ToString("F3");
CMD202.ChargCapacity12 = (ByteUtils.DToUInt32(data, 211) * 0.001).ToString("F3");
CMD202.ChargCapacity13 = (ByteUtils.DToUInt32(data, 215) * 0.001).ToString("F3");
CMD202.ChargCapacity14 = (ByteUtils.DToUInt32(data, 219) * 0.001).ToString("F3");
CMD202.ChargCapacity15 = (ByteUtils.DToUInt32(data, 223) * 0.001).ToString("F3");
CMD202.ChargCapacity16 = (ByteUtils.DToUInt32(data, 227) * 0.001).ToString("F3");
CMD202.ChargCapacity17 = (ByteUtils.DToUInt32(data, 231) * 0.001).ToString("F3");
CMD202.ChargCapacity18 = (ByteUtils.DToUInt32(data, 235) * 0.001).ToString("F3");
CMD202.ChargCapacity19 = (ByteUtils.DToUInt32(data, 239) * 0.001).ToString("F3");
CMD202.ChargCapacity20 = (ByteUtils.DToUInt32(data, 243) * 0.001).ToString("F3");
CMD202.ChargCapacity21 = (ByteUtils.DToUInt32(data, 247) * 0.001).ToString("F3");
CMD202.ChargCapacity22 = (ByteUtils.DToUInt32(data, 251) * 0.001).ToString("F3");
CMD202.ChargCapacity23 = (ByteUtils.DToUInt32(data, 255) * 0.001).ToString("F3");
CMD202.ChargCapacity24 = (ByteUtils.DToUInt32(data, 259) * 0.001).ToString("F3");
CMD202.ChargCapacity25 = (ByteUtils.DToUInt32(data, 263) * 0.001).ToString("F3");
CMD202.ChargCapacity26 = (ByteUtils.DToUInt32(data, 267) * 0.001).ToString("F3");
CMD202.ChargCapacity27 = (ByteUtils.DToUInt32(data, 271) * 0.001).ToString("F3");
CMD202.ChargCapacity28 = (ByteUtils.DToUInt32(data, 275) * 0.001).ToString("F3");
CMD202.ChargCapacity29 = (ByteUtils.DToUInt32(data, 279) * 0.001).ToString("F3");
CMD202.ChargCapacity30 = (ByteUtils.DToUInt32(data, 283) * 0.001).ToString("F3");
CMD202.ChargCapacity31 = (ByteUtils.DToUInt32(data, 287) * 0.001).ToString("F3");
CMD202.ChargCapacity32 = (ByteUtils.DToUInt32(data, 291) * 0.001).ToString("F3");
CMD202.ChargCapacity33 = (ByteUtils.DToUInt32(data, 295) * 0.001).ToString("F3");
CMD202.ChargCapacity34 = (ByteUtils.DToUInt32(data, 299) * 0.001).ToString("F3");
CMD202.ChargCapacity35 = (ByteUtils.DToUInt32(data, 303) * 0.001).ToString("F3");
CMD202.ChargCapacity36 = (ByteUtils.DToUInt32(data, 307) * 0.001).ToString("F3");
CMD202.ChargCapacity37 = (ByteUtils.DToUInt32(data, 311) * 0.001).ToString("F3");
CMD202.ChargCapacity38 = (ByteUtils.DToUInt32(data, 315) * 0.001).ToString("F3");
CMD202.ChargCapacity39 = (ByteUtils.DToUInt32(data, 319) * 0.001).ToString("F3");
CMD202.ChargCapacity40 = (ByteUtils.DToUInt32(data, 323) * 0.001).ToString("F3");
CMD202.ChargCapacity41 = (ByteUtils.DToUInt32(data, 327) * 0.001).ToString("F3");
CMD202.ChargCapacity42 = (ByteUtils.DToUInt32(data, 331) * 0.001).ToString("F3");
CMD202.ChargCapacity43 = (ByteUtils.DToUInt32(data, 335) * 0.001).ToString("F3");
CMD202.ChargCapacity44 = (ByteUtils.DToUInt32(data, 339) * 0.001).ToString("F3");
CMD202.ChargCapacity45 = (ByteUtils.DToUInt32(data, 343) * 0.001).ToString("F3");
CMD202.ChargCapacity46 = (ByteUtils.DToUInt32(data, 347) * 0.001).ToString("F3");
CMD202.ChargCapacity47 = (ByteUtils.DToUInt32(data, 351) * 0.001).ToString("F3");
CMD202.ChargCapacity48 = (ByteUtils.DToUInt32(data, 355) * 0.001).ToString("F3");
CMD202.StartMode = data[359];
CMD202.ChargSerialNum = Encoding.ASCII.GetString(data, 360, 32);
CMD202.ChargServiceCost = ByteUtils.DToUInt32(data, 392);
CMD202.KilElectricity = data[396];
CMD202.ParallelMark = data[397];
CMD202.ChargeOrDisMark = data[398];
CMD202.MeterEncData = Encoding.ASCII.GetString(data, 399, 34);
CMD202.MeterNum = Encoding.ASCII.GetString(data, 433, 6);
CMD202.MeterProVersion = ByteUtils.DToUInt16(data, 439);
CMD202.EncMode = data[441];
}
CMD202.ChargeAmount = ByteUtils.DToUInt32(data, 116);
CMD202.IndexNum = BitConverter.ToInt32(data, 120);
CMD202.CardBalance = ByteUtils.DToUInt32(data, 124);
CMD202.ChargRecord = ByteUtils.DToUInt32(data, 128);
CMD202.SumChargRecord = ByteUtils.DToUInt32(data, 132);
CMD202.Reserved3 = data[136];
CMD202.ChargStrategy = data[137];
switch (data[137])
{
case 1:
CMD202.ChargStrategyPara = ByteUtils.DToUInt32(data, 138).ToString();
break;
case 2:
CMD202.ChargStrategyPara = (ByteUtils.DToUInt32(data, 138) * 0.01).ToString("F2");
break;
case 3:
CMD202.ChargStrategyPara = (ByteUtils.DToUInt32(data, 138) * 0.01).ToString("F2");
break;
}
CMD202.CarVIN = Encoding.ASCII.GetString(data, 142, 17);
CMD202.CarID = Encoding.ASCII.GetString(data, 159, 8);
}
return CMD202;
}
public CMD204 ConCMD204(byte[] data)
{
CMD204 CMD204 = null;
if (data != null && data.Length > 0)
{
CMD204 = new CMD204();
CMD204.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD204.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD204.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD204.ChargID = Encoding.ASCII.GetString(data, 44, 32);
CMD204.Balance = ByteUtils.DToUInt32(data, 76);
CMD204.BlacklistSign = data[80];
CMD204.ChargCardPassword = Encoding.ASCII.GetString(data, 81, 32);
CMD204.RandomData = Encoding.ASCII.GetString(data, 113, 48);
CMD204.M1CardID = ByteUtils.DToUInt32(data, 161);
CMD204.Auth = data[165];
CMD204.ChargGunNum = data[166];
}
return CMD204;
}
public CMD206 ConCMD206(byte[] data)
{
CMD206 CMD206 = null;
if (data != null && data.Length > 0)
{
CMD206 = new CMD206();
CMD206.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD206.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD206.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD206.ChargID = Encoding.ASCII.GetString(data, 44, 32);
CMD206.ChargPassword = Encoding.ASCII.GetString(data, 76, 32);
CMD206.RandomData = Encoding.ASCII.GetString(data, 108, 48);
}
return CMD206;
}
public CMD208 ConCMD208(byte[] data)
{
CMD208 CMD208 = null;
if (data != null && data.Length > 0)
{
CMD208 = new CMD208();
CMD208.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD208.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD208.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD208.ChargGunNum = data[44];
CMD208.VINNum = Encoding.ASCII.GetString(data, 45, 17);
CMD208.ChargStrategy = data[62];
CMD208.ChargStrategyPara = ByteUtils.DToUInt32(data, 63);
}
return CMD208;
}
public CMD210 ConCMD210(byte[] data)
{
CMD210 CMD210 = null;
if (data != null && data.Length > 0)
{
CMD210 = new CMD210();
CMD210.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD210.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD210.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD210.ChargGunNum = data[44];
CMD210.StartResult = ByteUtils.DToUInt32(data, 45);
}
return CMD210;
}
public CMD222 ConCMD222(byte[] data)
{
CMD222 CMD222 = null;
if (data != null && data.Length > 0)
{
CMD222 = new CMD222();
CMD222.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD222.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD222.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD222.PosType = data[44];
CMD222.ChargGun = data[45];
CMD222.ChargID = Encoding.ASCII.GetString(data, 46, 32);
CMD222.StartTime = Encoding.ASCII.GetString(data, 78, 8);
CMD222.EndTime = Encoding.ASCII.GetString(data, 86, 8);
CMD222.TimeSpan = ByteUtils.DToUInt32(data, 94);
CMD222.SOCStart = data[98];
CMD222.SOCEnd = data[99];
CMD222.EndReason = ByteUtils.DToUInt32(data, 100);
CMD222.ChargCapacityNow = ByteUtils.DToUInt32(data, 104);
CMD222.SAmmeterValue = ByteUtils.DToUInt32(data, 108);
CMD222.EAmmeterValue = ByteUtils.DToUInt32(data, 112);
CMD222.ChargeAmount = ByteUtils.DToUInt32(data, 116);
CMD222.IndexNum = ByteUtils.DToUInt32(data, 120);
CMD222.CardBalance = ByteUtils.DToUInt32(data, 124);
CMD222.ChargRecord = ByteUtils.DToUInt32(data, 128);
CMD222.SumChargRecord = ByteUtils.DToUInt32(data, 132);
CMD222.Reserved3 = data[136];
CMD222.ChargStrategy = data[137];
CMD222.ChargStrategyPara = ByteUtils.DToUInt32(data, 138);
CMD222.CarVIN = Encoding.ASCII.GetString(data, 142, 17);
CMD222.CarID = Encoding.ASCII.GetString(data, 159, 8);
CMD222.ChargCapacity01 = (int)ByteUtils.DToUInt32(data, 167);
CMD222.ChargCapacity02 = (int)ByteUtils.DToUInt32(data, 171);
CMD222.ChargCapacity03 = (int)ByteUtils.DToUInt32(data, 175);
CMD222.ChargCapacity04 = (int)ByteUtils.DToUInt32(data, 179);
CMD222.ChargCapacity05 = (int)ByteUtils.DToUInt32(data, 183);
CMD222.ChargCapacity06 = (int)ByteUtils.DToUInt32(data, 187);
CMD222.ChargCapacity07 = (int)ByteUtils.DToUInt32(data, 191);
CMD222.ChargCapacity08 = (int)ByteUtils.DToUInt32(data, 195);
CMD222.ChargCapacity09 = (int)ByteUtils.DToUInt32(data, 199);
CMD222.ChargCapacity10 = (int)ByteUtils.DToUInt32(data, 203);
CMD222.ChargCapacity11 = (int)ByteUtils.DToUInt32(data, 207);
CMD222.ChargCapacity12 = (int)ByteUtils.DToUInt32(data, 211);
CMD222.ChargCapacity13 = (int)ByteUtils.DToUInt32(data, 215);
CMD222.ChargCapacity14 = (int)ByteUtils.DToUInt32(data, 219);
CMD222.ChargCapacity15 = (int)ByteUtils.DToUInt32(data, 223);
CMD222.ChargCapacity16 = (int)ByteUtils.DToUInt32(data, 227);
CMD222.ChargCapacity17 = (int)ByteUtils.DToUInt32(data, 231);
CMD222.ChargCapacity18 = (int)ByteUtils.DToUInt32(data, 235);
CMD222.ChargCapacity19 = (int)ByteUtils.DToUInt32(data, 239);
CMD222.ChargCapacity20 = (int)ByteUtils.DToUInt32(data, 243);
CMD222.ChargCapacity21 = (int)ByteUtils.DToUInt32(data, 247);
CMD222.ChargCapacity22 = (int)ByteUtils.DToUInt32(data, 251);
CMD222.ChargCapacity23 = (int)ByteUtils.DToUInt32(data, 255);
CMD222.ChargCapacity24 = (int)ByteUtils.DToUInt32(data, 259);
CMD222.ChargCapacity25 = (int)ByteUtils.DToUInt32(data, 263);
CMD222.ChargCapacity26 = (int)ByteUtils.DToUInt32(data, 267);
CMD222.ChargCapacity27 = (int)ByteUtils.DToUInt32(data, 271);
CMD222.ChargCapacity28 = (int)ByteUtils.DToUInt32(data, 275);
CMD222.ChargCapacity29 = (int)ByteUtils.DToUInt32(data, 279);
CMD222.ChargCapacity30 = (int)ByteUtils.DToUInt32(data, 283);
CMD222.ChargCapacity31 = (int)ByteUtils.DToUInt32(data, 287);
CMD222.ChargCapacity32 = (int)ByteUtils.DToUInt32(data, 291);
CMD222.ChargCapacity33 = (int)ByteUtils.DToUInt32(data, 295);
CMD222.ChargCapacity34 = (int)ByteUtils.DToUInt32(data, 299);
CMD222.ChargCapacity35 = (int)ByteUtils.DToUInt32(data, 303);
CMD222.ChargCapacity36 = (int)ByteUtils.DToUInt32(data, 307);
CMD222.ChargCapacity37 = (int)ByteUtils.DToUInt32(data, 311);
CMD222.ChargCapacity38 = (int)ByteUtils.DToUInt32(data, 315);
CMD222.ChargCapacity39 = (int)ByteUtils.DToUInt32(data, 319);
CMD222.ChargCapacity40 = (int)ByteUtils.DToUInt32(data, 323);
CMD222.ChargCapacity41 = (int)ByteUtils.DToUInt32(data, 327);
CMD222.ChargCapacity42 = (int)ByteUtils.DToUInt32(data, 331);
CMD222.ChargCapacity43 = (int)ByteUtils.DToUInt32(data, 335);
CMD222.ChargCapacity44 = (int)ByteUtils.DToUInt32(data, 339);
CMD222.ChargCapacity45 = (int)ByteUtils.DToUInt32(data, 343);
CMD222.ChargCapacity46 = (int)ByteUtils.DToUInt32(data, 347);
CMD222.ChargCapacity47 = (int)ByteUtils.DToUInt32(data, 351);
CMD222.ChargCapacity48 = (int)ByteUtils.DToUInt32(data, 355);
CMD222.StartMode = data[359];
CMD222.ChargSerialNum = Encoding.ASCII.GetString(data, 360, 32);
CMD222.ChargServiceCost = ByteUtils.DToUInt32(data, 392);
CMD222.KilElectricity = data[394];
CMD222.ParallelMark = data[395];
CMD222.ChargeOrDisMark = data[396];
CMD222.MeterEncData = data[397];
CMD222.MeterNum = Encoding.ASCII.GetString(data, 398, 6);
CMD222.MeterProVersion = ByteUtils.DToUInt16(data, 404);
CMD222.EncMode = data[408];
}
return CMD222;
}
public CMD302 ConCMD302(byte[] data)
{
CMD302 CMD302 = null;
if (data != null && data.Length > 0)
{
CMD302 = new CMD302();
CMD302.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD302.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD302.MessageOrderNum = ByteUtils.DToUInt16(data, 12);
CMD302.ChargGunNum = ByteUtils.DToUInt16(data, 14);
CMD302.ASCIINum = Encoding.ASCII.GetString(data, 16, 32);
CMD302.WorkState = data[48];
CMD302.connectState = data[49];
CMD302.BRMBMSVersionNum = data[50];
CMD302.BRMBatteryType = data[51];
CMD302.BRMRatedCapacity = ByteUtils.DToUInt32(data, 52);
CMD302.BRMRatedVoltage = ByteUtils.DToUInt32(data, 56);
CMD302.BRMBatteryManu = ByteUtils.DToUInt32(data, 60);
CMD302.BRMBatteryPackID = ByteUtils.DToUInt32(data, 64);
CMD302.BRMDateYear = ByteUtils.DToUInt16(data, 68);
CMD302.BRMDateMonth = data[70];
CMD302.BRMDateDay = data[71];
CMD302.BRMChargeCount = ByteUtils.DToUInt32(data, 72);
CMD302.BRMTitleMark = data[76];
CMD302.Reserved3 = data[77];
CMD302.BRMVINID = Encoding.ASCII.GetString(data, 78, 17);
CMD302.BRMBMSSoftVerNum = ByteUtils.DToUInt16(data, 95);
CMD302.MaxChargVoltage = ByteUtils.DToUInt32(data, 103);
CMD302.MaxChargCurrent = ByteUtils.DToUInt32(data, 107);
CMD302.TotalEnergy = ByteUtils.DToUInt32(data, 111);
CMD302.MaxTotalVoltage = ByteUtils.DToUInt32(data, 115);
CMD302.MaxTemp = data[119];
CMD302.ChargeState = ByteUtils.DToUInt16(data, 120);
CMD302.CellVoltage = ByteUtils.DToUInt32(data, 122);
CMD302.ChargePrepared = data[126];
CMD302.BCLVoltage = ByteUtils.DToUInt32(data, 127);
CMD302.BCLCurrent = ByteUtils.DToUInt32(data, 131);
CMD302.BCLChargMode = data[135];
CMD302.BCSVoltageValue = ByteUtils.DToUInt32(data, 136);
CMD302.BCSCurrentValue = ByteUtils.DToUInt32(data, 140);
CMD302.BCSVoltageMAX = ByteUtils.DToUInt32(data, 144);
CMD302.BCSBatteryNumMAX = data[145];
CMD302.BCSChargState = ByteUtils.DToUInt16(data, 146);
CMD302.ReChargeTime = ByteUtils.DToUInt32(data, 148);
CMD302.BSMNum = data[152];
CMD302.BSMMaxTemp = data[153];
CMD302.MaxTempPointNum = data[154];
CMD302.MinBatteryTemp = data[155];
CMD302.MinTempPointNum = data[156];
CMD302.voltageHighLow = data[157];
CMD302.ChargStateHighLow = data[158];
CMD302.BmsOvercurrent = data[159];
CMD302.TempHigh = data[160];
CMD302.InsulatState = data[161];
CMD302.ConnectState = data[162];
CMD302.AllowCharge = data[163];
CMD302.SOCTargetValue = data[164];
CMD302.SumVoltageSetValue = data[165];
CMD302.VoltageSetValue = data[166];
CMD302.ChargeEnd = data[167];
CMD302.InsulatFault = data[168];
CMD302.OvertempFault = data[169];
CMD302.Overtemp = data[170];
CMD302.ConnectorFault = data[171];
CMD302.ChargOvertempFault = data[172];
CMD302.HVoltageFault = data[173];
CMD302.VoltageSenseFault = data[174];
CMD302.OtherFault = data[175];
CMD302.Overcurrent = data[176];
CMD302.VoltageAnomaly = data[177];
CMD302.VoltageAnomaly = data[178];
CMD302.EndChargState = data[179];
CMD302.MinVoltage = data[180];
CMD302.MaxVoltage = data[181];
CMD302.MinChargTemp = data[182];
CMD302.MaxChargTemp = data[183];
CMD302.ReceiveTimeout1 = data[184];
CMD302.ReceiveTimeout2 = data[185];
CMD302.ReceiveTimeout3 = data[186];
CMD302.ReceiveTimeout4 = data[187];
CMD302.ReceiveTimeout5 = data[188];
CMD302.ReceiveTimeout6 = data[189];
CMD302.ReceiveTimeout7 = data[190];
CMD302.Other = data[191];
}
return CMD302;
}
public CMD304 ConCMD304(byte[] data)
{
CMD304 CMD304 = null;
if (data != null && data.Length > 0)
{
CMD304 = new CMD304();
CMD304.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD304.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD304.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD304.WorkState = data[44];
CMD304.connectState = data[45];
CMD304.BRMMessage = Encoding.ASCII.GetString(data, 46, 64);
CMD304.VBIMessage = Encoding.ASCII.GetString(data, 110, 64);
CMD304.ChargParameter = Encoding.ASCII.GetString(data, 174, 16);
CMD304.ReadyState = ByteUtils.DToUInt16(data, 190);
CMD304.ChargDemand = ByteUtils.DToUInt16(data, 198);
CMD304.TotalState = Encoding.ASCII.GetString(data, 206, 16);
CMD304.StateInfo = ByteUtils.DToUInt32(data, 222);
CMD304.StopCharg = ByteUtils.DToUInt32(data, 226);
CMD304.StatisticData = ByteUtils.DToUInt32(data, 230);
CMD304.BEMMessage = ByteUtils.DToUInt32(data, 234);
}
return CMD304;
}
public CMD402 ConCMD402(uint func, byte[] data)
{
CMD402 CMD402 = null;
if (data != null && data.Length > 0)
{
CMD402 = new CMD402();
CMD402.Reserved1 = ByteUtils.DToUInt16(data, 8);
CMD402.Reserved2 = ByteUtils.DToUInt16(data, 10);
CMD402.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD402.PosType = data[44];
CMD402.ChargGun = data[45];
CMD402.ChargCardID = Encoding.ASCII.GetString(data, 46, 32);
CMD402.ChargStartTime = Encoding.ASCII.GetString(data, 78, 8);
CMD402.ChargEndTime = Encoding.ASCII.GetString(data, 86, 8);
CMD402.ChargTimeLength = ByteUtils.DToUInt32(data, 94);
CMD402.SOCStart = data[98];
CMD402.SOCEnd = data[99];
CMD402.ChargEndReason = Encoding.ASCII.GetString(data, 100, 4);
if (func == 402)
{
CMD402.ChargCapacity = (ByteUtils.ToUInt32(data, 104) * 0.01).ToString("F2");
CMD402.ChargCapacity01 = ((ByteUtils.DToUInt16(data, 167)) * 0.01).ToString("F2");
CMD402.ChargCapacity02 = ((ByteUtils.DToUInt16(data, 169)) * 0.01).ToString("F2");
CMD402.ChargCapacity03 = ((ByteUtils.DToUInt16(data, 171)) * 0.01).ToString("F2");
CMD402.ChargCapacity04 = ((ByteUtils.DToUInt16(data, 173)) * 0.01).ToString("F2");
CMD402.ChargCapacity05 = ((ByteUtils.DToUInt16(data, 175)) * 0.01).ToString("F2");
CMD402.ChargCapacity06 = ((ByteUtils.DToUInt16(data, 177)) * 0.01).ToString("F2");
CMD402.ChargCapacity07 = ((ByteUtils.DToUInt16(data, 179)) * 0.01).ToString("F2");
CMD402.ChargCapacity08 = ((ByteUtils.DToUInt16(data, 181)) * 0.01).ToString("F2");
CMD402.ChargCapacity09 = ((ByteUtils.DToUInt16(data, 183)) * 0.01).ToString("F2");
CMD402.ChargCapacity10 = ((ByteUtils.DToUInt16(data, 185)) * 0.01).ToString("F2");
CMD402.ChargCapacity11 = ((ByteUtils.DToUInt16(data, 187)) * 0.01).ToString("F2");
CMD402.ChargCapacity12 = ((ByteUtils.DToUInt16(data, 189)) * 0.01).ToString("F2");
CMD402.ChargCapacity13 = ((ByteUtils.DToUInt16(data, 191)) * 0.01).ToString("F2");
CMD402.ChargCapacity14 = ((ByteUtils.DToUInt16(data, 193)) * 0.01).ToString("F2");
CMD402.ChargCapacity15 = ((ByteUtils.DToUInt16(data, 195)) * 0.01).ToString("F2");
CMD402.ChargCapacity16 = ((ByteUtils.DToUInt16(data, 197)) * 0.01).ToString("F2");
CMD402.ChargCapacity17 = ((ByteUtils.DToUInt16(data, 199)) * 0.01).ToString("F2");
CMD402.ChargCapacity18 = ((ByteUtils.DToUInt16(data, 201)) * 0.01).ToString("F2");
CMD402.ChargCapacity19 = ((ByteUtils.DToUInt16(data, 203)) * 0.01).ToString("F2");
CMD402.ChargCapacity20 = ((ByteUtils.DToUInt16(data, 205)) * 0.01).ToString("F2");
CMD402.ChargCapacity21 = ((ByteUtils.DToUInt16(data, 207)) * 0.01).ToString("F2");
CMD402.ChargCapacity22 = ((ByteUtils.DToUInt16(data, 209)) * 0.01).ToString("F2");
CMD402.ChargCapacity23 = ((ByteUtils.DToUInt16(data, 211)) * 0.01).ToString("F2");
CMD402.ChargCapacity24 = ((ByteUtils.DToUInt16(data, 213)) * 0.01).ToString("F2");
CMD402.ChargCapacity25 = ((ByteUtils.DToUInt16(data, 215)) * 0.01).ToString("F2");
CMD402.ChargCapacity26 = ((ByteUtils.DToUInt16(data, 217)) * 0.01).ToString("F2");
CMD402.ChargCapacity27 = ((ByteUtils.DToUInt16(data, 219)) * 0.01).ToString("F2");
CMD402.ChargCapacity28 = ((ByteUtils.DToUInt16(data, 221)) * 0.01).ToString("F2");
CMD402.ChargCapacity29 = ((ByteUtils.DToUInt16(data, 223)) * 0.01).ToString("F2");
CMD402.ChargCapacity30 = ((ByteUtils.DToUInt16(data, 225)) * 0.01).ToString("F2");
CMD402.ChargCapacity31 = ((ByteUtils.DToUInt16(data, 227)) * 0.01).ToString("F2");
CMD402.ChargCapacity32 = ((ByteUtils.DToUInt16(data, 229)) * 0.01).ToString("F2");
CMD402.ChargCapacity33 = ((ByteUtils.DToUInt16(data, 231)) * 0.01).ToString("F2");
CMD402.ChargCapacity34 = ((ByteUtils.DToUInt16(data, 233)) * 0.01).ToString("F2");
CMD402.ChargCapacity35 = ((ByteUtils.DToUInt16(data, 235)) * 0.01).ToString("F2");
CMD402.ChargCapacity36 = ((ByteUtils.DToUInt16(data, 237)) * 0.01).ToString("F2");
CMD402.ChargCapacity37 = ((ByteUtils.DToUInt16(data, 239)) * 0.01).ToString("F2");
CMD402.ChargCapacity38 = ((ByteUtils.DToUInt16(data, 241)) * 0.01).ToString("F2");
CMD402.ChargCapacity39 = ((ByteUtils.DToUInt16(data, 243)) * 0.01).ToString("F2");
CMD402.ChargCapacity40 = ((ByteUtils.DToUInt16(data, 245)) * 0.01).ToString("F2");
CMD402.ChargCapacity41 = ((ByteUtils.DToUInt16(data, 247)) * 0.01).ToString("F2");
CMD402.ChargCapacity42 = ((ByteUtils.DToUInt16(data, 249)) * 0.01).ToString("F2");
CMD402.ChargCapacity43 = ((ByteUtils.DToUInt16(data, 251)) * 0.01).ToString("F2");
CMD402.ChargCapacity44 = ((ByteUtils.DToUInt16(data, 253)) * 0.01).ToString("F2");
CMD402.ChargCapacity45 = ((ByteUtils.DToUInt16(data, 255)) * 0.01).ToString("F2");
CMD402.ChargCapacity46 = ((ByteUtils.DToUInt16(data, 257)) * 0.01).ToString("F2");
CMD402.ChargCapacity47 = ((ByteUtils.DToUInt16(data, 259)) * 0.01).ToString("F2");
CMD402.ChargCapacity48 = ((ByteUtils.DToUInt16(data, 261)) * 0.01).ToString("F2");
CMD402.StartMode = data[263];
CMD402.SerialNum = Encoding.ASCII.GetString(data, 264, 32);
CMD402.ChargServiceCost = ByteUtils.DToUInt32(data, 296);
CMD402.KilElectricity = (data[300] * 0.001).ToString("F4");
CMD402.ParallelMark = data[301];
}
else if (func == 422)
{
CMD402.ChargCapacity = (ByteUtils.ToUInt32(data, 104) * 0.001).ToString("F3");
CMD402.ChargCapacity01 = ((ByteUtils.DToUInt32(data, 167) * 0.001)).ToString("F3");
CMD402.ChargCapacity02 = ((ByteUtils.DToUInt32(data, 171) * 0.001)).ToString("F3");
CMD402.ChargCapacity03 = ((ByteUtils.DToUInt32(data, 175) * 0.001)).ToString("F3");
CMD402.ChargCapacity04 = ((ByteUtils.DToUInt32(data, 179) * 0.001)).ToString("F3");
CMD402.ChargCapacity05 = ((ByteUtils.DToUInt32(data, 183) * 0.001)).ToString("F3");
CMD402.ChargCapacity06 = ((ByteUtils.DToUInt32(data, 187) * 0.001)).ToString("F3");
CMD402.ChargCapacity07 = ((ByteUtils.DToUInt32(data, 191) * 0.001)).ToString("F3");
CMD402.ChargCapacity08 = ((ByteUtils.DToUInt32(data, 195) * 0.001)).ToString("F3");
CMD402.ChargCapacity09 = ((ByteUtils.DToUInt32(data, 199) * 0.001)).ToString("F3");
CMD402.ChargCapacity10 = ((ByteUtils.DToUInt32(data, 203) * 0.001)).ToString("F3");
CMD402.ChargCapacity11 = ((ByteUtils.DToUInt32(data, 207) * 0.001)).ToString("F3");
CMD402.ChargCapacity12 = ((ByteUtils.DToUInt32(data, 211) * 0.001)).ToString("F3");
CMD402.ChargCapacity13 = ((ByteUtils.DToUInt32(data, 215) * 0.001)).ToString("F3");
CMD402.ChargCapacity14 = ((ByteUtils.DToUInt32(data, 219) * 0.001)).ToString("F3");
CMD402.ChargCapacity15 = ((ByteUtils.DToUInt32(data, 223) * 0.001)).ToString("F3");
CMD402.ChargCapacity16 = ((ByteUtils.DToUInt32(data, 227) * 0.001)).ToString("F3");
CMD402.ChargCapacity17 = ((ByteUtils.DToUInt32(data, 231) * 0.001)).ToString("F3");
CMD402.ChargCapacity18 = ((ByteUtils.DToUInt32(data, 235) * 0.001)).ToString("F3");
CMD402.ChargCapacity19 = ((ByteUtils.DToUInt32(data, 239) * 0.001)).ToString("F3");
CMD402.ChargCapacity20 = ((ByteUtils.DToUInt32(data, 243) * 0.001)).ToString("F3");
CMD402.ChargCapacity21 = ((ByteUtils.DToUInt32(data, 247) * 0.001)).ToString("F3");
CMD402.ChargCapacity22 = ((ByteUtils.DToUInt32(data, 251) * 0.001)).ToString("F3");
CMD402.ChargCapacity23 = ((ByteUtils.DToUInt32(data, 255) * 0.001)).ToString("F3");
CMD402.ChargCapacity24 = ((ByteUtils.DToUInt32(data, 259) * 0.001)).ToString("F3");
CMD402.ChargCapacity25 = ((ByteUtils.DToUInt32(data, 263) * 0.001)).ToString("F3");
CMD402.ChargCapacity26 = ((ByteUtils.DToUInt32(data, 267) * 0.001)).ToString("F3");
CMD402.ChargCapacity27 = ((ByteUtils.DToUInt32(data, 271) * 0.001)).ToString("F3");
CMD402.ChargCapacity28 = ((ByteUtils.DToUInt32(data, 275) * 0.001)).ToString("F3");
CMD402.ChargCapacity29 = ((ByteUtils.DToUInt32(data, 279) * 0.001)).ToString("F3");
CMD402.ChargCapacity30 = ((ByteUtils.DToUInt32(data, 283) * 0.001)).ToString("F3");
CMD402.ChargCapacity31 = ((ByteUtils.DToUInt32(data, 287) * 0.001)).ToString("F3");
CMD402.ChargCapacity32 = ((ByteUtils.DToUInt32(data, 291) * 0.001)).ToString("F3");
CMD402.ChargCapacity33 = ((ByteUtils.DToUInt32(data, 295) * 0.001)).ToString("F3");
CMD402.ChargCapacity34 = ((ByteUtils.DToUInt32(data, 299) * 0.001)).ToString("F3");
CMD402.ChargCapacity35 = ((ByteUtils.DToUInt32(data, 303) * 0.001)).ToString("F3");
CMD402.ChargCapacity36 = ((ByteUtils.DToUInt32(data, 307) * 0.001)).ToString("F3");
CMD402.ChargCapacity37 = ((ByteUtils.DToUInt32(data, 311) * 0.001)).ToString("F3");
CMD402.ChargCapacity38 = ((ByteUtils.DToUInt32(data, 315) * 0.001)).ToString("F3");
CMD402.ChargCapacity39 = ((ByteUtils.DToUInt32(data, 319) * 0.001)).ToString("F3");
CMD402.ChargCapacity40 = ((ByteUtils.DToUInt32(data, 323) * 0.001)).ToString("F3");
CMD402.ChargCapacity41 = ((ByteUtils.DToUInt32(data, 327) * 0.001)).ToString("F3");
CMD402.ChargCapacity42 = ((ByteUtils.DToUInt32(data, 331) * 0.001)).ToString("F3");
CMD402.ChargCapacity43 = ((ByteUtils.DToUInt32(data, 335) * 0.001)).ToString("F3");
CMD402.ChargCapacity44 = ((ByteUtils.DToUInt32(data, 339) * 0.001)).ToString("F3");
CMD402.ChargCapacity45 = ((ByteUtils.DToUInt32(data, 343) * 0.001)).ToString("F3");
CMD402.ChargCapacity46 = ((ByteUtils.DToUInt32(data, 347) * 0.001)).ToString("F3");
CMD402.ChargCapacity47 = ((ByteUtils.DToUInt32(data, 351) * 0.001)).ToString("F3");
CMD402.ChargCapacity48 = ((ByteUtils.DToUInt32(data, 355) * 0.001)).ToString("F3");
CMD402.StartMode = data[359];
CMD402.SerialNum = Encoding.ASCII.GetString(data, 360, 32);
CMD402.ChargServiceCost = ByteUtils.DToUInt32(data, 392);
CMD402.KilElectricity = (data[396] * 0.001).ToString("F4");
CMD402.ParallelMark = data[397];
}
CMD402.SAmmeterValue = ByteUtils.DToUInt32(data, 108);
CMD402.EAmmeterValue = ByteUtils.DToUInt32(data, 112);
CMD402.ChargeAmount = ByteUtils.DToUInt32(data, 116);
CMD402.IndexNum = ByteUtils.DToUInt32(data, 120);
CMD402.InitialBalance = ByteUtils.DToUInt32(data, 124);
CMD402.ChargRecordIndex = ByteUtils.DToUInt32(data, 128);
CMD402.TotalChargeRecord = ByteUtils.DToUInt32(data, 132);
CMD402.Reserved3 = data[136];
CMD402.ChargStrategy = data[137];
switch (data[137])
{
case 1:
CMD402.ChargStrategyPara = (ByteUtils.ToUInt32(data, 138)).ToString();
break;
case 2:
CMD402.ChargStrategyPara = ((float)ByteUtils.ToUInt32(data, 138) * 0.01).ToString("F2");
break;
case 3:
CMD402.ChargStrategyPara = ((float)ByteUtils.ToUInt32(data, 138) * 0.01).ToString("F3");
break;
}
CMD402.VINCar = Encoding.ASCII.GetString(data, 142, 17);
CMD402.CarID = Encoding.ASCII.GetString(data, 159, 8);
}
return CMD402;
}
public CMD1002 ConCMD1002(byte[] data)
{
CMD1002 CMD1002 = null;
if (data != null && data.Length > 0)
{
CMD1002 = new CMD1002();
CMD1002.ErasurePercentage = data[8];
}
return CMD1002;
}
public CMD1004 ConCMD1004(byte[] data)
{
CMD1004 CMD1004 = null;
if (data != null && data.Length > 0)
{
CMD1004 = new CMD1004();
CMD1004.DataLength = data[8];
}
return CMD1004;
}
public CMD1006 ConCMD1006(byte[] data)
{
CMD1006 CMD1006 = null;
if (data != null && data.Length > 0)
{
CMD1006 = new CMD1006();
CMD1006.ResponseFlag = data[8];
}
return CMD1006;
}
public CMD1008 ConCMD1008(byte[] data)
{
CMD1008 CMD1008 = null;
if (data != null && data.Length > 0)
{
CMD1008 = new CMD1008();
CMD1008.ReceiveSN = data[8];
CMD1008.WriteFlag = data[9];
CMD1008.Reserved1 = (short)ByteUtils.DToUInt16(data, 10);
CMD1008.Reserved2 = (int)ByteUtils.DToUInt32(data, 12);
}
return CMD1008;
}
public CMD1010 ConCMD1010(byte[] data)
{
CMD1010 CMD1010 = null;
if (data != null && data.Length > 0)
{
CMD1010 = new CMD1010();
CMD1010.Reserved1 = ByteUtils.DToUInt16(data, 8);
}
return CMD1010;
}
public CMD1012 ConCMD1012(byte[] data)
{
CMD1012 CMD1012 = null;
if (data != null && data.Length > 0)
{
CMD1012 = new CMD1012();
CMD1012.Reserved1 = (int)ByteUtils.DToUInt32(data, 8);
}
return CMD1012;
}
public CMD1022 ConCMD1022(byte[] data)
{
CMD1022 CMD1022 = null;
if (data != null && data.Length > 0)
{
CMD1022 = new CMD1022();
CMD1022.EquipmentCode = (int)ByteUtils.DToUInt32(data, 8);
CMD1022.ProjectCode = (int)ByteUtils.DToUInt32(data, 12);
CMD1022.SoftwareVersion = (int)ByteUtils.DToUInt32(data, 16);
CMD1022.ReceiveFileSizeMax = (int)ByteUtils.DToUInt32(data, 20);
CMD1022.DeviceDescripte = Encoding.ASCII.GetString(data, 24, 32);
CMD1022.CommandFlag = (int)ByteUtils.DToUInt32(data, 56);
CMD1022.Offset = (int)ByteUtils.DToUInt32(data, 60);
CMD1022.ContinuatSN = data[64];
CMD1022.DataLength = (int)ByteUtils.DToUInt32(data, 65);
}
return CMD1022;
}
public CMD1102 ConCMD1102(byte[] data)
{
CMD1102 CMD1102 = null;
if (data != null && data.Length > 0)
{
CMD1102 = new CMD1102();
CMD1102.StartHour1 = data[8];
CMD1102.STartMin1 = data[9];
CMD1102.EndHour1 = data[10];
CMD1102.EndMin1 = data[11];
CMD1102.Rate1 = ByteUtils.DToUInt32(data, 12);
CMD1102.StartHour2 = data[16];
CMD1102.STartMin2 = data[17];
CMD1102.EndHour2 = data[18];
CMD1102.EndMin2 = data[19];
CMD1102.Rate2 = ByteUtils.DToUInt32(data, 20);
CMD1102.StartHour3 = data[24];
CMD1102.STartMin3 = data[25];
CMD1102.EndHour3 = data[26];
CMD1102.EndMin3 = data[27];
CMD1102.Rate3 = ByteUtils.DToUInt32(data, 28);
CMD1102.StartHour4 = data[32];
CMD1102.STartMin4 = data[33];
CMD1102.EndHour4 = data[34];
CMD1102.EndMin4 = data[35];
CMD1102.Rate4 = ByteUtils.DToUInt32(data, 36);
CMD1102.StartHour5 = data[40];
CMD1102.STartMin5 = data[41];
CMD1102.EndHour5 = data[42];
CMD1102.EndMin5 = data[43];
CMD1102.Rate5 = ByteUtils.DToUInt32(data, 44);
CMD1102.StartHour6 = data[48];
CMD1102.STartMin6 = data[49];
CMD1102.EndHour6 = data[50];
CMD1102.EndMin6 = data[51];
CMD1102.Rate6 = ByteUtils.DToUInt32(data, 52);
CMD1102.StartHour7 = data[56];
CMD1102.STartMin7 = data[57];
CMD1102.EndHour7 = data[58];
CMD1102.EndMin7 = data[59];
CMD1102.Rate7 = ByteUtils.DToUInt32(data, 60);
CMD1102.StartHour8 = data[64];
CMD1102.STartMin8 = data[65];
CMD1102.EndHour8 = data[66];
CMD1102.EndMin8 = data[67];
CMD1102.Rate8 = ByteUtils.DToUInt32(data, 68);
CMD1102.StartHour9 = data[72];
CMD1102.STartMin9 = data[73];
CMD1102.EndHour9 = data[74];
CMD1102.EndMin9 = data[75];
CMD1102.Rate9 = ByteUtils.DToUInt32(data, 76);
CMD1102.StartHour10 = data[80];
CMD1102.STartMin10 = data[81];
CMD1102.EndHour10 = data[82];
CMD1102.EndMin10 = data[83];
CMD1102.Rate10 = ByteUtils.DToUInt32(data, 84);
CMD1102.StartHour11 = data[88];
CMD1102.STartMin11 = data[89];
CMD1102.EndHour11 = data[90];
CMD1102.EndMin11 = data[91];
CMD1102.Rate11 = ByteUtils.DToUInt32(data, 92);
CMD1102.StartHour12 = data[96];
CMD1102.STartMin12 = data[97];
CMD1102.EndHour12 = data[98];
CMD1102.EndMin12 = data[99];
CMD1102.Rate12 = ByteUtils.DToUInt32(data, 100);
}
return CMD1102;
}
public CMD1104 ConCMD1104(byte[] data)
{
CMD1104 CMD1104 = null;
if (data != null && data.Length > 0)
{
CMD1104 = new CMD1104();
CMD1104.ConfirmResult = data[8];
}
return CMD1104;
}
public CMD1106 ConCMD1106(byte[] data)
{
CMD1106 CMD1106 = null;
if (data != null && data.Length > 0)
{
CMD1106 = new CMD1106();
CMD1106.ConfirmResult = data[8];
}
return CMD1106;
}
public CMD1108 ConCMD1108(byte[] data)
{
CMD1108 CMD1108 = null;
if (data != null && data.Length > 0)
{
CMD1108 = new CMD1108();
CMD1108.StartHour1 = data[8];
CMD1108.STartMin1 = data[9];
CMD1108.EndHour1 = data[10];
CMD1108.EndMin1 = data[11];
CMD1108.Rate1 = ByteUtils.DToUInt32(data, 12);
CMD1108.StartHour2 = data[16];
CMD1108.STartMin2 = data[17];
CMD1108.EndHour2 = data[18];
CMD1108.EndMin2 = data[19];
CMD1108.Rate2 = ByteUtils.DToUInt32(data, 20);
CMD1108.StartHour3 = data[24];
CMD1108.STartMin3 = data[25];
CMD1108.EndHour3 = data[26];
CMD1108.EndMin3 = data[27];
CMD1108.Rate3 = ByteUtils.DToUInt32(data, 28);
CMD1108.StartHour4 = data[32];
CMD1108.STartMin4 = data[33];
CMD1108.EndHour4 = data[34];
CMD1108.EndMin4 = data[35];
CMD1108.Rate4 = ByteUtils.DToUInt32(data, 36);
CMD1108.StartHour5 = data[40];
CMD1108.STartMin5 = data[41];
CMD1108.EndHour5 = data[42];
CMD1108.EndMin5 = data[43];
CMD1108.Rate5 = ByteUtils.DToUInt32(data, 44);
CMD1108.StartHour6 = data[48];
CMD1108.STartMin6 = data[49];
CMD1108.EndHour6 = data[50];
CMD1108.EndMin6 = data[51];
CMD1108.Rate6 = ByteUtils.DToUInt32(data, 52);
CMD1108.StartHour7 = data[56];
CMD1108.STartMin7 = data[57];
CMD1108.EndHour7 = data[58];
CMD1108.EndMin7 = data[59];
CMD1108.Rate7 = ByteUtils.DToUInt32(data, 60);
CMD1108.StartHour8 = data[64];
CMD1108.STartMin8 = data[65];
CMD1108.EndHour8 = data[66];
CMD1108.EndMin8 = data[67];
CMD1108.Rate8 = ByteUtils.DToUInt32(data, 68);
CMD1108.StartHour9 = data[72];
CMD1108.STartMin9 = data[73];
CMD1108.EndHour9 = data[74];
CMD1108.EndMin9 = data[75];
CMD1108.Rate9 = ByteUtils.DToUInt32(data, 76);
CMD1108.StartHour10 = data[80];
CMD1108.STartMin10 = data[81];
CMD1108.EndHour10 = data[82];
CMD1108.EndMin10 = data[83];
CMD1108.Rate10 = ByteUtils.DToUInt32(data, 84);
CMD1108.StartHour11 = data[88];
CMD1108.STartMin11 = data[89];
CMD1108.EndHour11 = data[90];
CMD1108.EndMin11 = data[91];
CMD1108.Rate11 = ByteUtils.DToUInt32(data, 92);
CMD1108.StartHour12 = data[96];
CMD1108.STartMin12 = data[97];
CMD1108.EndHour12 = data[98];
CMD1108.EndMin12 = data[99];
CMD1108.Rate12 = ByteUtils.DToUInt32(data, 100);
}
return CMD1108;
}
public CMD1302 ConCMD1302(byte[] data)
{
CMD1302 CMD1302 = null;
if (data != null && data.Length > 0)
{
CMD1302 = new CMD1302();
CMD1302.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD1302.WhitelistType = data[44];
CMD1302.Operate = data[45];
CMD1302.ListVersioe = ByteUtils.DToUInt32(data, 46);
CMD1302.OperatResult = data[50];
}
return CMD1302;
}
public CMD1402 ConCMD1402(byte[] data)
{
CMD1402 CMD1402 = null;
if (data != null && data.Length > 0)
{
CMD1402 = new CMD1402();
CMD1402.Result = data[12];
}
return CMD1402;
}
public CMD1403 ConCMD1403(byte[] data)
{
CMD1403 CMD1403 = null;
if (data != null && data.Length > 0)
{
CMD1403 = new CMD1403();
CMD1403.ScheduleResult = data[12];
}
return CMD1403;
}
public CMD1407 ConCMD1407(byte[] data)
{
CMD1407 CMD1407 = null;
if (data != null && data.Length > 0)
{
CMD1407 = new CMD1407();
CMD1407.Result = data[12];
}
return CMD1407;
}
public CMD1501 ConCMD1501(byte[] data)
{
CMD1501 CMD1501 = null;
if (data != null && data.Length > 0)
{
CMD1501 = new CMD1501();
CMD1501.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
CMD1501.UpFileName = Encoding.ASCII.GetString(data, 44, 128);
}
return CMD1501;
}
public CMD1503 ConCMD1503(byte[] data)
{
CMD1503 CMD1503 = null;
if (data != null && data.Length > 0)
{
CMD1503 = new CMD1503();
CMD1503.DataLength = ByteUtils.DToUInt32(data, 12);
CMD1503.MessageNum = ByteUtils.DToUInt32(data, 16);
CMD1503.LogData = Encoding.ASCII.GetString(data, 20, (data.Length - 21)); ;
}
return CMD1503;
}
public CMD1505 ConCMD1505(byte[] data)
{
CMD1505 CMD1505 = null;
if (data != null && data.Length > 0)
{
CMD1505 = new CMD1505();
}
return CMD1505;
}
}
}