CZ 8 months ago
commit 5861bdbbc7

@ -123,197 +123,197 @@ namespace BatCharging.Model
/// 命令 202 报文此字段是 2 字节,
/// 命令 222 报文此字段是 4 字节
/// </summary>
public UInt32 value26 { get; set; }
public UInt16 value26 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value27 { get; set; }
public UInt16 value27 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value28 { get; set; }
public UInt16 value28 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value29 { get; set; }
public UInt16 value29 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value30 { get; set; }
public UInt16 value30 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value31 { get; set; }
public UInt16 value31 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value32 { get; set; }
public UInt16 value32 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value33 { get; set; }
public UInt16 value33 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value34 { get; set; }
public UInt16 value34 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value35 { get; set; }
public UInt16 value35 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value36 { get; set; }
public UInt16 value36 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value37 { get; set; }
public UInt16 value37 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value38 { get; set; }
public UInt16 value38 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value39 { get; set; }
public UInt16 value39 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value40 { get; set; }
public UInt16 value40 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value41 { get; set; }
public UInt16 value41 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value42 { get; set; }
public UInt16 value42 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value43 { get; set; }
public UInt16 value43 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value44 { get; set; }
public UInt16 value44 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value45 { get; set; }
public UInt16 value45 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value46 { get; set; }
public UInt16 value46 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value47 { get; set; }
public UInt16 value47 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value48 { get; set; }
public UInt16 value48 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value49 { get; set; }
public UInt16 value49 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value50 { get; set; }
public UInt16 value50 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value51 { get; set; }
public UInt16 value51 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value52 { get; set; }
public UInt16 value52 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value53 { get; set; }
public UInt16 value53 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value54 { get; set; }
public UInt16 value54 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value55 { get; set; }
public UInt16 value55 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value56 { get; set; }
public UInt16 value56 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value57 { get; set; }
public UInt16 value57 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value58 { get; set; }
public UInt16 value58 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value59 { get; set; }
public UInt16 value59 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value60 { get; set; }
public UInt16 value60 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value61 { get; set; }
public UInt16 value61 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value62 { get; set; }
public UInt16 value62 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value63 { get; set; }
public UInt16 value63 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value64 { get; set; }
public UInt16 value64 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value65 { get; set; }
public UInt16 value65 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value66 { get; set; }
public UInt16 value66 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value67 { get; set; }
public UInt16 value67 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value68 { get; set; }
public UInt16 value68 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value69 { get; set; }
public UInt16 value69 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value70 { get; set; }
public UInt16 value70 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value71 { get; set; }
public UInt16 value71 { get; set; }
/// <summary>
///
/// </summary>
public UInt32 value72 { get; set; }
public UInt16 value72 { get; set; }
/// <summary>
/// 时段 48 充电电量
/// 命令 202 报文此字段是 2 字节,
/// 命令 222 报文此字段是 4 字节
/// </summary>
public UInt32 value73 { get; set; }
public UInt16 value73 { get; set; }
/// <summary>
/// 启动方式
/// <para>0本地刷卡启动</para>

@ -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; }
}
}

@ -1143,7 +1143,7 @@ namespace BatCharging.Service
if (CMD108 != null)
{
//(CMD=9)后台服务器应答桩上传命令请求(预留)
CmnChargerParam._CHR00TCPCLIENT.Send107();
//CmnChargerParam._CHR00TCPCLIENT.Send107();
}
}
@ -1268,6 +1268,23 @@ namespace BatCharging.Service
}
}
break;
case 222:
{
CMD222 CMD222 = new MsgReceiveCMDCom().ConCMD222(data);
string result = "充电桩上报“即插即充”启动充电结果 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩上报“即插即充”启动充电结果:" + JsonConvert.SerializeObject(CMD222);
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
if (CMD222 != null)
{
//(CMD=9)后台服务器应答桩上传命令请求(预留)
uint value05 = 0;
CMD221 CMD221 = new CMD221();
CmnChargerParam._CHR00TCPCLIENT.Send221(CMD221,value05);
}
}
break;
#endregion
#region 直流充电桩 BMS 信息数据(预留)
@ -2271,6 +2288,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 信息数据(预留)

@ -733,6 +733,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

