lch 8 months ago
commit 10c2b8c1bd

@ -27,7 +27,7 @@ namespace BatCharging.Model
/// <summary>
/// 内部索引号
/// </summary>
public UInt32 value05 { get; set; }
public int value05 { get; set; }
/// <summary>
/// 7、8、9 字段有效标志
/// <para>0- 无效</para>

@ -123,197 +123,197 @@ namespace BatCharging.Model
/// 命令 202 报文此字段是 2 字节,
/// 命令 222 报文此字段是 4 字节
/// </summary>
public UInt32 value26 { get; set; }
public String value26 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value27 { get; set; }
public String value27 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value28 { get; set; }
public String value28 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value29 { get; set; }
public String value29 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value30 { get; set; }
public String value30 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value31 { get; set; }
public String value31 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value32 { get; set; }
public String value32 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value33 { get; set; }
public String value33 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value34 { get; set; }
public String value34 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value35 { get; set; }
public String value35 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value36 { get; set; }
public String value36 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value37 { get; set; }
public String value37 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value38 { get; set; }
public String value38 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value39 { get; set; }
public String value39 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value40 { get; set; }
public String value40 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value41 { get; set; }
public String value41 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value42 { get; set; }
public String value42 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value43 { get; set; }
public String value43 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value44 { get; set; }
public String value44 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value45 { get; set; }
public String value45 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value46 { get; set; }
public String value46 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value47 { get; set; }
public String value47 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value48 { get; set; }
public String value48 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value49 { get; set; }
public String value49 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value50 { get; set; }
public String value50 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value51 { get; set; }
public String value51 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value52 { get; set; }
public String value52 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value53 { get; set; }
public String value53 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value54 { get; set; }
public String value54 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value55 { get; set; }
public String value55 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value56 { get; set; }
public String value56 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value57 { get; set; }
public String value57 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value58 { get; set; }
public String value58 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value59 { get; set; }
public String value59 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value60 { get; set; }
public String value60 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value61 { get; set; }
public String value61 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value62 { get; set; }
public String value62 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value63 { get; set; }
public String value63 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value64 { get; set; }
public String value64 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value65 { get; set; }
public String value65 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value66 { get; set; }
public String value66 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value67 { get; set; }
public String value67 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value68 { get; set; }
public String value68 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value69 { get; set; }
public String value69 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value70 { get; set; }
public String value70 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value71 { get; set; }
public String value71 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value72 { get; set; }
public String value72 { get; set; }
/// <summary>
/// 时段 48 充电电量
/// 命令 202 报文此字段是 2 字节,
/// 命令 222 报文此字段是 4 字节
/// </summary>
public UInt32 value73 { get; set; }
public String value73 { get; set; }
/// <summary>
/// 启动方式
/// <para>0本地刷卡启动</para>
@ -363,7 +363,7 @@ namespace BatCharging.Model
/// 4 字节电表安装时间(秒时戳, HEX)
/// 1 字节端钮历史状态(0 正常1 发生过端钮盖打开时间)
/// </summary>
public byte value80 { get; set; }
public string value80 { get; set; }
/// <summary>
/// 电表表号 6
/// </summary>

@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BatCharging.Model
{
public class CMD221
{
/// <summary>
/// 预留
/// </summary>
public UInt16 value01 { get; set; }
/// <summary>
/// 预留
/// </summary>
public UInt16 value02 { get; set; }
/// <summary>
/// 充电口号
/// </summary>
public byte value03 { get; set; }
/// <summary>
/// 充电卡号 32
/// </summary>
public string value04 { get; set; }
/// <summary>
/// 内部索引号
/// </summary>
public UInt32 value05 { get; set; }
/// <summary>
/// 7、8、9 字段有效标志
/// <para>0- 无效</para>
/// <para>1- 有效</para>
/// </summary>
public byte value06 { get; set; }
/// <summary>
/// 充电优惠前金额
/// </summary>
public UInt32 value07 { get; set; }
/// <summary>
/// 充电折扣金额
/// </summary>
public UInt32 value08 { get; set; }
/// <summary>
/// 充电实扣金额
/// </summary>
public UInt32 value09 { get; set; }
/// <summary>
/// 用户剩余金额
/// </summary>
public UInt32 value10 { get; set; }
/// <summary>
/// 充电实扣电费
/// </summary>
public UInt32 value11 { get; set; }
/// <summary>
/// 充电实扣服务费
/// </summary>
public UInt32 value12 { get; set; }
}
}

@ -0,0 +1,387 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BatCharging.Model
{
public class CMD222
{
/// <summary>
/// 预留
/// </summary>
public UInt16 value01 { get; set; }
/// <summary>
/// 预留
/// </summary>
public UInt16 value02 { get; set; }
/// <summary>
/// 充电桩编码
/// </summary>
public string value03 { get; set; }
/// <summary>
/// 充电枪位置类型
/// <para>1-直流</para>
/// <para>2-交流</para>
/// </summary>
public byte value04 { get; set; }
/// <summary>
/// 充电枪口
/// </summary>
public byte value05 { get; set; }
/// <summary>
/// 充电卡号 32
/// </summary>
public string value06 { get; set; }
/// <summary>
/// 充电开始时间
/// </summary>
public string value07 { get; set; }
/// <summary>
/// 充电结束时间
/// </summary>
public string value08 { get; set; }
/// <summary>
/// 充电时间长度
/// </summary>
public UInt32 value09 { get; set; }
/// <summary>
/// 开始 SOC
/// </summary>
public byte value10 { get; set; }
/// <summary>
/// 结束 SOC
/// </summary>
public byte value11 { get; set; }
/// <summary>
/// 充电结束原因
/// </summary>
public UInt32 value12 { get; set; }
/// <summary>
/// 本次充电电量
/// </summary>
public UInt32 value13 { get; set; }
/// <summary>
/// 充电前电表读数
/// </summary>
public UInt32 value14 { get; set; }
/// <summary>
/// 充电后电表读数
/// </summary>
public UInt32 value15 { get; set; }
/// <summary>
/// 本次充电金额
/// </summary>
public UInt32 value16 { get; set; }
/// <summary>
/// 内部索引号
/// </summary>
public UInt32 value17 { get; set; }
/// <summary>
/// 充电前卡余额
/// </summary>
public UInt32 value18 { get; set; }
/// <summary>
/// 当前充电记录索引
/// </summary>
public UInt32 value19 { get; set; }
/// <summary>
/// 总充电记录条目
/// </summary>
public UInt32 value20 { get; set; }
/// <summary>
/// 预留
/// </summary>
public byte value21 { get; set; }
/// <summary>
/// 充电策略
/// <para>0:充满为止</para>
/// <para>1:时间控制充电</para>
/// <para>2:金额控制充电</para>
/// <para>3:电量控制充电</para>
/// </summary>
public byte value22 { get; set; }
/// <summary>
/// 充电策略参数
///
/// 时间单位为 1 秒
/// 金额单位为 0.01 元
/// 电量时单位为 0.01kw
/// </summary>
public UInt32 value23 { get; set; }
/// <summary>
/// 车辆 VIN 17
/// </summary>
public string value24 { get; set; }
/// <summary>
/// 车牌号
/// </summary>
public string value25 { get; set; }
/// <summary>
/// 时段 1 充电电量
/// 命令 202 报文此字段是 2 字节,
/// 命令 222 报文此字段是 4 字节
/// </summary>
public UInt32 value26 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value27 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value28 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value29 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value30 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value31 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value32 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value33 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value34 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value35 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value36 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value37 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value38 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value39 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value40 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value41 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value42 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value43 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value44 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value45 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value46 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value47 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value48 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value49 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value50 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value51 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value52 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value53 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value54 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value55 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value56 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value57 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value58 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value59 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value60 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value61 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value62 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value63 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value64 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value65 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value66 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value67 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value68 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value69 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value70 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value71 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value72 { get; set; }
/// <summary>
/// 时段 48 充电电量
/// 命令 202 报文此字段是 2 字节,
/// 命令 222 报文此字段是 4 字节
/// </summary>
public UInt32 value73 { get; set; }
/// <summary>
/// 启动方式
/// <para>0本地刷卡启动</para>
/// <para>1后台启动</para>
/// <para>2本地管理员启动</para>
/// <para>3远程 VIN 验证启动</para>
/// <para>4远程密码验证启动</para>
/// <para>5本地 VIN 验证启动</para>
/// <para>6迪文界面流程启动</para>
/// </summary>
public byte value74 { get; set; }
/// <summary>
/// 充电流水号 32
/// </summary>
public string value75 { get; set; }
/// <summary>
/// 充电服务费
/// </summary>
public UInt32 value76 { get; set; }
/// <summary>
/// 千分位电量
/// </summary>
public byte value77 { get; set; }
/// <summary>
/// 并充标志
/// <para>0/1-单枪充电</para>
/// <para>2-单机柜双枪并充充电</para>
/// <para>3-双机柜双枪并充充电</para>
/// </summary>
public byte value78 { get; set; }
/// <summary>
/// 充放电标志
///
/// 2-充电
/// 0xf1-放电
/// 非协议定义值,都表示充电
/// </summary>
public byte value79 { get; set; }
/// <summary>
/// 电表加密数据
///
/// 瑞银电表解密后数据内容为:
/// 17 字节枪口识别号(BCD)
/// 4 字节计量开始时间(秒时戳, HEX)
/// 4 字节计量结束时间(秒时戳, HEX)
/// 4 字节正向充电电量(3 位小数, HEX)
/// 4 字节电表安装时间(秒时戳, HEX)
/// 1 字节端钮历史状态(0 正常1 发生过端钮盖打开时间)
/// </summary>
public byte value80 { get; set; }
/// <summary>
/// 电表表号 6
/// </summary>
public string value81 { get; set; }
/// <summary>
/// 电表协议版本
/// </summary>
public UInt16 value82 { get; set; }
/// <summary>
/// 加密方式
/// 当前加密方式(工厂模式下配置,抄读无任何限制)
/// <para>00:软件 AES128 加密</para>
/// <para>01:RJMU 国密 SM1(暂不支持)</para>
/// <para>02:RJMU 国密 SM4(暂不支持)</para>
/// <para>03:国网 ESAM 加密</para>
/// <para>04:ECC256 签名算法</para>
/// <para>05:其他</para>
/// </summary>
public byte value83 { get; set; }
}
}

