lch 10 months ago
commit 0249d698cf

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

@ -1108,13 +1108,11 @@ namespace BatCharging.Service
if (CMD104 != null) if (CMD104 != null)
{ {
byte chargeMuzzle = 0; byte chargeNum= 0;
uint executeResult = 0; bool reportMessage = true;
uint address = 0;
byte[] setData = null;
//(CMD=9)后台服务器应答桩上传命令请求(预留) //(CMD=9)后台服务器应答桩上传命令请求(预留)
CmnChargerParam._CHR00TCPCLIENT.Send103(chargeMuzzle, executeResult, address, setData); CmnChargerParam._CHR00TCPCLIENT.Send103(chargeNum,reportMessage);
} }
} }
@ -1145,7 +1143,7 @@ namespace BatCharging.Service
if (CMD108 != null) if (CMD108 != null)
{ {
//(CMD=9)后台服务器应答桩上传命令请求(预留) //(CMD=9)后台服务器应答桩上传命令请求(预留)
CmnChargerParam._CHR00TCPCLIENT.Send107(); //CmnChargerParam._CHR00TCPCLIENT.Send107();
} }
} }
@ -1209,7 +1207,7 @@ namespace BatCharging.Service
if (CMD202 != null) if (CMD202 != null)
{ {
//todo //todo
CmnChargerParam._CHR00TCPCLIENT.Send201(CMD202,); //CmnChargerParam._CHR00TCPCLIENT.Send201(CMD202,);
} }
} }
break; break;
@ -1222,7 +1220,7 @@ namespace BatCharging.Service
if (CMD204 != null) if (CMD204 != null)
{ {
CmnChargerParam._CHR00TCPCLIENT.Send203(); //CmnChargerParam._CHR00TCPCLIENT.Send203();
} }
} }
@ -1236,7 +1234,7 @@ namespace BatCharging.Service
if (CMD206 != null) if (CMD206 != null)
{ {
CmnChargerParam._CHR00TCPCLIENT.Send205(); //CmnChargerParam._CHR00TCPCLIENT.Send205();
} }
} }
@ -1271,6 +1269,23 @@ namespace BatCharging.Service
} }
} }
break; 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 #endregion
#region 直流充电桩 BMS 信息数据(预留) #region 直流充电桩 BMS 信息数据(预留)
@ -1332,7 +1347,7 @@ namespace BatCharging.Service
if (CMD1002 != null) if (CMD1002 != null)
{ {
//todo //todo
} }
} }
@ -1346,7 +1361,7 @@ namespace BatCharging.Service
if (CMD1004 != null) if (CMD1004 != null)
{ {
//todo //todo
} }
} }
break; break;
@ -1359,7 +1374,7 @@ namespace BatCharging.Service
if (CMD1006 != null) if (CMD1006 != null)
{ {
//todo //todo
} }
} }
break; break;
@ -1411,10 +1426,10 @@ namespace BatCharging.Service
if (CMD1022 != null) if (CMD1022 != null)
{ {
uint results = 0; uint results = 0;
string description = ""; string description = "";
//服务器回复充电桩主动请求升级命令 //服务器回复充电桩主动请求升级命令
CmnChargerParam._CHR00TCPCLIENT.Send1021( results, description); CmnChargerParam._CHR00TCPCLIENT.Send1021(results, description);
} }
} }
@ -1444,7 +1459,7 @@ namespace BatCharging.Service
if (CMD1104 != null) if (CMD1104 != null)
{ {
//todo //todo
} }
} }
@ -1458,7 +1473,7 @@ namespace BatCharging.Service
if (CMD1106 != null) if (CMD1106 != null)
{ {
//todo //todo
} }
} }
@ -2155,13 +2170,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 != null)
{ {
if (_chr_client.Connected) if (_chr_client.Connected)
{ {
new ChargerSendMsgUtils().Send9(_chr_client, chargeMuzzle, executeResult, address, setData); new ChargerSendMsgUtils().Send103(_chr_client, chargeNum, reportMessage);
} }
} }
} }
@ -2274,6 +2289,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 #endregion
#region- 直流充电桩 BMS 信息数据(预留) #region- 直流充电桩 BMS 信息数据(预留)