@ -139,21 +139,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 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[104];
byte day = data[105];
byte month = data[106];
ushort year = ByteUtils.DToUInt16(data, 107);
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;
}
@ -414,64 +415,64 @@ namespace BatCharging.Service.DataRlt
CMD202.value23 = ByteUtils.DToUInt32(data, 138);
CMD202.value24 = Encoding.ASCII.GetString(data, 142, 17);
CMD202.value25 = Encoding.ASCII.GetString(data, 159, 8);
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.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.value26 = ByteUtils.DToUInt16(data, 167);
CMD202.value27 = ByteUtils.DToUInt16(data, 171);
CMD202.value28 = ByteUtils.DToUInt16(data, 173);
CMD202.value29 = ByteUtils.DToUInt16(data, 175);
CMD202.value30 = ByteUtils.DToUInt16(data, 177);
CMD202.value31 = ByteUtils.DToUInt16(data, 179);
CMD202.value32 = ByteUtils.DToUInt16(data, 181);
CMD202.value33 = ByteUtils.DToUInt16(data, 183);
CMD202.value34 = ByteUtils.DToUInt16(data, 185);
CMD202.value35 = ByteUtils.DToUInt16(data, 187);
CMD202.value36 = ByteUtils.DToUInt16(data, 189);
CMD202.value37 = ByteUtils.DToUInt16(data, 191);
CMD202.value38 = ByteUtils.DToUInt16(data, 193);
CMD202.value39 = ByteUtils.DToUInt16(data, 195);
CMD202.value40 = ByteUtils.DToUInt16(data, 197);
CMD202.value41 = ByteUtils.DToUInt16(data, 199);
CMD202.value42 = ByteUtils.DToUInt16(data, 201);
CMD202.value43 = ByteUtils.DToUInt16(data, 203);
CMD202.value44 = ByteUtils.DToUInt16(data, 205);
CMD202.value45 = ByteUtils.DToUInt16(data, 207);
CMD202.value46 = ByteUtils.DToUInt16(data, 209);
CMD202.value47 = ByteUtils.DToUInt16(data, 211);
CMD202.value48 = ByteUtils.DToUInt16(data, 213);
CMD202.value49 = ByteUtils.DToUInt16(data, 215);
CMD202.value50 = ByteUtils.DToUInt16(data, 217);
CMD202.value51 = ByteUtils.DToUInt16(data, 219);
CMD202.value52 = ByteUtils.DToUInt16(data, 221);
CMD202.value53 = ByteUtils.DToUInt16(data, 223);
CMD202.value54 = ByteUtils.DToUInt16(data, 225);
CMD202.value55 = ByteUtils.DToUInt16(data, 227);
CMD202.value56 = ByteUtils.DToUInt16(data, 229);
CMD202.value57 = ByteUtils.DToUInt16(data, 231);
CMD202.value58 = ByteUtils.DToUInt16(data, 233);
CMD202.value59 = ByteUtils.DToUInt16(data, 235);
CMD202.value60 = ByteUtils.DToUInt16(data, 237);
CMD202.value61 = ByteUtils.DToUInt16(data, 239);
CMD202.value63 = ByteUtils.DToUInt16(data, 241);
CMD202.value64 = ByteUtils.DToUInt16(data, 243);
CMD202.value64 = ByteUtils.DToUInt16(data, 245);
CMD202.value65 = ByteUtils.DToUInt16(data, 247);
CMD202.value66 = ByteUtils.DToUInt16(data, 249);
CMD202.value67 = ByteUtils.DToUInt16(data, 251);
CMD202.value68 = ByteUtils.DToUInt16(data, 253);
CMD202.value69 = ByteUtils.DToUInt16(data, 255);
CMD202.value70 = ByteUtils.DToUInt16(data, 257);
CMD202.value71 = ByteUtils.DToUInt16(data, 259);
CMD202.value72 = ByteUtils.DToUInt16(data, 261);
CMD202.value73 = ByteUtils.DToUInt16(data, 263);
CMD202.value74 = data[265];
CMD202.value75 = Encoding.ASCII.GetString(data, 266, 32);
CMD202.value76 = ByteUtils.DToUInt32(data, 298);
CMD202.value77 = data[302];
CMD202.value78 = data[303];
CMD202.value79 = data[304];
CMD202.value80 = data[305];
CMD202.value81 = Encoding.ASCII.GetString(data, 306, 6);
CMD202.value82 = ByteUtils.DToUInt16(data, 312);
CMD202.value83 = data[314];
}
return CMD202;
}
@ -540,6 +541,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;

@ -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;
@ -861,7 +861,6 @@ namespace BatCharging.Service
APDUModel = model;
return result;
}
/// <summary>
/// 获取鉴权消息体字节数组
/// </summary>
@ -885,6 +884,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 +1397,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