@ -63,7 +63,7 @@ namespace BatCharging.Model
/// 命令 402 报文此字段单位是0.01kWh/bit
/// 命令 422 报 文 此 字 段 单 位 是0.001kWh/bit
/// </summary>
public float currentChargingLevel { get; set; }
public string currentChargingLevel { get; set; }
/// <summary>
/// 充电前电表读数
/// </summary>
@ -109,7 +109,7 @@ namespace BatCharging.Model
/// 金额单位为0.01元
/// 电量时单位为0.01kw
/// </summary>
public float chargingStrategyPara { get; set; }
public string chargingStrategyPara { get; set; }
/// <summary>
/// 车辆VIN 直流桩上传,没有填’\0
/// </summary>
@ -262,7 +262,7 @@ namespace BatCharging.Model
/// 如平台不对电量第三位小数做强检要求可忽略本字段。
/// 如本字段为0x09,千分位电量为 0.009Kw* h
/// </summary>
public byte millennialpowerConsumption { get; set; }
public string millennialpowerConsumption { get; set; }
/// <summary>
/// 并充标志
/// 0/1-单枪充电

@ -1108,13 +1108,11 @@ namespace BatCharging.Service
if (CMD104 != null)
{
byte chargeMuzzle = 0;
uint executeResult = 0;
uint address = 0;
byte[] setData = null;
byte chargeNum= 0;
bool reportMessage = true;
//(CMD=9)后台服务器应答桩上传命令请求(预留)
CmnChargerParam._CHR00TCPCLIENT.Send103(chargeMuzzle, executeResult, address, setData);
CmnChargerParam._CHR00TCPCLIENT.Send103(chargeNum,reportMessage);
}
}
@ -1145,7 +1143,7 @@ namespace BatCharging.Service
if (CMD108 != null)
{
//(CMD=9)后台服务器应答桩上传命令请求(预留)
CmnChargerParam._CHR00TCPCLIENT.Send107();
//CmnChargerParam._CHR00TCPCLIENT.Send107();
}
}
@ -1208,8 +1206,12 @@ namespace BatCharging.Service
if (CMD202 != null)
{
//todo
CmnChargerParam._CHR00TCPCLIENT.Send201(CMD202,);
//todo 实例化CMD201对象
CMD201 cMD201 = new CMD201();
//201中其他字段如何赋值
cMD201.value05 = CMD202.value17;
CmnChargerParam._CHR00TCPCLIENT.Send201(cMD201, func);
}
}
break;
@ -1222,7 +1224,7 @@ namespace BatCharging.Service
if (CMD204 != null)
{
CmnChargerParam._CHR00TCPCLIENT.Send203();
//CmnChargerParam._CHR00TCPCLIENT.Send203();
}
}
@ -1236,7 +1238,7 @@ namespace BatCharging.Service
if (CMD206 != null)
{
CmnChargerParam._CHR00TCPCLIENT.Send205();
//CmnChargerParam._CHR00TCPCLIENT.Send205();
}
}
@ -1308,8 +1310,9 @@ namespace BatCharging.Service
#region 历史记录
case 402:
case 422:
{
CMD402 CMD402 = new MsgReceiveCMDCom().ConCMD402(data);
CMD402 CMD402 = new MsgReceiveCMDCom().ConCMD402(func,data);
string result = "充电桩上报历史的充电记录 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩上报历史的充电记录:" + JsonConvert.SerializeObject(CMD402);
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
@ -1332,7 +1335,7 @@ namespace BatCharging.Service
if (CMD1002 != null)
{
//todo
//todo
}
}
@ -1346,7 +1349,7 @@ namespace BatCharging.Service
if (CMD1004 != null)
{
//todo
//todo
}
}
break;
@ -1359,7 +1362,7 @@ namespace BatCharging.Service
if (CMD1006 != null)
{
//todo
//todo
}
}
break;
@ -1411,10 +1414,10 @@ namespace BatCharging.Service
if (CMD1022 != null)
{
uint results = 0;
uint results = 0;
string description = "";
//服务器回复充电桩主动请求升级命令
CmnChargerParam._CHR00TCPCLIENT.Send1021( results, description);
CmnChargerParam._CHR00TCPCLIENT.Send1021(results, description);
}
}
@ -1444,7 +1447,7 @@ namespace BatCharging.Service
if (CMD1104 != null)
{
//todo
//todo
}
}
@ -1458,7 +1461,7 @@ namespace BatCharging.Service
if (CMD1106 != null)
{
//todo
//todo
}
}
@ -2155,13 +2158,13 @@ namespace BatCharging.Service
}
}
}
public void Send103(byte chargeMuzzle, uint executeResult, uint address, byte[] setData)
public void Send103(byte chargeNum, bool reportMessage)
{
if (_chr_client != null)
{
if (_chr_client.Connected)
{
new ChargerSendMsgUtils().Send9(_chr_client, chargeMuzzle, executeResult, address, setData);
new ChargerSendMsgUtils().Send103(_chr_client, chargeNum, reportMessage);
}
}
}
@ -2220,13 +2223,13 @@ namespace BatCharging.Service
#region 充电信息数据
public void Send201(CMD202 CMD202, byte value06, uint value07, uint value08, uint value09, uint value10, uint value11, uint value12)
public void Send201(CMD201 CMD201,uint func)
{
if (_chr_client != null)
{
if (_chr_client.Connected)
{
new ChargerSendMsgUtils().Send201(_chr_client, CMD202, value06, value07, value08, value09, value10, value11, value12);
new ChargerSendMsgUtils().Send201(_chr_client, CMD201, func);
}
}
}
@ -2274,6 +2277,16 @@ namespace BatCharging.Service
}
}
}
public void Send221(CMD221 CMD221, uint value05)
{
if (_chr_client != null)
{
if (_chr_client.Connected)
{
new ChargerSendMsgUtils().Send221(_chr_client, CMD221, value05);
}
}
}
#endregion
#region- 直流充电桩 BMS 信息数据(预留)

@ -411,7 +411,7 @@ namespace BatCharging.Service
CMD.value04 = executeResult;
CMD.value05 = address;
CMD.value06 = 4;
CMD.value07 = null;
CMD.value07 = new byte[4];
byte[] bytes = new ChargerSendCMD().SendRCMD9(out APDUModel, CMD);
@ -601,21 +601,10 @@ namespace BatCharging.Service
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send201(TcpClientChargerTool tcp_client, CMD202 CMD202, byte value06, uint value07, uint value08, uint value09, uint value10, uint value11, uint value12)
internal void Send201(TcpClientChargerTool tcp_client, CMD201 CMD,uint func)
{
CMD201 CMD = new CMD201();
CMD.value03 = CMD202.value05;
CMD.value04 = CMD202.value06;
CMD.value05 = CMD202.value17;
CMD.value06 = value06;
CMD.value07 = value07;
CMD.value08 = value08;
CMD.value09 = value09;
CMD.value10 = value10;
CMD.value11 = value11;
CMD.value12 = value12;
byte[] bytes = new ChargerSendCMD().SendRCMD201(out APDUModel APDUModel, CMD);
byte[] bytes = new ChargerSendCMD().SendRCMD201(out APDUModel APDUModel, CMD, func);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
@ -731,6 +720,26 @@ namespace BatCharging.Service
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes);
}
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send221(TcpClientChargerTool tcp_client, CMD221 CMD221, uint value05)
{
CMD221 CMD = new CMD221();
CMD.value01 = CMD221.value01;
CMD.value02 = CMD221.value02;
CMD.value03 = CMD221.value03;
CMD.value04 = CMD221.value04;
CMD.value05 = value05;
byte[] bytes = new ChargerSendCMD().SendRCMD221(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes);
}
#endregion

@ -140,21 +140,21 @@ namespace BatCharging.Service
/// </summary>
/// <param name="hexString">hexString 16进制字符串</param>
/// <returns>字节数组</returns>
public static byte[] ToByteByHexStr32(string hexString)
public static byte[] ToByteByHexStr32(string hexString,int leng)
{
byte[] bytes = new byte[32];
byte[] bytes = new byte[leng];
// 使用UTF8编码将字符串转换为字节数组
byte[] byteArray = Encoding.ASCII.GetBytes(hexString);
// 如果需要确保数组长度为32字节可以添加逻辑来处理长度不足的情况
if (byteArray.Length < 32)
if (byteArray.Length < leng)
{
Array.Copy(byteArray, 0, bytes, 0, byteArray.Length);
}
else if (byteArray.Length > 32)
else if (byteArray.Length > leng)
{
// 长度超过32字节可以截断或者抛出异常
Array.Copy(byteArray, 0, new byte[32], 0, 32); // 截断数组到32字节
Array.Copy(byteArray, 0, new byte[leng], 0, leng); // 截断数组到32字节
}
return byteArray;
}