@ -411,7 +411,7 @@ namespace BatCharging.Service
CMD.value04 = executeResult; CMD.value04 = executeResult;
CMD.value05 = address; CMD.value05 = address;
CMD.value06 = 4; CMD.value06 = 4;
CMD.value07 = null; CMD.value07 = new byte[4];
byte[] bytes = new ChargerSendCMD().SendRCMD9(out APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD9(out APDUModel, CMD);
@ -731,6 +731,26 @@ namespace BatCharging.Service
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); 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 #endregion

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

@ -268,35 +268,36 @@ namespace BatCharging.Service.DataRlt
CMD110.value08 = ByteUtils.DToUInt32(data, 53); CMD110.value08 = ByteUtils.DToUInt32(data, 53);
byte version1 = data[58]; byte version1 = data[58];
byte version2 = data[59]; byte version2 = data[59];
CMD110.value09 = "v" + version1.ToString() + version2.ToString(); byte version3 = data[60];
CMD110.value10 = data[60]; CMD110.value09 = "v" + version1.ToString() + version2.ToString() + version3.ToString();
CMD110.value11 = ByteUtils.DToUInt32(data, 61); CMD110.value10 = data[61];
CMD110.value12 = ByteUtils.DToUInt32(data, 65); CMD110.value11 = ByteUtils.DToUInt32(data, 62);
CMD110.value13 = ByteUtils.DToUInt32(data, 69); CMD110.value12 = ByteUtils.DToUInt32(data, 66);
CMD110.value14 = ByteUtils.DToUInt32(data, 73); CMD110.value13 = ByteUtils.DToUInt32(data, 70);
CMD110.value15 = ByteUtils.DToUInt16(data, 77); CMD110.value14 = ByteUtils.DToUInt32(data, 74);
CMD110.value16 = data[79]; CMD110.value15 = ByteUtils.DToUInt16(data, 78);
CMD110.value17 = data[80]; CMD110.value16 = data[80];
CMD110.value18 = ByteUtils.DToUInt32(data, 81); CMD110.value17 = data[81];
CMD110.value19 = data[85]; CMD110.value18 = ByteUtils.DToUInt32(data, 82);
CMD110.value20 = data[86]; CMD110.value19 = data[86];
CMD110.value21 = Encoding.ASCII.GetString(data, 87, 17); CMD110.value20 = data[87];
CMD110.value21 = Encoding.ASCII.GetString(data, 88, 17);
byte VersionSerialNum = data[104]; byte VersionSerialNum = data[105];
byte day = data[105]; byte day = data[106];
byte month = data[106]; byte month = data[107];
ushort year = ByteUtils.DToUInt16(data, 107); ushort year = ByteUtils.DToUInt16(data, 108);
CMD110.value22 = VersionSerialNum.ToString() + year.ToString() + "年" + month.ToString() + "月" + day.ToString() + "日"; CMD110.value22 = VersionSerialNum.ToString() + year.ToString() + "年" + month.ToString() + "月" + day.ToString() + "日";
CMD110.value23 = (float)(ByteUtils.DToUInt32(data, 112) * 0.1); CMD110.value23 = (float)(ByteUtils.DToUInt32(data, 113) * 0.1);
CMD110.value24 = (float)(ByteUtils.DToUInt32(data, 116) * 0.1); CMD110.value24 = (float)(ByteUtils.DToUInt32(data, 117) * 0.1);
CMD110.value25 = (float)(ByteUtils.DToUInt32(data, 120) * 0.1); CMD110.value25 = (float)(ByteUtils.DToUInt32(data, 121) * 0.1);
CMD110.value26 = (float)(ByteUtils.DToUInt32(data, 124) * 0.1); CMD110.value26 = (float)(ByteUtils.DToUInt32(data, 125) * 0.1);
CMD110.value27 = data[128]; CMD110.value27 = data[129];
CMD110.value28 = (float)(ByteUtils.DToUInt16(data, 129) * 0.1); CMD110.value28 = (float)(ByteUtils.DToUInt16(data, 130) * 0.1);
CMD110.value29 = (float)(ByteUtils.DToUInt32(data, 131) * 0.1); CMD110.value29 = (float)(ByteUtils.DToUInt32(data, 132) * 0.1);
CMD110.value30 = Encoding.ASCII.GetString(data, 135, 32); CMD110.value30 = Encoding.ASCII.GetString(data, 136, 32);
} }
return CMD110; return CMD110;
} }
@ -409,54 +410,54 @@ namespace BatCharging.Service.DataRlt
CMD202.value15 = (ByteUtils.DToUInt32(data, 112) * 0.01).ToString("F2"); CMD202.value15 = (ByteUtils.DToUInt32(data, 112) * 0.01).ToString("F2");
CMD202.value26 = ByteUtils.DToUInt32(data, 167); CMD202.value26 = ByteUtils.DToUInt16(data, 167).ToString();
CMD202.value27 = ByteUtils.DToUInt32(data, 171); CMD202.value27 = ByteUtils.DToUInt16(data, 171).ToString();
CMD202.value28 = ByteUtils.DToUInt32(data, 175); CMD202.value28 = ByteUtils.DToUInt16(data, 175).ToString();
CMD202.value29 = ByteUtils.DToUInt32(data, 179); CMD202.value29 = ByteUtils.DToUInt16(data, 179).ToString();
CMD202.value30 = ByteUtils.DToUInt32(data, 183); CMD202.value30 = ByteUtils.DToUInt16(data, 183).ToString();
CMD202.value31 = ByteUtils.DToUInt32(data, 187); CMD202.value31 = ByteUtils.DToUInt16(data, 187).ToString();
CMD202.value32 = ByteUtils.DToUInt32(data, 191); CMD202.value32 = ByteUtils.DToUInt16(data, 191).ToString();
CMD202.value33 = ByteUtils.DToUInt32(data, 195); CMD202.value33 = ByteUtils.DToUInt16(data, 195).ToString();
CMD202.value34 = ByteUtils.DToUInt32(data, 199); CMD202.value34 = ByteUtils.DToUInt16(data, 199).ToString();
CMD202.value35 = ByteUtils.DToUInt32(data, 203); CMD202.value35 = ByteUtils.DToUInt16(data, 203).ToString();
CMD202.value36 = ByteUtils.DToUInt32(data, 207); CMD202.value36 = ByteUtils.DToUInt16(data, 207).ToString();
CMD202.value37 = ByteUtils.DToUInt32(data, 211); CMD202.value37 = ByteUtils.DToUInt16(data, 211).ToString();
CMD202.value38 = ByteUtils.DToUInt32(data, 215); CMD202.value38 = ByteUtils.DToUInt16(data, 215).ToString();
CMD202.value39 = ByteUtils.DToUInt32(data, 219); CMD202.value39 = ByteUtils.DToUInt16(data, 219).ToString();
CMD202.value40 = ByteUtils.DToUInt32(data, 223); CMD202.value40 = ByteUtils.DToUInt16(data, 223).ToString();
CMD202.value41 = ByteUtils.DToUInt32(data, 227); CMD202.value41 = ByteUtils.DToUInt16(data, 227).ToString();
CMD202.value42 = ByteUtils.DToUInt32(data, 231); CMD202.value42 = ByteUtils.DToUInt16(data, 231).ToString();
CMD202.value43 = ByteUtils.DToUInt32(data, 235); CMD202.value43 = ByteUtils.DToUInt16(data, 235).ToString();
CMD202.value44 = ByteUtils.DToUInt32(data, 239); CMD202.value44 = ByteUtils.DToUInt16(data, 239).ToString();
CMD202.value45 = ByteUtils.DToUInt32(data, 243); CMD202.value45 = ByteUtils.DToUInt16(data, 243).ToString();
CMD202.value46 = ByteUtils.DToUInt32(data, 247); CMD202.value46 = ByteUtils.DToUInt16(data, 247).ToString();
CMD202.value47 = ByteUtils.DToUInt32(data, 251); CMD202.value47 = ByteUtils.DToUInt16(data, 251).ToString();
CMD202.value48 = ByteUtils.DToUInt32(data, 255); CMD202.value48 = ByteUtils.DToUInt16(data, 255).ToString();
CMD202.value49 = ByteUtils.DToUInt32(data, 259); CMD202.value49 = ByteUtils.DToUInt16(data, 259).ToString();
CMD202.value50 = ByteUtils.DToUInt32(data, 263); CMD202.value50 = ByteUtils.DToUInt16(data, 263).ToString();
CMD202.value51 = ByteUtils.DToUInt32(data, 267); CMD202.value51 = ByteUtils.DToUInt16(data, 267).ToString();
CMD202.value52 = ByteUtils.DToUInt32(data, 271); CMD202.value52 = ByteUtils.DToUInt16(data, 271).ToString();
CMD202.value53 = ByteUtils.DToUInt32(data, 275); CMD202.value53 = ByteUtils.DToUInt16(data, 275).ToString();
CMD202.value54 = ByteUtils.DToUInt32(data, 279); CMD202.value54 = ByteUtils.DToUInt16(data, 279).ToString();
CMD202.value55 = ByteUtils.DToUInt32(data, 283); CMD202.value55 = ByteUtils.DToUInt16(data, 283).ToString();
CMD202.value56 = ByteUtils.DToUInt32(data, 287); CMD202.value56 = ByteUtils.DToUInt16(data, 287).ToString();
CMD202.value57 = ByteUtils.DToUInt32(data, 291); CMD202.value57 = ByteUtils.DToUInt16(data, 291).ToString();
CMD202.value58 = ByteUtils.DToUInt32(data, 295); CMD202.value58 = ByteUtils.DToUInt16(data, 295).ToString();
CMD202.value59 = ByteUtils.DToUInt32(data, 299); CMD202.value59 = ByteUtils.DToUInt16(data, 299).ToString();
CMD202.value60 = ByteUtils.DToUInt32(data, 303); CMD202.value60 = ByteUtils.DToUInt16(data, 303).ToString();
CMD202.value61 = ByteUtils.DToUInt32(data, 307); CMD202.value61 = ByteUtils.DToUInt16(data, 307).ToString();
CMD202.value63 = ByteUtils.DToUInt32(data, 311); CMD202.value63 = ByteUtils.DToUInt16(data, 311).ToString();
CMD202.value64 = ByteUtils.DToUInt32(data, 315); CMD202.value64 = ByteUtils.DToUInt16(data, 315).ToString();
CMD202.value64 = ByteUtils.DToUInt32(data, 319); CMD202.value64 = ByteUtils.DToUInt16(data, 319).ToString();
CMD202.value65 = ByteUtils.DToUInt32(data, 323); CMD202.value65 = ByteUtils.DToUInt16(data, 323).ToString();
CMD202.value66 = ByteUtils.DToUInt32(data, 327); CMD202.value66 = ByteUtils.DToUInt16(data, 327).ToString();
CMD202.value67 = ByteUtils.DToUInt32(data, 331); CMD202.value67 = ByteUtils.DToUInt16(data, 331).ToString();
CMD202.value68 = ByteUtils.DToUInt32(data, 335); CMD202.value68 = ByteUtils.DToUInt16(data, 335).ToString();
CMD202.value69 = ByteUtils.DToUInt32(data, 339); CMD202.value69 = ByteUtils.DToUInt16(data, 339).ToString();
CMD202.value70 = ByteUtils.DToUInt32(data, 343); CMD202.value70 = ByteUtils.DToUInt16(data, 343).ToString();
CMD202.value71 = ByteUtils.DToUInt32(data, 347); CMD202.value71 = ByteUtils.DToUInt16(data, 347).ToString();
CMD202.value72 = ByteUtils.DToUInt32(data, 351); CMD202.value72 = ByteUtils.DToUInt16(data, 351).ToString();
CMD202.value73 = ByteUtils.DToUInt32(data, 355); CMD202.value73 = ByteUtils.DToUInt16(data, 355).ToString();
CMD202.value74 = data[359]; CMD202.value74 = data[359];
CMD202.value75 = Encoding.ASCII.GetString(data, 360, 32); CMD202.value75 = Encoding.ASCII.GetString(data, 360, 32);
@ -471,59 +472,59 @@ namespace BatCharging.Service.DataRlt
} }
else if (func == 222) else if (func == 222)
{ {
CMD202.value13 = ByteUtils.DToUInt32(data, 104); CMD202.value13 = (ByteUtils.DToUInt32(data, 104) * 0.001).ToString("F3");
CMD202.value14 = ByteUtils.DToUInt32(data, 108); CMD202.value14 = (ByteUtils.DToUInt32(data, 108) * 0.001).ToString("F3");
CMD202.value15 = ByteUtils.DToUInt32(data, 112); CMD202.value15 = (ByteUtils.DToUInt32(data, 112) * 0.001).ToString("F3");
CMD202.value26 = ByteUtils.DToUInt32(data, 167); CMD202.value26 = (ByteUtils.DToUInt32(data, 167)*0.001).ToString("F3");
CMD202.value27 = ByteUtils.DToUInt32(data, 171); CMD202.value27 = (ByteUtils.DToUInt32(data, 171)*0.001).ToString("F3");
CMD202.value28 = ByteUtils.DToUInt32(data, 175); CMD202.value28 = (ByteUtils.DToUInt32(data, 175)*0.001).ToString("F3");
CMD202.value29 = ByteUtils.DToUInt32(data, 179); CMD202.value29 = (ByteUtils.DToUInt32(data, 179)*0.001).ToString("F3");
CMD202.value30 = ByteUtils.DToUInt32(data, 183); CMD202.value30 = (ByteUtils.DToUInt32(data, 183)*0.001).ToString("F3");
CMD202.value31 = ByteUtils.DToUInt32(data, 187); CMD202.value31 = (ByteUtils.DToUInt32(data, 187)*0.001).ToString("F3");
CMD202.value32 = ByteUtils.DToUInt32(data, 191); CMD202.value32 = (ByteUtils.DToUInt32(data, 191)*0.001).ToString("F3");
CMD202.value33 = ByteUtils.DToUInt32(data, 195); CMD202.value33 = (ByteUtils.DToUInt32(data, 195)*0.001).ToString("F3");
CMD202.value34 = ByteUtils.DToUInt32(data, 199); CMD202.value34 = (ByteUtils.DToUInt32(data, 199)*0.001).ToString("F3");
CMD202.value35 = ByteUtils.DToUInt32(data, 203); CMD202.value35 = (ByteUtils.DToUInt32(data, 203)*0.001).ToString("F3");
CMD202.value36 = ByteUtils.DToUInt32(data, 207); CMD202.value36 = (ByteUtils.DToUInt32(data, 207)*0.001).ToString("F3");
CMD202.value37 = ByteUtils.DToUInt32(data, 211); CMD202.value37 = (ByteUtils.DToUInt32(data, 211)*0.001).ToString("F3");
CMD202.value38 = ByteUtils.DToUInt32(data, 215); CMD202.value38 = (ByteUtils.DToUInt32(data, 215)*0.001).ToString("F3");
CMD202.value39 = ByteUtils.DToUInt32(data, 219); CMD202.value39 = (ByteUtils.DToUInt32(data, 219)*0.001).ToString("F3");
CMD202.value40 = ByteUtils.DToUInt32(data, 223); CMD202.value40 = (ByteUtils.DToUInt32(data, 223)*0.001).ToString("F3");
CMD202.value41 = ByteUtils.DToUInt32(data, 227); CMD202.value41 = (ByteUtils.DToUInt32(data, 227)*0.001).ToString("F3");
CMD202.value42 = ByteUtils.DToUInt32(data, 231); CMD202.value42 = (ByteUtils.DToUInt32(data, 231)*0.001).ToString("F3");
CMD202.value43 = ByteUtils.DToUInt32(data, 235); CMD202.value43 = (ByteUtils.DToUInt32(data, 235)*0.001).ToString("F3");
CMD202.value44 = ByteUtils.DToUInt32(data, 239); CMD202.value44 = (ByteUtils.DToUInt32(data, 239)*0.001).ToString("F3");
CMD202.value45 = ByteUtils.DToUInt32(data, 243); CMD202.value45 = (ByteUtils.DToUInt32(data, 243)*0.001).ToString("F3");
CMD202.value46 = ByteUtils.DToUInt32(data, 247); CMD202.value46 = (ByteUtils.DToUInt32(data, 247)*0.001).ToString("F3");
CMD202.value47 = ByteUtils.DToUInt32(data, 251); CMD202.value47 = (ByteUtils.DToUInt32(data, 251)*0.001).ToString("F3");
CMD202.value48 = ByteUtils.DToUInt32(data, 255); CMD202.value48 = (ByteUtils.DToUInt32(data, 255)*0.001).ToString("F3");
CMD202.value49 = ByteUtils.DToUInt32(data, 259); CMD202.value49 = (ByteUtils.DToUInt32(data, 259)*0.001).ToString("F3");
CMD202.value50 = ByteUtils.DToUInt32(data, 263); CMD202.value50 = (ByteUtils.DToUInt32(data, 263)*0.001).ToString("F3");
CMD202.value51 = ByteUtils.DToUInt32(data, 267); CMD202.value51 = (ByteUtils.DToUInt32(data, 267)*0.001).ToString("F3");
CMD202.value52 = ByteUtils.DToUInt32(data, 271); CMD202.value52 = (ByteUtils.DToUInt32(data, 271)*0.001).ToString("F3");
CMD202.value53 = ByteUtils.DToUInt32(data, 275); CMD202.value53 = (ByteUtils.DToUInt32(data, 275)*0.001).ToString("F3");
CMD202.value54 = ByteUtils.DToUInt32(data, 279); CMD202.value54 = (ByteUtils.DToUInt32(data, 279)*0.001).ToString("F3");
CMD202.value55 = ByteUtils.DToUInt32(data, 283); CMD202.value55 = (ByteUtils.DToUInt32(data, 283)*0.001).ToString("F3");
CMD202.value56 = ByteUtils.DToUInt32(data, 287); CMD202.value56 = (ByteUtils.DToUInt32(data, 287)*0.001).ToString("F3");
CMD202.value57 = ByteUtils.DToUInt32(data, 291); CMD202.value57 = (ByteUtils.DToUInt32(data, 291)*0.001).ToString("F3");
CMD202.value58 = ByteUtils.DToUInt32(data, 295); CMD202.value58 = (ByteUtils.DToUInt32(data, 295)*0.001).ToString("F3");
CMD202.value59 = ByteUtils.DToUInt32(data, 299); CMD202.value59 = (ByteUtils.DToUInt32(data, 299)*0.001).ToString("F3");
CMD202.value60 = ByteUtils.DToUInt32(data, 303); CMD202.value60 = (ByteUtils.DToUInt32(data, 303)*0.001).ToString("F3");
CMD202.value61 = ByteUtils.DToUInt32(data, 307); CMD202.value61 = (ByteUtils.DToUInt32(data, 307)*0.001).ToString("F3");
CMD202.value63 = ByteUtils.DToUInt32(data, 311); CMD202.value63 = (ByteUtils.DToUInt32(data, 311)*0.001).ToString("F3");
CMD202.value64 = ByteUtils.DToUInt32(data, 315); CMD202.value64 = (ByteUtils.DToUInt32(data, 315)*0.001).ToString("F3");
CMD202.value64 = ByteUtils.DToUInt32(data, 319); CMD202.value64 = (ByteUtils.DToUInt32(data, 319)*0.001).ToString("F3");
CMD202.value65 = ByteUtils.DToUInt32(data, 323); CMD202.value65 = (ByteUtils.DToUInt32(data, 323)*0.001).ToString("F3");
CMD202.value66 = ByteUtils.DToUInt32(data, 327); CMD202.value66 = (ByteUtils.DToUInt32(data, 327)*0.001).ToString("F3");
CMD202.value67 = ByteUtils.DToUInt32(data, 331); CMD202.value67 = (ByteUtils.DToUInt32(data, 331)*0.001).ToString("F3");
CMD202.value68 = ByteUtils.DToUInt32(data, 335); CMD202.value68 = (ByteUtils.DToUInt32(data, 335)*0.001).ToString("F3");
CMD202.value69 = ByteUtils.DToUInt32(data, 339); CMD202.value69 = (ByteUtils.DToUInt32(data, 339)*0.001).ToString("F3");
CMD202.value70 = ByteUtils.DToUInt32(data, 343); CMD202.value70 = (ByteUtils.DToUInt32(data, 343)*0.001).ToString("F3");
CMD202.value71 = ByteUtils.DToUInt32(data, 347); CMD202.value71 = (ByteUtils.DToUInt32(data, 347)*0.001).ToString("F3");
CMD202.value72 = ByteUtils.DToUInt32(data, 351); CMD202.value72 = (ByteUtils.DToUInt32(data, 351)*0.001).ToString("F3");
CMD202.value73 = ByteUtils.DToUInt32(data, 355); CMD202.value73 = (ByteUtils.DToUInt32(data, 355)*0.001).ToString("F3");
CMD202.value74 = data[359]; CMD202.value74 = data[359];
CMD202.value75 = Encoding.ASCII.GetString(data, 360, 32); CMD202.value75 = Encoding.ASCII.GetString(data, 360, 32);
@ -631,6 +632,98 @@ namespace BatCharging.Service.DataRlt
} }
return CMD210; 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) public CMD302 ConCMD302(byte[] data)
{ {
CMD302 CMD302 = null; CMD302 CMD302 = null;

@ -12,7 +12,7 @@ namespace BatCharging.Service
#region 协议格式 #region 协议格式
public byte[] SendRCMD1(out APDUModel APDUModel, CMD1 t) public byte[] SendRCMD1(out APDUModel APDUModel, CMD1 t)
{ {
byte[] result = null; byte[] result = null;
APDUModel model = new APDUModel(); APDUModel model = new APDUModel();
@ -23,7 +23,7 @@ namespace BatCharging.Service
model.CMD = 1; model.CMD = 1;
model.checksumDomain = 0x01; model.checksumDomain = 0x01;
model.dataDomain = GetRCMD1DataInfo(t); //数据域 model.dataDomain = GetRCMD1DataInfo(t); //数据域
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度 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.value10));
lstContent.AddRange(BitConverter.GetBytes(CMD.value11)); lstContent.AddRange(BitConverter.GetBytes(CMD.value11));
lstContent.AddRange(BitConverter.GetBytes(CMD.value12)); 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.value14));
lstContent.AddRange(BitConverter.GetBytes(CMD.value15)); lstContent.AddRange(BitConverter.GetBytes(CMD.value15));
lstContent.AddRange(BitConverter.GetBytes(CMD.value16)); 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; byte[] result = null;
@ -861,7 +861,6 @@ namespace BatCharging.Service
APDUModel = model; APDUModel = model;
return result; return result;
} }
/// <summary> /// <summary>
/// 获取鉴权消息体字节数组 /// 获取鉴权消息体字节数组
/// </summary> /// </summary>
@ -885,6 +884,59 @@ namespace BatCharging.Service
return results; 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 #endregion
#region 直流充电桩 BMS 信息数据(预留) #region 直流充电桩 BMS 信息数据(预留)
@ -1345,7 +1397,7 @@ namespace BatCharging.Service
#region 与计费策略相关的指令 #region 与计费策略相关的指令
public byte[] SendRCMD1101(out APDUModel APDUModel ) public byte[] SendRCMD1101(out APDUModel APDUModel)
{ {
byte[] result = null; byte[] result = null;

@ -82,6 +82,7 @@
button38 = new System.Windows.Forms.Button(); button38 = new System.Windows.Forms.Button();
button39 = new System.Windows.Forms.Button(); button39 = new System.Windows.Forms.Button();
button40 = new System.Windows.Forms.Button(); button40 = new System.Windows.Forms.Button();
button17 = new System.Windows.Forms.Button();
groupBox3.SuspendLayout(); groupBox3.SuspendLayout();
groupBox1.SuspendLayout(); groupBox1.SuspendLayout();
groupBox5.SuspendLayout(); groupBox5.SuspendLayout();
@ -679,11 +680,22 @@
button40.UseVisualStyleBackColor = true; button40.UseVisualStyleBackColor = true;
button40.Click += button40_Click; 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 // FrmChargeResult
// //
AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(1563, 900); ClientSize = new System.Drawing.Size(1563, 900);
Controls.Add(button17);
Controls.Add(lstRecvFrameInfo); Controls.Add(lstRecvFrameInfo);
Controls.Add(groupBox16); Controls.Add(groupBox16);
Controls.Add(groupBox15); Controls.Add(groupBox15);
@ -774,5 +786,6 @@
private System.Windows.Forms.Button button39; private System.Windows.Forms.Button button39;
private System.Windows.Forms.Button button40; private System.Windows.Forms.Button button40;
private System.Windows.Forms.Button button12; private System.Windows.Forms.Button button12;
private System.Windows.Forms.Button button17;
} }
} }

@ -433,7 +433,7 @@ namespace Monitor.ChargeTest
/// <param name="e"></param> /// <param name="e"></param>
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
CmnChargerParam._CHR00TCPCLIENT.Send1101(); CmnChargerParam._CHR00TCPCLIENT.Send1101();
@ -570,8 +570,15 @@ namespace Monitor.ChargeTest
CMD.value14 = 11; CMD.value14 = 11;
CMD.value15 = 12; CMD.value15 = 12;
CMD.value16 = 13; CMD.value16 = 13;
CmnChargerParam._CHR00TCPCLIENT.Send7(CMD); 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