diff --git a/BatCharging.Model/客户端发送/CMD201.cs b/BatCharging.Model/客户端发送/CMD201.cs
index e640a13..eac1358 100644
--- a/BatCharging.Model/客户端发送/CMD201.cs
+++ b/BatCharging.Model/客户端发送/CMD201.cs
@@ -27,7 +27,7 @@ namespace BatCharging.Model
///
/// 内部索引号
///
- public UInt32 value05 { get; set; }
+ public int value05 { get; set; }
///
/// 7、8、9 字段有效标志
/// 0- 无效
diff --git a/BatCharging.Model/客户端接收/CMD202.cs b/BatCharging.Model/客户端接收/CMD202.cs
index 70094b4..1a5fc65 100644
--- a/BatCharging.Model/客户端接收/CMD202.cs
+++ b/BatCharging.Model/客户端接收/CMD202.cs
@@ -123,197 +123,197 @@ namespace BatCharging.Model
/// 命令 202 报文此字段是 2 字节,
/// 命令 222 报文此字段是 4 字节
///
- public UInt32 value26 { get; set; }
+ public String value26 { get; set; }
///
///
///
- public UInt32 value27 { get; set; }
+ public String value27 { get; set; }
///
///
///
- public UInt32 value28 { get; set; }
+ public String value28 { get; set; }
///
///
///
- public UInt32 value29 { get; set; }
+ public String value29 { get; set; }
///
///
///
- public UInt32 value30 { get; set; }
+ public String value30 { get; set; }
///
///
///
- public UInt32 value31 { get; set; }
+ public String value31 { get; set; }
///
///
///
- public UInt32 value32 { get; set; }
+ public String value32 { get; set; }
///
///
///
- public UInt32 value33 { get; set; }
+ public String value33 { get; set; }
///
///
///
- public UInt32 value34 { get; set; }
+ public String value34 { get; set; }
///
///
///
- public UInt32 value35 { get; set; }
+ public String value35 { get; set; }
///
///
///
- public UInt32 value36 { get; set; }
+ public String value36 { get; set; }
///
///
///
- public UInt32 value37 { get; set; }
+ public String value37 { get; set; }
///
///
///
- public UInt32 value38 { get; set; }
+ public String value38 { get; set; }
///
///
///
- public UInt32 value39 { get; set; }
+ public String value39 { get; set; }
///
///
///
- public UInt32 value40 { get; set; }
+ public String value40 { get; set; }
///
///
///
- public UInt32 value41 { get; set; }
+ public String value41 { get; set; }
///
///
///
- public UInt32 value42 { get; set; }
+ public String value42 { get; set; }
///
///
///
- public UInt32 value43 { get; set; }
+ public String value43 { get; set; }
///
///
///
- public UInt32 value44 { get; set; }
+ public String value44 { get; set; }
///
///
///
- public UInt32 value45 { get; set; }
+ public String value45 { get; set; }
///
///
///
- public UInt32 value46 { get; set; }
+ public String value46 { get; set; }
///
///
///
- public UInt32 value47 { get; set; }
+ public String value47 { get; set; }
///
///
///
- public UInt32 value48 { get; set; }
+ public String value48 { get; set; }
///
///
///
- public UInt32 value49 { get; set; }
+ public String value49 { get; set; }
///
///
///
- public UInt32 value50 { get; set; }
+ public String value50 { get; set; }
///
///
///
- public UInt32 value51 { get; set; }
+ public String value51 { get; set; }
///
///
///
- public UInt32 value52 { get; set; }
+ public String value52 { get; set; }
///
///
///
- public UInt32 value53 { get; set; }
+ public String value53 { get; set; }
///
///
///
- public UInt32 value54 { get; set; }
+ public String value54 { get; set; }
///
///
///
- public UInt32 value55 { get; set; }
+ public String value55 { get; set; }
///
///
///
- public UInt32 value56 { get; set; }
+ public String value56 { get; set; }
///
///
///
- public UInt32 value57 { get; set; }
+ public String value57 { get; set; }
///
///
///
- public UInt32 value58 { get; set; }
+ public String value58 { get; set; }
///
///
///
- public UInt32 value59 { get; set; }
+ public String value59 { get; set; }
///
///
///
- public UInt32 value60 { get; set; }
+ public String value60 { get; set; }
///
///
///
- public UInt32 value61 { get; set; }
+ public String value61 { get; set; }
///
///
///
- public UInt32 value62 { get; set; }
+ public String value62 { get; set; }
///
///
///
- public UInt32 value63 { get; set; }
+ public String value63 { get; set; }
///
///
///
- public UInt32 value64 { get; set; }
+ public String value64 { get; set; }
///
///
///
- public UInt32 value65 { get; set; }
+ public String value65 { get; set; }
///
///
///
- public UInt32 value66 { get; set; }
+ public String value66 { get; set; }
///
///
///
- public UInt32 value67 { get; set; }
+ public String value67 { get; set; }
///
///
///
- public UInt32 value68 { get; set; }
+ public String value68 { get; set; }
///
///
///
- public UInt32 value69 { get; set; }
+ public String value69 { get; set; }
///
///
///
- public UInt32 value70 { get; set; }
+ public String value70 { get; set; }
///
///
///
- public UInt32 value71 { get; set; }
+ public String value71 { get; set; }
///
///
///
- public UInt32 value72 { get; set; }
+ public String value72 { get; set; }
///
/// 时段 48 充电电量
/// 命令 202 报文此字段是 2 字节,
/// 命令 222 报文此字段是 4 字节
///
- public UInt32 value73 { get; set; }
+ public String value73 { get; set; }
///
/// 启动方式
/// 0:本地刷卡启动
@@ -363,7 +363,7 @@ namespace BatCharging.Model
/// 4 字节电表安装时间(秒时戳, HEX)
/// 1 字节端钮历史状态(0 正常,1 发生过端钮盖打开时间)
///
- public byte value80 { get; set; }
+ public string value80 { get; set; }
///
/// 电表表号 6
///
diff --git a/BatCharging.Model/客户端接收/CMD221.cs b/BatCharging.Model/客户端接收/CMD221.cs
new file mode 100644
index 0000000..ca66459
--- /dev/null
+++ b/BatCharging.Model/客户端接收/CMD221.cs
@@ -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
+ {
+ ///
+ /// 预留
+ ///
+ public UInt16 value01 { get; set; }
+ ///
+ /// 预留
+ ///
+ public UInt16 value02 { get; set; }
+ ///
+ /// 充电口号
+ ///
+ public byte value03 { get; set; }
+ ///
+ /// 充电卡号 32
+ ///
+ public string value04 { get; set; }
+ ///
+ /// 内部索引号
+ ///
+ public UInt32 value05 { get; set; }
+ ///
+ /// 7、8、9 字段有效标志
+ /// 0- 无效
+ /// 1- 有效
+ ///
+ public byte value06 { get; set; }
+ ///
+ /// 充电优惠前金额
+ ///
+ public UInt32 value07 { get; set; }
+ ///
+ /// 充电折扣金额
+ ///
+ public UInt32 value08 { get; set; }
+ ///
+ /// 充电实扣金额
+ ///
+ public UInt32 value09 { get; set; }
+ ///
+ /// 用户剩余金额
+ ///
+ public UInt32 value10 { get; set; }
+ ///
+ /// 充电实扣电费
+ ///
+ public UInt32 value11 { get; set; }
+ ///
+ /// 充电实扣服务费
+ ///
+ public UInt32 value12 { get; set; }
+ }
+}
diff --git a/BatCharging.Model/客户端接收/CMD222.cs b/BatCharging.Model/客户端接收/CMD222.cs
new file mode 100644
index 0000000..28a0819
--- /dev/null
+++ b/BatCharging.Model/客户端接收/CMD222.cs
@@ -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
+ {
+ ///
+ /// 预留
+ ///
+ public UInt16 value01 { get; set; }
+ ///
+ /// 预留
+ ///
+ public UInt16 value02 { get; set; }
+ ///
+ /// 充电桩编码
+ ///
+ public string value03 { get; set; }
+ ///
+ /// 充电枪位置类型
+ /// 1-直流
+ /// 2-交流
+ ///
+ public byte value04 { get; set; }
+ ///
+ /// 充电枪口
+ ///
+ public byte value05 { get; set; }
+ ///
+ /// 充电卡号 32
+ ///
+ public string value06 { get; set; }
+ ///
+ /// 充电开始时间
+ ///
+ public string value07 { get; set; }
+ ///
+ /// 充电结束时间
+ ///
+ public string value08 { get; set; }
+ ///
+ /// 充电时间长度
+ ///
+ public UInt32 value09 { get; set; }
+ ///
+ /// 开始 SOC
+ ///
+ public byte value10 { get; set; }
+ ///
+ /// 结束 SOC
+ ///
+ public byte value11 { get; set; }
+ ///
+ /// 充电结束原因
+ ///
+ public UInt32 value12 { get; set; }
+ ///
+ /// 本次充电电量
+ ///
+ public UInt32 value13 { get; set; }
+ ///
+ /// 充电前电表读数
+ ///
+ public UInt32 value14 { get; set; }
+ ///
+ /// 充电后电表读数
+ ///
+ public UInt32 value15 { get; set; }
+ ///
+ /// 本次充电金额
+ ///
+ public UInt32 value16 { get; set; }
+ ///
+ /// 内部索引号
+ ///
+ public UInt32 value17 { get; set; }
+ ///
+ /// 充电前卡余额
+ ///
+ public UInt32 value18 { get; set; }
+ ///
+ /// 当前充电记录索引
+ ///
+ public UInt32 value19 { get; set; }
+ ///
+ /// 总充电记录条目
+ ///
+ public UInt32 value20 { get; set; }
+ ///
+ /// 预留
+ ///
+ public byte value21 { get; set; }
+ ///
+ /// 充电策略
+ /// 0:充满为止
+ /// 1:时间控制充电
+ /// 2:金额控制充电
+ /// 3:电量控制充电
+ ///
+ public byte value22 { get; set; }
+ ///
+ /// 充电策略参数
+ ///
+ /// 时间单位为 1 秒
+ /// 金额单位为 0.01 元
+ /// 电量时单位为 0.01kw
+ ///
+ public UInt32 value23 { get; set; }
+ ///
+ /// 车辆 VIN 17
+ ///
+ public string value24 { get; set; }
+ ///
+ /// 车牌号
+ ///
+ public string value25 { get; set; }
+ ///
+ /// 时段 1 充电电量
+ /// 命令 202 报文此字段是 2 字节,
+ /// 命令 222 报文此字段是 4 字节
+ ///
+ public UInt32 value26 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value27 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value28 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value29 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value30 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value31 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value32 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value33 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value34 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value35 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value36 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value37 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value38 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value39 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value40 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value41 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value42 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value43 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value44 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value45 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value46 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value47 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value48 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value49 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value50 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value51 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value52 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value53 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value54 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value55 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value56 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value57 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value58 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value59 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value60 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value61 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value62 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value63 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value64 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value65 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value66 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value67 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value68 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value69 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value70 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value71 { get; set; }
+ ///
+ ///
+ ///
+ public UInt32 value72 { get; set; }
+ ///
+ /// 时段 48 充电电量
+ /// 命令 202 报文此字段是 2 字节,
+ /// 命令 222 报文此字段是 4 字节
+ ///
+ public UInt32 value73 { get; set; }
+ ///
+ /// 启动方式
+ /// 0:本地刷卡启动
+ /// 1:后台启动
+ /// 2:本地管理员启动
+ /// 3:远程 VIN 验证启动
+ /// 4:远程密码验证启动
+ /// 5:本地 VIN 验证启动
+ /// 6:迪文界面流程启动
+ ///
+ public byte value74 { get; set; }
+ ///
+ /// 充电流水号 32
+ ///
+ public string value75 { get; set; }
+ ///
+ /// 充电服务费
+ ///
+ public UInt32 value76 { get; set; }
+ ///
+ /// 千分位电量
+ ///
+ public byte value77 { get; set; }
+ ///
+ /// 并充标志
+ /// 0/1-单枪充电
+ /// 2-单机柜双枪并充充电
+ /// 3-双机柜双枪并充充电
+ ///
+ public byte value78 { get; set; }
+ ///
+ /// 充放电标志
+ ///
+ /// 2-充电
+ /// 0xf1-放电
+ /// 非协议定义值,都表示充电
+ ///
+ public byte value79 { get; set; }
+ ///
+ /// 电表加密数据
+ ///
+ /// 瑞银电表解密后数据内容为:
+ /// 17 字节枪口识别号(BCD)
+ /// 4 字节计量开始时间(秒时戳, HEX)
+ /// 4 字节计量结束时间(秒时戳, HEX)
+ /// 4 字节正向充电电量(3 位小数, HEX)
+ /// 4 字节电表安装时间(秒时戳, HEX)
+ /// 1 字节端钮历史状态(0 正常,1 发生过端钮盖打开时间)
+ ///
+ public byte value80 { get; set; }
+ ///
+ /// 电表表号 6
+ ///
+ public string value81 { get; set; }
+ ///
+ /// 电表协议版本
+ ///
+ public UInt16 value82 { get; set; }
+ ///
+ /// 加密方式
+ /// 当前加密方式(工厂模式下配置,抄读无任何限制)
+ /// 00:软件 AES128 加密
+ /// 01:RJMU 国密 SM1(暂不支持)
+ /// 02:RJMU 国密 SM4(暂不支持)
+ /// 03:国网 ESAM 加密
+ /// 04:ECC256 签名算法
+ /// 05:其他
+ ///
+ public byte value83 { get; set; }
+ }
+}
diff --git a/BatCharging.Model/客户端接收/CMD402.cs b/BatCharging.Model/客户端接收/CMD402.cs
index d02a586..c2f7760 100644
--- a/BatCharging.Model/客户端接收/CMD402.cs
+++ b/BatCharging.Model/客户端接收/CMD402.cs
@@ -63,7 +63,7 @@ namespace BatCharging.Model
/// 命令 402 报文此字段单位是0.01kWh/bit
/// 命令 422 报 文 此 字 段 单 位 是0.001kWh/bit
///
- public float currentChargingLevel { get; set; }
+ public string currentChargingLevel { get; set; }
///
/// 充电前电表读数
///
@@ -109,7 +109,7 @@ namespace BatCharging.Model
/// 金额单位为0.01元
/// 电量时单位为0.01kw
///
- public float chargingStrategyPara { get; set; }
+ public string chargingStrategyPara { get; set; }
///
/// 车辆VIN 直流桩上传,没有填’\0’
///
@@ -262,7 +262,7 @@ namespace BatCharging.Model
/// 如平台不对电量第三位小数做强检要求可忽略本字段。
/// 如本字段为:0x09,千分位电量为 0.009Kw* h
///
- public byte millennialpowerConsumption { get; set; }
+ public string millennialpowerConsumption { get; set; }
///
/// 并充标志
/// 0/1-单枪充电
diff --git a/BatCharging.Service/ChargerMgrTool.cs b/BatCharging.Service/ChargerMgrTool.cs
index 6df91f3..04438f2 100644
--- a/BatCharging.Service/ChargerMgrTool.cs
+++ b/BatCharging.Service/ChargerMgrTool.cs
@@ -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 信息数据(预留)
diff --git a/BatCharging.Service/ChargerSendMsg.cs b/BatCharging.Service/ChargerSendMsg.cs
index b87ec7b..2069514 100644
--- a/BatCharging.Service/ChargerSendMsg.cs
+++ b/BatCharging.Service/ChargerSendMsg.cs
@@ -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
///
///
///
- 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);
}
+ ///
+ /// (CMD=5)
+ ///
+ ///
+ ///
+ ///
+ 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
diff --git a/BatCharging.Service/Common/ByteUtils.cs b/BatCharging.Service/Common/ByteUtils.cs
index 44f89b5..c3c3848 100644
--- a/BatCharging.Service/Common/ByteUtils.cs
+++ b/BatCharging.Service/Common/ByteUtils.cs
@@ -140,21 +140,21 @@ namespace BatCharging.Service
///
/// hexString 16进制字符串
/// 字节数组
- 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;
}
diff --git a/BatCharging.Service/DataRlt/解析数据/MsgReceiveCMDCom.cs b/BatCharging.Service/DataRlt/解析数据/MsgReceiveCMDCom.cs
index 9fd155e..8589eb9 100644
--- a/BatCharging.Service/DataRlt/解析数据/MsgReceiveCMDCom.cs
+++ b/BatCharging.Service/DataRlt/解析数据/MsgReceiveCMDCom.cs
@@ -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;
}
diff --git a/BatCharging.Service/发送方法/ChargerSendCMD.cs b/BatCharging.Service/发送方法/ChargerSendCMD.cs
index 731bca5..cf411a2 100644
--- a/BatCharging.Service/发送方法/ChargerSendCMD.cs
+++ b/BatCharging.Service/发送方法/ChargerSendCMD.cs
@@ -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;
}
-
///
/// 获取鉴权消息体字节数组
///
@@ -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 lstResult = new List();
+ lstResult.AddRange(PublicProgram.APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+ ///
+ /// 获取鉴权消息体字节数组
+ ///
+ ///
+ /// 鉴权消息体字节数组
+ private byte[] GetRCMD221DataInfo(CMD221 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ 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;
diff --git a/Monitor.ChargeTest/FrmChargeResult.Designer.cs b/Monitor.ChargeTest/FrmChargeResult.Designer.cs
index 09ed7a4..21b5ea0 100644
--- a/Monitor.ChargeTest/FrmChargeResult.Designer.cs
+++ b/Monitor.ChargeTest/FrmChargeResult.Designer.cs
@@ -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;
}
}
diff --git a/Monitor.ChargeTest/FrmChargeResult.cs b/Monitor.ChargeTest/FrmChargeResult.cs
index e5f9b52..c0bd048 100644
--- a/Monitor.ChargeTest/FrmChargeResult.cs
+++ b/Monitor.ChargeTest/FrmChargeResult.cs
@@ -433,7 +433,7 @@ namespace Monitor.ChargeTest
///
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);
+ }
}
}