@ -268,35 +268,36 @@ namespace BatCharging.Service.DataRlt
CMD110.value08 = ByteUtils.DToUInt32(data, 53);
byte version1 = data[58];
byte version2 = data[59];
CMD110.value09 = "v" + version1.ToString() + version2.ToString();
CMD110.value10 = data[60];
CMD110.value11 = ByteUtils.DToUInt32(data, 61);
CMD110.value12 = ByteUtils.DToUInt32(data, 65);
CMD110.value13 = ByteUtils.DToUInt32(data, 69);
CMD110.value14 = ByteUtils.DToUInt32(data, 73);
CMD110.value15 = ByteUtils.DToUInt16(data, 77);
CMD110.value16 = data[79];
CMD110.value17 = data[80];
CMD110.value18 = ByteUtils.DToUInt32(data, 81);
CMD110.value19 = data[85];
CMD110.value20 = data[86];
CMD110.value21 = Encoding.ASCII.GetString(data, 87, 17);
byte VersionSerialNum = data[104];
byte day = data[105];
byte month = data[106];
ushort year = ByteUtils.DToUInt16(data, 107);
byte version3 = data[60];
CMD110.value09 = "v" + version1.ToString() + version2.ToString() + version3.ToString();
CMD110.value10 = data[61];
CMD110.value11 = ByteUtils.DToUInt32(data, 62);
CMD110.value12 = ByteUtils.DToUInt32(data, 66);
CMD110.value13 = ByteUtils.DToUInt32(data, 70);
CMD110.value14 = ByteUtils.DToUInt32(data, 74);
CMD110.value15 = ByteUtils.DToUInt16(data, 78);
CMD110.value16 = data[80];
CMD110.value17 = data[81];
CMD110.value18 = ByteUtils.DToUInt32(data, 82);
CMD110.value19 = data[86];
CMD110.value20 = data[87];
CMD110.value21 = 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.value22 = VersionSerialNum.ToString() + year.ToString() + "年" + month.ToString() + "月" + day.ToString() + "日";
CMD110.value23 = (float)(ByteUtils.DToUInt32(data, 112) * 0.1);
CMD110.value24 = (float)(ByteUtils.DToUInt32(data, 116) * 0.1);
CMD110.value25 = (float)(ByteUtils.DToUInt32(data, 120) * 0.1);
CMD110.value26 = (float)(ByteUtils.DToUInt32(data, 124) * 0.1);
CMD110.value27 = data[128];
CMD110.value28 = (float)(ByteUtils.DToUInt16(data, 129) * 0.1);
CMD110.value29 = (float)(ByteUtils.DToUInt32(data, 131) * 0.1);
CMD110.value30 = Encoding.ASCII.GetString(data, 135, 32);
CMD110.value23 = (float)(ByteUtils.DToUInt32(data, 113) * 0.1);
CMD110.value24 = (float)(ByteUtils.DToUInt32(data, 117) * 0.1);
CMD110.value25 = (float)(ByteUtils.DToUInt32(data, 121) * 0.1);
CMD110.value26 = (float)(ByteUtils.DToUInt32(data, 125) * 0.1);
CMD110.value27 = data[129];
CMD110.value28 = (float)(ByteUtils.DToUInt16(data, 130) * 0.1);
CMD110.value29 = (float)(ByteUtils.DToUInt32(data, 132) * 0.1);
CMD110.value30 = Encoding.ASCII.GetString(data, 136, 32);
}
return CMD110;
}
@ -409,132 +410,132 @@ namespace BatCharging.Service.DataRlt
CMD202.value15 = (ByteUtils.DToUInt32(data, 112) * 0.01).ToString("F2");
CMD202.value26 = ByteUtils.DToUInt32(data, 167);
CMD202.value27 = ByteUtils.DToUInt32(data, 171);
CMD202.value28 = ByteUtils.DToUInt32(data, 175);
CMD202.value29 = ByteUtils.DToUInt32(data, 179);
CMD202.value30 = ByteUtils.DToUInt32(data, 183);
CMD202.value31 = ByteUtils.DToUInt32(data, 187);
CMD202.value32 = ByteUtils.DToUInt32(data, 191);
CMD202.value33 = ByteUtils.DToUInt32(data, 195);
CMD202.value34 = ByteUtils.DToUInt32(data, 199);
CMD202.value35 = ByteUtils.DToUInt32(data, 203);
CMD202.value36 = ByteUtils.DToUInt32(data, 207);
CMD202.value37 = ByteUtils.DToUInt32(data, 211);
CMD202.value38 = ByteUtils.DToUInt32(data, 215);
CMD202.value39 = ByteUtils.DToUInt32(data, 219);
CMD202.value40 = ByteUtils.DToUInt32(data, 223);
CMD202.value41 = ByteUtils.DToUInt32(data, 227);
CMD202.value42 = ByteUtils.DToUInt32(data, 231);
CMD202.value43 = ByteUtils.DToUInt32(data, 235);
CMD202.value44 = ByteUtils.DToUInt32(data, 239);
CMD202.value45 = ByteUtils.DToUInt32(data, 243);
CMD202.value46 = ByteUtils.DToUInt32(data, 247);
CMD202.value47 = ByteUtils.DToUInt32(data, 251);
CMD202.value48 = ByteUtils.DToUInt32(data, 255);
CMD202.value49 = ByteUtils.DToUInt32(data, 259);
CMD202.value50 = ByteUtils.DToUInt32(data, 263);
CMD202.value51 = ByteUtils.DToUInt32(data, 267);
CMD202.value52 = ByteUtils.DToUInt32(data, 271);
CMD202.value53 = ByteUtils.DToUInt32(data, 275);
CMD202.value54 = ByteUtils.DToUInt32(data, 279);
CMD202.value55 = ByteUtils.DToUInt32(data, 283);
CMD202.value56 = ByteUtils.DToUInt32(data, 287);
CMD202.value57 = ByteUtils.DToUInt32(data, 291);
CMD202.value58 = ByteUtils.DToUInt32(data, 295);
CMD202.value59 = ByteUtils.DToUInt32(data, 299);
CMD202.value60 = ByteUtils.DToUInt32(data, 303);
CMD202.value61 = ByteUtils.DToUInt32(data, 307);
CMD202.value63 = ByteUtils.DToUInt32(data, 311);
CMD202.value64 = ByteUtils.DToUInt32(data, 315);
CMD202.value64 = ByteUtils.DToUInt32(data, 319);
CMD202.value65 = ByteUtils.DToUInt32(data, 323);
CMD202.value66 = ByteUtils.DToUInt32(data, 327);
CMD202.value67 = ByteUtils.DToUInt32(data, 331);
CMD202.value68 = ByteUtils.DToUInt32(data, 335);
CMD202.value69 = ByteUtils.DToUInt32(data, 339);
CMD202.value70 = ByteUtils.DToUInt32(data, 343);
CMD202.value71 = ByteUtils.DToUInt32(data, 347);
CMD202.value72 = ByteUtils.DToUInt32(data, 351);
CMD202.value73 = ByteUtils.DToUInt32(data, 355);
CMD202.value26 = ByteUtils.DToUInt16(data, 167).ToString();
CMD202.value27 = ByteUtils.DToUInt16(data, 169).ToString();
CMD202.value28 = ByteUtils.DToUInt16(data, 171).ToString();
CMD202.value29 = ByteUtils.DToUInt16(data, 173).ToString();
CMD202.value30 = ByteUtils.DToUInt16(data, 175).ToString();
CMD202.value31 = ByteUtils.DToUInt16(data, 177).ToString();
CMD202.value32 = ByteUtils.DToUInt16(data, 179).ToString();
CMD202.value33 = ByteUtils.DToUInt16(data, 181).ToString();
CMD202.value34 = ByteUtils.DToUInt16(data, 183).ToString();
CMD202.value35 = ByteUtils.DToUInt16(data, 185).ToString();
CMD202.value36 = ByteUtils.DToUInt16(data, 187).ToString();
CMD202.value37 = ByteUtils.DToUInt16(data, 189).ToString();
CMD202.value38 = ByteUtils.DToUInt16(data, 191).ToString();
CMD202.value39 = ByteUtils.DToUInt16(data, 193).ToString();
CMD202.value40 = ByteUtils.DToUInt16(data, 195).ToString();
CMD202.value41 = ByteUtils.DToUInt16(data, 197).ToString();
CMD202.value42 = ByteUtils.DToUInt16(data, 199).ToString();
CMD202.value43 = ByteUtils.DToUInt16(data, 201).ToString();
CMD202.value44 = ByteUtils.DToUInt16(data, 203).ToString();
CMD202.value45 = ByteUtils.DToUInt16(data, 205).ToString();
CMD202.value46 = ByteUtils.DToUInt16(data, 207).ToString();
CMD202.value47 = ByteUtils.DToUInt16(data, 209).ToString();
CMD202.value48 = ByteUtils.DToUInt16(data, 211).ToString();
CMD202.value49 = ByteUtils.DToUInt16(data, 213).ToString();
CMD202.value50 = ByteUtils.DToUInt16(data, 215).ToString();
CMD202.value51 = ByteUtils.DToUInt16(data, 217).ToString();
CMD202.value52 = ByteUtils.DToUInt16(data, 219).ToString();
CMD202.value53 = ByteUtils.DToUInt16(data, 221).ToString();
CMD202.value54 = ByteUtils.DToUInt16(data, 223).ToString();
CMD202.value55 = ByteUtils.DToUInt16(data, 225).ToString();
CMD202.value56 = ByteUtils.DToUInt16(data, 227).ToString();
CMD202.value57 = ByteUtils.DToUInt16(data, 229).ToString();
CMD202.value58 = ByteUtils.DToUInt16(data, 231).ToString();
CMD202.value59 = ByteUtils.DToUInt16(data, 233).ToString();
CMD202.value60 = ByteUtils.DToUInt16(data, 235).ToString();
CMD202.value61 = ByteUtils.DToUInt16(data, 237).ToString();
CMD202.value63 = ByteUtils.DToUInt16(data, 239).ToString();
CMD202.value64 = ByteUtils.DToUInt16(data, 241).ToString();
CMD202.value64 = ByteUtils.DToUInt16(data, 243).ToString();
CMD202.value65 = ByteUtils.DToUInt16(data, 245).ToString();
CMD202.value66 = ByteUtils.DToUInt16(data, 247).ToString();
CMD202.value67 = ByteUtils.DToUInt16(data, 249).ToString();
CMD202.value68 = ByteUtils.DToUInt16(data, 251).ToString();
CMD202.value69 = ByteUtils.DToUInt16(data, 253).ToString();
CMD202.value70 = ByteUtils.DToUInt16(data, 255).ToString();
CMD202.value71 = ByteUtils.DToUInt16(data, 257).ToString();
CMD202.value72 = ByteUtils.DToUInt16(data, 259).ToString();
CMD202.value73 = ByteUtils.DToUInt16(data, 261).ToString();
CMD202.value74 = data[359];
CMD202.value75 = Encoding.ASCII.GetString(data, 360, 32);
CMD202.value76 = ByteUtils.DToUInt32(data, 392);
CMD202.value77 = data[394];
CMD202.value78 = data[395];
CMD202.value79 = data[396];
CMD202.value80 = data[397];
CMD202.value81 = Encoding.ASCII.GetString(data, 398, 6);
CMD202.value82 = ByteUtils.DToUInt16(data, 404);
CMD202.value83 = data[408];
CMD202.value74 = data[263];
CMD202.value75 = Encoding.ASCII.GetString(data, 264, 32);
CMD202.value76 = ByteUtils.DToUInt32(data, 296);
CMD202.value77 = data[300];
CMD202.value78 = data[301];
CMD202.value79 = data[302];
CMD202.value80 = Encoding.ASCII.GetString(data, 303, 34);
CMD202.value81 = Encoding.ASCII.GetString(data, 337, 6);
CMD202.value82 = ByteUtils.DToUInt16(data, 343);
CMD202.value83 = data[345];
}
else if (func == 222)
{
CMD202.value13 = ByteUtils.DToUInt32(data, 104);
CMD202.value14 = ByteUtils.DToUInt32(data, 108);
CMD202.value15 = ByteUtils.DToUInt32(data, 112);
CMD202.value26 = ByteUtils.DToUInt32(data, 167);
CMD202.value27 = ByteUtils.DToUInt32(data, 171);
CMD202.value28 = ByteUtils.DToUInt32(data, 175);
CMD202.value29 = ByteUtils.DToUInt32(data, 179);
CMD202.value30 = ByteUtils.DToUInt32(data, 183);
CMD202.value31 = ByteUtils.DToUInt32(data, 187);
CMD202.value32 = ByteUtils.DToUInt32(data, 191);
CMD202.value33 = ByteUtils.DToUInt32(data, 195);
CMD202.value34 = ByteUtils.DToUInt32(data, 199);
CMD202.value35 = ByteUtils.DToUInt32(data, 203);
CMD202.value36 = ByteUtils.DToUInt32(data, 207);
CMD202.value37 = ByteUtils.DToUInt32(data, 211);
CMD202.value38 = ByteUtils.DToUInt32(data, 215);
CMD202.value39 = ByteUtils.DToUInt32(data, 219);
CMD202.value40 = ByteUtils.DToUInt32(data, 223);
CMD202.value41 = ByteUtils.DToUInt32(data, 227);
CMD202.value42 = ByteUtils.DToUInt32(data, 231);
CMD202.value43 = ByteUtils.DToUInt32(data, 235);
CMD202.value44 = ByteUtils.DToUInt32(data, 239);
CMD202.value45 = ByteUtils.DToUInt32(data, 243);
CMD202.value46 = ByteUtils.DToUInt32(data, 247);
CMD202.value47 = ByteUtils.DToUInt32(data, 251);
CMD202.value48 = ByteUtils.DToUInt32(data, 255);
CMD202.value49 = ByteUtils.DToUInt32(data, 259);
CMD202.value50 = ByteUtils.DToUInt32(data, 263);
CMD202.value51 = ByteUtils.DToUInt32(data, 267);
CMD202.value52 = ByteUtils.DToUInt32(data, 271);
CMD202.value53 = ByteUtils.DToUInt32(data, 275);
CMD202.value54 = ByteUtils.DToUInt32(data, 279);
CMD202.value55 = ByteUtils.DToUInt32(data, 283);
CMD202.value56 = ByteUtils.DToUInt32(data, 287);
CMD202.value57 = ByteUtils.DToUInt32(data, 291);
CMD202.value58 = ByteUtils.DToUInt32(data, 295);
CMD202.value59 = ByteUtils.DToUInt32(data, 299);
CMD202.value60 = ByteUtils.DToUInt32(data, 303);
CMD202.value61 = ByteUtils.DToUInt32(data, 307);
CMD202.value63 = ByteUtils.DToUInt32(data, 311);
CMD202.value64 = ByteUtils.DToUInt32(data, 315);
CMD202.value64 = ByteUtils.DToUInt32(data, 319);
CMD202.value65 = ByteUtils.DToUInt32(data, 323);
CMD202.value66 = ByteUtils.DToUInt32(data, 327);
CMD202.value67 = ByteUtils.DToUInt32(data, 331);
CMD202.value68 = ByteUtils.DToUInt32(data, 335);
CMD202.value69 = ByteUtils.DToUInt32(data, 339);
CMD202.value70 = ByteUtils.DToUInt32(data, 343);
CMD202.value71 = ByteUtils.DToUInt32(data, 347);
CMD202.value72 = ByteUtils.DToUInt32(data, 351);
CMD202.value73 = ByteUtils.DToUInt32(data, 355);
CMD202.value13 = (ByteUtils.DToUInt32(data, 104) * 0.001).ToString("F3");
CMD202.value14 = (ByteUtils.DToUInt32(data, 108) * 0.001).ToString("F3");
CMD202.value15 = (ByteUtils.DToUInt32(data, 112) * 0.001).ToString("F3");
CMD202.value26 = (ByteUtils.DToUInt32(data, 167) * 0.001).ToString("F3");
CMD202.value27 = (ByteUtils.DToUInt32(data, 171) * 0.001).ToString("F3");
CMD202.value28 = (ByteUtils.DToUInt32(data, 175) * 0.001).ToString("F3");
CMD202.value29 = (ByteUtils.DToUInt32(data, 179) * 0.001).ToString("F3");
CMD202.value30 = (ByteUtils.DToUInt32(data, 183) * 0.001).ToString("F3");
CMD202.value31 = (ByteUtils.DToUInt32(data, 187) * 0.001).ToString("F3");
CMD202.value32 = (ByteUtils.DToUInt32(data, 191) * 0.001).ToString("F3");
CMD202.value33 = (ByteUtils.DToUInt32(data, 195) * 0.001).ToString("F3");
CMD202.value34 = (ByteUtils.DToUInt32(data, 199) * 0.001).ToString("F3");
CMD202.value35 = (ByteUtils.DToUInt32(data, 203) * 0.001).ToString("F3");
CMD202.value36 = (ByteUtils.DToUInt32(data, 207) * 0.001).ToString("F3");
CMD202.value37 = (ByteUtils.DToUInt32(data, 211) * 0.001).ToString("F3");
CMD202.value38 = (ByteUtils.DToUInt32(data, 215) * 0.001).ToString("F3");
CMD202.value39 = (ByteUtils.DToUInt32(data, 219) * 0.001).ToString("F3");
CMD202.value40 = (ByteUtils.DToUInt32(data, 223) * 0.001).ToString("F3");
CMD202.value41 = (ByteUtils.DToUInt32(data, 227) * 0.001).ToString("F3");
CMD202.value42 = (ByteUtils.DToUInt32(data, 231) * 0.001).ToString("F3");
CMD202.value43 = (ByteUtils.DToUInt32(data, 235) * 0.001).ToString("F3");
CMD202.value44 = (ByteUtils.DToUInt32(data, 239) * 0.001).ToString("F3");
CMD202.value45 = (ByteUtils.DToUInt32(data, 243) * 0.001).ToString("F3");
CMD202.value46 = (ByteUtils.DToUInt32(data, 247) * 0.001).ToString("F3");
CMD202.value47 = (ByteUtils.DToUInt32(data, 251) * 0.001).ToString("F3");
CMD202.value48 = (ByteUtils.DToUInt32(data, 255) * 0.001).ToString("F3");
CMD202.value49 = (ByteUtils.DToUInt32(data, 259) * 0.001).ToString("F3");
CMD202.value50 = (ByteUtils.DToUInt32(data, 263) * 0.001).ToString("F3");
CMD202.value51 = (ByteUtils.DToUInt32(data, 267) * 0.001).ToString("F3");
CMD202.value52 = (ByteUtils.DToUInt32(data, 271) * 0.001).ToString("F3");
CMD202.value53 = (ByteUtils.DToUInt32(data, 275) * 0.001).ToString("F3");
CMD202.value54 = (ByteUtils.DToUInt32(data, 279) * 0.001).ToString("F3");
CMD202.value55 = (ByteUtils.DToUInt32(data, 283) * 0.001).ToString("F3");
CMD202.value56 = (ByteUtils.DToUInt32(data, 287) * 0.001).ToString("F3");
CMD202.value57 = (ByteUtils.DToUInt32(data, 291) * 0.001).ToString("F3");
CMD202.value58 = (ByteUtils.DToUInt32(data, 295) * 0.001).ToString("F3");
CMD202.value59 = (ByteUtils.DToUInt32(data, 299) * 0.001).ToString("F3");
CMD202.value60 = (ByteUtils.DToUInt32(data, 303) * 0.001).ToString("F3");
CMD202.value61 = (ByteUtils.DToUInt32(data, 307) * 0.001).ToString("F3");
CMD202.value63 = (ByteUtils.DToUInt32(data, 311) * 0.001).ToString("F3");
CMD202.value64 = (ByteUtils.DToUInt32(data, 315) * 0.001).ToString("F3");
CMD202.value64 = (ByteUtils.DToUInt32(data, 319) * 0.001).ToString("F3");
CMD202.value65 = (ByteUtils.DToUInt32(data, 323) * 0.001).ToString("F3");
CMD202.value66 = (ByteUtils.DToUInt32(data, 327) * 0.001).ToString("F3");
CMD202.value67 = (ByteUtils.DToUInt32(data, 331) * 0.001).ToString("F3");
CMD202.value68 = (ByteUtils.DToUInt32(data, 335) * 0.001).ToString("F3");
CMD202.value69 = (ByteUtils.DToUInt32(data, 339) * 0.001).ToString("F3");
CMD202.value70 = (ByteUtils.DToUInt32(data, 343) * 0.001).ToString("F3");
CMD202.value71 = (ByteUtils.DToUInt32(data, 347) * 0.001).ToString("F3");
CMD202.value72 = (ByteUtils.DToUInt32(data, 351) * 0.001).ToString("F3");
CMD202.value73 = (ByteUtils.DToUInt32(data, 355) * 0.001).ToString("F3");
CMD202.value74 = data[359];
CMD202.value75 = Encoding.ASCII.GetString(data, 360, 32);
CMD202.value76 = ByteUtils.DToUInt32(data, 392);
CMD202.value77 = data[394];
CMD202.value78 = data[395];
CMD202.value79 = data[396];
CMD202.value80 = data[397];
CMD202.value81 = Encoding.ASCII.GetString(data, 398, 6);
CMD202.value82 = ByteUtils.DToUInt16(data, 404);
CMD202.value83 = data[408];
CMD202.value77 = data[396];
CMD202.value78 = data[397];
CMD202.value79 = data[398];
CMD202.value80 = Encoding.ASCII.GetString(data, 399, 34);
CMD202.value81 = Encoding.ASCII.GetString(data, 433, 6);
CMD202.value82 = ByteUtils.DToUInt16(data, 439);
CMD202.value83 = data[441];
}
CMD202.value16 = ByteUtils.DToUInt32(data, 116);
@ -631,6 +632,98 @@ namespace BatCharging.Service.DataRlt
}
return CMD210;
}
public CMD222 ConCMD222(byte[] data)
{
CMD222 CMD222 = null;
if (data != null && data.Length > 0)
{
CMD222 = new CMD222();
CMD222.value01 = ByteUtils.DToUInt16(data, 8);
CMD222.value02 = ByteUtils.DToUInt16(data, 10);
CMD222.value03 = Encoding.ASCII.GetString(data, 12, 32);
CMD222.value04 = data[44];
CMD222.value05 = data[45];
CMD222.value06 = Encoding.ASCII.GetString(data, 46, 32);
CMD222.value07 = Encoding.ASCII.GetString(data, 78, 8);
CMD222.value08 = Encoding.ASCII.GetString(data, 86, 8);
CMD222.value09 = ByteUtils.DToUInt32(data, 94);
CMD222.value10 = data[98];
CMD222.value11 = data[99];
CMD222.value12 = ByteUtils.DToUInt32(data, 100);
CMD222.value13 = ByteUtils.DToUInt32(data, 104);
CMD222.value14 = ByteUtils.DToUInt32(data, 108);
CMD222.value15 = ByteUtils.DToUInt32(data, 112);
CMD222.value16 = ByteUtils.DToUInt32(data, 116);
CMD222.value17 = ByteUtils.DToUInt32(data, 120);
CMD222.value18 = ByteUtils.DToUInt32(data, 124);
CMD222.value19 = ByteUtils.DToUInt32(data, 128);
CMD222.value20 = ByteUtils.DToUInt32(data, 132);
CMD222.value21 = data[136];
CMD222.value22 = data[137];
CMD222.value23 = ByteUtils.DToUInt32(data, 138);
CMD222.value24 = Encoding.ASCII.GetString(data, 142, 17);
CMD222.value25 = Encoding.ASCII.GetString(data, 159, 8);
CMD222.value26 = ByteUtils.DToUInt32(data, 167);
CMD222.value27 = ByteUtils.DToUInt32(data, 171);
CMD222.value28 = ByteUtils.DToUInt32(data, 175);
CMD222.value29 = ByteUtils.DToUInt32(data, 179);
CMD222.value30 = ByteUtils.DToUInt32(data, 183);
CMD222.value31 = ByteUtils.DToUInt32(data, 187);
CMD222.value32 = ByteUtils.DToUInt32(data, 191);
CMD222.value33 = ByteUtils.DToUInt32(data, 195);
CMD222.value34 = ByteUtils.DToUInt32(data, 199);
CMD222.value35 = ByteUtils.DToUInt32(data, 203);
CMD222.value36 = ByteUtils.DToUInt32(data, 207);
CMD222.value37 = ByteUtils.DToUInt32(data, 211);
CMD222.value38 = ByteUtils.DToUInt32(data, 215);
CMD222.value39 = ByteUtils.DToUInt32(data, 219);
CMD222.value40 = ByteUtils.DToUInt32(data, 223);
CMD222.value41 = ByteUtils.DToUInt32(data, 227);
CMD222.value42 = ByteUtils.DToUInt32(data, 231);
CMD222.value43 = ByteUtils.DToUInt32(data, 235);
CMD222.value44 = ByteUtils.DToUInt32(data, 239);
CMD222.value45 = ByteUtils.DToUInt32(data, 243);
CMD222.value46 = ByteUtils.DToUInt32(data, 247);
CMD222.value47 = ByteUtils.DToUInt32(data, 251);
CMD222.value48 = ByteUtils.DToUInt32(data, 255);
CMD222.value49 = ByteUtils.DToUInt32(data, 259);
CMD222.value50 = ByteUtils.DToUInt32(data, 263);
CMD222.value51 = ByteUtils.DToUInt32(data, 267);
CMD222.value52 = ByteUtils.DToUInt32(data, 271);
CMD222.value53 = ByteUtils.DToUInt32(data, 275);
CMD222.value54 = ByteUtils.DToUInt32(data, 279);
CMD222.value55 = ByteUtils.DToUInt32(data, 283);
CMD222.value56 = ByteUtils.DToUInt32(data, 287);
CMD222.value57 = ByteUtils.DToUInt32(data, 291);
CMD222.value58 = ByteUtils.DToUInt32(data, 295);
CMD222.value59 = ByteUtils.DToUInt32(data, 299);
CMD222.value60 = ByteUtils.DToUInt32(data, 303);
CMD222.value61 = ByteUtils.DToUInt32(data, 307);
CMD222.value63 = ByteUtils.DToUInt32(data, 311);
CMD222.value64 = ByteUtils.DToUInt32(data, 315);
CMD222.value64 = ByteUtils.DToUInt32(data, 319);
CMD222.value65 = ByteUtils.DToUInt32(data, 323);
CMD222.value66 = ByteUtils.DToUInt32(data, 327);
CMD222.value67 = ByteUtils.DToUInt32(data, 331);
CMD222.value68 = ByteUtils.DToUInt32(data, 335);
CMD222.value69 = ByteUtils.DToUInt32(data, 339);
CMD222.value70 = ByteUtils.DToUInt32(data, 343);
CMD222.value71 = ByteUtils.DToUInt32(data, 347);
CMD222.value72 = ByteUtils.DToUInt32(data, 351);
CMD222.value73 = ByteUtils.DToUInt32(data, 355);
CMD222.value74 = data[359];
CMD222.value75 = Encoding.ASCII.GetString(data, 360, 32);
CMD222.value76 = ByteUtils.DToUInt32(data, 392);
CMD222.value77 = data[394];
CMD222.value78 = data[395];
CMD222.value79 = data[396];
CMD222.value80 = data[397];
CMD222.value81 = Encoding.ASCII.GetString(data, 398, 6);
CMD222.value82 = ByteUtils.DToUInt16(data, 404);
CMD222.value83 = data[408];
}
return CMD222;
}
public CMD302 ConCMD302(byte[] data)
{
CMD302 CMD302 = null;
@ -741,7 +834,7 @@ namespace BatCharging.Service.DataRlt
}
return CMD304;
}
public CMD402 ConCMD402(byte[] data)
public CMD402 ConCMD402(uint func, byte[] data)
{
CMD402 CMD402 = null;
if (data != null && data.Length > 0)
@ -759,7 +852,126 @@ namespace BatCharging.Service.DataRlt
CMD402.startSoc = data[98];
CMD402.endSoc = data[99];
CMD402.chargingEndReason = Encoding.ASCII.GetString(data, 100, 4);
CMD402.currentChargingLevel = (float)ByteUtils.ToUInt32(data, 104);
if (func == 402)
{
CMD402.currentChargingLevel = (ByteUtils.ToUInt32(data, 104) * 0.01).ToString("F2");
CMD402.timeUInt32erval1ChargingElectLevel = ((ByteUtils.DToUInt16(data, 167)) * 0.01).ToString("F2");
CMD402.timeUInt32erval2ChargingElectLevel = ((ByteUtils.DToUInt16(data, 169)) * 0.01).ToString("F2");
CMD402.timeUInt32erval3ChargingElectLevel = ((ByteUtils.DToUInt16(data, 171)) * 0.01).ToString("F2");
CMD402.timeUInt32erval4ChargingElectLevel = ((ByteUtils.DToUInt16(data, 173)) * 0.01).ToString("F2");
CMD402.timeUInt32erval5ChargingElectLevel = ((ByteUtils.DToUInt16(data, 175)) * 0.01).ToString("F2");
CMD402.timeUInt32erval6ChargingElectLevel = ((ByteUtils.DToUInt16(data, 177)) * 0.01).ToString("F2");
CMD402.timeUInt32erval7ChargingElectLevel = ((ByteUtils.DToUInt16(data, 179)) * 0.01).ToString("F2");
CMD402.timeUInt32erval8ChargingElectLevel = ((ByteUtils.DToUInt16(data, 181)) * 0.01).ToString("F2");
CMD402.timeUInt32erval9ChargingElectLevel = ((ByteUtils.DToUInt16(data, 183)) * 0.01).ToString("F2");
CMD402.timeUInt32erval10ChargingElectLevel = ((ByteUtils.DToUInt16(data, 183)) * 0.01).ToString("F2");
CMD402.timeUInt32erval11ChargingElectLevel = ((ByteUtils.DToUInt16(data, 185)) * 0.01).ToString("F2");
CMD402.timeUInt32erval12ChargingElectLevel = ((ByteUtils.DToUInt16(data, 187)) * 0.01).ToString("F2");
CMD402.timeUInt32erval13ChargingElectLevel = ((ByteUtils.DToUInt16(data, 189)) * 0.01).ToString("F2");
CMD402.timeUInt32erval14ChargingElectLevel = ((ByteUtils.DToUInt16(data, 191)) * 0.01).ToString("F2");
CMD402.timeUInt32erval15ChargingElectLevel = ((ByteUtils.DToUInt16(data, 193)) * 0.01).ToString("F2");
CMD402.timeUInt32erval16ChargingElectLevel = ((ByteUtils.DToUInt16(data, 195)) * 0.01).ToString("F2");
CMD402.timeUInt32erval17ChargingElectLevel = ((ByteUtils.DToUInt16(data, 197)) * 0.01).ToString("F2");
CMD402.timeUInt32erval18ChargingElectLevel = ((ByteUtils.DToUInt16(data, 199)) * 0.01).ToString("F2");
CMD402.timeUInt32erval19ChargingElectLevel = ((ByteUtils.DToUInt16(data, 201)) * 0.01).ToString("F2");
CMD402.timeUInt32erval20ChargingElectLevel = ((ByteUtils.DToUInt16(data, 203)) * 0.01).ToString("F2");
CMD402.timeUInt32erval21ChargingElectLevel = ((ByteUtils.DToUInt16(data, 205)) * 0.01).ToString("F2");
CMD402.timeUInt32erval22ChargingElectLevel = ((ByteUtils.DToUInt16(data, 207)) * 0.01).ToString("F2");
CMD402.timeUInt32erval23ChargingElectLevel = ((ByteUtils.DToUInt16(data, 209)) * 0.01).ToString("F2");
CMD402.timeUInt32erval24ChargingElectLevel = ((ByteUtils.DToUInt16(data, 211)) * 0.01).ToString("F2");
CMD402.timeUInt32erval25ChargingElectLevel = ((ByteUtils.DToUInt16(data, 213)) * 0.01).ToString("F2");
CMD402.timeUInt32erval26ChargingElectLevel = ((ByteUtils.DToUInt16(data, 215)) * 0.01).ToString("F2");
CMD402.timeUInt32erval27ChargingElectLevel = ((ByteUtils.DToUInt16(data, 217)) * 0.01).ToString("F2");
CMD402.timeUInt32erval28ChargingElectLevel = ((ByteUtils.DToUInt16(data, 219)) * 0.01).ToString("F2");
CMD402.timeUInt32erval29ChargingElectLevel = ((ByteUtils.DToUInt16(data, 221)) * 0.01).ToString("F2");
CMD402.timeUInt32erval30ChargingElectLevel = ((ByteUtils.DToUInt16(data, 223)) * 0.01).ToString("F2");
CMD402.timeUInt32erval31ChargingElectLevel = ((ByteUtils.DToUInt16(data, 225)) * 0.01).ToString("F2");
CMD402.timeUInt32erval32ChargingElectLevel = ((ByteUtils.DToUInt16(data, 227)) * 0.01).ToString("F2");
CMD402.timeUInt32erval33ChargingElectLevel = ((ByteUtils.DToUInt16(data, 229)) * 0.01).ToString("F2");
CMD402.timeUInt32erval34ChargingElectLevel = ((ByteUtils.DToUInt16(data, 231)) * 0.01).ToString("F2");
CMD402.timeUInt32erval35ChargingElectLevel = ((ByteUtils.DToUInt16(data, 233)) * 0.01).ToString("F2");
CMD402.timeUInt32erval36ChargingElectLevel = ((ByteUtils.DToUInt16(data, 235)) * 0.01).ToString("F2");
CMD402.timeUInt32erval37ChargingElectLevel = ((ByteUtils.DToUInt16(data, 237)) * 0.01).ToString("F2");
CMD402.timeUInt32erval38ChargingElectLevel = ((ByteUtils.DToUInt16(data, 239)) * 0.01).ToString("F2");
CMD402.timeUInt32erval39ChargingElectLevel = ((ByteUtils.DToUInt16(data, 241)) * 0.01).ToString("F2");
CMD402.timeUInt32erval40ChargingElectLevel = ((ByteUtils.DToUInt16(data, 243)) * 0.01).ToString("F2");
CMD402.timeUInt32erval41ChargingElectLevel = ((ByteUtils.DToUInt16(data, 245)) * 0.01).ToString("F2");
CMD402.timeUInt32erval42ChargingElectLevel = ((ByteUtils.DToUInt16(data, 247)) * 0.01).ToString("F2");
CMD402.timeUInt32erval43ChargingElectLevel = ((ByteUtils.DToUInt16(data, 249)) * 0.01).ToString("F2");
CMD402.timeUInt32erval44ChargingElectLevel = ((ByteUtils.DToUInt16(data, 251)) * 0.01).ToString("F2");
CMD402.timeUInt32erval45ChargingElectLevel = ((ByteUtils.DToUInt16(data, 253)) * 0.01).ToString("F2");
CMD402.timeUInt32erval46ChargingElectLevel = ((ByteUtils.DToUInt16(data, 255)) * 0.01).ToString("F2");
CMD402.timeUInt32erval47ChargingElectLevel = ((ByteUtils.DToUInt16(data, 257)) * 0.01).ToString("F2");
CMD402.timeUInt32erval48ChargingElectLevel = ((ByteUtils.DToUInt16(data, 259)) * 0.01).ToString("F2");
CMD402.startWay = data[261];
CMD402.chargingSerialNum = Encoding.ASCII.GetString(data, 262, 32);
CMD402.chargingServiceCharge = ByteUtils.DToUInt32(data, 294);
CMD402.millennialpowerConsumption = (data[298]*0.001).ToString("F4");
CMD402.parallelChargingMark = data[299];
}
else if (func == 422)
{
CMD402.currentChargingLevel = (ByteUtils.ToUInt32(data, 104) * 0.001).ToString("F3");
CMD402.timeUInt32erval1ChargingElectLevel = ((ByteUtils.DToUInt32(data, 167)*0.001)).ToString("F3");
CMD402.timeUInt32erval2ChargingElectLevel = ((ByteUtils.DToUInt32(data, 171)*0.001)).ToString("F3");
CMD402.timeUInt32erval3ChargingElectLevel = ((ByteUtils.DToUInt32(data, 175)*0.001)).ToString("F3");
CMD402.timeUInt32erval4ChargingElectLevel = ((ByteUtils.DToUInt32(data, 179)*0.001)).ToString("F3");
CMD402.timeUInt32erval5ChargingElectLevel = ((ByteUtils.DToUInt32(data, 183)*0.001)).ToString("F3");
CMD402.timeUInt32erval6ChargingElectLevel = ((ByteUtils.DToUInt32(data, 187)*0.001)).ToString("F3");
CMD402.timeUInt32erval7ChargingElectLevel = ((ByteUtils.DToUInt32(data, 191)*0.001)).ToString("F3");
CMD402.timeUInt32erval8ChargingElectLevel = ((ByteUtils.DToUInt32(data, 195)*0.001)).ToString("F3");
CMD402.timeUInt32erval9ChargingElectLevel = ((ByteUtils.DToUInt32(data, 199)*0.001)).ToString("F3");
CMD402.timeUInt32erval10ChargingElectLevel = ((ByteUtils.DToUInt32(data, 203)*0.001)).ToString("F3");
CMD402.timeUInt32erval11ChargingElectLevel = ((ByteUtils.DToUInt32(data, 207)*0.001)).ToString("F3");
CMD402.timeUInt32erval12ChargingElectLevel = ((ByteUtils.DToUInt32(data, 211)*0.001)).ToString("F3");
CMD402.timeUInt32erval13ChargingElectLevel = ((ByteUtils.DToUInt32(data, 215)*0.001)).ToString("F3");
CMD402.timeUInt32erval14ChargingElectLevel = ((ByteUtils.DToUInt32(data, 219)*0.001)).ToString("F3");
CMD402.timeUInt32erval15ChargingElectLevel = ((ByteUtils.DToUInt32(data, 223)*0.001)).ToString("F3");
CMD402.timeUInt32erval16ChargingElectLevel = ((ByteUtils.DToUInt32(data, 227)*0.001)).ToString("F3");
CMD402.timeUInt32erval17ChargingElectLevel = ((ByteUtils.DToUInt32(data, 231)*0.001)).ToString("F3");
CMD402.timeUInt32erval18ChargingElectLevel = ((ByteUtils.DToUInt32(data, 235)*0.001)).ToString("F3");
CMD402.timeUInt32erval19ChargingElectLevel = ((ByteUtils.DToUInt32(data, 239)*0.001)).ToString("F3");
CMD402.timeUInt32erval20ChargingElectLevel = ((ByteUtils.DToUInt32(data, 243)*0.001)).ToString("F3");
CMD402.timeUInt32erval21ChargingElectLevel = ((ByteUtils.DToUInt32(data, 247)*0.001)).ToString("F3");
CMD402.timeUInt32erval22ChargingElectLevel = ((ByteUtils.DToUInt32(data, 251)*0.001)).ToString("F3");
CMD402.timeUInt32erval23ChargingElectLevel = ((ByteUtils.DToUInt32(data, 255)*0.001)).ToString("F3");
CMD402.timeUInt32erval24ChargingElectLevel = ((ByteUtils.DToUInt32(data, 259)*0.001)).ToString("F3");
CMD402.timeUInt32erval25ChargingElectLevel = ((ByteUtils.DToUInt32(data, 263)*0.001)).ToString("F3");
CMD402.timeUInt32erval26ChargingElectLevel = ((ByteUtils.DToUInt32(data, 267)*0.001)).ToString("F3");
CMD402.timeUInt32erval27ChargingElectLevel = ((ByteUtils.DToUInt32(data, 271)*0.001)).ToString("F3");
CMD402.timeUInt32erval28ChargingElectLevel = ((ByteUtils.DToUInt32(data, 275)*0.001)).ToString("F3");
CMD402.timeUInt32erval29ChargingElectLevel = ((ByteUtils.DToUInt32(data, 279)*0.001)).ToString("F3");
CMD402.timeUInt32erval30ChargingElectLevel = ((ByteUtils.DToUInt32(data, 283)*0.001)).ToString("F3");
CMD402.timeUInt32erval31ChargingElectLevel = ((ByteUtils.DToUInt32(data, 287)*0.001)).ToString("F3");
CMD402.timeUInt32erval32ChargingElectLevel = ((ByteUtils.DToUInt32(data, 291)*0.001)).ToString("F3");
CMD402.timeUInt32erval33ChargingElectLevel = ((ByteUtils.DToUInt32(data, 295)*0.001)).ToString("F3");
CMD402.timeUInt32erval34ChargingElectLevel = ((ByteUtils.DToUInt32(data, 299)*0.001)).ToString("F3");
CMD402.timeUInt32erval35ChargingElectLevel = ((ByteUtils.DToUInt32(data, 301)*0.001)).ToString("F3");
CMD402.timeUInt32erval36ChargingElectLevel = ((ByteUtils.DToUInt32(data, 305)*0.001)).ToString("F3");
CMD402.timeUInt32erval37ChargingElectLevel = ((ByteUtils.DToUInt32(data, 309)*0.001)).ToString("F3");
CMD402.timeUInt32erval38ChargingElectLevel = ((ByteUtils.DToUInt32(data, 313)*0.001)).ToString("F3");
CMD402.timeUInt32erval39ChargingElectLevel = ((ByteUtils.DToUInt32(data, 317)*0.001)).ToString("F3");
CMD402.timeUInt32erval40ChargingElectLevel = ((ByteUtils.DToUInt32(data, 321)*0.001)).ToString("F3");
CMD402.timeUInt32erval41ChargingElectLevel = ((ByteUtils.DToUInt32(data, 325)*0.001)).ToString("F3");
CMD402.timeUInt32erval42ChargingElectLevel = ((ByteUtils.DToUInt32(data, 329)*0.001)).ToString("F3");
CMD402.timeUInt32erval43ChargingElectLevel = ((ByteUtils.DToUInt32(data, 333)*0.001)).ToString("F3");
CMD402.timeUInt32erval44ChargingElectLevel = ((ByteUtils.DToUInt32(data, 337)*0.001)).ToString("F3");
CMD402.timeUInt32erval45ChargingElectLevel = ((ByteUtils.DToUInt32(data, 341)*0.001)).ToString("F3");
CMD402.timeUInt32erval46ChargingElectLevel = ((ByteUtils.DToUInt32(data, 345)*0.001)).ToString("F3");
CMD402.timeUInt32erval47ChargingElectLevel = ((ByteUtils.DToUInt32(data, 349)*0.001)).ToString("F3");
CMD402.timeUInt32erval48ChargingElectLevel = ((ByteUtils.DToUInt32(data, 353)*0.001)).ToString("F3");
CMD402.startWay = data[357];
CMD402.chargingSerialNum = Encoding.ASCII.GetString(data, 358, 32);
CMD402.chargingServiceCharge = ByteUtils.DToUInt32(data, 390);
CMD402.millennialpowerConsumption = (data[394] * 0.001).ToString("F4");
CMD402.parallelChargingMark = data[395];
}
CMD402.beforeChargingElectMeter = ByteUtils.DToUInt32(data, 108);
CMD402.behindChargingElectMeter = ByteUtils.DToUInt32(data, 112);
CMD402.currentChargingMoney = ByteUtils.DToUInt32(data, 116);
@ -769,62 +981,23 @@ namespace BatCharging.Service.DataRlt
CMD402.allCharingRecordEntry = ByteUtils.DToUInt32(data, 132);
CMD402.reserved3 = data[136];
CMD402.chargingStrategy = data[137];
CMD402.chargingStrategyPara = (float)ByteUtils.ToUInt32(data, 138);
switch (data[137])
{
case 1:
CMD402.chargingStrategyPara = (ByteUtils.ToUInt32(data, 138)).ToString();
break;
case 2:
CMD402.chargingStrategyPara = ((float)ByteUtils.ToUInt32(data, 138) * 0.01).ToString("F2");
break;
case 3:
CMD402.chargingStrategyPara = ((float)ByteUtils.ToUInt32(data, 138) * 0.01).ToString("F3");
break;
}
CMD402.carVin = Encoding.ASCII.GetString(data, 142, 17);
CMD402.carNum = Encoding.ASCII.GetString(data, 159, 8);
CMD402.timeUInt32erval1ChargingElectLevel = Encoding.ASCII.GetString(data, 167, 2);
CMD402.timeUInt32erval2ChargingElectLevel = Encoding.ASCII.GetString(data, 169, 2);
CMD402.timeUInt32erval3ChargingElectLevel = Encoding.ASCII.GetString(data, 171, 2);
CMD402.timeUInt32erval4ChargingElectLevel = Encoding.ASCII.GetString(data, 173, 2);
CMD402.timeUInt32erval5ChargingElectLevel = Encoding.ASCII.GetString(data, 175, 2);
CMD402.timeUInt32erval6ChargingElectLevel = Encoding.ASCII.GetString(data, 177, 2);
CMD402.timeUInt32erval7ChargingElectLevel = Encoding.ASCII.GetString(data, 179, 2);
CMD402.timeUInt32erval8ChargingElectLevel = Encoding.ASCII.GetString(data, 181, 2);
CMD402.timeUInt32erval9ChargingElectLevel = Encoding.ASCII.GetString(data, 183, 2);
CMD402.timeUInt32erval10ChargingElectLevel = Encoding.ASCII.GetString(data, 183, 2);
CMD402.timeUInt32erval11ChargingElectLevel = Encoding.ASCII.GetString(data, 185, 2);
CMD402.timeUInt32erval12ChargingElectLevel = Encoding.ASCII.GetString(data, 187, 2);
CMD402.timeUInt32erval13ChargingElectLevel = Encoding.ASCII.GetString(data, 189, 2);
CMD402.timeUInt32erval14ChargingElectLevel = Encoding.ASCII.GetString(data, 191, 2);
CMD402.timeUInt32erval15ChargingElectLevel = Encoding.ASCII.GetString(data, 193, 2);
CMD402.timeUInt32erval16ChargingElectLevel = Encoding.ASCII.GetString(data, 195, 2);
CMD402.timeUInt32erval17ChargingElectLevel = Encoding.ASCII.GetString(data, 197, 2);
CMD402.timeUInt32erval18ChargingElectLevel = Encoding.ASCII.GetString(data, 199, 2);
CMD402.timeUInt32erval19ChargingElectLevel = Encoding.ASCII.GetString(data, 201, 2);
CMD402.timeUInt32erval20ChargingElectLevel = Encoding.ASCII.GetString(data, 203, 2);
CMD402.timeUInt32erval21ChargingElectLevel = Encoding.ASCII.GetString(data, 205, 2);
CMD402.timeUInt32erval22ChargingElectLevel = Encoding.ASCII.GetString(data, 207, 2);
CMD402.timeUInt32erval23ChargingElectLevel = Encoding.ASCII.GetString(data, 209, 2);
CMD402.timeUInt32erval24ChargingElectLevel = Encoding.ASCII.GetString(data, 211, 2);
CMD402.timeUInt32erval25ChargingElectLevel = Encoding.ASCII.GetString(data, 213, 2);
CMD402.timeUInt32erval26ChargingElectLevel = Encoding.ASCII.GetString(data, 215, 2);
CMD402.timeUInt32erval27ChargingElectLevel = Encoding.ASCII.GetString(data, 217, 2);
CMD402.timeUInt32erval28ChargingElectLevel = Encoding.ASCII.GetString(data, 219, 2);
CMD402.timeUInt32erval29ChargingElectLevel = Encoding.ASCII.GetString(data, 221, 2);
CMD402.timeUInt32erval30ChargingElectLevel = Encoding.ASCII.GetString(data, 223, 2);
CMD402.timeUInt32erval31ChargingElectLevel = Encoding.ASCII.GetString(data, 225, 2);
CMD402.timeUInt32erval32ChargingElectLevel = Encoding.ASCII.GetString(data, 227, 2);
CMD402.timeUInt32erval33ChargingElectLevel = Encoding.ASCII.GetString(data, 229, 2);
CMD402.timeUInt32erval34ChargingElectLevel = Encoding.ASCII.GetString(data, 231, 2);
CMD402.timeUInt32erval35ChargingElectLevel = Encoding.ASCII.GetString(data, 233, 2);
CMD402.timeUInt32erval36ChargingElectLevel = Encoding.ASCII.GetString(data, 235, 2);
CMD402.timeUInt32erval37ChargingElectLevel = Encoding.ASCII.GetString(data, 237, 2);
CMD402.timeUInt32erval38ChargingElectLevel = Encoding.ASCII.GetString(data, 239, 2);
CMD402.timeUInt32erval39ChargingElectLevel = Encoding.ASCII.GetString(data, 241, 2);
CMD402.timeUInt32erval40ChargingElectLevel = Encoding.ASCII.GetString(data, 243, 2);
CMD402.timeUInt32erval41ChargingElectLevel = Encoding.ASCII.GetString(data, 245, 2);
CMD402.timeUInt32erval42ChargingElectLevel = Encoding.ASCII.GetString(data, 247, 2);
CMD402.timeUInt32erval43ChargingElectLevel = Encoding.ASCII.GetString(data, 249, 2);
CMD402.timeUInt32erval44ChargingElectLevel = Encoding.ASCII.GetString(data, 251, 2);
CMD402.timeUInt32erval45ChargingElectLevel = Encoding.ASCII.GetString(data, 253, 2);
CMD402.timeUInt32erval46ChargingElectLevel = Encoding.ASCII.GetString(data, 255, 2);
CMD402.timeUInt32erval47ChargingElectLevel = Encoding.ASCII.GetString(data, 257, 2);
CMD402.timeUInt32erval48ChargingElectLevel = Encoding.ASCII.GetString(data, 259, 2);
CMD402.startWay = data[261];
CMD402.chargingSerialNum = Encoding.ASCII.GetString(data, 262, 32);
CMD402.chargingServiceCharge = ByteUtils.DToUInt32(data, 294);
CMD402.millennialpowerConsumption = data[298];
CMD402.parallelChargingMark = data[299];
}
return CMD402;
}

@ -12,7 +12,7 @@ namespace BatCharging.Service
#region 协议格式
public byte[] SendRCMD1(out APDUModel APDUModel, CMD1 t)
{
byte[] result = null;
APDUModel model = new APDUModel();
@ -23,7 +23,7 @@ namespace BatCharging.Service
model.CMD = 1;
model.checksumDomain = 0x01;
model.dataDomain = GetRCMD1DataInfo(t); //数据域
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
@ -222,7 +222,7 @@ namespace BatCharging.Service
lstContent.AddRange(BitConverter.GetBytes(CMD.value10));
lstContent.AddRange(BitConverter.GetBytes(CMD.value11));
lstContent.AddRange(BitConverter.GetBytes(CMD.value12));
lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.value13));
lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.value13, 32));
lstContent.AddRange(BitConverter.GetBytes(CMD.value14));
lstContent.AddRange(BitConverter.GetBytes(CMD.value15));
lstContent.AddRange(BitConverter.GetBytes(CMD.value16));
@ -232,7 +232,7 @@ namespace BatCharging.Service
}
public byte[] SendRCMD9(out APDUModel APDUModel,CMD9 CMD)
public byte[] SendRCMD9(out APDUModel APDUModel, CMD9 CMD)
{
byte[] result = null;
@ -623,7 +623,7 @@ namespace BatCharging.Service
#region 充电信息数据
public byte[] SendRCMD201(out APDUModel APDUModel, CMD201 CMD)
public byte[] SendRCMD201(out APDUModel APDUModel, CMD201 CMD, uint func)
{
byte[] result = null;
@ -632,7 +632,15 @@ namespace BatCharging.Service
model.OriginDomain2 = 0xF5;
model.infoDomain = 0x02;
model.SerialNumberDomain = 0xff;
model.CMD = 2011;
if (func == 202)
{
model.CMD = 201;
}
else if (func == 222)
{
model.CMD = 221;
}
model.checksumDomain = 0x01;
model.dataDomain = GetRCMD201DataInfo(CMD); //数据域
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
@ -861,7 +869,6 @@ namespace BatCharging.Service
APDUModel = model;
return result;
}
/// <summary>
/// 获取鉴权消息体字节数组
/// </summary>
@ -885,6 +892,59 @@ namespace BatCharging.Service
return results;
}
public byte[] SendRCMD221(out APDUModel APDUModel, CMD221 CMD)
{
byte[] result = null;
APDUModel model = new APDUModel();
model.OriginDomain1 = 0xAA;
model.OriginDomain2 = 0xF5;
model.infoDomain = 0x02;
model.SerialNumberDomain = 0xff;
model.CMD = 221;
model.checksumDomain = 0x01;
model.dataDomain = GetRCMD221DataInfo(CMD); //数据域
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List<byte> lstResult = new List<byte>();
lstResult.AddRange(PublicProgram.APCI(model).ToArray());
result = lstResult.ToArray();
APDUModel = model;
return result;
}
/// <summary>
/// 获取鉴权消息体字节数组
/// </summary>
/// <param name="auth"></param>
/// <returns>鉴权消息体字节数组</returns>
private byte[] GetRCMD221DataInfo(CMD221 CMD)
{
byte[] results = null;
if (CMD != null)
{
List<byte> lstContent = new List<byte>();
lstContent.AddRange(BitConverter.GetBytes(CMD.value01));
lstContent.AddRange(BitConverter.GetBytes(CMD.value02));
lstContent.AddRange(BitConverter.GetBytes(CMD.value03));
lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD.value04));
lstContent.AddRange(BitConverter.GetBytes(CMD.value05));
lstContent.AddRange(BitConverter.GetBytes(CMD.value06));
lstContent.AddRange(BitConverter.GetBytes(CMD.value07));
lstContent.AddRange(BitConverter.GetBytes(CMD.value08));
lstContent.AddRange(BitConverter.GetBytes(CMD.value09));
lstContent.AddRange(BitConverter.GetBytes(CMD.value10));
lstContent.AddRange(BitConverter.GetBytes(CMD.value11));
lstContent.AddRange(BitConverter.GetBytes(CMD.value12));
results = lstContent.ToArray();
}
return results;
}
#endregion
#region 直流充电桩 BMS 信息数据(预留)
@ -1345,7 +1405,7 @@ namespace BatCharging.Service
#region 与计费策略相关的指令
public byte[] SendRCMD1101(out APDUModel APDUModel )
public byte[] SendRCMD1101(out APDUModel APDUModel)
{
byte[] result = null;

@ -82,6 +82,7 @@
button38 = new System.Windows.Forms.Button();
button39 = new System.Windows.Forms.Button();
button40 = new System.Windows.Forms.Button();
button17 = new System.Windows.Forms.Button();
groupBox3.SuspendLayout();
groupBox1.SuspendLayout();
groupBox5.SuspendLayout();
@ -679,11 +680,22 @@
button40.UseVisualStyleBackColor = true;
button40.Click += button40_Click;
//
// button17
//
button17.Location = new System.Drawing.Point(608, 135);
button17.Name = "button17";
button17.Size = new System.Drawing.Size(115, 37);
button17.TabIndex = 124;
button17.Text = "113";
button17.UseVisualStyleBackColor = true;
button17.Click += button17_Click;
//
// FrmChargeResult
//
AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(1563, 900);
Controls.Add(button17);
Controls.Add(lstRecvFrameInfo);
Controls.Add(groupBox16);
Controls.Add(groupBox15);
@ -774,5 +786,6 @@
private System.Windows.Forms.Button button39;
private System.Windows.Forms.Button button40;
private System.Windows.Forms.Button button12;
private System.Windows.Forms.Button button17;
}
}

@ -433,7 +433,7 @@ namespace Monitor.ChargeTest
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{
CmnChargerParam._CHR00TCPCLIENT.Send1101();
@ -570,8 +570,15 @@ namespace Monitor.ChargeTest
CMD.value14 = 11;
CMD.value15 = 12;
CMD.value16 = 13;
CmnChargerParam._CHR00TCPCLIENT.Send7(CMD);
}
private void button17_Click(object sender, EventArgs e)
{
byte chargeNum = 0;
byte sign = 0;
CmnChargerParam._CHR00TCPCLIENT.Send113(chargeNum, sign);
}
}
}

Loading…
Cancel
Save