diff --git a/.vs/hybirdMyFrame/DesignTimeBuild/.dtbcache.v2 b/.vs/hybirdMyFrame/DesignTimeBuild/.dtbcache.v2
index 248bbf7..775c3cd 100644
Binary files a/.vs/hybirdMyFrame/DesignTimeBuild/.dtbcache.v2 and b/.vs/hybirdMyFrame/DesignTimeBuild/.dtbcache.v2 differ
diff --git a/.vs/hybirdMyFrame/v17/.futdcache.v2 b/.vs/hybirdMyFrame/v17/.futdcache.v2
index 212b1f1..e4481a7 100644
Binary files a/.vs/hybirdMyFrame/v17/.futdcache.v2 and b/.vs/hybirdMyFrame/v17/.futdcache.v2 differ
diff --git a/.vs/hybirdMyFrame/v17/.suo b/.vs/hybirdMyFrame/v17/.suo
index fcc86d1..c5e13fd 100644
Binary files a/.vs/hybirdMyFrame/v17/.suo and b/.vs/hybirdMyFrame/v17/.suo differ
diff --git a/BatCharging.Manager/BatCharging.Manager.csproj b/BatCharging.Manager/BatCharging.Manager.csproj
new file mode 100644
index 0000000..1a50bd5
--- /dev/null
+++ b/BatCharging.Manager/BatCharging.Manager.csproj
@@ -0,0 +1,17 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BatCharging.Manager/ChargerEqmManager.cs b/BatCharging.Manager/ChargerEqmManager.cs
new file mode 100644
index 0000000..c1eecdd
--- /dev/null
+++ b/BatCharging.Manager/ChargerEqmManager.cs
@@ -0,0 +1,85 @@
+using BatCharging.Service;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BatCharging.Manager
+{
+ public class ChargerEqmManager
+ {
+ #region 定义锁
+
+ private object lockObj = new object(); //线程同步锁
+
+ #endregion 定义锁
+
+ #region 字段属性
+
+ ///
+ /// 是否可以发送充电机数据到云平台
+ ///
+ private bool _can_send_chrg_data = true;
+
+ ///
+ /// 是否可以发送充电机数据到云平台
+ ///
+ public bool F_CanSendChrgData
+ {
+ get { return _can_send_chrg_data; }
+ set
+ {
+ lock (lockObj)
+ {
+ _can_send_chrg_data = value;
+ }
+ }
+ }
+
+ ///
+ /// 是否启动智能充电方法
+ ///
+ private bool _can_smart_chrg = true;
+
+ ///
+ /// 是否启动智能充电方法
+ ///
+ public bool F_CanSmartChrg
+ {
+ get { return _can_smart_chrg; }
+ set
+ {
+ lock (lockObj)
+ {
+ _can_smart_chrg = value;
+ }
+ }
+ }
+
+ ///
+ /// 发送充电机数据到云平台的周期(单位:秒)
+ ///
+ private int _send_chrg_data_period = 30;
+
+ ///
+ /// 发送充电机数据到云平台的周期(单位:秒)
+ ///
+ public int F_SendChrgDataPeriod
+ {
+ get { return _send_chrg_data_period; }
+ set
+ {
+ lock (lockObj)
+ {
+ _send_chrg_data_period = value;
+ }
+ }
+ }
+
+ #endregion 字段属性
+
+
+ }
+}
diff --git a/BatCharging.Manager/CmnChargingsEqmInfo.cs b/BatCharging.Manager/CmnChargingsEqmInfo.cs
new file mode 100644
index 0000000..e6bbb36
--- /dev/null
+++ b/BatCharging.Manager/CmnChargingsEqmInfo.cs
@@ -0,0 +1,118 @@
+using BatCharging.Service;
+using DotNetty.Transport.Channels;
+using System;
+
+namespace BatCharging.Manager
+{
+ public class CmnChargingsEqmInfo
+ {
+ #region
+ private static object lockObj = new object(); //߳ͬ
+ #endregion
+
+ #region ֶ
+ ///
+ /// վ
+ ///
+ internal static string _station_no = "";
+ ///
+ /// վ
+ ///
+ public static string F_StationNo
+ {
+ get
+ {
+ return _station_no;
+ }
+ set
+ {
+ lock (lockObj)
+ {
+ _station_no = value;
+ }
+ }
+ }
+
+ ///
+ /// λгʵʱ
+ ///
+ internal static float[] _bin_powers = new float[7] { 0, 0, 0, 0, 0, 0, 0 };
+ ///
+ /// λгʵʱ
+ ///
+ public static float[] F_BinPowers
+ {
+ get
+ {
+ return _bin_powers;
+ }
+ set
+ {
+ lock (lockObj)
+ {
+ _bin_powers = value;
+ }
+ }
+ }
+ #endregion ֶ
+
+ #region ֶ
+ public static string _OUTCHR01IPADDR = "172.0.30.30";
+ public static string _OUTCHR02IPADDR = "172.0.30.31";
+ public static string _OUTCHR03IPADDR = "172.0.30.32";
+ public static string _OUTCHR04IPADDR = "172.0.30.33";
+
+ public static int _OUTCHR01PORT = 4567;
+ public static int _OUTCHR02PORT = 4567;
+ public static int _OUTCHR03PORT = 4567;
+ public static int _OUTCHR04PORT = 4567;
+
+ public static IChannelId _ID;
+ public static string _CHR0IPADDR = "0.0.0.0";
+ public static int _CHR0PORT = 4567;
+ public static string _EQMCODE = "";
+
+
+ public volatile static ChargerMgrTool _CHR01 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR02 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR03 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR04 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR05 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR06 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR07 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+
+ public volatile static ChargerMgrTool _CHR08 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR09 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR10 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR11 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR12 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR13 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR14 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+
+ public volatile static ChargerMgrTool _CHR15 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR16 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR17 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR18 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR19 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR20 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR21 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+
+ public volatile static ChargerMgrTool _CHR22 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR23 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+ public volatile static ChargerMgrTool _CHR24 = new ChargerMgrTool(_ID, _CHR0IPADDR, _CHR0PORT, _EQMCODE);
+
+ #endregion ֶ
+
+ #region ״ֵ̬
+
+ public static byte _CHR01WORKVAL = 0;
+ public static byte _CHR02WORKVAL = 0;
+ public static byte _CHR03WORKVAL = 0;
+ public static byte _CHR04WORKVAL = 0;
+ public static byte _CHR05WORKVAL = 0;
+ public static byte _CHR06WORKVAL = 0;
+ public static byte _CHR07WORKVAL = 0;
+ public static byte[] _CHRSWORKVAL = new byte[] { 0, 0, 0, 0, 0, 0, 0 };
+ #endregion ״ֵ̬
+ }
+}
diff --git a/BatCharging.Model/BatCharging.Model.csproj b/BatCharging.Model/BatCharging.Model.csproj
new file mode 100644
index 0000000..132c02c
--- /dev/null
+++ b/BatCharging.Model/BatCharging.Model.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
diff --git a/HybirdFrameworkEntity/MsgModel/APDUModel.cs b/BatCharging.Model/MsgModel/APDUModel.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/APDUModel.cs
rename to BatCharging.Model/MsgModel/APDUModel.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD10.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD10.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD10.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD10.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1002.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD1002.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1002.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD1002.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1004.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD1004.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1004.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD1004.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1006.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD1006.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1006.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD1006.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1008.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD1008.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1008.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD1008.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1010.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD1010.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1010.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD1010.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1012.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD1012.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1012.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD1012.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD102.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD102.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD102.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD102.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1022.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD1022.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1022.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD1022.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD104.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD104.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD104.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD104.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD106.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD106.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD106.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD106.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD108.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD108.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD108.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD108.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD110.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD110.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD110.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD110.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1102.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD1102.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1102.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD1102.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1104.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD1104.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1104.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD1104.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1106.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD1106.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1106.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD1106.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1108.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD1108.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1108.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD1108.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD112.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD112.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD112.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD112.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD114.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD114.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD114.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD114.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1302.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD1302.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1302.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD1302.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1402.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD1402.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1402.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD1402.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1403.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD1403.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1403.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD1403.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1407.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD1407.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1407.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD1407.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1501.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD1501.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1501.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD1501.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1503.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD1503.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1503.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD1503.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1505.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD1505.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1505.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD1505.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1506.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD1506.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD1506.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD1506.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD2.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD2.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD2.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD2.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD202.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD202.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD202.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD202.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD204.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD204.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD204.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD204.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD206.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD206.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD206.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD206.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD208.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD208.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD208.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD208.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD210.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD210.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD210.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD210.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD221.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD221.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD221.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD221.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD222.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD222.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD222.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD222.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD302.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD302.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD302.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD302.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD304.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD304.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD304.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD304.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD4.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD4.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD4.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD4.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD402.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD402.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD402.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD402.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD6.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD6.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD6.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD6.cs
diff --git a/HybirdFrameworkEntity/MsgModel/RecpCMD/CMD8.cs b/BatCharging.Model/MsgModel/RecpCMD/CMD8.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/RecpCMD/CMD8.cs
rename to BatCharging.Model/MsgModel/RecpCMD/CMD8.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD1.cs b/BatCharging.Model/MsgModel/SendCMD/CMD1.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD1.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD1.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD1001.cs b/BatCharging.Model/MsgModel/SendCMD/CMD1001.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD1001.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD1001.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD1003.cs b/BatCharging.Model/MsgModel/SendCMD/CMD1003.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD1003.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD1003.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD1005.cs b/BatCharging.Model/MsgModel/SendCMD/CMD1005.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD1005.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD1005.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD1007.cs b/BatCharging.Model/MsgModel/SendCMD/CMD1007.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD1007.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD1007.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD1009.cs b/BatCharging.Model/MsgModel/SendCMD/CMD1009.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD1009.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD1009.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD101.cs b/BatCharging.Model/MsgModel/SendCMD/CMD101.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD101.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD101.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD1011.cs b/BatCharging.Model/MsgModel/SendCMD/CMD1011.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD1011.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD1011.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD1021.cs b/BatCharging.Model/MsgModel/SendCMD/CMD1021.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD1021.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD1021.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD103.cs b/BatCharging.Model/MsgModel/SendCMD/CMD103.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD103.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD103.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD105.cs b/BatCharging.Model/MsgModel/SendCMD/CMD105.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD105.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD105.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD107.cs b/BatCharging.Model/MsgModel/SendCMD/CMD107.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD107.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD107.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD109.cs b/BatCharging.Model/MsgModel/SendCMD/CMD109.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD109.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD109.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD1101.cs b/BatCharging.Model/MsgModel/SendCMD/CMD1101.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD1101.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD1101.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD1103.cs b/BatCharging.Model/MsgModel/SendCMD/CMD1103.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD1103.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD1103.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD1105.cs b/BatCharging.Model/MsgModel/SendCMD/CMD1105.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD1105.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD1105.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD1107.cs b/BatCharging.Model/MsgModel/SendCMD/CMD1107.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD1107.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD1107.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD111.cs b/BatCharging.Model/MsgModel/SendCMD/CMD111.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD111.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD111.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD113.cs b/BatCharging.Model/MsgModel/SendCMD/CMD113.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD113.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD113.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD1301.cs b/BatCharging.Model/MsgModel/SendCMD/CMD1301.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD1301.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD1301.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD1401.cs b/BatCharging.Model/MsgModel/SendCMD/CMD1401.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD1401.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD1401.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD1406.cs b/BatCharging.Model/MsgModel/SendCMD/CMD1406.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD1406.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD1406.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD1502.cs b/BatCharging.Model/MsgModel/SendCMD/CMD1502.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD1502.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD1502.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD1504.cs b/BatCharging.Model/MsgModel/SendCMD/CMD1504.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD1504.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD1504.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD201.cs b/BatCharging.Model/MsgModel/SendCMD/CMD201.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD201.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD201.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD203.cs b/BatCharging.Model/MsgModel/SendCMD/CMD203.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD203.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD203.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD205.cs b/BatCharging.Model/MsgModel/SendCMD/CMD205.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD205.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD205.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD207.cs b/BatCharging.Model/MsgModel/SendCMD/CMD207.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD207.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD207.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD209.cs b/BatCharging.Model/MsgModel/SendCMD/CMD209.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD209.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD209.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD3.cs b/BatCharging.Model/MsgModel/SendCMD/CMD3.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD3.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD3.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD301.cs b/BatCharging.Model/MsgModel/SendCMD/CMD301.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD301.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD301.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD303.cs b/BatCharging.Model/MsgModel/SendCMD/CMD303.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD303.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD303.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD401.cs b/BatCharging.Model/MsgModel/SendCMD/CMD401.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD401.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD401.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD5.cs b/BatCharging.Model/MsgModel/SendCMD/CMD5.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD5.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD5.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD7.cs b/BatCharging.Model/MsgModel/SendCMD/CMD7.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD7.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD7.cs
diff --git a/HybirdFrameworkEntity/MsgModel/SendCMD/CMD9.cs b/BatCharging.Model/MsgModel/SendCMD/CMD9.cs
similarity index 100%
rename from HybirdFrameworkEntity/MsgModel/SendCMD/CMD9.cs
rename to BatCharging.Model/MsgModel/SendCMD/CMD9.cs
diff --git a/BatCharging.Service/BatCharging.Service.csproj b/BatCharging.Service/BatCharging.Service.csproj
new file mode 100644
index 0000000..c89146a
--- /dev/null
+++ b/BatCharging.Service/BatCharging.Service.csproj
@@ -0,0 +1,18 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/HybirdFrameworkEntity/MsgModel/ByteUtils.cs b/BatCharging.Service/ByteUtils.cs
similarity index 99%
rename from HybirdFrameworkEntity/MsgModel/ByteUtils.cs
rename to BatCharging.Service/ByteUtils.cs
index 05aced8..9884f0d 100644
--- a/HybirdFrameworkEntity/MsgModel/ByteUtils.cs
+++ b/BatCharging.Service/ByteUtils.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace HybirdFrameworkEntity
+namespace BatCharging.Service
{
public class ByteUtils
{
diff --git a/BatCharging.Service/ChargerMgrTool.cs b/BatCharging.Service/ChargerMgrTool.cs
new file mode 100644
index 0000000..253d2e4
--- /dev/null
+++ b/BatCharging.Service/ChargerMgrTool.cs
@@ -0,0 +1,5225 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Reflection;
+using System.Threading.Tasks;
+using System.Threading;
+using HybirdFrameworkEntity;
+using System.Text;
+using Newtonsoft.Json;
+using System.Linq;
+using DotNetty.Transport.Channels;
+
+namespace BatCharging.Service
+{
+ ///
+ /// 1ų
+ ///
+ public class ChargerMgrTool
+ {
+ #region
+
+ private object lockObj = new object(); //߳ͬ
+
+ #endregion
+
+ #region ֶ
+
+ #region Ϣ
+ private IChannelId _id;
+ public IChannelId ID
+ {
+ get { return _id; }
+ set
+ {
+ lock (lockObj)
+ {
+ _id = value;
+ }
+ }
+ }
+
+ IChannel channel;
+
+ ///
+ /// IPַ
+ ///
+ private string _ip_addr;
+
+ ///
+ /// IPַ
+ ///
+ public string F_IPAddr
+ {
+ get { return _ip_addr; }
+ set
+ {
+ lock (lockObj)
+ {
+ _ip_addr = value;
+ }
+ }
+ }
+
+ ///
+ /// ˿ں
+ ///
+ private int _ip_port = 4567;
+
+ ///
+ /// ˿ں
+ ///
+ public int F_Port
+ {
+ get { return _ip_port; }
+ set
+ {
+ lock (lockObj)
+ {
+ _ip_port = value;
+ }
+ }
+ }
+
+ ///
+ /// ӱ־
+ ///
+ private bool connecting_flage = false;
+
+ ///
+ /// ӱ־
+ ///
+ public bool ConnectingFlage
+ {
+ get { return connecting_flage; }
+ set
+ {
+ lock (lockObj)
+ {
+ connecting_flage = value;
+ }
+ }
+ }
+
+
+ ///
+ /// ͨѶǷ
+ ///
+ private bool _net_connected = false;
+
+ ///
+ /// ͨѶǷ
+ ///
+ public bool F_NetConnected
+ {
+ get { return _net_connected; }
+ set
+ {
+ lock (lockObj)
+ {
+ _net_connected = value;
+ }
+ }
+ }
+
+
+ ///
+ /// ͨѶʹ
+ ///
+ private bool _net_connect_enabled = true;
+
+ ///
+ /// ͨѶʹ
+ ///
+ public bool F_NetConnectEnabled
+ {
+ get { return _net_connect_enabled; }
+ set
+ {
+ lock (lockObj)
+ {
+ _net_connect_enabled = value;
+ }
+ }
+ }
+
+ ///
+ /// ͨѶж϶߳ʱʱ䣨λ룩
+ ///
+ private int _net_check_time_out = 30;
+
+ ///
+ /// ͨѶǷ
+ ///
+ public int F_NetCheckTimeOut
+ {
+ get { return _net_check_time_out; }
+ set
+ {
+ lock (lockObj)
+ {
+ _net_check_time_out = value;
+ }
+ }
+ }
+
+ ///
+ /// ǷѾʼ
+ ///
+ private bool _is_charged = false;
+
+ ///
+ /// ǷѾʼ
+ ///
+ public bool F_IsCharged
+ {
+ get { return _is_charged; }
+ set
+ {
+ lock (lockObj)
+ {
+ _is_charged = value;
+ }
+ }
+ }
+
+ ///
+ /// Ƿֹͣ
+ ///
+ private bool _is_stoped = false;
+
+ ///
+ /// Ƿֹͣ
+ ///
+ public bool F_IsStoped
+ {
+ get { return _is_stoped; }
+ set
+ {
+ lock (lockObj)
+ {
+ _is_stoped = value;
+ }
+ }
+ }
+
+ ///
+ /// ״̬0:Чֵ1:Ȩɹ2:Ȩʧܣ3ʼɹ4ʼʧܣ5ڳ磻6ֹͣɹ7ֹͣʧܣ
+ ///
+ private UInt16 _charging_status = 0;
+
+ ///
+ /// ״̬0:Чֵ1:Ȩɹ2:Ȩʧܣ3ʼɹ4ʼʧܣ5ڳ磻6ֹͣɹ7ֹͣʧܣ
+ ///
+ public UInt16 F_ChargingStatus
+ {
+ get { return _charging_status; }
+ set
+ {
+ lock (lockObj)
+ {
+ _charging_status = value;
+ }
+ }
+ }
+
+ ///
+ /// 翪ʼʱ䣨Ĭ2000-1-1
+ ///
+ private DateTime _charging_start_time = Convert.ToDateTime("2000-1-1");
+
+ ///
+ /// 翪ʼʱ䣨Ĭ2000-1-1
+ ///
+ public DateTime F_ChargingStartTime
+ {
+ get { return _charging_start_time; }
+ set
+ {
+ lock (lockObj)
+ {
+ _charging_start_time = value;
+ }
+ }
+ }
+
+ ///
+ /// ֹͣʱ䣨Ĭ2000-1-1
+ ///
+ private DateTime _charging_stop_time = Convert.ToDateTime("2000-1-1");
+
+ ///
+ /// ֹͣʱ䣨Ĭ2000-1-1
+ ///
+ public DateTime F_ChargingStopTime
+ {
+ get { return _charging_stop_time; }
+ set
+ {
+ lock (lockObj)
+ {
+ _charging_stop_time = value;
+ }
+ }
+ }
+
+ ///
+ /// ǷѾȨ
+ ///
+ private bool _is_authed = false;
+
+ ///
+ /// վǷѾȨ
+ ///
+ public bool F_IsAuthed
+ {
+ get { return _is_authed; }
+ set
+ {
+ lock (lockObj)
+ {
+ _is_authed = value;
+ }
+ }
+ }
+
+ ///
+ /// óֹͣԭ.0ͣ 1쳣,ǿͣ
+ ///
+ private byte _stop_reason = 0;
+
+ ///
+ /// óֹͣԭ.0ͣ 1쳣,ǿͣ
+ ///
+ public byte F_StopReason
+ {
+ get { return _stop_reason; }
+ set
+ {
+ lock (lockObj)
+ {
+ _stop_reason = value;
+ }
+ }
+ }
+
+ ///
+ /// ѭԶָֹͣյظֹͣɺΪFalse
+ ///
+ private bool _is_can_send_stop_cmd = true;
+
+ ///
+ /// óֹͣԭ.0ͣ 1쳣,ǿͣ
+ ///
+ public bool F_IsCanSendStopCmd
+ {
+ get { return _is_can_send_stop_cmd; }
+ set
+ {
+ lock (lockObj)
+ {
+ _is_can_send_stop_cmd = value;
+ }
+ }
+ }
+
+ ///
+ /// ¼ǷѾƽ̨
+ ///
+ internal bool _record_to_cloud_sended = false;
+
+ ///
+ /// ¼ǷѾƽ̨
+ ///
+ public bool F_RecordToCloudSended
+ {
+ get { return _record_to_cloud_sended; }
+ set
+ {
+ lock (lockObj)
+ {
+ _record_to_cloud_sended = value;
+ }
+ }
+ }
+
+ ///
+ ///
+ ///
+ private string _eqmcode;
+
+ ///
+ ///
+ ///
+ public string F_EqmCode
+ {
+ get { return _eqmcode; }
+ set
+ {
+ lock (lockObj)
+ {
+ _eqmcode = value;
+ }
+ }
+ }
+
+ ///
+ /// ״̬-ңݰеõ0:12ɣ3/ŵͣ
+ ///
+ private byte _workstate;
+
+ ///
+ /// ״̬-ңݰеõ0:12ɣ3/ŵͣ
+ ///
+ public byte F_WorkState
+ {
+ get { return _workstate; }
+ set
+ {
+ lock (lockObj)
+ {
+ _workstate = value;
+ }
+ }
+ }
+
+ ///
+ ///
+ ///
+ private bool _is_fault;
+
+ ///
+ /// -true:ϣfalse:
+ ///
+ public bool F_IsFault
+ {
+ get { return _is_fault; }
+ set
+ {
+ lock (lockObj)
+ {
+ _is_fault = value;
+ }
+ }
+ }
+
+ ///
+ ///
+ ///
+ private bool _is_alarm;
+
+ ///
+ /// -true:false:
+ ///
+ public bool F_IsAlarm
+ {
+ get { return _is_alarm; }
+ set
+ {
+ lock (lockObj)
+ {
+ _is_alarm = value;
+ }
+ }
+ }
+
+ ///
+ ///
+ ///
+ private int _fault_number = 0;
+
+ ///
+ ///
+ ///
+ public int F_FaultNumber
+ {
+ get { return _fault_number; }
+ set
+ {
+ lock (lockObj)
+ {
+ _fault_number = value;
+ }
+ }
+ }
+
+ ///
+ /// ϱб
+ ///
+ private List _fault_alaram_no_list = new List();
+
+ ///
+ /// ϱб
+ ///
+ public List F_FaultAlarmNoList
+ {
+ get { return _fault_alaram_no_list; }
+ set
+ {
+ lock (lockObj)
+ {
+ _fault_alaram_no_list = value;
+ }
+ }
+ }
+
+ ///
+ ///SOC
+ ///
+ private byte _soc = 0;
+
+ ///
+ /// SOC
+ ///
+ public byte F_SOC
+ {
+ get { return _soc; }
+ set
+ {
+ lock (lockObj)
+ {
+ _soc = value;
+ }
+ }
+ }
+
+ ///
+ ///ʵʱ繦
+ ///
+ private float _power = 0;
+
+ ///
+ /// ʵʱ繦
+ ///
+ public float F_Power
+ {
+ get { return _power; }
+ set
+ {
+ lock (lockObj)
+ {
+ _power = value;
+ }
+ }
+ }
+
+
+ ///
+ /// ʱ
+ ///
+ private DateTime _recving_data_time = DateTime.Now;
+
+ ///
+ /// ʱ
+ ///
+ public DateTime F_RecvingDataTime
+ {
+ get { return _recving_data_time; }
+ set
+ {
+ lock (lockObj)
+ {
+ _recving_data_time = value;
+ }
+ }
+ }
+
+ ///
+ ///ʷ״̬¼ֵ
+ ///
+ private bool _charger_status_record_value;
+
+ ///
+ /// ʷ״̬¼ֵ false֮ǰΪڳ״̬ true:֮ǰΪڳ״̬
+ ///
+ public bool ChargerStatusRecordValue
+ {
+ get { return _charger_status_record_value; }
+ set
+ {
+ lock (lockObj)
+ {
+ _charger_status_record_value = value;
+ }
+ }
+ }
+
+
+ ///
+ ///ͷ״̬ʷ¼ֵ 0δ֪ 1֮ǰΪ״̬ 2:֮ǰΪδ״̬
+ ///
+ private int electr_connector_connect_status_record = 0;
+
+ ///
+ /// ͷ״̬ʷ¼ֵ 0δ֪ 1֮ǰΪ״̬ 2:֮ǰΪδ״̬
+ ///
+ public int electrConnectorConnectStatusRecord
+ {
+ get { return electr_connector_connect_status_record; }
+ set
+ {
+ lock (lockObj)
+ {
+ electr_connector_connect_status_record = value;
+ }
+ }
+ }
+
+ //private int alarmProcessCounter = 0;
+ ///
+ ///
+ ///
+ private ushort HeartBeatProcessCounter = 0;
+
+
+
+
+
+ #endregion Ϣ
+
+
+ #region Ϣ
+
+
+
+ #endregion Ϣ
+
+ #endregion ֶ
+
+ #region ṹ
+
+ public ChargerMgrTool()
+ {
+ }
+
+
+ ///
+ /// ṹ
+ ///
+ /// IPַ
+ /// ˿ں
+ public ChargerMgrTool(string ipAddr, int port)
+ {
+ _ip_addr = ipAddr;
+ _ip_port = port;
+ }
+
+ ///
+ ///
+ ///
+ /// IPַ
+ /// ˿ں
+ /// Ŀĵַֽ
+ public ChargerMgrTool(IChannelId id, string ipAddr, int port, string eqmcode)
+ {
+ _id = id;
+ _ip_addr = ipAddr;
+ _ip_port = port;
+ _eqmcode = eqmcode;
+ }
+
+ #endregion ṹ
+
+ #region ¼
+
+
+ #endregion ¼
+
+ #region ¼
+
+ #endregion ¼
+
+ #region ͨѶ߳
+ ///
+ /// ̺߳Ͷ߳
+ ///
+ public void ChargerNetHeartBeatThread()
+ {
+ Thread chrgConnectedThread = new Thread(ChargerHeartBeatFunc);
+ chrgConnectedThread.IsBackground = true;
+ chrgConnectedThread.Start();
+ }
+
+
+ public void ChargerHeartBeatFunc()
+ {
+ _net_connected = true;
+ while (_net_connect_enabled && _net_connected)
+ {
+ Thread.Sleep(2000);
+ if (!connecting_flage)
+ {
+ DateTime recvTime = DateTime.Now;
+ int seconds = Convert.ToInt32(recvTime.Subtract(F_RecvingDataTime).TotalSeconds);
+ if (seconds >= _net_check_time_out)
+ {
+
+ }
+ }
+
+ if (_net_connected)
+ {
+ ushort heartbeatNum = 0;
+ byte[] bytes = Send101(heartbeatNum);
+ //if (Server != null)
+ //{
+ // Server.Send(bytes);
+ //}
+ }
+ }
+ }
+
+ #endregion ͨѶ߳
+
+ #region ݽ
+
+
+ public void decode(string IP, string port, byte[] data)
+ {
+ switch (IP)
+ {
+ case "1":
+
+ break;
+ case "2":
+ break;
+ case "3":
+ break;
+ case "4":
+ break;
+ case "5":
+ break;
+ }
+ int func = (ushort)(data[6] + (data[6 + 1] << 8));
+ F_RecvingDataTime = DateTime.Now;
+ switch (func)
+ {
+ #region Эʽ
+
+ case 2:
+ {
+ CMD2 CMD2 = ConCMD2(data);
+ string result = "(CMD=2)/ѯӦ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "(CMD=2)/ѯӦ" + JsonConvert.SerializeObject(CMD2);
+ ////Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+
+ }
+ break;
+ case 4:
+ {
+ CMD4 CMD4 = ConCMD4(data);
+ string result = "(CMD=4)ַ/ѯӦ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "(CMD=4)ַ/ѯӦ" + JsonConvert.SerializeObject(CMD4);
+ ////Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+
+ }
+ break;
+ case 6:
+ {
+ CMD6 CMD6 = ConCMD6(data);
+ string result = "(CMD=6)Ժ̨Ӧ- ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "(CMD=6)Ժ̨Ӧ" + JsonConvert.SerializeObject(CMD6);
+ ////Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+
+ }
+ break;
+ case 8:
+ {
+ CMD8 CMD8 = ConCMD8(data);
+ string result = "(CMD=8) Ժ̨·ijӦ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "(CMD=8) Ժ̨·ijӦ" + JsonConvert.SerializeObject(CMD8);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+
+ }
+ break;
+ case 10:
+ {
+ CMD10 CMD10 = ConCMD10(data);
+ string result = "(CMD=10)ϴ(Ԥ) - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "(CMD=10)ϴ(Ԥ)" + JsonConvert.SerializeObject(CMD10);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+
+ }
+ break;
+ #endregion
+
+ #region ϴ
+
+ case 102:
+ {
+ CMD102 CMD102 = ConCMD102(data);
+ string result = "(CMD=10)ϴϢ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "(CMD=10)ϴϢ" + JsonConvert.SerializeObject(CMD102);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+
+ }
+ break;
+ case 104:
+ {
+ CMD104 CMD104 = ConCMD104(data);
+ string result = "(CMD=10)״̬Ϣϱ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "(CMD=10)״̬Ϣϱ" + JsonConvert.SerializeObject(CMD104);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+
+ }
+ break;
+ case 106:
+ {
+ CMD106 CMD106 = ConCMD106(data);
+ string result = "(CMD=10)ǩϢϱ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "(CMD=10)ǩϢϱ" + JsonConvert.SerializeObject(CMD106);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+
+ }
+ break;
+ case 108:
+ {
+ CMD108 CMD108 = ConCMD108(data);
+ string result = "(CMD=10)澯Ϣϱ(Ԥ) - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "(CMD=10)澯Ϣϱ(Ԥ)" + JsonConvert.SerializeObject(CMD108);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+
+ }
+ break;
+ case 110:
+ {
+ CMD110 CMD110 = ConCMD110(data);
+ string result = "(CMD=10)ϱ(Ԥ) - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "(CMD=10)ϱ(Ԥ)" + JsonConvert.SerializeObject(CMD110);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+
+ }
+ break;
+ case 112:
+ {
+ CMD112 CMD112 = ConCMD112(data);
+ string result = "(CMD=10)ģϢϱ(Ԥ) - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "(CMD=10)ģϢϱ" + JsonConvert.SerializeObject(CMD112);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ case 114:
+ {
+ CMD114 CMD114 = ConCMD114(data);
+ string result = "(CMD=10)ӦѯһγʱϢ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "(CMD=10)ӦѯһγʱϢ" + JsonConvert.SerializeObject(CMD114);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ #endregion
+
+ #region Ϣ
+
+ case 202:
+ case 222:
+ {
+ CMD202 CMD202 = ConCMD202((UInt16)func, data);
+ string result = "ϱ¼Ϣ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "ϱ¼Ϣ" + JsonConvert.SerializeObject(CMD202);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+
+ }
+ break;
+ case 204:
+ {
+ CMD204 CMD204 = ConCMD204(data);
+ string result = "ϴû˻ѯ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "ϴû˻ѯĶ" + JsonConvert.SerializeObject(CMD204);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+
+ }
+ break;
+ case 206:
+ {
+ CMD206 CMD206 = ConCMD206(data);
+ string result = "ϴû֤ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "ϴû֤Ķ" + JsonConvert.SerializeObject(CMD206);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ case 208:
+ {
+ CMD208 CMD208 = ConCMD208(data);
+ string result = "ϱ弴䡱 - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "ϱ弴䡱" + JsonConvert.SerializeObject(CMD208);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ case 210:
+ {
+ CMD210 CMD210 = ConCMD210(data);
+ string result = "ϱ弴䡱 - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "ϱ弴䡱" + JsonConvert.SerializeObject(CMD210);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ #endregion
+
+ #region ֱ BMS Ϣ(Ԥ)
+ case 302:
+ {
+ CMD302 CMD302 = ConCMD302(data);
+ string result = "ϱBMSϢ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "ϱBMSϢ" + JsonConvert.SerializeObject(CMD302);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ case 304:
+ {
+ CMD304 CMD304 = ConCMD304(data);
+ string result = "ϱBMSϢ(Ԥ-ʱ) - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "ϱBMSϢ(Ԥ-ʱ)" + JsonConvert.SerializeObject(CMD304);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ #endregion
+
+ #region ʷ¼
+ case 402:
+ case 422:
+ {
+ CMD402 CMD402 = ConCMD402((UInt16)func, data);
+ string result = "ϱʷij¼ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "ϱʷij¼" + JsonConvert.SerializeObject(CMD402);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+
+ }
+ break;
+ #endregion
+
+ #region
+ case 1002:
+ {
+ CMD1002 CMD1002 = ConCMD1002(data);
+ string result = "ظ·ָ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "ظ·ָ" + JsonConvert.SerializeObject(CMD1002);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ case 1004:
+ {
+ CMD1004 CMD1004 = ConCMD1004(data);
+ string result = "Ӧ·ļָ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "Ӧ·ļָ" + JsonConvert.SerializeObject(CMD1004);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ case 1006:
+ {
+ CMD1006 CMD1006 = ConCMD1006(data);
+ string result = "Ӧ·ļСָ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "Ӧ·ļСָ" + JsonConvert.SerializeObject(CMD1006);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ case 1008:
+ {
+ CMD1008 CMD1008 = ConCMD1008(data);
+ string result = "Ӧ·ļָ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "Ӧ·ļָ" + JsonConvert.SerializeObject(CMD1008);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ case 1010:
+ {
+ CMD1010 CMD1010 = ConCMD1010(data);
+ string result = "Ӧ·ļݽָ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "Ӧ·ļݽָ" + JsonConvert.SerializeObject(CMD1010);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ case 1012:
+ {
+ CMD1012 CMD1012 = ConCMD1012(data);
+ string result = "Ӧ·ָ- ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "Ӧ·ָ" + JsonConvert.SerializeObject(CMD1012);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ case 1022:
+ {
+ CMD1022 CMD1022 = ConCMD1022(data);
+ string result = " - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "" + JsonConvert.SerializeObject(CMD1022);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ #endregion
+
+ #region ƷѲصָ
+ case 1102:
+ {
+ CMD1102 CMD1102 = ConCMD1102(data);
+ string result = "Ӧ̨ѯ24ʱѼƼ۲Ϣ- ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "Ӧ̨ѯ24ʱѼƼ۲Ϣ" + JsonConvert.SerializeObject(CMD1102);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ case 1104:
+ {
+ CMD1104 CMD1104 = ConCMD1104(data);
+ string result = "Ӧ̨24ʱѼƼ۲Ϣ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "Ӧ̨24ʱѼƼ۲Ϣ" + JsonConvert.SerializeObject(CMD1104);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ case 1106:
+ {
+ CMD1106 CMD1106 = ConCMD1106(data);
+ string result = "Ӧ̨÷ʱμƼ۲Ϣ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "Ӧ̨÷ʱμƼ۲Ϣ" + JsonConvert.SerializeObject(CMD1106);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ case 1108:
+ {
+ CMD1108 CMD1108 = ConCMD1108(data);
+ string result = "ظʱѼƼ۲Ϣ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "ظʱѼƼ۲Ϣ" + JsonConvert.SerializeObject(CMD1108);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ #endregion
+
+ #region
+ case 1302:
+ {
+ CMD1302 CMD1302 = ConCMD1302(data);
+ string result = "Ӧ־ݰ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "Ӧ־ݰ" + JsonConvert.SerializeObject(CMD1302);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ #endregion
+
+ #region FTPԶFTPʽ־ϴ
+ case 1402:
+ {
+ CMD1402 CMD1402 = ConCMD1402(data);
+ string result = "Ӧ·FTPԶ- ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "Ӧ·FTPԶ" + JsonConvert.SerializeObject(CMD1402);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ case 1403:
+ {
+ CMD1403 CMD1403 = ConCMD1403(data);
+ string result = "ӦFTPؽ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "ӦFTPؽȶ" + JsonConvert.SerializeObject(CMD1403);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ case 1407:
+ {
+ CMD1407 CMD1407 = ConCMD1407(data);
+ string result = "Ӧ·ȡ־ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "Ӧ·ȡ־" + JsonConvert.SerializeObject(CMD1407);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ #endregion
+
+ #region Э鷽ʽ־ϴ
+ case 1501:
+ {
+ CMD1501 CMD1501 = ConCMD1501(data);
+ string result = "(CMD=1501ϴļ - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "(CMD=1501ϴļ" + JsonConvert.SerializeObject(CMD1501);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ case 1503:
+ {
+ CMD1503 CMD1503 = ConCMD1503(data);
+ string result = "(CMD=10)ϴ(Ԥ) - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "(CMD=10)ϴ(Ԥ)" + JsonConvert.SerializeObject(CMD1503);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+
+ }
+ break;
+ case 1505://ɣҪر
+ {
+ CMD1505 CMD1505 = ConCMD1505(data);
+ string result = "(CMD=10)ϴ(Ԥ) - ֽݣ" + ByteUtils.BytesToHexStr(data) + "";
+ result += "\r\n" + "(CMD=10)ϴ(Ԥ)" + JsonConvert.SerializeObject(CMD1505);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "");
+ }
+ break;
+ #endregion
+ }
+ }
+
+
+ #endregion ݽ
+
+ #region ݷ
+
+ #region /ѯ
+ ///
+ /// (CMD=1)̨·ι
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public byte[] Send1(byte type, uint startAddress, byte num, byte[] setData)
+ {
+ APDUModel APDUModel;
+
+ CMD1 CMD1 = new CMD1();
+ CMD1.Type = type;
+ CMD1.SetAddress = startAddress;
+ CMD1.SelectNum = num;
+ CMD1.SetByteNum = (ushort)(num * 4);
+ CMD1.SetData = setData;
+
+ byte[] bytes = new ChargerSendCMD().SendRCMD1(out APDUModel, CMD1);
+
+ if (APDUModel != null)
+ {
+ string result = "1̨·ι-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ }
+ return bytes;
+ }
+
+ ///
+ /// (CMD=3)
+ ///
+ ///
+ ///
+ ///
+ public byte[] Send3(byte type, uint startAddress, byte[] setData)
+ {
+ APDUModel APDUModel;
+
+
+ CMD3 CMD3 = new CMD3();
+ CMD3.Reserved1 = 0;
+ CMD3.Reserved2 = 0;
+ CMD3.Type = type;
+ CMD3.SAddress = startAddress;
+ CMD3.SBytes = cmd3StartAddress[startAddress];
+ CMD3.SData = setData;
+
+ byte[] bytes = new ChargerSendCMD().SendRCMD3(out APDUModel, CMD3);
+
+ if (APDUModel != null)
+ {
+ string result = "3̨·ַͲ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ }
+ return bytes;
+ }
+
+
+ ///
+ /// ̨·
+ ///
+ ///
+ /// ǹ
+ /// ʼַ
+ ///
+ ///
+ public byte[] Send5(byte chargeMuzzle, uint startAddress, byte num, byte[] setData)
+ {
+
+ APDUModel APDUModel;
+
+ CMD5 CMD = new CMD5();
+ CMD.RechargeableMuzzle = chargeMuzzle;
+ CMD.CommandAddress = startAddress;
+ CMD.CommandNum = num;
+ CMD.CommandLength = (ushort)(num * 4);
+ CMD.CommandData = setData;
+
+
+ byte[] bytes = new ChargerSendCMD().SendRCMD5(out APDUModel, CMD);
+
+ if (APDUModel != null)
+ {
+ string result = "5̨·-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ }
+ return bytes;
+ }
+
+
+
+ ///
+ /// ̨·
+ ///
+ ///
+ ///
+ public byte[] Send7(CMD7 CMD)
+ {
+ APDUModel APDUModel;
+
+ byte[] bytes = new ChargerSendCMD().SendRCMD7(out APDUModel, CMD);
+ if (APDUModel != null)
+ {
+
+ string result = "7̨·-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ }
+ return bytes;
+ }
+
+
+
+
+ public byte[] Send9(byte chargeMuzzle, uint executeResult, uint address, byte[] setData)
+ {
+ APDUModel APDUModel;
+
+ CMD9 CMD = new CMD9();
+
+ CMD.ChargGunNum = chargeMuzzle;
+ CMD.FWResult = executeResult;
+ CMD.CommandAddress = address;
+ CMD.DataLength = 4;
+ CMD.Datas = new byte[4];
+
+ byte[] bytes = new ChargerSendCMD().SendRCMD9(out APDUModel, CMD);
+
+ if (APDUModel != null)
+ {
+ string result = "9̨Ӧϴ(Ԥ)-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ }
+ return bytes;
+ }
+
+
+ #endregion
+
+ #region ϴ
+ ///
+ /// ӦϢ
+ ///
+ ///
+ /// Ӧ
+ public byte[] Send101(ushort heartbeatNum)
+ {
+ APDUModel APDUModel;
+
+ CMD101 CMD = new CMD101();
+
+ CMD.HearResponse = heartbeatNum;
+
+ byte[] bytes = new ChargerSendCMD().SendRCMD101(out APDUModel, CMD);
+ if (APDUModel != null)
+ {
+
+ string result = "101ӦϢ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ }
+ return bytes;
+ }
+
+ ///
+ /// Ӧ״̬Ϣ
+ ///
+ ///
+ /// ں
+ /// Ƿϱһ104 0- 1-
+ public byte[] Send103(byte chargeNum, bool reportMessage)
+ {
+ APDUModel APDUModel;
+
+
+ CMD103 CMD = new CMD103();
+ CMD.ChargNum = chargeNum;
+ CMD.Reported = reportMessage;
+
+
+ byte[] bytes = new ChargerSendCMD().SendRCMD103(out APDUModel, CMD);
+ if (APDUModel != null)
+ {
+ string result = "103Ӧ״̬Ϣ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ }
+ return bytes;
+ }
+
+ ///
+ /// Ӧǩ
+ ///
+ ///
+ ///
+ public byte[] Send105(CMD105 CMD)
+ {
+ APDUModel APDUModel;
+
+ byte[] bytes = new ChargerSendCMD().SendRCMD105(out APDUModel, CMD);
+ if (APDUModel != null)
+ {
+ string result = "105Ӧǩ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ }
+ return bytes;
+ }
+
+ ///
+ /// Ӧ澯Ϣ
+ ///
+ ///
+ public byte[] Send107()
+ {
+ APDUModel APDUModel;
+
+ CMD107 CMD = new CMD107();
+
+ byte[] bytes = new ChargerSendCMD().SendRCMD107(out APDUModel, CMD);
+ if (APDUModel != null)
+ {
+ string result = "107Ӧ澯Ϣ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ }
+ return bytes;
+ }
+
+ ///
+ /// Ӧ澯Ϣ
+ ///
+ ///
+ public byte[] Send109()
+ {
+ APDUModel APDUModel;
+
+
+
+ CMD109 CMD = new CMD109();
+
+
+ byte[] bytes = new ChargerSendCMD().SendRCMD109(out APDUModel, CMD);
+ if (APDUModel != null)
+ {
+ string result = "109Ӧ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ }
+ return bytes;
+ }
+
+ public byte[] Send111(byte messageType)
+ {
+ APDUModel APDUModel;
+
+
+ CMD111 CMD = new CMD111();
+
+ CMD.MessageType = messageType;
+
+
+ byte[] bytes = new ChargerSendCMD().SendRCMD111(out APDUModel, CMD);
+ if (APDUModel != null)
+ {
+ string result = "111ӦϱģϢԤ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ }
+ return bytes;
+ }
+
+ ///
+ /// ѯһγʱϢ
+ ///
+ ///
+ /// ں
+ /// ־
+ public byte[] Send113(byte chargeNum, byte sign)
+ {
+ APDUModel APDUModel;
+
+ CMD113 CMD = new CMD113();
+
+ CMD.ChargNum = chargeNum;
+ CMD.Sign = sign;
+
+
+ byte[] bytes = new ChargerSendCMD().SendRCMD113(out APDUModel, CMD);
+ if (APDUModel != null)
+ {
+ string result = "113ѯһγʱϢ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ }
+ return bytes;
+ }
+
+ #endregion
+
+ #region Ϣ
+
+ ///
+ /// (CMD=5)
+ ///
+ ///
+ ///
+ ///
+ public byte[] Send201(CMD201 CMD, uint func)
+ {
+
+ byte[] bytes = new ChargerSendCMD().SendRCMD201(out APDUModel APDUModel, CMD, func);
+ string result = "201ӦϱϢ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+
+
+ public byte[] Send203(CMD203 CMD)
+ {
+ byte[] bytes = new ChargerSendCMD().SendRCMD203(out APDUModel APDUModel, CMD);
+ string result = "203Ӧ˻ѯϢ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+
+
+ public byte[] Send205(uint value03, uint value04)
+ {
+ CMD205 CMD = new CMD205();
+ CMD.Reserved1 = 0;
+ CMD.Reserved2 = 0;
+ CMD.ResponseCode = value03;
+ if (CMD.ResponseCode == 0)
+ {
+ CMD.Balance = value04;
+ }
+ else
+ {
+ CMD.Balance = 0;
+ }
+
+ byte[] bytes = new ChargerSendCMD().SendRCMD205(out APDUModel APDUModel, CMD);
+ string result = "205Ӧ֤ģԤ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+
+
+ public byte[] Send207(CMD208 CMD208, string value06, string value07, byte value08, byte value09, uint value10, ulong value11)
+ {
+ CMD207 CMD = new CMD207();
+ CMD.Reserved1 = 0;
+ CMD.Reserved2 = 0;
+ CMD.ASCIINum = CMD208.ASCIINum;
+ CMD.ChargGunNum = CMD208.ChargGunNum;
+ CMD.VINNum = CMD208.VINNum;
+ CMD.VINBindAccount = value06;
+ CMD.ChargSerialNum = value07;
+ CMD.VerifyResult = value08;
+ CMD.VerifyCause = value09;
+ CMD.RechBalance = value10;
+ CMD.StopCode = value11;
+ byte[] bytes = new ChargerSendCMD().SendRCMD207(out APDUModel APDUModel, CMD);
+ string result = "207ƽ̨ظ弴䡱-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+
+
+ public byte[] Send209(CMD210 CMD210, string value05)
+ {
+ CMD209 CMD = new CMD209();
+ CMD.Reserved1 = CMD210.Reserved1;
+ CMD.Reserved2 = CMD210.Reserved2;
+ CMD.ASCIINum = CMD210.ASCIINum;
+ CMD.ChargGunNum = CMD210.ChargGunNum;
+ CMD.VINNum = value05;
+ byte[] bytes = new ChargerSendCMD().SendRCMD209(out APDUModel APDUModel, CMD);
+ string result = "209ƽ̨ظ弴䡱-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+ public byte[] Send221(CMD221 CMD221, uint value05)
+ {
+ CMD221 CMD = new CMD221();
+ CMD.Reserved1 = CMD221.Reserved1;
+ CMD.Reserved2 = CMD221.Reserved2;
+ CMD.ChargNum = CMD221.ChargNum;
+ CMD.ChargID = CMD221.ChargID;
+ CMD.IndexNum = value05;
+ byte[] bytes = new ChargerSendCMD().SendRCMD221(out APDUModel APDUModel, CMD);
+ string result = "վӦŵϱģ״̬-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+
+ #endregion
+
+ #region ֱ BMS Ϣ(Ԥ)
+
+ public byte[] Send301()
+ {
+ CMD301 CMD = new CMD301();
+ CMD.Reserved1 = 0;
+ CMD.Reserved2 = 0;
+ byte[] bytes = new ChargerSendCMD().SendRCMD301(out APDUModel APDUModel, CMD);
+ string result = "301ӦϱBMSϢ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+
+ public byte[] Send303()
+ {
+ CMD303 CMD = new CMD303();
+ CMD.Reserved1 = 0;
+ CMD.Reserved2 = 0;
+ byte[] bytes = new ChargerSendCMD().SendRCMD303(out APDUModel APDUModel, CMD);
+ string result = "303ӦϱBMSϢ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+ #endregion
+
+ #region ʷ¼
+
+ public byte[] Send401(string chargingSerialNum, uint startIndex)
+ {
+ CMD401 CMD = new CMD401();
+ CMD.Reserved1 = 0;
+ CMD.Reserved2 = 0;
+ CMD.SelectIndex = startIndex;
+ CMD.ChargSerialNum = chargingSerialNum;
+ byte[] bytes = new ChargerSendCMD().SendRCMD401(out APDUModel APDUModel, CMD);
+ string result = "401/421ѯʷ¼-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+ #endregion
+
+ #region
+
+ public byte[] Send1001(uint instruct)
+ {
+ CMD1001 CMD = new CMD1001();
+ CMD.CInstruction = instruct;
+ byte[] bytes = new ChargerSendCMD().SendRCMD1001(out APDUModel APDUModel, CMD);
+ string result = "1001·ָ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+ public byte[] Send1003(string fileName)
+ {
+ CMD1003 CMD = new CMD1003();
+ CMD.Filename = fileName;
+ byte[] bytes = new ChargerSendCMD().SendRCMD1003(out APDUModel APDUModel, CMD);
+ string result = "1003·ļָ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+ public byte[] Send1005(uint fileLength)
+ {
+ CMD1005 CMD = new CMD1005();
+ CMD.FileLength = fileLength;
+ byte[] bytes = new ChargerSendCMD().SendRCMD1005(out APDUModel APDUModel, CMD);
+ string result = "1005·ļС-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+ public byte[] Send1007(string updata)
+ {
+ CMD1007 CMD = new CMD1007();
+ CMD.UpFileData = updata;
+ byte[] bytes = new ChargerSendCMD().SendRCMD1007(out APDUModel APDUModel, CMD);
+ string result = "1007·ļ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+ public byte[] Send1009(uint Reserved1)
+ {
+ CMD1009 CMD = new CMD1009();
+ CMD.Reserved1 = Reserved1;
+ byte[] bytes = new ChargerSendCMD().SendRCMD1009(out APDUModel APDUModel, CMD);
+ string result = "1009·ļݽָ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+ public byte[] Send1011(uint Reserved1)
+ {
+ CMD1011 CMD = new CMD1011();
+ CMD.Reserved1 = 0;
+ byte[] bytes = new ChargerSendCMD().SendRCMD1011(out APDUModel APDUModel, CMD);
+ string result = "1011·ָ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+ public byte[] Send1021(uint results, string description)
+ {
+ CMD1021 CMD = new CMD1021();
+ CMD.ResponseResult = results;
+ CMD.ResponsExplain = description;
+ byte[] bytes = new ChargerSendCMD().SendRCMD1021(out APDUModel APDUModel, CMD);
+ string result = "1021ظ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+ #endregion
+
+ #region ƷѲصָ
+
+
+ public byte[] Send1101()
+ {
+ byte[] bytes = new ChargerSendCMD().SendRCMD1101(out APDUModel APDUModel);
+ string result = "1101̨ѯ24ʱѼƼ۲Ϣ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+ public byte[] Send1103(CMD1103 CMD)
+ {
+ byte[] bytes = new ChargerSendCMD().SendRCMD1103(out APDUModel APDUModel, CMD);
+ string result = "1103̨24ʱεѼƼ۲Ϣ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+ public byte[] Send1105(CMD1105 CMD)
+ {
+ byte[] bytes = new ChargerSendCMD().SendRCMD1105(out APDUModel APDUModel, CMD);
+ string result = "1105̨÷ʱμƼ۲Ϣ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+ public byte[] Send1107()
+ {
+ byte[] bytes = new ChargerSendCMD().SendRCMD1107(out APDUModel APDUModel);
+ string result = "1107̨ѯʱѼƼ۲Ϣ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+ #endregion
+
+ #region
+
+
+ public byte[] Send1301(CMD1301 CMD)
+ {
+ byte[] bytes = new ChargerSendCMD().SendRCMD1301(out APDUModel APDUModel, CMD);
+ string result = "1301·־ݰ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+ #endregion
+
+ #region FTP Զ FTP ʽ־ϴ
+
+ public byte[] Send1401(CMD1401 CMD)
+ {
+ byte[] bytes = new ChargerSendCMD().SendRCMD1401(out APDUModel APDUModel, CMD);
+ string result = "1401·FTPԶ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+ public byte[] Send1406(CMD1406 CMD)
+ {
+ byte[] bytes = new ChargerSendCMD().SendRCMD1406(out APDUModel APDUModel, CMD);
+ string result = "1406·ȡ־Ϣ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+ #endregion
+
+ #region Э鷽ʽ־ϴ
+
+ public byte[] Send1502(uint responseCode)
+ {
+ CMD1502 CMD = new CMD1502();
+
+ CMD.AnswerCode = responseCode;
+ byte[] bytes = new ChargerSendCMD().SendRCMD1502(out APDUModel APDUModel, CMD);
+ string result = "cmd1502 ϴ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+ public byte[] Send1504(uint logo, uint successReservedMessageNum)
+ {
+ CMD1504 CMD = new CMD1504();
+ CMD.Reserved1 = 0;
+ CMD.Reserved2 = 0;
+ CMD.Sign = logo;
+ CMD.ReceiveMessageNum = successReservedMessageNum;
+ byte[] bytes = new ChargerSendCMD().SendRCMD1504(out APDUModel APDUModel, CMD);
+ string result = "1504Ӧϴ־-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+
+ public byte[] Send1506()
+ {
+ CMD1506 CMD = new CMD1506();
+ CMD.Reserved1 = 0;
+ CMD.Reserved1 = 0;
+ byte[] bytes = new ChargerSendCMD().SendRCMD1506(out APDUModel APDUModel, CMD);
+ string result = "1506ǰļ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+
+ //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
+ return bytes;
+ }
+ #endregion
+
+ ///
+ ///
+ ///
+ Dictionary cmd3StartAddress = new Dictionary()
+ {
+ {1, 32},
+ {2, 8},
+ {3, 8},
+ {4, 8},
+ {5, 6},
+ {6, 16},
+ {7, 256},
+ {8, 16},
+ {9, 16},
+ {10, 256},
+ {11, 128},
+ {12, 12},
+ {13, 64},
+ {14, 8},
+ {15, 256},
+ {16, 256},
+ {17, 256},
+ {18, 256},
+ {19, 256},
+ { 20, 256},
+ };
+
+ #endregion
+
+ #region ݽ
+
+ public CMD2 ConCMD2(byte[] data)
+ {
+ CMD2 CMD2 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD2 = new CMD2();
+ CMD2.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD2.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD2.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD2.Type = data[44];
+ CMD2.SAddress = ByteUtils.DToUInt32(data, 45);
+ CMD2.SNum = data[50];
+ CMD2.SResult = data[51];
+ CMD2.SData = Encoding.ASCII.GetString(data, 52, (data.Length - 52));
+
+ }
+ return CMD2;
+ }
+ public CMD4 ConCMD4(byte[] data)
+ {
+ CMD4 CMD4 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD4 = new CMD4();
+ CMD4.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD4.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD4.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD4.Type = data[44];
+ CMD4.SAddress = ByteUtils.DToUInt32(data, 45);
+ CMD4.SResult = data[49];
+ CMD4.SData = Encoding.ASCII.GetString(data, 50, (data.Length - 51));
+
+ }
+ return CMD4;
+ }
+ public CMD6 ConCMD6(byte[] data)
+ {
+ CMD6 CMD6 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD6 = new CMD6();
+ CMD6.value01 = ByteUtils.DToUInt16(data, 8);
+ CMD6.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD6.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD6.ChargMuzzle = data[44];
+ CMD6.CommandMark = ByteUtils.DToUInt32(data, 45);
+ CMD6.CommandNum = data[49];
+ CMD6.CommandResult = data[50];
+ }
+ return CMD6;
+ }
+ public CMD8 ConCMD8(byte[] data)
+ {
+ CMD8 CMD8 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD8 = new CMD8();
+ CMD8.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD8.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD8.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD8.ChargMuzzle = data[44];
+ CMD8.CommandResult = ByteUtils.DToUInt16(data, 45);
+ CMD8.ChargSerialNum = Encoding.ASCII.GetString(data, 49, 32);
+ }
+ return CMD8;
+ }
+ public CMD10 ConCMD10(byte[] data)
+ {
+ CMD10 CMD10 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD10 = new CMD10();
+ CMD10.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD10.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD10.ASCIINum = Encoding.ASCII.GetString(data, 12, 32); ;
+ CMD10.ChargGunNum = data[44];
+ CMD10.RequestStaIP = ByteUtils.DToUInt32(data, 45);
+ CMD10.Parameter = (float)((ByteUtils.DToUInt32(data, 49)) * 0.01);
+ }
+ return CMD10;
+ }
+ public CMD102 ConCMD102(byte[] data)
+ {
+ CMD102 CMD102 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD102 = new CMD102();
+ CMD102.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD102.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD102.ASCIINum = Encoding.ASCII.GetString(data, 12, 32); ;
+ CMD102.HeartNum = ByteUtils.DToUInt16(data, 44);
+ CMD102.GunStatus[0] = data[46];
+ CMD102.GunStatus[1] = data[47];
+ CMD102.GunStatus[2] = data[48];
+ CMD102.GunStatus[3] = data[49];
+ CMD102.GunStatus[4] = data[50];
+ CMD102.GunStatus[5] = data[51];
+ CMD102.GunStatus[6] = data[52];
+ CMD102.GunStatus[7] = data[53];
+ CMD102.GunStatus[8] = data[54];
+ CMD102.GunStatus[9] = data[55];
+ CMD102.GunStatus[10] = data[56];
+ CMD102.GunStatus[11] = data[57];
+ CMD102.GunStatus[12] = data[58];
+ CMD102.GunStatus[13] = data[59];
+ CMD102.GunStatus[14] = data[60];
+ CMD102.GunStatus[15] = data[61];
+ }
+ return CMD102;
+ }
+ public CMD104 ConCMD104(byte[] data)
+ {
+ CMD104 CMD104 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD104 = new CMD104();
+
+ CMD104.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD104.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD104.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD104.ChargGunNum = data[44];
+ CMD104.ChargNum = data[45];
+ CMD104.ChargGunType = data[46];
+ CMD104.WorkState = data[47];
+ CMD104.SOCNOW = data[48];
+ CMD104.MaxAlarmCode = Encoding.ASCII.GetString(data, 49, 4);
+ CMD104.ConnecteState = data[53];
+ CMD104.TotalCost = (float)(ByteUtils.DToUInt32(data, 54) * 0.01);
+ CMD104.Reserved3 = ByteUtils.DToUInt32(data, 58);
+ CMD104.Reserved4 = ByteUtils.DToUInt32(data, 62);
+ if (data[46] == 1)
+ {
+ CMD104.DcChargVoltage = ByteUtils.DToUInt16(data, 66);
+ CMD104.DcChargCurrent = ByteUtils.DToUInt16(data, 68);
+ CMD104.BMSDemVoltage = ByteUtils.DToUInt16(data, 70);
+ CMD104.BMSDemCurrent = ByteUtils.DToUInt16(data, 72);
+ }
+ else
+ {
+ CMD104.DcChargVoltage = 0;
+ CMD104.DcChargCurrent = 0;
+ CMD104.BMSDemVoltage = 0;
+ CMD104.BMSDemCurrent = 0;
+ }
+
+
+
+ CMD104.BMSchargMode = data[74];
+ CMD104.AcChargVoltageA = ByteUtils.DToUInt16(data, 75);
+ CMD104.AcChargVoltageB = ByteUtils.DToUInt16(data, 77);
+ CMD104.AcChargVoltageC = ByteUtils.DToUInt16(data, 79);
+ CMD104.AcChargCurrentA = ByteUtils.DToUInt16(data, 81);
+ CMD104.AcChargCurrentB = ByteUtils.DToUInt16(data, 83);
+ CMD104.AcChargCurrentC = ByteUtils.DToUInt16(data, 85);
+ CMD104.RemainTime = ByteUtils.DToUInt16(data, 87);
+ CMD104.ChargTime = ByteUtils.DToUInt32(data, 89);
+ CMD104.TotalChargkwh = ByteUtils.DToUInt32(data, 93);
+ CMD104.StartAmmeterValue = (float)(ByteUtils.DToUInt32(data, 97) * 0.01);
+ CMD104.AmmeterValue = (float)(ByteUtils.DToUInt32(data, 101) * 0.01);
+ CMD104.ChargStartMode = data[105];
+ CMD104.ChargStrategy = data[106];
+ CMD104.ChargStrategyPara = ByteUtils.DToUInt32(data, 107);
+ CMD104.AppointmentSign = data[111];
+ CMD104.ChargID = Encoding.ASCII.GetString(data, 112, 32);
+ CMD104.OutTime = data[144];
+ CMD104.StartTime = Encoding.ASCII.GetString(data, 145, 8);
+ CMD104.InitialBalance = ByteUtils.DToUInt32(data, 153);
+ CMD104.Reserved5 = ByteUtils.DToUInt32(data, 157);
+ CMD104.ChargPower = (float)(ByteUtils.DToUInt32(data, 161) * 0.1);
+ CMD104.Reserved6 = ByteUtils.DToUInt32(data, 165);
+ CMD104.Reserved7 = ByteUtils.DToUInt32(data, 169);
+ CMD104.Reserved8 = ByteUtils.DToUInt32(data, 173);
+ CMD104.OutletTemp = data[177];
+ CMD104.Temperature = data[178];
+ CMD104.ChargGunTemp = data[179];
+ CMD104.VINNum = Encoding.ASCII.GetString(data, 180, 18);
+ CMD104.DoorState = data[198];
+ CMD104.ChargSerialNum = Encoding.ASCII.GetString(data, 199, 32);
+ CMD104.TotalElectricity = ByteUtils.DToUInt32(data, 231);
+ CMD104.ServiceCharge = ByteUtils.DToUInt32(data, 235);
+ CMD104.HomingState = data[239];
+ CMD104.GroundLockedState = data[240];
+ CMD104.KilojoulesElec = data[241];
+ CMD104.DcACElectricity = ((float)(ByteUtils.DToUInt32(data, 242) * 0.001)).ToString("F1");
+ CMD104.ChargMode = data[246];
+ CMD104.ChargeOrDisSign = data[247];
+ }
+ return CMD104;
+ }
+ public CMD106 ConCMD106(byte[] data)
+ {
+ CMD106 CMD106 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD106 = new CMD106();
+ CMD106.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD106.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD106.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD106.Sign = data[44];
+ CMD106.ChargVersion = ByteUtils.DToUInt32(data, 45);
+ CMD106.ChargProType = ByteUtils.DToUInt16(data, 49);
+ CMD106.StartNum = ByteUtils.DToUInt32(data, 51);
+ CMD106.DataUploadMode = data[55];
+ CMD106.SignInterval = ByteUtils.DToUInt16(data, 56);
+ CMD106.RunVariable = data[58];
+ CMD106.ChargGunNum = data[59];
+ CMD106.HeartReportCycle = data[60];
+ CMD106.TimeoutNum = data[61];
+ CMD106.RecordNum = ByteUtils.DToUInt32(data, 62);
+ CMD106.SystemTime = Encoding.ASCII.GetString(data, 66, 8);
+ CMD106.Reserved3 = Encoding.ASCII.GetString(data, 74, 8);
+ CMD106.Reserved4 = Encoding.ASCII.GetString(data, 82, 8);
+ CMD106.Reserved5 = Encoding.ASCII.GetString(data, 90, 8);
+ CMD106.RandomNum = ByteUtils.DToUInt32(data, 98);
+ CMD106.ProtocolVersion = ByteUtils.DToUInt16(data, 102);
+ CMD106.WhiteVersionNum = ByteUtils.DToUInt16(data, 104);
+ CMD106.DeviceType = data[108];
+ CMD106.AssetCoding = Encoding.ASCII.GetString(data, 109, 32);
+ }
+ return CMD106;
+ }
+ public CMD108 ConCMD108(byte[] data)
+ {
+ CMD108 CMD108 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD108 = new CMD108();
+ CMD108.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD108.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD108.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD108.AlarmBitInfo = Encoding.ASCII.GetString(data, 44, 32);
+ }
+ return CMD108;
+ }
+ public CMD110 ConCMD110(byte[] data)
+ {
+ CMD110 CMD110 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD110 = new CMD110();
+ CMD110.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD110.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD110.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD110.ChargGunNum = data[44];
+ CMD110.ChargeFail = ByteUtils.DToUInt32(data, 45);
+ CMD110.SendMessage = ByteUtils.DToUInt16(data, 49);
+ CMD110.Reserved3 = ByteUtils.DToUInt16(data, 51);
+ CMD110.Reserved4 = ByteUtils.DToUInt32(data, 53);
+ byte version1 = data[58];
+ byte version2 = data[59];
+ byte version3 = data[60];
+ CMD110.BRMBMSVersionNum = "v" + version1.ToString() + version2.ToString() + version3.ToString();
+ CMD110.BRMBatteryType = data[61];
+ CMD110.BRMRatedCapacity = ByteUtils.DToUInt32(data, 62);
+ CMD110.BRMRatedVoltage = ByteUtils.DToUInt32(data, 66);
+ CMD110.BRMBatteryManu = ByteUtils.DToUInt32(data, 70);
+ CMD110.BRMBatteryPackID = ByteUtils.DToUInt32(data, 74);
+ CMD110.BRMDateYear = ByteUtils.DToUInt16(data, 78);
+ CMD110.BRMDateMonth = data[80];
+ CMD110.BRMDateDay = data[81];
+ CMD110.BRMChargeCount = ByteUtils.DToUInt32(data, 82);
+ CMD110.BRMTitleMark = data[86];
+ CMD110.Reserved5 = data[87];
+ CMD110.BRMVINID = Encoding.ASCII.GetString(data, 88, 17);
+
+ byte VersionSerialNum = data[105];
+ byte day = data[106];
+ byte month = data[107];
+ ushort year = ByteUtils.DToUInt16(data, 108);
+
+
+ CMD110.BRMBMSSoftVerNum = VersionSerialNum.ToString() + year.ToString() + "" + month.ToString() + "" + day.ToString() + "";
+ CMD110.MaxChargVoltage = (float)(ByteUtils.DToUInt32(data, 113) * 0.1);
+ CMD110.MaxChargCurrent = (float)(ByteUtils.DToUInt32(data, 117) * 0.1);
+ CMD110.TotalEnergy = (float)(ByteUtils.DToUInt32(data, 121) * 0.1);
+ CMD110.MaxTotalVoltage = (float)(ByteUtils.DToUInt32(data, 125) * 0.1);
+ CMD110.MaxTemp = data[129];
+ CMD110.ChargeState = (float)(ByteUtils.DToUInt16(data, 130) * 0.1);
+ CMD110.CellVoltage = (float)(ByteUtils.DToUInt32(data, 132) * 0.1);
+ CMD110.ChargSerialNum = Encoding.ASCII.GetString(data, 136, 32);
+ }
+ return CMD110;
+ }
+ public CMD112 ConCMD112(byte[] data)
+ {
+ CMD112 CMD112 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD112 = new CMD112();
+ CMD112.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD112.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD112.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD112.ReportMode = data[44];
+ CMD112.ModuleNum = data[45];
+ CMD112.ModuleType = data[46];
+ CMD112.ACModuleversion1 = ByteUtils.DToUInt16(data, 47);
+ CMD112.DCModuleversion1 = ByteUtils.DToUInt16(data, 49);
+ CMD112.ModuleState1 = data[51];
+ CMD112.ModuleOutVoltage1 = ByteUtils.DToUInt16(data, 52);
+ CMD112.ModuleOutCurrent1 = ByteUtils.DToUInt16(data, 54);
+ CMD112.ModuleAlarm1 = ByteUtils.DToUInt32(data, 56);
+ CMD112.ACModuleversion2 = ByteUtils.DToUInt16(data, 60);
+ CMD112.DCModuleversion2 = ByteUtils.DToUInt16(data, 62);
+ CMD112.ModuleState2 = data[64];
+ CMD112.ModuleOutVoltage2 = ByteUtils.DToUInt16(data, 65);
+ CMD112.ModuleOutCurrent2 = ByteUtils.DToUInt16(data, 67);
+ CMD112.ModuleAlarm2 = ByteUtils.DToUInt32(data, 69);
+ }
+ return CMD112;
+ }
+ public CMD114 ConCMD114(byte[] data)
+ {
+ CMD114 CMD114 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD114 = new CMD114();
+ CMD114.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD114.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD114.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD114.ChargGunNum = data[44];
+ CMD114.WorkState = data[45];
+ CMD114.StartChargTime = Encoding.ASCII.GetString(data, 46, 8);
+ /*
+ 7 54
+ 8 56
+ 9 58
+ 10 60
+ 11 62
+ 12 64
+ 13 66
+ 14 68
+ 15 70
+ 16 72
+ 17 74
+ 18 76
+ 19 78
+ 20 80
+ 21 82
+ 22 84
+ 23 86
+ 24 88
+ 25 90
+ 26 92
+ 27 94
+ 28 96
+ 29 98
+ 30 100
+ 31 102
+ 32 104
+ 33 106
+ 34 108
+ 35 110
+ 36 112
+ 37 114
+ 38 116
+ 39 118
+ 40 120
+ 41 122
+ 42 124
+ 43 126
+ 44 128
+ 45 130
+ 46 132
+ 47 134
+ 48 136
+ 49 138
+ 50 140
+ 51 142
+ 52 144
+ 53 146
+ 54 148
+
+ */
+ CMD114.Charge01 = ByteUtils.DToUInt16(data, 54);
+ CMD114.Charge02 = ByteUtils.DToUInt16(data, 56);
+ CMD114.Charge03 = ByteUtils.DToUInt16(data, 58);
+ CMD114.Charge04 = ByteUtils.DToUInt16(data, 60);
+ CMD114.Charge05 = ByteUtils.DToUInt16(data, 62);
+ CMD114.Charge06 = ByteUtils.DToUInt16(data, 64);
+ CMD114.Charge07 = ByteUtils.DToUInt16(data, 66);
+ CMD114.Charge08 = ByteUtils.DToUInt16(data, 68);
+ CMD114.Charge09 = ByteUtils.DToUInt16(data, 70);
+ CMD114.Charge10 = ByteUtils.DToUInt16(data, 72);
+ CMD114.Charge11 = ByteUtils.DToUInt16(data, 74);
+ CMD114.Charge12 = ByteUtils.DToUInt16(data, 76);
+ CMD114.Charge13 = ByteUtils.DToUInt16(data, 78);
+ CMD114.Charge14 = ByteUtils.DToUInt16(data, 80);
+ CMD114.Charge15 = ByteUtils.DToUInt16(data, 82);
+ CMD114.Charge16 = ByteUtils.DToUInt16(data, 84);
+ CMD114.Charge17 = ByteUtils.DToUInt16(data, 86);
+ CMD114.Charge18 = ByteUtils.DToUInt16(data, 88);
+ CMD114.Charge19 = ByteUtils.DToUInt16(data, 90);
+ CMD114.Charge20 = ByteUtils.DToUInt16(data, 92);
+ CMD114.Charge21 = ByteUtils.DToUInt16(data, 94);
+ CMD114.Charge22 = ByteUtils.DToUInt16(data, 96);
+ CMD114.Charge23 = ByteUtils.DToUInt16(data, 98);
+ CMD114.Charge24 = ByteUtils.DToUInt16(data, 100);
+ CMD114.Charge25 = ByteUtils.DToUInt16(data, 102);
+ CMD114.Charge26 = ByteUtils.DToUInt16(data, 104);
+ CMD114.Charge27 = ByteUtils.DToUInt16(data, 106);
+ CMD114.Charge29 = ByteUtils.DToUInt16(data, 108);
+ CMD114.Charge30 = ByteUtils.DToUInt16(data, 110);
+ CMD114.Charge31 = ByteUtils.DToUInt16(data, 112);
+ CMD114.Charge32 = ByteUtils.DToUInt16(data, 114);
+ CMD114.Charge33 = ByteUtils.DToUInt16(data, 116);
+ CMD114.Charge34 = ByteUtils.DToUInt16(data, 118);
+ CMD114.Charge35 = ByteUtils.DToUInt16(data, 120);
+ CMD114.Charge36 = ByteUtils.DToUInt16(data, 122);
+ CMD114.Charge37 = ByteUtils.DToUInt16(data, 124);
+ CMD114.Charge38 = ByteUtils.DToUInt16(data, 126);
+ CMD114.Charge39 = ByteUtils.DToUInt16(data, 128);
+ CMD114.Charge40 = ByteUtils.DToUInt16(data, 130);
+ CMD114.Charge41 = ByteUtils.DToUInt16(data, 132);
+ }
+ return CMD114;
+ }
+ public CMD202 ConCMD202(uint func, byte[] data)
+ {
+ CMD202 CMD202 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD202 = new CMD202();
+ CMD202.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD202.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD202.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD202.PosType = data[44];
+ CMD202.ChargGun = data[45];
+ CMD202.ChargID = Encoding.ASCII.GetString(data, 46, 32);
+ CMD202.StartTime = Encoding.ASCII.GetString(data, 78, 8);
+ CMD202.EndTime = Encoding.ASCII.GetString(data, 86, 8);
+ CMD202.TimeSpan = ByteUtils.DToUInt32(data, 94);
+ CMD202.SOCStart = data[98];
+ CMD202.SOCEnd = data[99];
+ CMD202.EndReason = ByteUtils.DToUInt32(data, 100);
+
+ if (func == 202)
+ {
+ CMD202.ChargCapacityNow = (ByteUtils.DToUInt32(data, 104) * 0.01).ToString("F2");
+ CMD202.SAmmeterValue = (ByteUtils.DToUInt32(data, 108) * 0.01).ToString("F2");
+ CMD202.EAmmeterValue = (ByteUtils.DToUInt32(data, 112) * 0.01).ToString("F2");
+
+
+ CMD202.ChargCapacity01 = ByteUtils.DToUInt16(data, 167).ToString();
+ CMD202.ChargCapacity02 = ByteUtils.DToUInt16(data, 169).ToString();
+ CMD202.ChargCapacity03 = ByteUtils.DToUInt16(data, 171).ToString();
+ CMD202.ChargCapacity04 = ByteUtils.DToUInt16(data, 173).ToString();
+ CMD202.ChargCapacity05 = ByteUtils.DToUInt16(data, 175).ToString();
+ CMD202.ChargCapacity06 = ByteUtils.DToUInt16(data, 177).ToString();
+ CMD202.ChargCapacity07 = ByteUtils.DToUInt16(data, 179).ToString();
+ CMD202.ChargCapacity08 = ByteUtils.DToUInt16(data, 181).ToString();
+ CMD202.ChargCapacity09 = ByteUtils.DToUInt16(data, 183).ToString();
+ CMD202.ChargCapacity10 = ByteUtils.DToUInt16(data, 185).ToString();
+ CMD202.ChargCapacity11 = ByteUtils.DToUInt16(data, 187).ToString();
+ CMD202.ChargCapacity12 = ByteUtils.DToUInt16(data, 189).ToString();
+ CMD202.ChargCapacity13 = ByteUtils.DToUInt16(data, 191).ToString();
+ CMD202.ChargCapacity14 = ByteUtils.DToUInt16(data, 193).ToString();
+ CMD202.ChargCapacity15 = ByteUtils.DToUInt16(data, 195).ToString();
+ CMD202.ChargCapacity16 = ByteUtils.DToUInt16(data, 197).ToString();
+ CMD202.ChargCapacity17 = ByteUtils.DToUInt16(data, 199).ToString();
+ CMD202.ChargCapacity18 = ByteUtils.DToUInt16(data, 201).ToString();
+ CMD202.ChargCapacity19 = ByteUtils.DToUInt16(data, 203).ToString();
+ CMD202.ChargCapacity20 = ByteUtils.DToUInt16(data, 205).ToString();
+ CMD202.ChargCapacity21 = ByteUtils.DToUInt16(data, 207).ToString();
+ CMD202.ChargCapacity22 = ByteUtils.DToUInt16(data, 209).ToString();
+ CMD202.ChargCapacity23 = ByteUtils.DToUInt16(data, 211).ToString();
+ CMD202.ChargCapacity24 = ByteUtils.DToUInt16(data, 213).ToString();
+ CMD202.ChargCapacity25 = ByteUtils.DToUInt16(data, 215).ToString();
+ CMD202.ChargCapacity26 = ByteUtils.DToUInt16(data, 217).ToString();
+ CMD202.ChargCapacity27 = ByteUtils.DToUInt16(data, 219).ToString();
+ CMD202.ChargCapacity28 = ByteUtils.DToUInt16(data, 221).ToString();
+ CMD202.ChargCapacity29 = ByteUtils.DToUInt16(data, 223).ToString();
+ CMD202.ChargCapacity30 = ByteUtils.DToUInt16(data, 225).ToString();
+ CMD202.ChargCapacity31 = ByteUtils.DToUInt16(data, 227).ToString();
+ CMD202.ChargCapacity32 = ByteUtils.DToUInt16(data, 229).ToString();
+ CMD202.ChargCapacity33 = ByteUtils.DToUInt16(data, 231).ToString();
+ CMD202.ChargCapacity34 = ByteUtils.DToUInt16(data, 233).ToString();
+ CMD202.ChargCapacity35 = ByteUtils.DToUInt16(data, 235).ToString();
+ CMD202.ChargCapacity36 = ByteUtils.DToUInt16(data, 237).ToString();
+ CMD202.ChargCapacity37 = ByteUtils.DToUInt16(data, 239).ToString();
+ CMD202.ChargCapacity38 = ByteUtils.DToUInt16(data, 241).ToString();
+ CMD202.ChargCapacity39 = ByteUtils.DToUInt16(data, 243).ToString();
+ CMD202.ChargCapacity40 = ByteUtils.DToUInt16(data, 245).ToString();
+ CMD202.ChargCapacity41 = ByteUtils.DToUInt16(data, 247).ToString();
+ CMD202.ChargCapacity42 = ByteUtils.DToUInt16(data, 249).ToString();
+ CMD202.ChargCapacity43 = ByteUtils.DToUInt16(data, 251).ToString();
+ CMD202.ChargCapacity44 = ByteUtils.DToUInt16(data, 253).ToString();
+ CMD202.ChargCapacity45 = ByteUtils.DToUInt16(data, 255).ToString();
+ CMD202.ChargCapacity46 = ByteUtils.DToUInt16(data, 257).ToString();
+ CMD202.ChargCapacity47 = ByteUtils.DToUInt16(data, 259).ToString();
+ CMD202.ChargCapacity48 = ByteUtils.DToUInt16(data, 261).ToString();
+
+ CMD202.StartMode = data[263];
+ CMD202.ChargSerialNum = Encoding.ASCII.GetString(data, 264, 32);
+ CMD202.ChargServiceCost = ByteUtils.DToUInt32(data, 296);
+ CMD202.KilElectricity = data[300];
+ CMD202.ParallelMark = data[301];
+ CMD202.ChargeOrDisMark = data[302];
+ CMD202.MeterEncData = Encoding.ASCII.GetString(data, 303, 34);
+ CMD202.MeterNum = Encoding.ASCII.GetString(data, 337, 6);
+ CMD202.MeterProVersion = ByteUtils.DToUInt16(data, 343);
+ CMD202.EncMode = data[345];
+ }
+ else if (func == 222)
+ {
+ CMD202.ChargCapacityNow = (ByteUtils.DToUInt32(data, 104) * 0.001).ToString("F3");
+ CMD202.SAmmeterValue = (ByteUtils.DToUInt32(data, 108) * 0.001).ToString("F3");
+ CMD202.EAmmeterValue = (ByteUtils.DToUInt32(data, 112) * 0.001).ToString("F3");
+
+
+ CMD202.ChargCapacity01 = (ByteUtils.DToUInt32(data, 167) * 0.001).ToString("F3");
+ CMD202.ChargCapacity02 = (ByteUtils.DToUInt32(data, 171) * 0.001).ToString("F3");
+ CMD202.ChargCapacity03 = (ByteUtils.DToUInt32(data, 175) * 0.001).ToString("F3");
+ CMD202.ChargCapacity04 = (ByteUtils.DToUInt32(data, 179) * 0.001).ToString("F3");
+ CMD202.ChargCapacity05 = (ByteUtils.DToUInt32(data, 183) * 0.001).ToString("F3");
+ CMD202.ChargCapacity06 = (ByteUtils.DToUInt32(data, 187) * 0.001).ToString("F3");
+ CMD202.ChargCapacity07 = (ByteUtils.DToUInt32(data, 191) * 0.001).ToString("F3");
+ CMD202.ChargCapacity08 = (ByteUtils.DToUInt32(data, 195) * 0.001).ToString("F3");
+ CMD202.ChargCapacity09 = (ByteUtils.DToUInt32(data, 199) * 0.001).ToString("F3");
+ CMD202.ChargCapacity10 = (ByteUtils.DToUInt32(data, 203) * 0.001).ToString("F3");
+ CMD202.ChargCapacity11 = (ByteUtils.DToUInt32(data, 207) * 0.001).ToString("F3");
+ CMD202.ChargCapacity12 = (ByteUtils.DToUInt32(data, 211) * 0.001).ToString("F3");
+ CMD202.ChargCapacity13 = (ByteUtils.DToUInt32(data, 215) * 0.001).ToString("F3");
+ CMD202.ChargCapacity14 = (ByteUtils.DToUInt32(data, 219) * 0.001).ToString("F3");
+ CMD202.ChargCapacity15 = (ByteUtils.DToUInt32(data, 223) * 0.001).ToString("F3");
+ CMD202.ChargCapacity16 = (ByteUtils.DToUInt32(data, 227) * 0.001).ToString("F3");
+ CMD202.ChargCapacity17 = (ByteUtils.DToUInt32(data, 231) * 0.001).ToString("F3");
+ CMD202.ChargCapacity18 = (ByteUtils.DToUInt32(data, 235) * 0.001).ToString("F3");
+ CMD202.ChargCapacity19 = (ByteUtils.DToUInt32(data, 239) * 0.001).ToString("F3");
+ CMD202.ChargCapacity20 = (ByteUtils.DToUInt32(data, 243) * 0.001).ToString("F3");
+ CMD202.ChargCapacity21 = (ByteUtils.DToUInt32(data, 247) * 0.001).ToString("F3");
+ CMD202.ChargCapacity22 = (ByteUtils.DToUInt32(data, 251) * 0.001).ToString("F3");
+ CMD202.ChargCapacity23 = (ByteUtils.DToUInt32(data, 255) * 0.001).ToString("F3");
+ CMD202.ChargCapacity24 = (ByteUtils.DToUInt32(data, 259) * 0.001).ToString("F3");
+ CMD202.ChargCapacity25 = (ByteUtils.DToUInt32(data, 263) * 0.001).ToString("F3");
+ CMD202.ChargCapacity26 = (ByteUtils.DToUInt32(data, 267) * 0.001).ToString("F3");
+ CMD202.ChargCapacity27 = (ByteUtils.DToUInt32(data, 271) * 0.001).ToString("F3");
+ CMD202.ChargCapacity28 = (ByteUtils.DToUInt32(data, 275) * 0.001).ToString("F3");
+ CMD202.ChargCapacity29 = (ByteUtils.DToUInt32(data, 279) * 0.001).ToString("F3");
+ CMD202.ChargCapacity30 = (ByteUtils.DToUInt32(data, 283) * 0.001).ToString("F3");
+ CMD202.ChargCapacity31 = (ByteUtils.DToUInt32(data, 287) * 0.001).ToString("F3");
+ CMD202.ChargCapacity32 = (ByteUtils.DToUInt32(data, 291) * 0.001).ToString("F3");
+ CMD202.ChargCapacity33 = (ByteUtils.DToUInt32(data, 295) * 0.001).ToString("F3");
+ CMD202.ChargCapacity34 = (ByteUtils.DToUInt32(data, 299) * 0.001).ToString("F3");
+ CMD202.ChargCapacity35 = (ByteUtils.DToUInt32(data, 303) * 0.001).ToString("F3");
+ CMD202.ChargCapacity36 = (ByteUtils.DToUInt32(data, 307) * 0.001).ToString("F3");
+ CMD202.ChargCapacity37 = (ByteUtils.DToUInt32(data, 311) * 0.001).ToString("F3");
+ CMD202.ChargCapacity38 = (ByteUtils.DToUInt32(data, 315) * 0.001).ToString("F3");
+ CMD202.ChargCapacity39 = (ByteUtils.DToUInt32(data, 319) * 0.001).ToString("F3");
+ CMD202.ChargCapacity40 = (ByteUtils.DToUInt32(data, 323) * 0.001).ToString("F3");
+ CMD202.ChargCapacity41 = (ByteUtils.DToUInt32(data, 327) * 0.001).ToString("F3");
+ CMD202.ChargCapacity42 = (ByteUtils.DToUInt32(data, 331) * 0.001).ToString("F3");
+ CMD202.ChargCapacity43 = (ByteUtils.DToUInt32(data, 335) * 0.001).ToString("F3");
+ CMD202.ChargCapacity44 = (ByteUtils.DToUInt32(data, 339) * 0.001).ToString("F3");
+ CMD202.ChargCapacity45 = (ByteUtils.DToUInt32(data, 343) * 0.001).ToString("F3");
+ CMD202.ChargCapacity46 = (ByteUtils.DToUInt32(data, 347) * 0.001).ToString("F3");
+ CMD202.ChargCapacity47 = (ByteUtils.DToUInt32(data, 351) * 0.001).ToString("F3");
+ CMD202.ChargCapacity48 = (ByteUtils.DToUInt32(data, 355) * 0.001).ToString("F3");
+
+ CMD202.StartMode = data[359];
+ CMD202.ChargSerialNum = Encoding.ASCII.GetString(data, 360, 32);
+ CMD202.ChargServiceCost = ByteUtils.DToUInt32(data, 392);
+ CMD202.KilElectricity = data[396];
+ CMD202.ParallelMark = data[397];
+ CMD202.ChargeOrDisMark = data[398];
+ CMD202.MeterEncData = Encoding.ASCII.GetString(data, 399, 34);
+ CMD202.MeterNum = Encoding.ASCII.GetString(data, 433, 6);
+ CMD202.MeterProVersion = ByteUtils.DToUInt16(data, 439);
+ CMD202.EncMode = data[441];
+ }
+
+ CMD202.ChargeAmount = ByteUtils.DToUInt32(data, 116);
+ CMD202.IndexNum = BitConverter.ToInt32(data, 120);
+ CMD202.CardBalance = ByteUtils.DToUInt32(data, 124);
+ CMD202.ChargRecord = ByteUtils.DToUInt32(data, 128);
+ CMD202.SumChargRecord = ByteUtils.DToUInt32(data, 132);
+ CMD202.Reserved3 = data[136];
+ CMD202.ChargStrategy = data[137];
+ switch (data[137])
+ {
+ case 1:
+ CMD202.ChargStrategyPara = ByteUtils.DToUInt32(data, 138).ToString();
+ break;
+ case 2:
+ CMD202.ChargStrategyPara = (ByteUtils.DToUInt32(data, 138) * 0.01).ToString("F2");
+ break;
+ case 3:
+ CMD202.ChargStrategyPara = (ByteUtils.DToUInt32(data, 138) * 0.01).ToString("F2");
+ break;
+ }
+
+
+
+ CMD202.CarVIN = Encoding.ASCII.GetString(data, 142, 17);
+ CMD202.CarID = Encoding.ASCII.GetString(data, 159, 8);
+
+
+ }
+ return CMD202;
+ }
+ public CMD204 ConCMD204(byte[] data)
+ {
+ CMD204 CMD204 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD204 = new CMD204();
+ CMD204.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD204.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD204.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD204.ChargID = Encoding.ASCII.GetString(data, 44, 32);
+ CMD204.Balance = ByteUtils.DToUInt32(data, 76);
+ CMD204.BlacklistSign = data[80];
+ CMD204.ChargCardPassword = Encoding.ASCII.GetString(data, 81, 32);
+ CMD204.RandomData = Encoding.ASCII.GetString(data, 113, 48);
+ CMD204.M1CardID = ByteUtils.DToUInt32(data, 161);
+ CMD204.Auth = data[165];
+ CMD204.ChargGunNum = data[166];
+ }
+ return CMD204;
+ }
+ public CMD206 ConCMD206(byte[] data)
+ {
+ CMD206 CMD206 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD206 = new CMD206();
+ CMD206.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD206.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD206.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD206.ChargID = Encoding.ASCII.GetString(data, 44, 32);
+ CMD206.ChargPassword = Encoding.ASCII.GetString(data, 76, 32);
+ CMD206.RandomData = Encoding.ASCII.GetString(data, 108, 48);
+ }
+ return CMD206;
+ }
+ public CMD208 ConCMD208(byte[] data)
+ {
+ CMD208 CMD208 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD208 = new CMD208();
+ CMD208.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD208.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD208.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD208.ChargGunNum = data[44];
+ CMD208.VINNum = Encoding.ASCII.GetString(data, 45, 17);
+ CMD208.ChargStrategy = data[62];
+ CMD208.ChargStrategyPara = ByteUtils.DToUInt32(data, 63);
+ }
+ return CMD208;
+ }
+ public CMD210 ConCMD210(byte[] data)
+ {
+ CMD210 CMD210 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD210 = new CMD210();
+ CMD210.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD210.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD210.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD210.ChargGunNum = data[44];
+ CMD210.StartResult = ByteUtils.DToUInt32(data, 45);
+ }
+ return CMD210;
+ }
+ public CMD222 ConCMD222(byte[] data)
+ {
+ CMD222 CMD222 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD222 = new CMD222();
+ CMD222.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD222.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD222.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD222.PosType = data[44];
+ CMD222.ChargGun = data[45];
+ CMD222.ChargID = Encoding.ASCII.GetString(data, 46, 32);
+ CMD222.StartTime = Encoding.ASCII.GetString(data, 78, 8);
+ CMD222.EndTime = Encoding.ASCII.GetString(data, 86, 8);
+ CMD222.TimeSpan = ByteUtils.DToUInt32(data, 94);
+ CMD222.SOCStart = data[98];
+ CMD222.SOCEnd = data[99];
+ CMD222.EndReason = ByteUtils.DToUInt32(data, 100);
+ CMD222.ChargCapacityNow = ByteUtils.DToUInt32(data, 104);
+ CMD222.SAmmeterValue = ByteUtils.DToUInt32(data, 108);
+ CMD222.EAmmeterValue = ByteUtils.DToUInt32(data, 112);
+ CMD222.ChargeAmount = ByteUtils.DToUInt32(data, 116);
+ CMD222.IndexNum = ByteUtils.DToUInt32(data, 120);
+ CMD222.CardBalance = ByteUtils.DToUInt32(data, 124);
+ CMD222.ChargRecord = ByteUtils.DToUInt32(data, 128);
+ CMD222.SumChargRecord = ByteUtils.DToUInt32(data, 132);
+ CMD222.Reserved3 = data[136];
+ CMD222.ChargStrategy = data[137];
+ CMD222.ChargStrategyPara = ByteUtils.DToUInt32(data, 138);
+ CMD222.CarVIN = Encoding.ASCII.GetString(data, 142, 17);
+ CMD222.CarID = Encoding.ASCII.GetString(data, 159, 8);
+ CMD222.ChargCapacity01 = (int)ByteUtils.DToUInt32(data, 167);
+ CMD222.ChargCapacity02 = (int)ByteUtils.DToUInt32(data, 171);
+ CMD222.ChargCapacity03 = (int)ByteUtils.DToUInt32(data, 175);
+ CMD222.ChargCapacity04 = (int)ByteUtils.DToUInt32(data, 179);
+ CMD222.ChargCapacity05 = (int)ByteUtils.DToUInt32(data, 183);
+ CMD222.ChargCapacity06 = (int)ByteUtils.DToUInt32(data, 187);
+ CMD222.ChargCapacity07 = (int)ByteUtils.DToUInt32(data, 191);
+ CMD222.ChargCapacity08 = (int)ByteUtils.DToUInt32(data, 195);
+ CMD222.ChargCapacity09 = (int)ByteUtils.DToUInt32(data, 199);
+ CMD222.ChargCapacity10 = (int)ByteUtils.DToUInt32(data, 203);
+ CMD222.ChargCapacity11 = (int)ByteUtils.DToUInt32(data, 207);
+ CMD222.ChargCapacity12 = (int)ByteUtils.DToUInt32(data, 211);
+ CMD222.ChargCapacity13 = (int)ByteUtils.DToUInt32(data, 215);
+ CMD222.ChargCapacity14 = (int)ByteUtils.DToUInt32(data, 219);
+ CMD222.ChargCapacity15 = (int)ByteUtils.DToUInt32(data, 223);
+ CMD222.ChargCapacity16 = (int)ByteUtils.DToUInt32(data, 227);
+ CMD222.ChargCapacity17 = (int)ByteUtils.DToUInt32(data, 231);
+ CMD222.ChargCapacity18 = (int)ByteUtils.DToUInt32(data, 235);
+ CMD222.ChargCapacity19 = (int)ByteUtils.DToUInt32(data, 239);
+ CMD222.ChargCapacity20 = (int)ByteUtils.DToUInt32(data, 243);
+ CMD222.ChargCapacity21 = (int)ByteUtils.DToUInt32(data, 247);
+ CMD222.ChargCapacity22 = (int)ByteUtils.DToUInt32(data, 251);
+ CMD222.ChargCapacity23 = (int)ByteUtils.DToUInt32(data, 255);
+ CMD222.ChargCapacity24 = (int)ByteUtils.DToUInt32(data, 259);
+ CMD222.ChargCapacity25 = (int)ByteUtils.DToUInt32(data, 263);
+ CMD222.ChargCapacity26 = (int)ByteUtils.DToUInt32(data, 267);
+ CMD222.ChargCapacity27 = (int)ByteUtils.DToUInt32(data, 271);
+ CMD222.ChargCapacity28 = (int)ByteUtils.DToUInt32(data, 275);
+ CMD222.ChargCapacity29 = (int)ByteUtils.DToUInt32(data, 279);
+ CMD222.ChargCapacity30 = (int)ByteUtils.DToUInt32(data, 283);
+ CMD222.ChargCapacity31 = (int)ByteUtils.DToUInt32(data, 287);
+ CMD222.ChargCapacity32 = (int)ByteUtils.DToUInt32(data, 291);
+ CMD222.ChargCapacity33 = (int)ByteUtils.DToUInt32(data, 295);
+ CMD222.ChargCapacity34 = (int)ByteUtils.DToUInt32(data, 299);
+ CMD222.ChargCapacity35 = (int)ByteUtils.DToUInt32(data, 303);
+ CMD222.ChargCapacity36 = (int)ByteUtils.DToUInt32(data, 307);
+ CMD222.ChargCapacity37 = (int)ByteUtils.DToUInt32(data, 311);
+ CMD222.ChargCapacity38 = (int)ByteUtils.DToUInt32(data, 315);
+ CMD222.ChargCapacity39 = (int)ByteUtils.DToUInt32(data, 319);
+ CMD222.ChargCapacity40 = (int)ByteUtils.DToUInt32(data, 323);
+ CMD222.ChargCapacity41 = (int)ByteUtils.DToUInt32(data, 327);
+ CMD222.ChargCapacity42 = (int)ByteUtils.DToUInt32(data, 331);
+ CMD222.ChargCapacity43 = (int)ByteUtils.DToUInt32(data, 335);
+ CMD222.ChargCapacity44 = (int)ByteUtils.DToUInt32(data, 339);
+ CMD222.ChargCapacity45 = (int)ByteUtils.DToUInt32(data, 343);
+ CMD222.ChargCapacity46 = (int)ByteUtils.DToUInt32(data, 347);
+ CMD222.ChargCapacity47 = (int)ByteUtils.DToUInt32(data, 351);
+ CMD222.ChargCapacity48 = (int)ByteUtils.DToUInt32(data, 355);
+ CMD222.StartMode = data[359];
+ CMD222.ChargSerialNum = Encoding.ASCII.GetString(data, 360, 32);
+ CMD222.ChargServiceCost = ByteUtils.DToUInt32(data, 392);
+ CMD222.KilElectricity = data[394];
+ CMD222.ParallelMark = data[395];
+ CMD222.ChargeOrDisMark = data[396];
+ CMD222.MeterEncData = data[397];
+ CMD222.MeterNum = Encoding.ASCII.GetString(data, 398, 6);
+ CMD222.MeterProVersion = ByteUtils.DToUInt16(data, 404);
+ CMD222.EncMode = data[408];
+ }
+ return CMD222;
+ }
+ public CMD302 ConCMD302(byte[] data)
+ {
+ CMD302 CMD302 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD302 = new CMD302();
+ CMD302.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD302.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD302.MessageOrderNum = ByteUtils.DToUInt16(data, 12);
+ CMD302.ChargGunNum = ByteUtils.DToUInt16(data, 14);
+ CMD302.ASCIINum = Encoding.ASCII.GetString(data, 16, 32);
+ CMD302.WorkState = data[48];
+ CMD302.connectState = data[49];
+ CMD302.BRMBMSVersionNum = data[50];
+ CMD302.BRMBatteryType = data[51];
+ CMD302.BRMRatedCapacity = ByteUtils.DToUInt32(data, 52);
+ CMD302.BRMRatedVoltage = ByteUtils.DToUInt32(data, 56);
+ CMD302.BRMBatteryManu = ByteUtils.DToUInt32(data, 60);
+ CMD302.BRMBatteryPackID = ByteUtils.DToUInt32(data, 64);
+ CMD302.BRMDateYear = ByteUtils.DToUInt16(data, 68);
+ CMD302.BRMDateMonth = data[70];
+ CMD302.BRMDateDay = data[71];
+ CMD302.BRMChargeCount = ByteUtils.DToUInt32(data, 72);
+ CMD302.BRMTitleMark = data[76];
+ CMD302.Reserved3 = data[77];
+ CMD302.BRMVINID = Encoding.ASCII.GetString(data, 78, 17);
+ CMD302.BRMBMSSoftVerNum = ByteUtils.DToUInt16(data, 95);
+ CMD302.MaxChargVoltage = ByteUtils.DToUInt32(data, 103);
+ CMD302.MaxChargCurrent = ByteUtils.DToUInt32(data, 107);
+ CMD302.TotalEnergy = ByteUtils.DToUInt32(data, 111);
+ CMD302.MaxTotalVoltage = ByteUtils.DToUInt32(data, 115);
+ CMD302.MaxTemp = data[119];
+ CMD302.ChargeState = ByteUtils.DToUInt16(data, 120);
+ CMD302.CellVoltage = ByteUtils.DToUInt32(data, 122);
+ CMD302.ChargePrepared = data[126];
+ CMD302.BCLVoltage = ByteUtils.DToUInt32(data, 127);
+ CMD302.BCLCurrent = ByteUtils.DToUInt32(data, 131);
+ CMD302.BCLChargMode = data[135];
+ CMD302.BCSVoltageValue = ByteUtils.DToUInt32(data, 136);
+ CMD302.BCSCurrentValue = ByteUtils.DToUInt32(data, 140);
+ CMD302.BCSVoltageMAX = ByteUtils.DToUInt32(data, 144);
+ CMD302.BCSBatteryNumMAX = data[145];
+ CMD302.BCSChargState = ByteUtils.DToUInt16(data, 146);
+ CMD302.ReChargeTime = ByteUtils.DToUInt32(data, 148);
+ CMD302.BSMNum = data[152];
+ CMD302.BSMMaxTemp = data[153];
+ CMD302.MaxTempPointNum = data[154];
+ CMD302.MinBatteryTemp = data[155];
+ CMD302.MinTempPointNum = data[156];
+ CMD302.voltageHighLow = data[157];
+ CMD302.ChargStateHighLow = data[158];
+ CMD302.BmsOvercurrent = data[159];
+ CMD302.TempHigh = data[160];
+ CMD302.InsulatState = data[161];
+ CMD302.ConnectState = data[162];
+ CMD302.AllowCharge = data[163];
+ CMD302.SOCTargetValue = data[164];
+ CMD302.SumVoltageSetValue = data[165];
+ CMD302.VoltageSetValue = data[166];
+ CMD302.ChargeEnd = data[167];
+ CMD302.InsulatFault = data[168];
+ CMD302.OvertempFault = data[169];
+ CMD302.Overtemp = data[170];
+ CMD302.ConnectorFault = data[171];
+ CMD302.ChargOvertempFault = data[172];
+ CMD302.HVoltageFault = data[173];
+ CMD302.VoltageSenseFault = data[174];
+ CMD302.OtherFault = data[175];
+ CMD302.Overcurrent = data[176];
+ CMD302.VoltageAnomaly = data[177];
+ CMD302.VoltageAnomaly = data[178];
+ CMD302.EndChargState = data[179];
+ CMD302.MinVoltage = data[180];
+ CMD302.MaxVoltage = data[181];
+ CMD302.MinChargTemp = data[182];
+ CMD302.MaxChargTemp = data[183];
+ CMD302.ReceiveTimeout1 = data[184];
+ CMD302.ReceiveTimeout2 = data[185];
+ CMD302.ReceiveTimeout3 = data[186];
+ CMD302.ReceiveTimeout4 = data[187];
+ CMD302.ReceiveTimeout5 = data[188];
+ CMD302.ReceiveTimeout6 = data[189];
+ CMD302.ReceiveTimeout7 = data[190];
+ CMD302.Other = data[191];
+ }
+ return CMD302;
+ }
+ public CMD304 ConCMD304(byte[] data)
+ {
+ CMD304 CMD304 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD304 = new CMD304();
+ CMD304.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD304.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD304.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD304.WorkState = data[44];
+ CMD304.connectState = data[45];
+ CMD304.BRMMessage = Encoding.ASCII.GetString(data, 46, 64);
+ CMD304.VBIMessage = Encoding.ASCII.GetString(data, 110, 64);
+ CMD304.ChargParameter = Encoding.ASCII.GetString(data, 174, 16);
+ CMD304.ReadyState = ByteUtils.DToUInt16(data, 190);
+ CMD304.ChargDemand = ByteUtils.DToUInt16(data, 198);
+ CMD304.TotalState = Encoding.ASCII.GetString(data, 206, 16);
+ CMD304.StateInfo = ByteUtils.DToUInt32(data, 222);
+ CMD304.StopCharg = ByteUtils.DToUInt32(data, 226);
+ CMD304.StatisticData = ByteUtils.DToUInt32(data, 230);
+ CMD304.BEMMessage = ByteUtils.DToUInt32(data, 234);
+ }
+ return CMD304;
+ }
+ public CMD402 ConCMD402(uint func, byte[] data)
+ {
+ CMD402 CMD402 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD402 = new CMD402();
+ CMD402.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ CMD402.Reserved2 = ByteUtils.DToUInt16(data, 10);
+ CMD402.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD402.PosType = data[44];
+ CMD402.ChargGun = data[45];
+ CMD402.ChargCardID = Encoding.ASCII.GetString(data, 46, 32);
+ CMD402.ChargStartTime = Encoding.ASCII.GetString(data, 78, 8);
+ CMD402.ChargEndTime = Encoding.ASCII.GetString(data, 86, 8);
+ CMD402.ChargTimeLength = ByteUtils.DToUInt32(data, 94);
+ CMD402.SOCStart = data[98];
+ CMD402.SOCEnd = data[99];
+ CMD402.ChargEndReason = Encoding.ASCII.GetString(data, 100, 4);
+ if (func == 402)
+ {
+ CMD402.ChargCapacity = (ByteUtils.ToUInt32(data, 104) * 0.01).ToString("F2");
+
+
+ CMD402.ChargCapacity01 = ((ByteUtils.DToUInt16(data, 167)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity02 = ((ByteUtils.DToUInt16(data, 169)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity03 = ((ByteUtils.DToUInt16(data, 171)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity04 = ((ByteUtils.DToUInt16(data, 173)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity05 = ((ByteUtils.DToUInt16(data, 175)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity06 = ((ByteUtils.DToUInt16(data, 177)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity07 = ((ByteUtils.DToUInt16(data, 179)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity08 = ((ByteUtils.DToUInt16(data, 181)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity09 = ((ByteUtils.DToUInt16(data, 183)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity10 = ((ByteUtils.DToUInt16(data, 185)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity11 = ((ByteUtils.DToUInt16(data, 187)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity12 = ((ByteUtils.DToUInt16(data, 189)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity13 = ((ByteUtils.DToUInt16(data, 191)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity14 = ((ByteUtils.DToUInt16(data, 193)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity15 = ((ByteUtils.DToUInt16(data, 195)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity16 = ((ByteUtils.DToUInt16(data, 197)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity17 = ((ByteUtils.DToUInt16(data, 199)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity18 = ((ByteUtils.DToUInt16(data, 201)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity19 = ((ByteUtils.DToUInt16(data, 203)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity20 = ((ByteUtils.DToUInt16(data, 205)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity21 = ((ByteUtils.DToUInt16(data, 207)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity22 = ((ByteUtils.DToUInt16(data, 209)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity23 = ((ByteUtils.DToUInt16(data, 211)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity24 = ((ByteUtils.DToUInt16(data, 213)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity25 = ((ByteUtils.DToUInt16(data, 215)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity26 = ((ByteUtils.DToUInt16(data, 217)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity27 = ((ByteUtils.DToUInt16(data, 219)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity28 = ((ByteUtils.DToUInt16(data, 221)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity29 = ((ByteUtils.DToUInt16(data, 223)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity30 = ((ByteUtils.DToUInt16(data, 225)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity31 = ((ByteUtils.DToUInt16(data, 227)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity32 = ((ByteUtils.DToUInt16(data, 229)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity33 = ((ByteUtils.DToUInt16(data, 231)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity34 = ((ByteUtils.DToUInt16(data, 233)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity35 = ((ByteUtils.DToUInt16(data, 235)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity36 = ((ByteUtils.DToUInt16(data, 237)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity37 = ((ByteUtils.DToUInt16(data, 239)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity38 = ((ByteUtils.DToUInt16(data, 241)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity39 = ((ByteUtils.DToUInt16(data, 243)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity40 = ((ByteUtils.DToUInt16(data, 245)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity41 = ((ByteUtils.DToUInt16(data, 247)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity42 = ((ByteUtils.DToUInt16(data, 249)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity43 = ((ByteUtils.DToUInt16(data, 251)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity44 = ((ByteUtils.DToUInt16(data, 253)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity45 = ((ByteUtils.DToUInt16(data, 255)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity46 = ((ByteUtils.DToUInt16(data, 257)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity47 = ((ByteUtils.DToUInt16(data, 259)) * 0.01).ToString("F2");
+ CMD402.ChargCapacity48 = ((ByteUtils.DToUInt16(data, 261)) * 0.01).ToString("F2");
+
+ CMD402.StartMode = data[263];
+ CMD402.SerialNum = Encoding.ASCII.GetString(data, 264, 32);
+ CMD402.ChargServiceCost = ByteUtils.DToUInt32(data, 296);
+ CMD402.KilElectricity = (data[300] * 0.001).ToString("F4");
+ CMD402.ParallelMark = data[301];
+ }
+ else if (func == 422)
+ {
+ CMD402.ChargCapacity = (ByteUtils.ToUInt32(data, 104) * 0.001).ToString("F3");
+
+
+ CMD402.ChargCapacity01 = ((ByteUtils.DToUInt32(data, 167) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity02 = ((ByteUtils.DToUInt32(data, 171) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity03 = ((ByteUtils.DToUInt32(data, 175) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity04 = ((ByteUtils.DToUInt32(data, 179) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity05 = ((ByteUtils.DToUInt32(data, 183) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity06 = ((ByteUtils.DToUInt32(data, 187) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity07 = ((ByteUtils.DToUInt32(data, 191) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity08 = ((ByteUtils.DToUInt32(data, 195) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity09 = ((ByteUtils.DToUInt32(data, 199) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity10 = ((ByteUtils.DToUInt32(data, 203) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity11 = ((ByteUtils.DToUInt32(data, 207) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity12 = ((ByteUtils.DToUInt32(data, 211) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity13 = ((ByteUtils.DToUInt32(data, 215) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity14 = ((ByteUtils.DToUInt32(data, 219) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity15 = ((ByteUtils.DToUInt32(data, 223) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity16 = ((ByteUtils.DToUInt32(data, 227) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity17 = ((ByteUtils.DToUInt32(data, 231) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity18 = ((ByteUtils.DToUInt32(data, 235) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity19 = ((ByteUtils.DToUInt32(data, 239) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity20 = ((ByteUtils.DToUInt32(data, 243) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity21 = ((ByteUtils.DToUInt32(data, 247) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity22 = ((ByteUtils.DToUInt32(data, 251) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity23 = ((ByteUtils.DToUInt32(data, 255) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity24 = ((ByteUtils.DToUInt32(data, 259) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity25 = ((ByteUtils.DToUInt32(data, 263) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity26 = ((ByteUtils.DToUInt32(data, 267) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity27 = ((ByteUtils.DToUInt32(data, 271) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity28 = ((ByteUtils.DToUInt32(data, 275) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity29 = ((ByteUtils.DToUInt32(data, 279) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity30 = ((ByteUtils.DToUInt32(data, 283) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity31 = ((ByteUtils.DToUInt32(data, 287) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity32 = ((ByteUtils.DToUInt32(data, 291) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity33 = ((ByteUtils.DToUInt32(data, 295) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity34 = ((ByteUtils.DToUInt32(data, 299) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity35 = ((ByteUtils.DToUInt32(data, 303) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity36 = ((ByteUtils.DToUInt32(data, 307) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity37 = ((ByteUtils.DToUInt32(data, 311) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity38 = ((ByteUtils.DToUInt32(data, 315) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity39 = ((ByteUtils.DToUInt32(data, 319) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity40 = ((ByteUtils.DToUInt32(data, 323) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity41 = ((ByteUtils.DToUInt32(data, 327) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity42 = ((ByteUtils.DToUInt32(data, 331) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity43 = ((ByteUtils.DToUInt32(data, 335) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity44 = ((ByteUtils.DToUInt32(data, 339) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity45 = ((ByteUtils.DToUInt32(data, 343) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity46 = ((ByteUtils.DToUInt32(data, 347) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity47 = ((ByteUtils.DToUInt32(data, 351) * 0.001)).ToString("F3");
+ CMD402.ChargCapacity48 = ((ByteUtils.DToUInt32(data, 355) * 0.001)).ToString("F3");
+ CMD402.StartMode = data[359];
+ CMD402.SerialNum = Encoding.ASCII.GetString(data, 360, 32);
+ CMD402.ChargServiceCost = ByteUtils.DToUInt32(data, 392);
+ CMD402.KilElectricity = (data[396] * 0.001).ToString("F4");
+ CMD402.ParallelMark = data[397];
+ }
+
+ CMD402.SAmmeterValue = ByteUtils.DToUInt32(data, 108);
+ CMD402.EAmmeterValue = ByteUtils.DToUInt32(data, 112);
+ CMD402.ChargeAmount = ByteUtils.DToUInt32(data, 116);
+ CMD402.IndexNum = ByteUtils.DToUInt32(data, 120);
+ CMD402.InitialBalance = ByteUtils.DToUInt32(data, 124);
+ CMD402.ChargRecordIndex = ByteUtils.DToUInt32(data, 128);
+ CMD402.TotalChargeRecord = ByteUtils.DToUInt32(data, 132);
+ CMD402.Reserved3 = data[136];
+ CMD402.ChargStrategy = data[137];
+ switch (data[137])
+ {
+ case 1:
+ CMD402.ChargStrategyPara = (ByteUtils.ToUInt32(data, 138)).ToString();
+ break;
+ case 2:
+ CMD402.ChargStrategyPara = ((float)ByteUtils.ToUInt32(data, 138) * 0.01).ToString("F2");
+ break;
+ case 3:
+ CMD402.ChargStrategyPara = ((float)ByteUtils.ToUInt32(data, 138) * 0.01).ToString("F3");
+ break;
+ }
+
+
+ CMD402.VINCar = Encoding.ASCII.GetString(data, 142, 17);
+ CMD402.CarID = Encoding.ASCII.GetString(data, 159, 8);
+
+ }
+ return CMD402;
+ }
+ public CMD1002 ConCMD1002(byte[] data)
+ {
+ CMD1002 CMD1002 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD1002 = new CMD1002();
+ CMD1002.ErasurePercentage = data[8];
+ }
+ return CMD1002;
+ }
+ public CMD1004 ConCMD1004(byte[] data)
+ {
+ CMD1004 CMD1004 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD1004 = new CMD1004();
+ CMD1004.DataLength = data[8];
+ }
+ return CMD1004;
+ }
+ public CMD1006 ConCMD1006(byte[] data)
+ {
+ CMD1006 CMD1006 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD1006 = new CMD1006();
+ CMD1006.ResponseFlag = data[8];
+ }
+ return CMD1006;
+ }
+ public CMD1008 ConCMD1008(byte[] data)
+ {
+ CMD1008 CMD1008 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD1008 = new CMD1008();
+ CMD1008.ReceiveSN = data[8];
+ CMD1008.WriteFlag = data[9];
+ CMD1008.Reserved1 = (short)ByteUtils.DToUInt16(data, 10);
+ CMD1008.Reserved2 = (int)ByteUtils.DToUInt32(data, 12);
+ }
+ return CMD1008;
+ }
+ public CMD1010 ConCMD1010(byte[] data)
+ {
+ CMD1010 CMD1010 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD1010 = new CMD1010();
+ CMD1010.Reserved1 = ByteUtils.DToUInt16(data, 8);
+ }
+ return CMD1010;
+ }
+ public CMD1012 ConCMD1012(byte[] data)
+ {
+ CMD1012 CMD1012 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD1012 = new CMD1012();
+ CMD1012.Reserved1 = (int)ByteUtils.DToUInt32(data, 8);
+ }
+ return CMD1012;
+ }
+ public CMD1022 ConCMD1022(byte[] data)
+ {
+ CMD1022 CMD1022 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD1022 = new CMD1022();
+ CMD1022.EquipmentCode = (int)ByteUtils.DToUInt32(data, 8);
+ CMD1022.ProjectCode = (int)ByteUtils.DToUInt32(data, 12);
+ CMD1022.SoftwareVersion = (int)ByteUtils.DToUInt32(data, 16);
+ CMD1022.ReceiveFileSizeMax = (int)ByteUtils.DToUInt32(data, 20);
+ CMD1022.DeviceDescripte = Encoding.ASCII.GetString(data, 24, 32);
+ CMD1022.CommandFlag = (int)ByteUtils.DToUInt32(data, 56);
+ CMD1022.Offset = (int)ByteUtils.DToUInt32(data, 60);
+ CMD1022.ContinuatSN = data[64];
+ CMD1022.DataLength = (int)ByteUtils.DToUInt32(data, 65);
+ }
+ return CMD1022;
+ }
+ public CMD1102 ConCMD1102(byte[] data)
+ {
+ CMD1102 CMD1102 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD1102 = new CMD1102();
+ CMD1102.StartHour1 = data[8];
+ CMD1102.STartMin1 = data[9];
+ CMD1102.EndHour1 = data[10];
+ CMD1102.EndMin1 = data[11];
+ CMD1102.Rate1 = ByteUtils.DToUInt32(data, 12);
+
+ CMD1102.StartHour2 = data[16];
+ CMD1102.STartMin2 = data[17];
+ CMD1102.EndHour2 = data[18];
+ CMD1102.EndMin2 = data[19];
+ CMD1102.Rate2 = ByteUtils.DToUInt32(data, 20);
+
+ CMD1102.StartHour3 = data[24];
+ CMD1102.STartMin3 = data[25];
+ CMD1102.EndHour3 = data[26];
+ CMD1102.EndMin3 = data[27];
+ CMD1102.Rate3 = ByteUtils.DToUInt32(data, 28);
+
+ CMD1102.StartHour4 = data[32];
+ CMD1102.STartMin4 = data[33];
+ CMD1102.EndHour4 = data[34];
+ CMD1102.EndMin4 = data[35];
+ CMD1102.Rate4 = ByteUtils.DToUInt32(data, 36);
+
+ CMD1102.StartHour5 = data[40];
+ CMD1102.STartMin5 = data[41];
+ CMD1102.EndHour5 = data[42];
+ CMD1102.EndMin5 = data[43];
+ CMD1102.Rate5 = ByteUtils.DToUInt32(data, 44);
+
+ CMD1102.StartHour6 = data[48];
+ CMD1102.STartMin6 = data[49];
+ CMD1102.EndHour6 = data[50];
+ CMD1102.EndMin6 = data[51];
+ CMD1102.Rate6 = ByteUtils.DToUInt32(data, 52);
+
+ CMD1102.StartHour7 = data[56];
+ CMD1102.STartMin7 = data[57];
+ CMD1102.EndHour7 = data[58];
+ CMD1102.EndMin7 = data[59];
+ CMD1102.Rate7 = ByteUtils.DToUInt32(data, 60);
+
+ CMD1102.StartHour8 = data[64];
+ CMD1102.STartMin8 = data[65];
+ CMD1102.EndHour8 = data[66];
+ CMD1102.EndMin8 = data[67];
+ CMD1102.Rate8 = ByteUtils.DToUInt32(data, 68);
+
+ CMD1102.StartHour9 = data[72];
+ CMD1102.STartMin9 = data[73];
+ CMD1102.EndHour9 = data[74];
+ CMD1102.EndMin9 = data[75];
+ CMD1102.Rate9 = ByteUtils.DToUInt32(data, 76);
+
+ CMD1102.StartHour10 = data[80];
+ CMD1102.STartMin10 = data[81];
+ CMD1102.EndHour10 = data[82];
+ CMD1102.EndMin10 = data[83];
+ CMD1102.Rate10 = ByteUtils.DToUInt32(data, 84);
+
+ CMD1102.StartHour11 = data[88];
+ CMD1102.STartMin11 = data[89];
+ CMD1102.EndHour11 = data[90];
+ CMD1102.EndMin11 = data[91];
+ CMD1102.Rate11 = ByteUtils.DToUInt32(data, 92);
+
+ CMD1102.StartHour12 = data[96];
+ CMD1102.STartMin12 = data[97];
+ CMD1102.EndHour12 = data[98];
+ CMD1102.EndMin12 = data[99];
+ CMD1102.Rate12 = ByteUtils.DToUInt32(data, 100);
+ }
+ return CMD1102;
+ }
+ public CMD1104 ConCMD1104(byte[] data)
+ {
+ CMD1104 CMD1104 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD1104 = new CMD1104();
+ CMD1104.ConfirmResult = data[8];
+ }
+ return CMD1104;
+ }
+ public CMD1106 ConCMD1106(byte[] data)
+ {
+ CMD1106 CMD1106 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD1106 = new CMD1106();
+ CMD1106.ConfirmResult = data[8];
+ }
+ return CMD1106;
+ }
+ public CMD1108 ConCMD1108(byte[] data)
+ {
+ CMD1108 CMD1108 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD1108 = new CMD1108();
+ CMD1108.StartHour1 = data[8];
+ CMD1108.STartMin1 = data[9];
+ CMD1108.EndHour1 = data[10];
+ CMD1108.EndMin1 = data[11];
+ CMD1108.Rate1 = ByteUtils.DToUInt32(data, 12);
+
+ CMD1108.StartHour2 = data[16];
+ CMD1108.STartMin2 = data[17];
+ CMD1108.EndHour2 = data[18];
+ CMD1108.EndMin2 = data[19];
+ CMD1108.Rate2 = ByteUtils.DToUInt32(data, 20);
+
+ CMD1108.StartHour3 = data[24];
+ CMD1108.STartMin3 = data[25];
+ CMD1108.EndHour3 = data[26];
+ CMD1108.EndMin3 = data[27];
+ CMD1108.Rate3 = ByteUtils.DToUInt32(data, 28);
+
+ CMD1108.StartHour4 = data[32];
+ CMD1108.STartMin4 = data[33];
+ CMD1108.EndHour4 = data[34];
+ CMD1108.EndMin4 = data[35];
+ CMD1108.Rate4 = ByteUtils.DToUInt32(data, 36);
+
+ CMD1108.StartHour5 = data[40];
+ CMD1108.STartMin5 = data[41];
+ CMD1108.EndHour5 = data[42];
+ CMD1108.EndMin5 = data[43];
+ CMD1108.Rate5 = ByteUtils.DToUInt32(data, 44);
+
+ CMD1108.StartHour6 = data[48];
+ CMD1108.STartMin6 = data[49];
+ CMD1108.EndHour6 = data[50];
+ CMD1108.EndMin6 = data[51];
+ CMD1108.Rate6 = ByteUtils.DToUInt32(data, 52);
+
+ CMD1108.StartHour7 = data[56];
+ CMD1108.STartMin7 = data[57];
+ CMD1108.EndHour7 = data[58];
+ CMD1108.EndMin7 = data[59];
+ CMD1108.Rate7 = ByteUtils.DToUInt32(data, 60);
+
+ CMD1108.StartHour8 = data[64];
+ CMD1108.STartMin8 = data[65];
+ CMD1108.EndHour8 = data[66];
+ CMD1108.EndMin8 = data[67];
+ CMD1108.Rate8 = ByteUtils.DToUInt32(data, 68);
+
+ CMD1108.StartHour9 = data[72];
+ CMD1108.STartMin9 = data[73];
+ CMD1108.EndHour9 = data[74];
+ CMD1108.EndMin9 = data[75];
+ CMD1108.Rate9 = ByteUtils.DToUInt32(data, 76);
+
+ CMD1108.StartHour10 = data[80];
+ CMD1108.STartMin10 = data[81];
+ CMD1108.EndHour10 = data[82];
+ CMD1108.EndMin10 = data[83];
+ CMD1108.Rate10 = ByteUtils.DToUInt32(data, 84);
+
+ CMD1108.StartHour11 = data[88];
+ CMD1108.STartMin11 = data[89];
+ CMD1108.EndHour11 = data[90];
+ CMD1108.EndMin11 = data[91];
+ CMD1108.Rate11 = ByteUtils.DToUInt32(data, 92);
+
+ CMD1108.StartHour12 = data[96];
+ CMD1108.STartMin12 = data[97];
+ CMD1108.EndHour12 = data[98];
+ CMD1108.EndMin12 = data[99];
+ CMD1108.Rate12 = ByteUtils.DToUInt32(data, 100);
+
+ }
+ return CMD1108;
+ }
+ public CMD1302 ConCMD1302(byte[] data)
+ {
+ CMD1302 CMD1302 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD1302 = new CMD1302();
+
+ CMD1302.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD1302.WhitelistType = data[44];
+ CMD1302.Operate = data[45];
+ CMD1302.ListVersioe = ByteUtils.DToUInt32(data, 46);
+ CMD1302.OperatResult = data[50];
+ }
+ return CMD1302;
+ }
+ public CMD1402 ConCMD1402(byte[] data)
+ {
+ CMD1402 CMD1402 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD1402 = new CMD1402();
+
+ CMD1402.Result = data[12];
+ }
+ return CMD1402;
+ }
+ public CMD1403 ConCMD1403(byte[] data)
+ {
+ CMD1403 CMD1403 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD1403 = new CMD1403();
+
+ CMD1403.ScheduleResult = data[12];
+ }
+ return CMD1403;
+ }
+ public CMD1407 ConCMD1407(byte[] data)
+ {
+ CMD1407 CMD1407 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD1407 = new CMD1407();
+
+ CMD1407.Result = data[12];
+ }
+ return CMD1407;
+ }
+ public CMD1501 ConCMD1501(byte[] data)
+ {
+ CMD1501 CMD1501 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD1501 = new CMD1501();
+
+ CMD1501.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
+ CMD1501.UpFileName = Encoding.ASCII.GetString(data, 44, 128);
+ }
+ return CMD1501;
+ }
+ public CMD1503 ConCMD1503(byte[] data)
+ {
+ CMD1503 CMD1503 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD1503 = new CMD1503();
+
+ CMD1503.DataLength = ByteUtils.DToUInt32(data, 12);
+ CMD1503.MessageNum = ByteUtils.DToUInt32(data, 16);
+ CMD1503.LogData = Encoding.ASCII.GetString(data, 20, (data.Length - 21)); ;
+ }
+ return CMD1503;
+ }
+ public CMD1505 ConCMD1505(byte[] data)
+ {
+ CMD1505 CMD1505 = null;
+ if (data != null && data.Length > 0)
+ {
+ CMD1505 = new CMD1505();
+ }
+ return CMD1505;
+ }
+
+
+
+
+
+ #endregion ݷ
+ }
+ public class ChargerSendCMD
+ {
+ #region Эʽ
+ public byte[] SendRCMD1(out APDUModel APDUModel, CMD1 CMD)
+ {
+
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 1;
+ model.checksumDomain = 0x01;
+
+
+ model.dataDomain = GetRCMD1DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD1DataInfo(CMD1 CMD1)
+ {
+ byte[] results = null;
+ if (CMD1 != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD1.WorkingData_Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD1.WorkingData_Reserved2));
+ lstContent.Add(CMD1.Type);
+ lstContent.AddRange(BitConverter.GetBytes(CMD1.SetAddress));//ʼַ
+ lstContent.Add(CMD1.SelectNum);//ѯ
+ lstContent.AddRange(BitConverter.GetBytes(CMD1.SetByteNum));//ֽ
+ if (CMD1.Type == 1)
+ {
+ lstContent.AddRange(CMD1.SetData);
+ }
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+ public byte[] SendRCMD3(out APDUModel APDUModel, CMD3 CMD3)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 3;
+ model.checksumDomain = 0x01;
+
+
+ model.dataDomain = GetRCMD3DataInfo(CMD3); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD3DataInfo(CMD3 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+ lstContent.Add(CMD.Type);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.SAddress));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.SBytes));
+ if (CMD.Type == 1)
+ {
+ lstContent.AddRange(CMD.SData);
+ }
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+ public byte[] SendRCMD5(out APDUModel APDUModel, CMD5 cMD5)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 5;
+ model.checksumDomain = 0x01;
+
+ model.dataDomain = GetRCMD5DataInfo(cMD5); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD5DataInfo(CMD5 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+ lstContent.Add(CMD.RechargeableMuzzle);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.CommandAddress));
+ lstContent.Add(CMD.CommandNum);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.CommandLength));
+ lstContent.AddRange(CMD.CommandData);
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+
+ public byte[] SendRCMD7(out APDUModel APDUModel, CMD7 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 7;
+ model.checksumDomain = 0x01;
+
+
+
+ model.dataDomain = GetRCMD7DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD7DataInfo(CMD7 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved));
+ lstContent.Add(CMD.ChargMuzzle);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.ChargeType));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.ChargeStopPassword));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.ChargStrategy));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.ChargStrategyPara));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.ScheduleStartupTime));
+ lstContent.Add(CMD.OutTime);
+ lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.CardNumber, 32));
+ lstContent.Add(CMD.NetOutageSign);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.MaxElectric));
+ lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.SerialNum, 32));
+ lstContent.Add(CMD.BMSVoltage);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Balance));
+ lstContent.Add(CMD.DisOrChargeMark);
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+
+ public byte[] SendRCMD9(out APDUModel APDUModel, CMD9 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 9;
+ model.checksumDomain = 0x01;
+
+
+
+ model.dataDomain = GetRCMD9DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD9DataInfo(CMD9 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.ChargGunNum));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.FWResult));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.CommandAddress));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.DataLength));
+ lstContent.AddRange(CMD.Datas);
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+ #endregion
+
+ #region ϴ
+
+ public byte[] SendRCMD101(out APDUModel APDUModel, CMD101 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 101;
+ model.checksumDomain = 0x01;
+
+
+
+ model.dataDomain = GetRCMD101DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD101DataInfo(CMD101 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.HearResponse));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+
+ public byte[] SendRCMD103(out APDUModel APDUModel, CMD103 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 103;
+ model.checksumDomain = 0x01;
+
+
+ model.dataDomain = GetRCMD103DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD103DataInfo(CMD103 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+ lstContent.Add(CMD.ChargNum);
+ lstContent.Add(Convert.ToByte(CMD.Reported));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+ public byte[] SendRCMD105(out APDUModel APDUModel, CMD105 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 105;
+ model.checksumDomain = 0x01;
+
+
+
+ model.dataDomain = GetRCMD105DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD105DataInfo(CMD105 CMD105)
+ {
+ byte[] results = null;
+ if (CMD105 != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD105.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD105.Reserved2));
+ lstContent.AddRange(BitConverter.GetBytes(CMD105.NumResponse));
+ lstContent.Add(CMD105.LoginVerify);
+ lstContent.Add(CMD105.EncryptionFlag);
+ if (CMD105.EncryptionFlag == 1)
+ {
+ lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD105.RSAComModule));
+ lstContent.AddRange(BitConverter.GetBytes(CMD105.RSAComSecret));
+ }
+ lstContent.Add(CMD105.StSign);
+ lstContent.AddRange(BitConverter.GetBytes(CMD105.BCDTime));
+ lstContent.Add(CMD105.MessageUpload);
+ if (CMD105.EncryptionFlag == 1)
+ lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD105.AESSecretKey));
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+
+ public byte[] SendRCMD107(out APDUModel APDUModel, CMD107 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 107;
+ model.checksumDomain = 0x01;
+
+
+
+ model.dataDomain = GetRCMD107DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD107DataInfo(CMD107 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));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+
+ public byte[] SendRCMD109(out APDUModel APDUModel, CMD109 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 109;
+ model.checksumDomain = 0x01;
+
+
+ model.dataDomain = GetRCMD109DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD109DataInfo(CMD109 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+
+ public byte[] SendRCMD111(out APDUModel APDUModel, CMD111 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 111;
+ model.checksumDomain = 0x01;
+
+
+ model.dataDomain = GetRCMD111DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD111DataInfo(CMD111 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.MessageType));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+ public byte[] SendRCMD113(out APDUModel APDUModel, CMD113 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 113;
+ model.checksumDomain = 0x01;
+
+ model.dataDomain = GetRCMD113DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD113DataInfo(CMD113 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+ lstContent.Add(CMD.ChargNum);
+ lstContent.Add(Convert.ToByte(CMD.Sign));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+ #endregion
+
+ #region Ϣ
+
+ public byte[] SendRCMD201(out APDUModel APDUModel, CMD201 CMD, uint func)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ 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); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD201DataInfo(CMD201 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.ChargNum));
+ lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.ChargID, 32));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.IndexNum));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.ValidMark));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.InitialCost));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.DiscountCost));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.NetCost));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Balance));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.NetElectricCost));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.NetServiceCost));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+
+ public byte[] SendRCMD203(out APDUModel APDUModel, CMD203 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 203;
+ model.checksumDomain = 0x01;
+
+
+
+ model.dataDomain = GetRCMD203DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD203DataInfo(CMD203 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.ResCode));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Balance));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.SumEleRate));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.EleRate));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.ChargPassword));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.VINSign));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.CarIDVerify));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved3));
+ lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.SerialNum, 32));
+ lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.VIN, 17));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.ChargGunNum));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+
+ public byte[] SendRCMD205(out APDUModel APDUModel, CMD205 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 205;
+ model.checksumDomain = 0x01;
+
+
+
+
+ model.dataDomain = GetRCMD205DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD205DataInfo(CMD205 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.ResponseCode));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Balance));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+
+ public byte[] SendRCMD207(out APDUModel APDUModel, CMD207 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 207;
+ model.checksumDomain = 0x01;
+
+
+
+
+ model.dataDomain = GetRCMD207DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD207DataInfo(CMD207 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+ lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.ASCIINum, 32));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.ChargGunNum));
+ lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.VINNum, 17));
+ lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.VINBindAccount, 32));
+ lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.ChargSerialNum, 32));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.VerifyResult));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.VerifyCause));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.RechBalance));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.StopCode));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+
+ public byte[] SendRCMD209(out APDUModel APDUModel, CMD209 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 209;
+ model.checksumDomain = 0x01;
+
+
+ model.dataDomain = GetRCMD209DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD209DataInfo(CMD209 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+ lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.ASCIINum, 32));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.ChargGunNum));
+ lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.VINNum, 17));
+
+ results = lstContent.ToArray();
+ }
+ 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); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(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.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.ChargNum));
+ lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD.ChargID));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.IndexNum));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.ValidMark));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.InitialCost));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.DiscountCost));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.NetCost));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Balance));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.NetElectricCost));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.NetServiceCost));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+ #endregion
+
+ #region ֱ BMS Ϣ(Ԥ)
+
+ public byte[] SendRCMD301(out APDUModel APDUModel, CMD301 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 301;
+ model.checksumDomain = 0x01;
+
+
+
+ model.dataDomain = GetRCMD301DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD301DataInfo(CMD301 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+
+ public byte[] SendRCMD303(out APDUModel APDUModel, CMD303 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 303;
+ model.checksumDomain = 0x01;
+
+
+
+ model.dataDomain = GetRCMD303DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD303DataInfo(CMD303 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+ #endregion
+
+ #region ʷ¼
+ public byte[] SendRCMD401(out APDUModel APDUModel, CMD401 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 401;
+ model.checksumDomain = 0x01;
+
+
+
+ model.dataDomain = GetRCMD401DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD401DataInfo(CMD401 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.SelectIndex));
+ lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD.ChargSerialNum));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+ #endregion
+
+ #region
+ public byte[] SendRCMD1001(out APDUModel APDUModel, CMD1001 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 1001;
+ model.checksumDomain = 0x01;
+
+
+
+ model.dataDomain = GetRCMD1001DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD1001DataInfo(CMD1001 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.CInstruction));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+ public byte[] SendRCMD1003(out APDUModel APDUModel, CMD1003 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 1003;
+ model.checksumDomain = 0x01;
+
+
+
+ model.dataDomain = GetRCMD1003DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD1003DataInfo(CMD1003 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(Encoding.ASCII.GetBytes(CMD.Filename));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+ public byte[] SendRCMD1005(out APDUModel APDUModel, CMD1005 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 1005;
+ model.checksumDomain = 0x01;
+
+
+
+ model.dataDomain = GetRCMD1005DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD1005DataInfo(CMD1005 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.FileLength));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+ public byte[] SendRCMD1007(out APDUModel APDUModel, CMD1007 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 1007;
+ model.checksumDomain = 0x01;
+
+
+
+ model.dataDomain = GetRCMD1007DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD1007DataInfo(CMD1007 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD.UpFileData));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+ public byte[] SendRCMD1009(out APDUModel APDUModel, CMD1009 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 1009;
+ model.checksumDomain = 0x01;
+
+
+
+ model.dataDomain = GetRCMD1009DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD1009DataInfo(CMD1009 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+
+ public byte[] SendRCMD1011(out APDUModel APDUModel, CMD1011 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 1011;
+ model.checksumDomain = 0x01;
+
+
+
+ model.dataDomain = GetRCMD1011DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD1011DataInfo(CMD1011 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+ public byte[] SendRCMD1021(out APDUModel APDUModel, CMD1021 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 1021;
+ model.checksumDomain = 0x01;
+
+
+
+ model.dataDomain = GetRCMD1021DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD1021DataInfo(CMD1021 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.AddRange(BitConverter.GetBytes(CMD.ResponseResult));
+ lstContent.AddRange(Encoding.UTF8.GetBytes(CMD.ResponsExplain));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+ #endregion
+
+ #region ƷѲصָ
+
+ public byte[] SendRCMD1101(out APDUModel APDUModel)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 1101;
+ model.checksumDomain = 0x01;
+
+ CMD1101 CMD = new CMD1101();
+
+ model.dataDomain = GetRCMD1101DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD1101DataInfo(CMD1101 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+
+ public byte[] SendRCMD1103(out APDUModel APDUModel, CMD1103 CMD)
+ {
+ byte[] result;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 1103;
+ model.checksumDomain = 0x01;
+
+ model.dataDomain = GetRCMD1103DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD1103DataInfo(CMD1103 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.Add(CMD.StartHour1);
+ lstContent.Add(CMD.STartMin1);
+ lstContent.Add(CMD.EndHour1);
+ lstContent.Add(CMD.EndMin1);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate1));
+
+ lstContent.Add(CMD.StartHour2);
+ lstContent.Add(CMD.STartMin2);
+ lstContent.Add(CMD.EndHour2);
+ lstContent.Add(CMD.EndMin2);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate2));
+
+ lstContent.Add(CMD.StartHour3);
+ lstContent.Add(CMD.STartMin3);
+ lstContent.Add(CMD.EndHour3);
+ lstContent.Add(CMD.EndMin3);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate3));
+
+ lstContent.Add(CMD.StartHour4);
+ lstContent.Add(CMD.STartMin4);
+ lstContent.Add(CMD.EndHour4);
+ lstContent.Add(CMD.EndMin4);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate4));
+
+ lstContent.Add(CMD.StartHour5);
+ lstContent.Add(CMD.STartMin5);
+ lstContent.Add(CMD.EndHour5);
+ lstContent.Add(CMD.EndMin5);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate5));
+
+ lstContent.Add(CMD.StartHour6);
+ lstContent.Add(CMD.STartMin6);
+ lstContent.Add(CMD.EndHour6);
+ lstContent.Add(CMD.EndMin6);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate6));
+
+ lstContent.Add(CMD.StartHour7);
+ lstContent.Add(CMD.STartMin7);
+ lstContent.Add(CMD.EndHour7);
+ lstContent.Add(CMD.EndMin7);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate7));
+
+ lstContent.Add(CMD.StartHour8);
+ lstContent.Add(CMD.STartMin8);
+ lstContent.Add(CMD.EndHour8);
+ lstContent.Add(CMD.EndMin8);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate8));
+
+ lstContent.Add(CMD.StartHour9);
+ lstContent.Add(CMD.STartMin9);
+ lstContent.Add(CMD.EndHour9);
+ lstContent.Add(CMD.EndMin9);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate9));
+
+ lstContent.Add(CMD.StartHour10);
+ lstContent.Add(CMD.STartMin10);
+ lstContent.Add(CMD.EndHour10);
+ lstContent.Add(CMD.EndMin10);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate10));
+
+ lstContent.Add(CMD.StartHour11);
+ lstContent.Add(CMD.STartMin11);
+ lstContent.Add(CMD.EndHour11);
+ lstContent.Add(CMD.EndMin11);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate11));
+
+ lstContent.Add(CMD.StartHour12);
+ lstContent.Add(CMD.STartMin12);
+ lstContent.Add(CMD.EndHour12);
+ lstContent.Add(CMD.EndMin12);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate12));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+ public byte[] SendRCMD1105(out APDUModel APDUModel, CMD1105 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 1105;
+ model.checksumDomain = 0x01;
+
+ model.dataDomain = GetRCMD1105DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD1105DataInfo(CMD1105 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ lstContent.Add(CMD.StartHour1);
+ lstContent.Add(CMD.STartMin1);
+ lstContent.Add(CMD.EndHour1);
+ lstContent.Add(CMD.EndMin1);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.reserveRate1));
+
+ lstContent.Add(CMD.StartHour2);
+ lstContent.Add(CMD.STartMin2);
+ lstContent.Add(CMD.EndHour2);
+ lstContent.Add(CMD.EndMin2);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate2));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.reserveRate2));
+
+ lstContent.Add(CMD.StartHour3);
+ lstContent.Add(CMD.STartMin3);
+ lstContent.Add(CMD.EndHour3);
+ lstContent.Add(CMD.EndMin3);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate3));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.reserveRate3));
+
+ lstContent.Add(CMD.StartHour4);
+ lstContent.Add(CMD.STartMin4);
+ lstContent.Add(CMD.EndHour4);
+ lstContent.Add(CMD.EndMin4);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate4));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.reserveRate4));
+
+ lstContent.Add(CMD.StartHour5);
+ lstContent.Add(CMD.STartMin5);
+ lstContent.Add(CMD.EndHour5);
+ lstContent.Add(CMD.EndMin5);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate5));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.reserveRate5));
+
+ lstContent.Add(CMD.StartHour6);
+ lstContent.Add(CMD.STartMin6);
+ lstContent.Add(CMD.EndHour6);
+ lstContent.Add(CMD.EndMin6);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate6));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.reserveRate6));
+
+ lstContent.Add(CMD.StartHour7);
+ lstContent.Add(CMD.STartMin7);
+ lstContent.Add(CMD.EndHour7);
+ lstContent.Add(CMD.EndMin7);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate7));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.reserveRate7));
+
+ lstContent.Add(CMD.StartHour8);
+ lstContent.Add(CMD.STartMin8);
+ lstContent.Add(CMD.EndHour8);
+ lstContent.Add(CMD.EndMin8);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate8));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.reserveRate8));
+
+ lstContent.Add(CMD.StartHour9);
+ lstContent.Add(CMD.STartMin9);
+ lstContent.Add(CMD.EndHour9);
+ lstContent.Add(CMD.EndMin9);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate9));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.reserveRate9));
+
+ lstContent.Add(CMD.StartHour10);
+ lstContent.Add(CMD.STartMin10);
+ lstContent.Add(CMD.EndHour10);
+ lstContent.Add(CMD.EndMin10);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate10));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.reserveRate10));
+
+ lstContent.Add(CMD.StartHour11);
+ lstContent.Add(CMD.STartMin11);
+ lstContent.Add(CMD.EndHour11);
+ lstContent.Add(CMD.EndMin11);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate11));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.reserveRate11));
+
+ lstContent.Add(CMD.StartHour12);
+ lstContent.Add(CMD.STartMin12);
+ lstContent.Add(CMD.EndHour12);
+ lstContent.Add(CMD.EndMin12);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Rate12));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.reserveRate12));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+ public byte[] SendRCMD1107(out APDUModel APDUModel)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 1107;
+ model.checksumDomain = 0x01;
+
+ CMD1107 CMD = new CMD1107();
+
+ model.dataDomain = GetRCMD1107DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD1107DataInfo(CMD1107 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+ #endregion
+
+ #region
+
+ public byte[] SendRCMD1301(out APDUModel APDUModel, CMD1301 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 1301;
+ model.checksumDomain = 0x01;
+
+ model.dataDomain = GetRCMD1301DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// CMD1301 翨 30byte\0
+ ///
+ ///
+ ///
+ public byte[] AddByteArray(byte[] byteArray, int len)
+ {
+ byte[] result = new byte[len];
+ if (byteArray != null)
+ {
+ if (byteArray.Length <= len)
+ {
+ Array.Copy(byteArray, result, byteArray.Length);
+ }
+ }
+ return result;
+ }
+
+
+ ///
+ /// ȡȨϢֽ
+ /// 1-翨 32byte\2-VIN 17byte
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD1301DataInfo(CMD1301 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.ASCIINum), 32));
+ lstContent.Add(CMD.WhitelistType);
+ lstContent.Add(CMD.Operate);
+ lstContent.AddRange(BitConverter.GetBytes(CMD.WhitelistVersioNum));
+ //Ϊѯ =4ֶβҪ
+ if (CMD.Operate != 4)
+ {
+ lstContent.AddRange(BitConverter.GetBytes(CMD.WhitelistNum));
+ if (CMD.WhitelistType == 1)
+ {
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID01), 32));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID02), 32));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID03), 32));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID04), 32));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID05), 32));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID06), 32));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID07), 32));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID08), 32));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID09), 32));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID10), 32));
+ }
+ else
+ {
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID01), 17));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID02), 17));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID03), 17));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID04), 17));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID05), 17));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID06), 17));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID07), 17));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID08), 17));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID09), 17));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.VINCarID10), 17));
+ }
+ }
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+ #endregion
+
+ #region FTP Զ FTP ʽ־ϴ
+
+ public byte[] SendRCMD1401(out APDUModel APDUModel, CMD1401 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 1401;
+ model.checksumDomain = 0x01;
+
+ model.dataDomain = GetRCMD1401DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD1401DataInfo(CMD1401 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+ lstContent.AddRange(BitConverter.GetBytes((ushort)(Convert.ToSingle(CMD.UpFileVersioNum) * 100)));
+
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.ServerIP), 32));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.UserName), 16));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.Password), 16));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.DownloadPath), 64));
+
+ lstContent.Add(CMD.ExecutiveMode);
+ lstContent.Add(CMD.DeviceType);
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+
+ public byte[] SendRCMD1406(out APDUModel APDUModel, CMD1406 CMD)
+ {
+ byte[] result;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 1406;
+ model.checksumDomain = 0x01;
+
+ model.dataDomain = GetRCMD1406DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD1406DataInfo(CMD1406 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+ lstContent.Add(CMD.LogType);
+
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.ServerIP), 32));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.UserName), 16));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.Password), 16));
+ lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.LogPath), 32));
+ lstContent.Add(CMD.ExecutiveMode);
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+ #endregion
+
+ #region Э鷽ʽ־ϴ
+
+ public byte[] SendRCMD1502(out APDUModel APDUModel, CMD1502 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 1502;
+ model.checksumDomain = 0x01;
+
+
+ model.dataDomain = GetRCMD1502DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD1502DataInfo(CMD1502 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.AnswerCode));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+
+ public byte[] SendRCMD1504(out APDUModel APDUModel, CMD1504 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 1504;
+ model.checksumDomain = 0x01;
+
+ model.dataDomain = GetRCMD1504DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD1504DataInfo(CMD1504 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Sign));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.ReceiveMessageNum));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+
+
+ public byte[] SendRCMD1506(out APDUModel APDUModel, CMD1506 CMD)
+ {
+ byte[] result = null;
+
+ APDUModel model = new APDUModel();
+ model.OriginDomain1 = 0xAA;
+ model.OriginDomain2 = 0xF5;
+ model.infoDomain = 0x02;
+ model.SerialNumberDomain = 0xff;
+ model.CMD = 1506;
+ model.checksumDomain = 0x01;
+
+
+ model.dataDomain = GetRCMD1506DataInfo(CMD); //
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+
+ List lstResult = new List();
+ lstResult.AddRange(APCI(model).ToArray());
+ result = lstResult.ToArray();
+
+ APDUModel = model;
+ return result;
+ }
+
+ ///
+ /// ȡȨϢֽ
+ ///
+ ///
+ /// ȨϢֽ
+ private byte[] GetRCMD1506DataInfo(CMD1506 CMD)
+ {
+ byte[] results = null;
+ if (CMD != null)
+ {
+ List lstContent = new List();
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
+ lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
+
+ results = lstContent.ToArray();
+ }
+ return results;
+ }
+ #endregion
+
+ List APCI(APDUModel baseApci)
+ {
+ List lstResult = null;
+ if (baseApci != null)
+ {
+ lstResult = new List();
+ //ʼ
+ lstResult.Add(baseApci.OriginDomain1);
+ lstResult.Add(baseApci.OriginDomain2);
+ //
+ byte[] packLens = BitConverter.GetBytes(baseApci.LengthDomain);
+ lstResult.AddRange(packLens);
+ //Ϣ
+ lstResult.Add(baseApci.infoDomain);
+ //к
+ lstResult.Add(baseApci.SerialNumberDomain);
+ //Դַ
+ byte[] packSrcs = BitConverter.GetBytes(baseApci.CMD);
+ lstResult.AddRange(packSrcs);
+ //
+ lstResult.AddRange(baseApci.dataDomain);
+
+ baseApci.checksumDomain = checksumDomain(lstResult.ToArray());
+ //У
+ lstResult.Add(baseApci.checksumDomain);
+ }
+ return lstResult;
+ }
+ ///
+ /// ݰ-У
+ ///
+ ///
+ ///
+ public static byte checksumDomain(byte[] data)
+ {
+ int checksum = 0;
+
+ for (int i = 6; i < data.Count(); i++)//ûУԲһ
+ {
+ checksum += data[i];
+ }
+
+ //foreach (byte b in data)
+ //{
+ // checksum += b;
+ //}
+ // ȡУ͵ĵ8λ
+ return (byte)(checksum & 0xFF);
+ }
+ }
+}
diff --git a/HybirdFrameworkEntity/Class1.cs b/HybirdFrameworkEntity/Class1.cs
deleted file mode 100644
index 71c4664..0000000
--- a/HybirdFrameworkEntity/Class1.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace HybirdFrameworkEntity
-{
- public class Class1
- {
-
- }
-}
diff --git a/HybirdFrameworkEntity/MsgModel/Decode.cs b/HybirdFrameworkEntity/MsgModel/Decode.cs
deleted file mode 100644
index 345d201..0000000
--- a/HybirdFrameworkEntity/MsgModel/Decode.cs
+++ /dev/null
@@ -1,1766 +0,0 @@
-using Newtonsoft.Json;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace HybirdFrameworkEntity
-{
- public class Decode
- {
- public void decode(string IP,string port,byte[] data)
- {
- switch (IP)
- {
- case "1":
-
- break;
- case "2":
- break;
- case "3":
- break;
- case "4":
- break;
- case "5":
- break;
- }
- int func = (ushort)(data[6] + (data[6 + 1] << 8));
- switch (func)
- {
- #region 协议格式
-
- case 2:
- {
- CMD2 CMD2 = ConCMD2(data);
- string result = "(CMD=2)充电桩参数整形设置/查询应答 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "(CMD=2)充电桩参数整形设置/查询应答对象:" + JsonConvert.SerializeObject(CMD2);
- ////Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
-
- }
- break;
- case 4:
- {
- CMD4 CMD4 = ConCMD4(data);
- string result = "(CMD=4)充电桩参数字符形设置/查询应答 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "(CMD=4)充电桩参数字符形设置/查询应答对象:" + JsonConvert.SerializeObject(CMD4);
- ////Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
-
- }
- break;
- case 6:
- {
- CMD6 CMD6 = ConCMD6(data);
- string result = "(CMD=6)充电桩对后台控制命令应答- 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "(CMD=6)充电桩对后台控制命令应答对象:" + JsonConvert.SerializeObject(CMD6);
- ////Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
-
- }
- break;
- case 8:
- {
- CMD8 CMD8 = ConCMD8(data);
- string result = "(CMD=8) 充电桩对后台下发的充电桩开启充电控制应答 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "(CMD=8) 充电桩对后台下发的充电桩开启充电控制应答对象:" + JsonConvert.SerializeObject(CMD8);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
-
- }
- break;
- case 10:
- {
- CMD10 CMD10 = ConCMD10(data);
- string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD10);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
-
- }
- break;
- #endregion
-
- #region 充电桩主动上传数据
-
- case 102:
- {
- CMD102 CMD102 = ConCMD102(data);
- string result = "(CMD=10)充电桩上传心跳包信息 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "(CMD=10)充电桩上传心跳包信息对象:" + JsonConvert.SerializeObject(CMD102);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
-
- }
- break;
- case 104:
- {
- CMD104 CMD104 = ConCMD104(data);
- string result = "(CMD=10)充电桩状态信息包上报 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "(CMD=10)充电桩状态信息包上报对象:" + JsonConvert.SerializeObject(CMD104);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
-
- }
- break;
- case 106:
- {
- CMD106 CMD106 = ConCMD106(data);
- string result = "(CMD=10)充电桩签到信息上报 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "(CMD=10)充电桩签到信息上报对象:" + JsonConvert.SerializeObject(CMD106);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
-
- }
- break;
- case 108:
- {
- CMD108 CMD108 = ConCMD108(data);
- string result = "(CMD=10)充电桩告警信息上报(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "(CMD=10)充电桩告警信息上报(预留)对象:" + JsonConvert.SerializeObject(CMD108);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
-
- }
- break;
- case 110:
- {
- CMD110 CMD110 = ConCMD110(data);
- string result = "(CMD=10)充电桩上报充电启动完成命令(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "(CMD=10)充电桩上报充电启动完成命令(预留)对象:" + JsonConvert.SerializeObject(CMD110);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
-
- }
- break;
- case 112:
- {
- CMD112 CMD112 = ConCMD112(data);
- string result = "(CMD=10)充电桩模块信息上报(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "(CMD=10)充电桩模块信息上报对象:" + JsonConvert.SerializeObject(CMD112);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- case 114:
- {
- CMD114 CMD114 = ConCMD114(data);
- string result = "(CMD=10)充电桩应答服务器查询最近一次充电各时段信息 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "(CMD=10)充电桩应答服务器查询最近一次充电各时段信息对象:" + JsonConvert.SerializeObject(CMD114);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- #endregion
-
- #region 充电信息数据
-
- case 202:
- case 222:
- {
- CMD202 CMD202 = ConCMD202((UInt16)func, data);
- string result = "充电桩上报充电记录信息 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "上报充电记录信息对象:" + JsonConvert.SerializeObject(CMD202);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
-
- }
- break;
- case 204:
- {
- CMD204 CMD204 = ConCMD204(data);
- string result = "充电桩充电上传用户账户查询报文 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩充电上传用户账户查询报文对象:" + JsonConvert.SerializeObject(CMD204);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
-
- }
- break;
- case 206:
- {
- CMD206 CMD206 = ConCMD206(data);
- string result = "充电桩充电上传用户密码验证报文 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩充电上传用户密码验证报文对象:" + JsonConvert.SerializeObject(CMD206);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- case 208:
- {
- CMD208 CMD208 = ConCMD208(data);
- string result = "充电桩上报“即插即充”启动充电请求 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩上报“即插即充”启动充电请求对象:" + JsonConvert.SerializeObject(CMD208);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- case 210:
- {
- CMD210 CMD210 = ConCMD210(data);
- string result = "充电桩上报“即插即充”启动充电结果 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩上报“即插即充”启动充电结果:" + JsonConvert.SerializeObject(CMD210);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- #endregion
-
- #region 直流充电桩 BMS 信息数据(预留)
- case 302:
- {
- CMD302 CMD302 = ConCMD302(data);
- string result = "充电桩上报BMS信息 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩上报BMS信息对象:" + JsonConvert.SerializeObject(CMD302);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- case 304:
- {
- CMD304 CMD304 = ConCMD304(data);
- string result = "充电桩上报BMS信息(预留-暂时不用) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩上报BMS信息(预留-暂时不用)对象:" + JsonConvert.SerializeObject(CMD304);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- #endregion
-
- #region 历史记录
- case 402:
- case 422:
- {
- CMD402 CMD402 = ConCMD402((UInt16)func, data);
- string result = "充电桩上报历史的充电记录 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩上报历史的充电记录:" + JsonConvert.SerializeObject(CMD402);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
-
- }
- break;
- #endregion
-
- #region 升级命令
- case 1002:
- {
- CMD1002 CMD1002 = ConCMD1002(data);
- string result = "充电桩回复服务器下发擦除指令 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩回复服务器下发擦除指令对象:" + JsonConvert.SerializeObject(CMD1002);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- case 1004:
- {
- CMD1004 CMD1004 = ConCMD1004(data);
- string result = "充电桩应答服务器下发升级文件名指令 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩应答服务器下发升级文件名指令对象:" + JsonConvert.SerializeObject(CMD1004);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- case 1006:
- {
- CMD1006 CMD1006 = ConCMD1006(data);
- string result = "充电桩应答服务器下发升级文件大小指令 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩应答服务器下发升级文件大小指令对象:" + JsonConvert.SerializeObject(CMD1006);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- case 1008:
- {
- CMD1008 CMD1008 = ConCMD1008(data);
- string result = "充电桩应答服务器下发升级文件数据指令 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩应答服务器下发升级文件数据指令对象:" + JsonConvert.SerializeObject(CMD1008);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- case 1010:
- {
- CMD1010 CMD1010 = ConCMD1010(data);
- string result = "充电桩应答服务器下发升级文件数据结束指令 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩应答服务器下发升级文件数据结束指令对象:" + JsonConvert.SerializeObject(CMD1010);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- case 1012:
- {
- CMD1012 CMD1012 = ConCMD1012(data);
- string result = "充电桩应答服务器下发重启指令- 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩应答服务器下发重启指令对象:" + JsonConvert.SerializeObject(CMD1012);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- case 1022:
- {
- CMD1022 CMD1022 = ConCMD1022(data);
- string result = "充电桩主动请求升级命令 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩主动请求升级命令对象:" + JsonConvert.SerializeObject(CMD1022);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- #endregion
-
- #region 与计费策略相关的指令
- case 1102:
- {
- CMD1102 CMD1102 = ConCMD1102(data);
- string result = "充电桩应答后台服务器查询24时电费计价策略信息- 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩应答后台服务器查询24时电费计价策略信息对象:" + JsonConvert.SerializeObject(CMD1102);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- case 1104:
- {
- CMD1104 CMD1104 = ConCMD1104(data);
- string result = "充电桩应答后台服务器设置24时电费计价策略信息 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩应答后台服务器设置24时电费计价策略信息对象:" + JsonConvert.SerializeObject(CMD1104);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- case 1106:
- {
- CMD1106 CMD1106 = ConCMD1106(data);
- string result = "充电桩应答后台服务器设置分时段计价策略信息 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩应答后台服务器设置分时段计价策略信息对象:" + JsonConvert.SerializeObject(CMD1106);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- case 1108:
- {
- CMD1108 CMD1108 = ConCMD1108(data);
- string result = "充电桩回复分时电费计价策略信息 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩回复分时电费计价策略信息对象:" + JsonConvert.SerializeObject(CMD1108);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- #endregion
-
- #region 白名单报文
- case 1302:
- {
- CMD1302 CMD1302 = ConCMD1302(data);
- string result = "充电桩应答白名单操作日志数据包 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩应答白名单操作日志数据包对象:" + JsonConvert.SerializeObject(CMD1302);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- #endregion
-
- #region FTP远程升级和FTP方式日志上传
- case 1402:
- {
- CMD1402 CMD1402 = ConCMD1402(data);
- string result = "充电桩应答服务器下发FTP远程升级命令- 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩应答服务器下发FTP远程升级命令对象:" + JsonConvert.SerializeObject(CMD1402);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- case 1403:
- {
- CMD1403 CMD1403 = ConCMD1403(data);
- string result = "充电桩应答FTP升级包下载进度 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩应答FTP升级包下载进度对象:" + JsonConvert.SerializeObject(CMD1403);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- case 1407:
- {
- CMD1407 CMD1407 = ConCMD1407(data);
- string result = "充电桩应答服务器下发获取充电桩日志命令 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "充电桩应答服务器下发获取充电桩日志命令对象:" + JsonConvert.SerializeObject(CMD1407);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- #endregion
-
- #region 协议方式日志上传
- case 1501:
- {
- CMD1501 CMD1501 = ConCMD1501(data);
- string result = "(CMD=1501)申请上传文件 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "(CMD=1501)申请上传文件对象:" + JsonConvert.SerializeObject(CMD1501);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- case 1503:
- {
- CMD1503 CMD1503 = ConCMD1503(data);
- string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1503);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
-
- }
- break;
- case 1505://接收完成,要保存关闭
- {
- CMD1505 CMD1505 = ConCMD1505(data);
- string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
- result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1505);
- //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
- }
- break;
- #endregion
- }
- }
-
-
- public CMD2 ConCMD2(byte[] data)
- {
- CMD2 CMD2 = null;
- if (data != null && data.Length > 0)
- {
- CMD2 = new CMD2();
- CMD2.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD2.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD2.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD2.Type = data[44];
- CMD2.SAddress = ByteUtils.DToUInt32(data, 45);
- CMD2.SNum = data[50];
- CMD2.SResult = data[51];
- CMD2.SData = Encoding.ASCII.GetString(data, 52, (data.Length - 52));
-
- }
- return CMD2;
- }
- public CMD4 ConCMD4(byte[] data)
- {
- CMD4 CMD4 = null;
- if (data != null && data.Length > 0)
- {
- CMD4 = new CMD4();
- CMD4.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD4.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD4.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD4.Type = data[44];
- CMD4.SAddress = ByteUtils.DToUInt32(data, 45);
- CMD4.SResult = data[49];
- CMD4.SData = Encoding.ASCII.GetString(data, 50, (data.Length - 51));
-
- }
- return CMD4;
- }
- public CMD6 ConCMD6(byte[] data)
- {
- CMD6 CMD6 = null;
- if (data != null && data.Length > 0)
- {
- CMD6 = new CMD6();
- CMD6.value01 = ByteUtils.DToUInt16(data, 8);
- CMD6.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD6.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD6.ChargMuzzle = data[44];
- CMD6.CommandMark = ByteUtils.DToUInt32(data, 45);
- CMD6.CommandNum = data[49];
- CMD6.CommandResult = data[50];
- }
- return CMD6;
- }
- public CMD8 ConCMD8(byte[] data)
- {
- CMD8 CMD8 = null;
- if (data != null && data.Length > 0)
- {
- CMD8 = new CMD8();
- CMD8.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD8.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD8.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD8.ChargMuzzle = data[44];
- CMD8.CommandResult = ByteUtils.DToUInt16(data, 45);
- CMD8.ChargSerialNum = Encoding.ASCII.GetString(data, 49, 32);
- }
- return CMD8;
- }
- public CMD10 ConCMD10(byte[] data)
- {
- CMD10 CMD10 = null;
- if (data != null && data.Length > 0)
- {
- CMD10 = new CMD10();
- CMD10.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD10.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD10.ASCIINum = Encoding.ASCII.GetString(data, 12, 32); ;
- CMD10.ChargGunNum = data[44];
- CMD10.RequestStaIP = ByteUtils.DToUInt32(data, 45);
- CMD10.Parameter = (float)((ByteUtils.DToUInt32(data, 49)) * 0.01);
- }
- return CMD10;
- }
- public CMD102 ConCMD102(byte[] data)
- {
- CMD102 CMD102 = null;
- if (data != null && data.Length > 0)
- {
- CMD102 = new CMD102();
- CMD102.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD102.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD102.ASCIINum = Encoding.ASCII.GetString(data, 12, 32); ;
- CMD102.HeartNum = ByteUtils.DToUInt16(data, 44);
- CMD102.GunStatus[0] = data[46];
- CMD102.GunStatus[1] = data[47];
- CMD102.GunStatus[2] = data[48];
- CMD102.GunStatus[3] = data[49];
- CMD102.GunStatus[4] = data[50];
- CMD102.GunStatus[5] = data[51];
- CMD102.GunStatus[6] = data[52];
- CMD102.GunStatus[7] = data[53];
- CMD102.GunStatus[8] = data[54];
- CMD102.GunStatus[9] = data[55];
- CMD102.GunStatus[10] = data[56];
- CMD102.GunStatus[11] = data[57];
- CMD102.GunStatus[12] = data[58];
- CMD102.GunStatus[13] = data[59];
- CMD102.GunStatus[14] = data[60];
- CMD102.GunStatus[15] = data[61];
- }
- return CMD102;
- }
- public CMD104 ConCMD104(byte[] data)
- {
- CMD104 CMD104 = null;
- if (data != null && data.Length > 0)
- {
- CMD104 = new CMD104();
-
- CMD104.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD104.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD104.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD104.ChargGunNum = data[44];
- CMD104.ChargNum = data[45];
- CMD104.ChargGunType = data[46];
- CMD104.WorkState = data[47];
- CMD104.SOCNOW = data[48];
- CMD104.MaxAlarmCode = Encoding.ASCII.GetString(data, 49, 4);
- CMD104.ConnecteState = data[53];
- CMD104.TotalCost = (float)(ByteUtils.DToUInt32(data, 54) * 0.01);
- CMD104.Reserved3 = ByteUtils.DToUInt32(data, 58);
- CMD104.Reserved4 = ByteUtils.DToUInt32(data, 62);
- if (data[46] == 1)
- {
- CMD104.DcChargVoltage = ByteUtils.DToUInt16(data, 66);
- CMD104.DcChargCurrent = ByteUtils.DToUInt16(data, 68);
- CMD104.BMSDemVoltage = ByteUtils.DToUInt16(data, 70);
- CMD104.BMSDemCurrent = ByteUtils.DToUInt16(data, 72);
- }
- else
- {
- CMD104.DcChargVoltage = 0;
- CMD104.DcChargCurrent = 0;
- CMD104.BMSDemVoltage = 0;
- CMD104.BMSDemCurrent = 0;
- }
-
-
-
- CMD104.BMSchargMode = data[74];
- CMD104.AcChargVoltageA = ByteUtils.DToUInt16(data, 75);
- CMD104.AcChargVoltageB = ByteUtils.DToUInt16(data, 77);
- CMD104.AcChargVoltageC = ByteUtils.DToUInt16(data, 79);
- CMD104.AcChargCurrentA = ByteUtils.DToUInt16(data, 81);
- CMD104.AcChargCurrentB = ByteUtils.DToUInt16(data, 83);
- CMD104.AcChargCurrentC = ByteUtils.DToUInt16(data, 85);
- CMD104.RemainTime = ByteUtils.DToUInt16(data, 87);
- CMD104.ChargTime = ByteUtils.DToUInt32(data, 89);
- CMD104.TotalChargkwh = ByteUtils.DToUInt32(data, 93);
- CMD104.StartAmmeterValue = (float)(ByteUtils.DToUInt32(data, 97) * 0.01);
- CMD104.AmmeterValue = (float)(ByteUtils.DToUInt32(data, 101) * 0.01);
- CMD104.ChargStartMode = data[105];
- CMD104.ChargStrategy = data[106];
- CMD104.ChargStrategyPara = ByteUtils.DToUInt32(data, 107);
- CMD104.AppointmentSign = data[111];
- CMD104.ChargID = Encoding.ASCII.GetString(data, 112, 32);
- CMD104.OutTime = data[144];
- CMD104.StartTime = Encoding.ASCII.GetString(data, 145, 8);
- CMD104.InitialBalance = ByteUtils.DToUInt32(data, 153);
- CMD104.Reserved5 = ByteUtils.DToUInt32(data, 157);
- CMD104.ChargPower = (float)(ByteUtils.DToUInt32(data, 161) * 0.1);
- CMD104.Reserved6 = ByteUtils.DToUInt32(data, 165);
- CMD104.Reserved7 = ByteUtils.DToUInt32(data, 169);
- CMD104.Reserved8 = ByteUtils.DToUInt32(data, 173);
- CMD104.OutletTemp = data[177];
- CMD104.Temperature = data[178];
- CMD104.ChargGunTemp = data[179];
- CMD104.VINNum = Encoding.ASCII.GetString(data, 180, 18);
- CMD104.DoorState = data[198];
- CMD104.ChargSerialNum = Encoding.ASCII.GetString(data, 199, 32);
- CMD104.TotalElectricity = ByteUtils.DToUInt32(data, 231);
- CMD104.ServiceCharge = ByteUtils.DToUInt32(data, 235);
- CMD104.HomingState = data[239];
- CMD104.GroundLockedState = data[240];
- CMD104.KilojoulesElec = data[241];
- CMD104.DcACElectricity = ((float)(ByteUtils.DToUInt32(data, 242) * 0.001)).ToString("F1");
- CMD104.ChargMode = data[246];
- CMD104.ChargeOrDisSign = data[247];
- }
- return CMD104;
- }
- public CMD106 ConCMD106(byte[] data)
- {
- CMD106 CMD106 = null;
- if (data != null && data.Length > 0)
- {
- CMD106 = new CMD106();
- CMD106.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD106.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD106.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD106.Sign = data[44];
- CMD106.ChargVersion = ByteUtils.DToUInt32(data, 45);
- CMD106.ChargProType = ByteUtils.DToUInt16(data, 49);
- CMD106.StartNum = ByteUtils.DToUInt32(data, 51);
- CMD106.DataUploadMode = data[55];
- CMD106.SignInterval = ByteUtils.DToUInt16(data, 56);
- CMD106.RunVariable = data[58];
- CMD106.ChargGunNum = data[59];
- CMD106.HeartReportCycle = data[60];
- CMD106.TimeoutNum = data[61];
- CMD106.RecordNum = ByteUtils.DToUInt32(data, 62);
- CMD106.SystemTime = Encoding.ASCII.GetString(data, 66, 8);
- CMD106.Reserved3 = Encoding.ASCII.GetString(data, 74, 8);
- CMD106.Reserved4 = Encoding.ASCII.GetString(data, 82, 8);
- CMD106.Reserved5 = Encoding.ASCII.GetString(data, 90, 8);
- CMD106.RandomNum = ByteUtils.DToUInt32(data, 98);
- CMD106.ProtocolVersion = ByteUtils.DToUInt16(data, 102);
- CMD106.WhiteVersionNum = ByteUtils.DToUInt16(data, 104);
- CMD106.DeviceType = data[108];
- CMD106.AssetCoding = Encoding.ASCII.GetString(data, 109, 32);
- }
- return CMD106;
- }
- public CMD108 ConCMD108(byte[] data)
- {
- CMD108 CMD108 = null;
- if (data != null && data.Length > 0)
- {
- CMD108 = new CMD108();
- CMD108.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD108.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD108.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD108.AlarmBitInfo = Encoding.ASCII.GetString(data, 44, 32);
- }
- return CMD108;
- }
- public CMD110 ConCMD110(byte[] data)
- {
- CMD110 CMD110 = null;
- if (data != null && data.Length > 0)
- {
- CMD110 = new CMD110();
- CMD110.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD110.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD110.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD110.ChargGunNum = data[44];
- CMD110.ChargeFail = ByteUtils.DToUInt32(data, 45);
- CMD110.SendMessage = ByteUtils.DToUInt16(data, 49);
- CMD110.Reserved3 = ByteUtils.DToUInt16(data, 51);
- CMD110.Reserved4 = ByteUtils.DToUInt32(data, 53);
- byte version1 = data[58];
- byte version2 = data[59];
- byte version3 = data[60];
- CMD110.BRMBMSVersionNum = "v" + version1.ToString() + version2.ToString() + version3.ToString();
- CMD110.BRMBatteryType = data[61];
- CMD110.BRMRatedCapacity = ByteUtils.DToUInt32(data, 62);
- CMD110.BRMRatedVoltage = ByteUtils.DToUInt32(data, 66);
- CMD110.BRMBatteryManu = ByteUtils.DToUInt32(data, 70);
- CMD110.BRMBatteryPackID = ByteUtils.DToUInt32(data, 74);
- CMD110.BRMDateYear = ByteUtils.DToUInt16(data, 78);
- CMD110.BRMDateMonth = data[80];
- CMD110.BRMDateDay = data[81];
- CMD110.BRMChargeCount = ByteUtils.DToUInt32(data, 82);
- CMD110.BRMTitleMark = data[86];
- CMD110.Reserved5 = data[87];
- CMD110.BRMVINID = Encoding.ASCII.GetString(data, 88, 17);
-
- byte VersionSerialNum = data[105];
- byte day = data[106];
- byte month = data[107];
- ushort year = ByteUtils.DToUInt16(data, 108);
-
-
- CMD110.BRMBMSSoftVerNum = VersionSerialNum.ToString() + year.ToString() + "年" + month.ToString() + "月" + day.ToString() + "日";
- CMD110.MaxChargVoltage = (float)(ByteUtils.DToUInt32(data, 113) * 0.1);
- CMD110.MaxChargCurrent = (float)(ByteUtils.DToUInt32(data, 117) * 0.1);
- CMD110.TotalEnergy = (float)(ByteUtils.DToUInt32(data, 121) * 0.1);
- CMD110.MaxTotalVoltage = (float)(ByteUtils.DToUInt32(data, 125) * 0.1);
- CMD110.MaxTemp = data[129];
- CMD110.ChargeState = (float)(ByteUtils.DToUInt16(data, 130) * 0.1);
- CMD110.CellVoltage = (float)(ByteUtils.DToUInt32(data, 132) * 0.1);
- CMD110.ChargSerialNum = Encoding.ASCII.GetString(data, 136, 32);
- }
- return CMD110;
- }
- public CMD112 ConCMD112(byte[] data)
- {
- CMD112 CMD112 = null;
- if (data != null && data.Length > 0)
- {
- CMD112 = new CMD112();
- CMD112.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD112.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD112.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD112.ReportMode = data[44];
- CMD112.ModuleNum = data[45];
- CMD112.ModuleType = data[46];
- CMD112.ACModuleversion1 = ByteUtils.DToUInt16(data, 47);
- CMD112.DCModuleversion1 = ByteUtils.DToUInt16(data, 49);
- CMD112.ModuleState1 = data[51];
- CMD112.ModuleOutVoltage1 = ByteUtils.DToUInt16(data, 52);
- CMD112.ModuleOutCurrent1 = ByteUtils.DToUInt16(data, 54);
- CMD112.ModuleAlarm1 = ByteUtils.DToUInt32(data, 56);
- CMD112.ACModuleversion2 = ByteUtils.DToUInt16(data, 60);
- CMD112.DCModuleversion2 = ByteUtils.DToUInt16(data, 62);
- CMD112.ModuleState2 = data[64];
- CMD112.ModuleOutVoltage2 = ByteUtils.DToUInt16(data, 65);
- CMD112.ModuleOutCurrent2 = ByteUtils.DToUInt16(data, 67);
- CMD112.ModuleAlarm2 = ByteUtils.DToUInt32(data, 69);
- }
- return CMD112;
- }
- public CMD114 ConCMD114(byte[] data)
- {
- CMD114 CMD114 = null;
- if (data != null && data.Length > 0)
- {
- CMD114 = new CMD114();
- CMD114.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD114.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD114.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD114.ChargGunNum = data[44];
- CMD114.WorkState = data[45];
- CMD114.StartChargTime = Encoding.ASCII.GetString(data, 46, 8);
- /*
- 7 54
- 8 56
- 9 58
- 10 60
- 11 62
- 12 64
- 13 66
- 14 68
- 15 70
- 16 72
- 17 74
- 18 76
- 19 78
- 20 80
- 21 82
- 22 84
- 23 86
- 24 88
- 25 90
- 26 92
- 27 94
- 28 96
- 29 98
- 30 100
- 31 102
- 32 104
- 33 106
- 34 108
- 35 110
- 36 112
- 37 114
- 38 116
- 39 118
- 40 120
- 41 122
- 42 124
- 43 126
- 44 128
- 45 130
- 46 132
- 47 134
- 48 136
- 49 138
- 50 140
- 51 142
- 52 144
- 53 146
- 54 148
-
- */
- CMD114.Charge01 = ByteUtils.DToUInt16(data, 54);
- CMD114.Charge02 = ByteUtils.DToUInt16(data, 56);
- CMD114.Charge03 = ByteUtils.DToUInt16(data, 58);
- CMD114.Charge04 = ByteUtils.DToUInt16(data, 60);
- CMD114.Charge05 = ByteUtils.DToUInt16(data, 62);
- CMD114.Charge06 = ByteUtils.DToUInt16(data, 64);
- CMD114.Charge07 = ByteUtils.DToUInt16(data, 66);
- CMD114.Charge08 = ByteUtils.DToUInt16(data, 68);
- CMD114.Charge09 = ByteUtils.DToUInt16(data, 70);
- CMD114.Charge10 = ByteUtils.DToUInt16(data, 72);
- CMD114.Charge11 = ByteUtils.DToUInt16(data, 74);
- CMD114.Charge12 = ByteUtils.DToUInt16(data, 76);
- CMD114.Charge13 = ByteUtils.DToUInt16(data, 78);
- CMD114.Charge14 = ByteUtils.DToUInt16(data, 80);
- CMD114.Charge15 = ByteUtils.DToUInt16(data, 82);
- CMD114.Charge16 = ByteUtils.DToUInt16(data, 84);
- CMD114.Charge17 = ByteUtils.DToUInt16(data, 86);
- CMD114.Charge18 = ByteUtils.DToUInt16(data, 88);
- CMD114.Charge19 = ByteUtils.DToUInt16(data, 90);
- CMD114.Charge20 = ByteUtils.DToUInt16(data, 92);
- CMD114.Charge21 = ByteUtils.DToUInt16(data, 94);
- CMD114.Charge22 = ByteUtils.DToUInt16(data, 96);
- CMD114.Charge23 = ByteUtils.DToUInt16(data, 98);
- CMD114.Charge24 = ByteUtils.DToUInt16(data, 100);
- CMD114.Charge25 = ByteUtils.DToUInt16(data, 102);
- CMD114.Charge26 = ByteUtils.DToUInt16(data, 104);
- CMD114.Charge27 = ByteUtils.DToUInt16(data, 106);
- CMD114.Charge29 = ByteUtils.DToUInt16(data, 108);
- CMD114.Charge30 = ByteUtils.DToUInt16(data, 110);
- CMD114.Charge31 = ByteUtils.DToUInt16(data, 112);
- CMD114.Charge32 = ByteUtils.DToUInt16(data, 114);
- CMD114.Charge33 = ByteUtils.DToUInt16(data, 116);
- CMD114.Charge34 = ByteUtils.DToUInt16(data, 118);
- CMD114.Charge35 = ByteUtils.DToUInt16(data, 120);
- CMD114.Charge36 = ByteUtils.DToUInt16(data, 122);
- CMD114.Charge37 = ByteUtils.DToUInt16(data, 124);
- CMD114.Charge38 = ByteUtils.DToUInt16(data, 126);
- CMD114.Charge39 = ByteUtils.DToUInt16(data, 128);
- CMD114.Charge40 = ByteUtils.DToUInt16(data, 130);
- CMD114.Charge41 = ByteUtils.DToUInt16(data, 132);
- }
- return CMD114;
- }
- public CMD202 ConCMD202(uint func, byte[] data)
- {
- CMD202 CMD202 = null;
- if (data != null && data.Length > 0)
- {
- CMD202 = new CMD202();
- CMD202.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD202.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD202.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD202.PosType = data[44];
- CMD202.ChargGun = data[45];
- CMD202.ChargID = Encoding.ASCII.GetString(data, 46, 32);
- CMD202.StartTime = Encoding.ASCII.GetString(data, 78, 8);
- CMD202.EndTime = Encoding.ASCII.GetString(data, 86, 8);
- CMD202.TimeSpan = ByteUtils.DToUInt32(data, 94);
- CMD202.SOCStart = data[98];
- CMD202.SOCEnd = data[99];
- CMD202.EndReason = ByteUtils.DToUInt32(data, 100);
-
- if (func == 202)
- {
- CMD202.ChargCapacityNow = (ByteUtils.DToUInt32(data, 104) * 0.01).ToString("F2");
- CMD202.SAmmeterValue = (ByteUtils.DToUInt32(data, 108) * 0.01).ToString("F2");
- CMD202.EAmmeterValue = (ByteUtils.DToUInt32(data, 112) * 0.01).ToString("F2");
-
-
- CMD202.ChargCapacity01 = ByteUtils.DToUInt16(data, 167).ToString();
- CMD202.ChargCapacity02 = ByteUtils.DToUInt16(data, 169).ToString();
- CMD202.ChargCapacity03 = ByteUtils.DToUInt16(data, 171).ToString();
- CMD202.ChargCapacity04 = ByteUtils.DToUInt16(data, 173).ToString();
- CMD202.ChargCapacity05 = ByteUtils.DToUInt16(data, 175).ToString();
- CMD202.ChargCapacity06 = ByteUtils.DToUInt16(data, 177).ToString();
- CMD202.ChargCapacity07 = ByteUtils.DToUInt16(data, 179).ToString();
- CMD202.ChargCapacity08 = ByteUtils.DToUInt16(data, 181).ToString();
- CMD202.ChargCapacity09 = ByteUtils.DToUInt16(data, 183).ToString();
- CMD202.ChargCapacity10 = ByteUtils.DToUInt16(data, 185).ToString();
- CMD202.ChargCapacity11 = ByteUtils.DToUInt16(data, 187).ToString();
- CMD202.ChargCapacity12 = ByteUtils.DToUInt16(data, 189).ToString();
- CMD202.ChargCapacity13 = ByteUtils.DToUInt16(data, 191).ToString();
- CMD202.ChargCapacity14 = ByteUtils.DToUInt16(data, 193).ToString();
- CMD202.ChargCapacity15 = ByteUtils.DToUInt16(data, 195).ToString();
- CMD202.ChargCapacity16 = ByteUtils.DToUInt16(data, 197).ToString();
- CMD202.ChargCapacity17 = ByteUtils.DToUInt16(data, 199).ToString();
- CMD202.ChargCapacity18 = ByteUtils.DToUInt16(data, 201).ToString();
- CMD202.ChargCapacity19 = ByteUtils.DToUInt16(data, 203).ToString();
- CMD202.ChargCapacity20 = ByteUtils.DToUInt16(data, 205).ToString();
- CMD202.ChargCapacity21 = ByteUtils.DToUInt16(data, 207).ToString();
- CMD202.ChargCapacity22 = ByteUtils.DToUInt16(data, 209).ToString();
- CMD202.ChargCapacity23 = ByteUtils.DToUInt16(data, 211).ToString();
- CMD202.ChargCapacity24 = ByteUtils.DToUInt16(data, 213).ToString();
- CMD202.ChargCapacity25 = ByteUtils.DToUInt16(data, 215).ToString();
- CMD202.ChargCapacity26 = ByteUtils.DToUInt16(data, 217).ToString();
- CMD202.ChargCapacity27 = ByteUtils.DToUInt16(data, 219).ToString();
- CMD202.ChargCapacity28 = ByteUtils.DToUInt16(data, 221).ToString();
- CMD202.ChargCapacity29 = ByteUtils.DToUInt16(data, 223).ToString();
- CMD202.ChargCapacity30 = ByteUtils.DToUInt16(data, 225).ToString();
- CMD202.ChargCapacity31 = ByteUtils.DToUInt16(data, 227).ToString();
- CMD202.ChargCapacity32 = ByteUtils.DToUInt16(data, 229).ToString();
- CMD202.ChargCapacity33 = ByteUtils.DToUInt16(data, 231).ToString();
- CMD202.ChargCapacity34 = ByteUtils.DToUInt16(data, 233).ToString();
- CMD202.ChargCapacity35 = ByteUtils.DToUInt16(data, 235).ToString();
- CMD202.ChargCapacity36 = ByteUtils.DToUInt16(data, 237).ToString();
- CMD202.ChargCapacity37 = ByteUtils.DToUInt16(data, 239).ToString();
- CMD202.ChargCapacity38 = ByteUtils.DToUInt16(data, 241).ToString();
- CMD202.ChargCapacity39 = ByteUtils.DToUInt16(data, 243).ToString();
- CMD202.ChargCapacity40 = ByteUtils.DToUInt16(data, 245).ToString();
- CMD202.ChargCapacity41 = ByteUtils.DToUInt16(data, 247).ToString();
- CMD202.ChargCapacity42 = ByteUtils.DToUInt16(data, 249).ToString();
- CMD202.ChargCapacity43 = ByteUtils.DToUInt16(data, 251).ToString();
- CMD202.ChargCapacity44 = ByteUtils.DToUInt16(data, 253).ToString();
- CMD202.ChargCapacity45 = ByteUtils.DToUInt16(data, 255).ToString();
- CMD202.ChargCapacity46 = ByteUtils.DToUInt16(data, 257).ToString();
- CMD202.ChargCapacity47 = ByteUtils.DToUInt16(data, 259).ToString();
- CMD202.ChargCapacity48 = ByteUtils.DToUInt16(data, 261).ToString();
-
- CMD202.StartMode = data[263];
- CMD202.ChargSerialNum = Encoding.ASCII.GetString(data, 264, 32);
- CMD202.ChargServiceCost = ByteUtils.DToUInt32(data, 296);
- CMD202.KilElectricity = data[300];
- CMD202.ParallelMark = data[301];
- CMD202.ChargeOrDisMark = data[302];
- CMD202.MeterEncData = Encoding.ASCII.GetString(data, 303, 34);
- CMD202.MeterNum = Encoding.ASCII.GetString(data, 337, 6);
- CMD202.MeterProVersion = ByteUtils.DToUInt16(data, 343);
- CMD202.EncMode = data[345];
- }
- else if (func == 222)
- {
- CMD202.ChargCapacityNow = (ByteUtils.DToUInt32(data, 104) * 0.001).ToString("F3");
- CMD202.SAmmeterValue = (ByteUtils.DToUInt32(data, 108) * 0.001).ToString("F3");
- CMD202.EAmmeterValue = (ByteUtils.DToUInt32(data, 112) * 0.001).ToString("F3");
-
-
- CMD202.ChargCapacity01 = (ByteUtils.DToUInt32(data, 167) * 0.001).ToString("F3");
- CMD202.ChargCapacity02 = (ByteUtils.DToUInt32(data, 171) * 0.001).ToString("F3");
- CMD202.ChargCapacity03 = (ByteUtils.DToUInt32(data, 175) * 0.001).ToString("F3");
- CMD202.ChargCapacity04 = (ByteUtils.DToUInt32(data, 179) * 0.001).ToString("F3");
- CMD202.ChargCapacity05 = (ByteUtils.DToUInt32(data, 183) * 0.001).ToString("F3");
- CMD202.ChargCapacity06 = (ByteUtils.DToUInt32(data, 187) * 0.001).ToString("F3");
- CMD202.ChargCapacity07 = (ByteUtils.DToUInt32(data, 191) * 0.001).ToString("F3");
- CMD202.ChargCapacity08 = (ByteUtils.DToUInt32(data, 195) * 0.001).ToString("F3");
- CMD202.ChargCapacity09 = (ByteUtils.DToUInt32(data, 199) * 0.001).ToString("F3");
- CMD202.ChargCapacity10 = (ByteUtils.DToUInt32(data, 203) * 0.001).ToString("F3");
- CMD202.ChargCapacity11 = (ByteUtils.DToUInt32(data, 207) * 0.001).ToString("F3");
- CMD202.ChargCapacity12 = (ByteUtils.DToUInt32(data, 211) * 0.001).ToString("F3");
- CMD202.ChargCapacity13 = (ByteUtils.DToUInt32(data, 215) * 0.001).ToString("F3");
- CMD202.ChargCapacity14 = (ByteUtils.DToUInt32(data, 219) * 0.001).ToString("F3");
- CMD202.ChargCapacity15 = (ByteUtils.DToUInt32(data, 223) * 0.001).ToString("F3");
- CMD202.ChargCapacity16 = (ByteUtils.DToUInt32(data, 227) * 0.001).ToString("F3");
- CMD202.ChargCapacity17 = (ByteUtils.DToUInt32(data, 231) * 0.001).ToString("F3");
- CMD202.ChargCapacity18 = (ByteUtils.DToUInt32(data, 235) * 0.001).ToString("F3");
- CMD202.ChargCapacity19 = (ByteUtils.DToUInt32(data, 239) * 0.001).ToString("F3");
- CMD202.ChargCapacity20 = (ByteUtils.DToUInt32(data, 243) * 0.001).ToString("F3");
- CMD202.ChargCapacity21 = (ByteUtils.DToUInt32(data, 247) * 0.001).ToString("F3");
- CMD202.ChargCapacity22 = (ByteUtils.DToUInt32(data, 251) * 0.001).ToString("F3");
- CMD202.ChargCapacity23 = (ByteUtils.DToUInt32(data, 255) * 0.001).ToString("F3");
- CMD202.ChargCapacity24 = (ByteUtils.DToUInt32(data, 259) * 0.001).ToString("F3");
- CMD202.ChargCapacity25 = (ByteUtils.DToUInt32(data, 263) * 0.001).ToString("F3");
- CMD202.ChargCapacity26 = (ByteUtils.DToUInt32(data, 267) * 0.001).ToString("F3");
- CMD202.ChargCapacity27 = (ByteUtils.DToUInt32(data, 271) * 0.001).ToString("F3");
- CMD202.ChargCapacity28 = (ByteUtils.DToUInt32(data, 275) * 0.001).ToString("F3");
- CMD202.ChargCapacity29 = (ByteUtils.DToUInt32(data, 279) * 0.001).ToString("F3");
- CMD202.ChargCapacity30 = (ByteUtils.DToUInt32(data, 283) * 0.001).ToString("F3");
- CMD202.ChargCapacity31 = (ByteUtils.DToUInt32(data, 287) * 0.001).ToString("F3");
- CMD202.ChargCapacity32 = (ByteUtils.DToUInt32(data, 291) * 0.001).ToString("F3");
- CMD202.ChargCapacity33 = (ByteUtils.DToUInt32(data, 295) * 0.001).ToString("F3");
- CMD202.ChargCapacity34 = (ByteUtils.DToUInt32(data, 299) * 0.001).ToString("F3");
- CMD202.ChargCapacity35 = (ByteUtils.DToUInt32(data, 303) * 0.001).ToString("F3");
- CMD202.ChargCapacity36 = (ByteUtils.DToUInt32(data, 307) * 0.001).ToString("F3");
- CMD202.ChargCapacity37 = (ByteUtils.DToUInt32(data, 311) * 0.001).ToString("F3");
- CMD202.ChargCapacity38 = (ByteUtils.DToUInt32(data, 315) * 0.001).ToString("F3");
- CMD202.ChargCapacity39 = (ByteUtils.DToUInt32(data, 319) * 0.001).ToString("F3");
- CMD202.ChargCapacity40 = (ByteUtils.DToUInt32(data, 323) * 0.001).ToString("F3");
- CMD202.ChargCapacity41 = (ByteUtils.DToUInt32(data, 327) * 0.001).ToString("F3");
- CMD202.ChargCapacity42 = (ByteUtils.DToUInt32(data, 331) * 0.001).ToString("F3");
- CMD202.ChargCapacity43 = (ByteUtils.DToUInt32(data, 335) * 0.001).ToString("F3");
- CMD202.ChargCapacity44 = (ByteUtils.DToUInt32(data, 339) * 0.001).ToString("F3");
- CMD202.ChargCapacity45 = (ByteUtils.DToUInt32(data, 343) * 0.001).ToString("F3");
- CMD202.ChargCapacity46 = (ByteUtils.DToUInt32(data, 347) * 0.001).ToString("F3");
- CMD202.ChargCapacity47 = (ByteUtils.DToUInt32(data, 351) * 0.001).ToString("F3");
- CMD202.ChargCapacity48 = (ByteUtils.DToUInt32(data, 355) * 0.001).ToString("F3");
-
- CMD202.StartMode = data[359];
- CMD202.ChargSerialNum = Encoding.ASCII.GetString(data, 360, 32);
- CMD202.ChargServiceCost = ByteUtils.DToUInt32(data, 392);
- CMD202.KilElectricity = data[396];
- CMD202.ParallelMark = data[397];
- CMD202.ChargeOrDisMark = data[398];
- CMD202.MeterEncData = Encoding.ASCII.GetString(data, 399, 34);
- CMD202.MeterNum = Encoding.ASCII.GetString(data, 433, 6);
- CMD202.MeterProVersion = ByteUtils.DToUInt16(data, 439);
- CMD202.EncMode = data[441];
- }
-
- CMD202.ChargeAmount = ByteUtils.DToUInt32(data, 116);
- CMD202.IndexNum = BitConverter.ToInt32(data, 120);
- CMD202.CardBalance = ByteUtils.DToUInt32(data, 124);
- CMD202.ChargRecord = ByteUtils.DToUInt32(data, 128);
- CMD202.SumChargRecord = ByteUtils.DToUInt32(data, 132);
- CMD202.Reserved3 = data[136];
- CMD202.ChargStrategy = data[137];
- switch (data[137])
- {
- case 1:
- CMD202.ChargStrategyPara = ByteUtils.DToUInt32(data, 138).ToString();
- break;
- case 2:
- CMD202.ChargStrategyPara = (ByteUtils.DToUInt32(data, 138) * 0.01).ToString("F2");
- break;
- case 3:
- CMD202.ChargStrategyPara = (ByteUtils.DToUInt32(data, 138) * 0.01).ToString("F2");
- break;
- }
-
-
-
- CMD202.CarVIN = Encoding.ASCII.GetString(data, 142, 17);
- CMD202.CarID = Encoding.ASCII.GetString(data, 159, 8);
-
-
- }
- return CMD202;
- }
- public CMD204 ConCMD204(byte[] data)
- {
- CMD204 CMD204 = null;
- if (data != null && data.Length > 0)
- {
- CMD204 = new CMD204();
- CMD204.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD204.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD204.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD204.ChargID = Encoding.ASCII.GetString(data, 44, 32);
- CMD204.Balance = ByteUtils.DToUInt32(data, 76);
- CMD204.BlacklistSign = data[80];
- CMD204.ChargCardPassword = Encoding.ASCII.GetString(data, 81, 32);
- CMD204.RandomData = Encoding.ASCII.GetString(data, 113, 48);
- CMD204.M1CardID = ByteUtils.DToUInt32(data, 161);
- CMD204.Auth = data[165];
- CMD204.ChargGunNum = data[166];
- }
- return CMD204;
- }
- public CMD206 ConCMD206(byte[] data)
- {
- CMD206 CMD206 = null;
- if (data != null && data.Length > 0)
- {
- CMD206 = new CMD206();
- CMD206.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD206.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD206.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD206.ChargID = Encoding.ASCII.GetString(data, 44, 32);
- CMD206.ChargPassword = Encoding.ASCII.GetString(data, 76, 32);
- CMD206.RandomData = Encoding.ASCII.GetString(data, 108, 48);
- }
- return CMD206;
- }
- public CMD208 ConCMD208(byte[] data)
- {
- CMD208 CMD208 = null;
- if (data != null && data.Length > 0)
- {
- CMD208 = new CMD208();
- CMD208.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD208.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD208.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD208.ChargGunNum = data[44];
- CMD208.VINNum = Encoding.ASCII.GetString(data, 45, 17);
- CMD208.ChargStrategy = data[62];
- CMD208.ChargStrategyPara = ByteUtils.DToUInt32(data, 63);
- }
- return CMD208;
- }
- public CMD210 ConCMD210(byte[] data)
- {
- CMD210 CMD210 = null;
- if (data != null && data.Length > 0)
- {
- CMD210 = new CMD210();
- CMD210.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD210.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD210.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD210.ChargGunNum = data[44];
- CMD210.StartResult = ByteUtils.DToUInt32(data, 45);
- }
- return CMD210;
- }
- public CMD222 ConCMD222(byte[] data)
- {
- CMD222 CMD222 = null;
- if (data != null && data.Length > 0)
- {
- CMD222 = new CMD222();
- CMD222.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD222.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD222.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD222.PosType = data[44];
- CMD222.ChargGun = data[45];
- CMD222.ChargID = Encoding.ASCII.GetString(data, 46, 32);
- CMD222.StartTime = Encoding.ASCII.GetString(data, 78, 8);
- CMD222.EndTime = Encoding.ASCII.GetString(data, 86, 8);
- CMD222.TimeSpan = ByteUtils.DToUInt32(data, 94);
- CMD222.SOCStart = data[98];
- CMD222.SOCEnd = data[99];
- CMD222.EndReason = ByteUtils.DToUInt32(data, 100);
- CMD222.ChargCapacityNow = ByteUtils.DToUInt32(data, 104);
- CMD222.SAmmeterValue = ByteUtils.DToUInt32(data, 108);
- CMD222.EAmmeterValue = ByteUtils.DToUInt32(data, 112);
- CMD222.ChargeAmount = ByteUtils.DToUInt32(data, 116);
- CMD222.IndexNum = ByteUtils.DToUInt32(data, 120);
- CMD222.CardBalance = ByteUtils.DToUInt32(data, 124);
- CMD222.ChargRecord = ByteUtils.DToUInt32(data, 128);
- CMD222.SumChargRecord = ByteUtils.DToUInt32(data, 132);
- CMD222.Reserved3 = data[136];
- CMD222.ChargStrategy = data[137];
- CMD222.ChargStrategyPara = ByteUtils.DToUInt32(data, 138);
- CMD222.CarVIN = Encoding.ASCII.GetString(data, 142, 17);
- CMD222.CarID = Encoding.ASCII.GetString(data, 159, 8);
- CMD222.ChargCapacity01 = (int)ByteUtils.DToUInt32(data, 167);
- CMD222.ChargCapacity02 = (int)ByteUtils.DToUInt32(data, 171);
- CMD222.ChargCapacity03 = (int)ByteUtils.DToUInt32(data, 175);
- CMD222.ChargCapacity04 = (int)ByteUtils.DToUInt32(data, 179);
- CMD222.ChargCapacity05 = (int)ByteUtils.DToUInt32(data, 183);
- CMD222.ChargCapacity06 = (int)ByteUtils.DToUInt32(data, 187);
- CMD222.ChargCapacity07 = (int)ByteUtils.DToUInt32(data, 191);
- CMD222.ChargCapacity08 = (int)ByteUtils.DToUInt32(data, 195);
- CMD222.ChargCapacity09 = (int)ByteUtils.DToUInt32(data, 199);
- CMD222.ChargCapacity10 = (int)ByteUtils.DToUInt32(data, 203);
- CMD222.ChargCapacity11 = (int)ByteUtils.DToUInt32(data, 207);
- CMD222.ChargCapacity12 = (int)ByteUtils.DToUInt32(data, 211);
- CMD222.ChargCapacity13 = (int)ByteUtils.DToUInt32(data, 215);
- CMD222.ChargCapacity14 = (int)ByteUtils.DToUInt32(data, 219);
- CMD222.ChargCapacity15 = (int)ByteUtils.DToUInt32(data, 223);
- CMD222.ChargCapacity16 = (int)ByteUtils.DToUInt32(data, 227);
- CMD222.ChargCapacity17 = (int)ByteUtils.DToUInt32(data, 231);
- CMD222.ChargCapacity18 = (int)ByteUtils.DToUInt32(data, 235);
- CMD222.ChargCapacity19 = (int)ByteUtils.DToUInt32(data, 239);
- CMD222.ChargCapacity20 = (int)ByteUtils.DToUInt32(data, 243);
- CMD222.ChargCapacity21 = (int)ByteUtils.DToUInt32(data, 247);
- CMD222.ChargCapacity22 = (int)ByteUtils.DToUInt32(data, 251);
- CMD222.ChargCapacity23 = (int)ByteUtils.DToUInt32(data, 255);
- CMD222.ChargCapacity24 = (int)ByteUtils.DToUInt32(data, 259);
- CMD222.ChargCapacity25 = (int)ByteUtils.DToUInt32(data, 263);
- CMD222.ChargCapacity26 = (int)ByteUtils.DToUInt32(data, 267);
- CMD222.ChargCapacity27 = (int)ByteUtils.DToUInt32(data, 271);
- CMD222.ChargCapacity28 = (int)ByteUtils.DToUInt32(data, 275);
- CMD222.ChargCapacity29 = (int)ByteUtils.DToUInt32(data, 279);
- CMD222.ChargCapacity30 = (int)ByteUtils.DToUInt32(data, 283);
- CMD222.ChargCapacity31 = (int)ByteUtils.DToUInt32(data, 287);
- CMD222.ChargCapacity32 = (int)ByteUtils.DToUInt32(data, 291);
- CMD222.ChargCapacity33 = (int)ByteUtils.DToUInt32(data, 295);
- CMD222.ChargCapacity34 = (int)ByteUtils.DToUInt32(data, 299);
- CMD222.ChargCapacity35 = (int)ByteUtils.DToUInt32(data, 303);
- CMD222.ChargCapacity36 = (int)ByteUtils.DToUInt32(data, 307);
- CMD222.ChargCapacity37 = (int)ByteUtils.DToUInt32(data, 311);
- CMD222.ChargCapacity38 = (int)ByteUtils.DToUInt32(data, 315);
- CMD222.ChargCapacity39 = (int)ByteUtils.DToUInt32(data, 319);
- CMD222.ChargCapacity40 = (int)ByteUtils.DToUInt32(data, 323);
- CMD222.ChargCapacity41 = (int)ByteUtils.DToUInt32(data, 327);
- CMD222.ChargCapacity42 = (int)ByteUtils.DToUInt32(data, 331);
- CMD222.ChargCapacity43 = (int)ByteUtils.DToUInt32(data, 335);
- CMD222.ChargCapacity44 = (int)ByteUtils.DToUInt32(data, 339);
- CMD222.ChargCapacity45 = (int)ByteUtils.DToUInt32(data, 343);
- CMD222.ChargCapacity46 = (int)ByteUtils.DToUInt32(data, 347);
- CMD222.ChargCapacity47 = (int)ByteUtils.DToUInt32(data, 351);
- CMD222.ChargCapacity48 = (int)ByteUtils.DToUInt32(data, 355);
- CMD222.StartMode = data[359];
- CMD222.ChargSerialNum = Encoding.ASCII.GetString(data, 360, 32);
- CMD222.ChargServiceCost = ByteUtils.DToUInt32(data, 392);
- CMD222.KilElectricity = data[394];
- CMD222.ParallelMark = data[395];
- CMD222.ChargeOrDisMark = data[396];
- CMD222.MeterEncData = data[397];
- CMD222.MeterNum = Encoding.ASCII.GetString(data, 398, 6);
- CMD222.MeterProVersion = ByteUtils.DToUInt16(data, 404);
- CMD222.EncMode = data[408];
- }
- return CMD222;
- }
- public CMD302 ConCMD302(byte[] data)
- {
- CMD302 CMD302 = null;
- if (data != null && data.Length > 0)
- {
- CMD302 = new CMD302();
- CMD302.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD302.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD302.MessageOrderNum = ByteUtils.DToUInt16(data, 12);
- CMD302.ChargGunNum = ByteUtils.DToUInt16(data, 14);
- CMD302.ASCIINum = Encoding.ASCII.GetString(data, 16, 32);
- CMD302.WorkState = data[48];
- CMD302.connectState = data[49];
- CMD302.BRMBMSVersionNum = data[50];
- CMD302.BRMBatteryType = data[51];
- CMD302.BRMRatedCapacity = ByteUtils.DToUInt32(data, 52);
- CMD302.BRMRatedVoltage = ByteUtils.DToUInt32(data, 56);
- CMD302.BRMBatteryManu = ByteUtils.DToUInt32(data, 60);
- CMD302.BRMBatteryPackID = ByteUtils.DToUInt32(data, 64);
- CMD302.BRMDateYear = ByteUtils.DToUInt16(data, 68);
- CMD302.BRMDateMonth = data[70];
- CMD302.BRMDateDay = data[71];
- CMD302.BRMChargeCount = ByteUtils.DToUInt32(data, 72);
- CMD302.BRMTitleMark = data[76];
- CMD302.Reserved3 = data[77];
- CMD302.BRMVINID = Encoding.ASCII.GetString(data, 78, 17);
- CMD302.BRMBMSSoftVerNum = ByteUtils.DToUInt16(data, 95);
- CMD302.MaxChargVoltage = ByteUtils.DToUInt32(data, 103);
- CMD302.MaxChargCurrent = ByteUtils.DToUInt32(data, 107);
- CMD302.TotalEnergy = ByteUtils.DToUInt32(data, 111);
- CMD302.MaxTotalVoltage = ByteUtils.DToUInt32(data, 115);
- CMD302.MaxTemp = data[119];
- CMD302.ChargeState = ByteUtils.DToUInt16(data, 120);
- CMD302.CellVoltage = ByteUtils.DToUInt32(data, 122);
- CMD302.ChargePrepared = data[126];
- CMD302.BCLVoltage = ByteUtils.DToUInt32(data, 127);
- CMD302.BCLCurrent = ByteUtils.DToUInt32(data, 131);
- CMD302.BCLChargMode = data[135];
- CMD302.BCSVoltageValue = ByteUtils.DToUInt32(data, 136);
- CMD302.BCSCurrentValue = ByteUtils.DToUInt32(data, 140);
- CMD302.BCSVoltageMAX = ByteUtils.DToUInt32(data, 144);
- CMD302.BCSBatteryNumMAX = data[145];
- CMD302.BCSChargState = ByteUtils.DToUInt16(data, 146);
- CMD302.ReChargeTime = ByteUtils.DToUInt32(data, 148);
- CMD302.BSMNum = data[152];
- CMD302.BSMMaxTemp = data[153];
- CMD302.MaxTempPointNum = data[154];
- CMD302.MinBatteryTemp = data[155];
- CMD302.MinTempPointNum = data[156];
- CMD302.voltageHighLow = data[157];
- CMD302.ChargStateHighLow = data[158];
- CMD302.BmsOvercurrent = data[159];
- CMD302.TempHigh = data[160];
- CMD302.InsulatState = data[161];
- CMD302.ConnectState = data[162];
- CMD302.AllowCharge = data[163];
- CMD302.SOCTargetValue = data[164];
- CMD302.SumVoltageSetValue = data[165];
- CMD302.VoltageSetValue = data[166];
- CMD302.ChargeEnd = data[167];
- CMD302.InsulatFault = data[168];
- CMD302.OvertempFault = data[169];
- CMD302.Overtemp = data[170];
- CMD302.ConnectorFault = data[171];
- CMD302.ChargOvertempFault = data[172];
- CMD302.HVoltageFault = data[173];
- CMD302.VoltageSenseFault = data[174];
- CMD302.OtherFault = data[175];
- CMD302.Overcurrent = data[176];
- CMD302.VoltageAnomaly = data[177];
- CMD302.VoltageAnomaly = data[178];
- CMD302.EndChargState = data[179];
- CMD302.MinVoltage = data[180];
- CMD302.MaxVoltage = data[181];
- CMD302.MinChargTemp = data[182];
- CMD302.MaxChargTemp = data[183];
- CMD302.ReceiveTimeout1 = data[184];
- CMD302.ReceiveTimeout2 = data[185];
- CMD302.ReceiveTimeout3 = data[186];
- CMD302.ReceiveTimeout4 = data[187];
- CMD302.ReceiveTimeout5 = data[188];
- CMD302.ReceiveTimeout6 = data[189];
- CMD302.ReceiveTimeout7 = data[190];
- CMD302.Other = data[191];
- }
- return CMD302;
- }
- public CMD304 ConCMD304(byte[] data)
- {
- CMD304 CMD304 = null;
- if (data != null && data.Length > 0)
- {
- CMD304 = new CMD304();
- CMD304.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD304.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD304.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD304.WorkState = data[44];
- CMD304.connectState = data[45];
- CMD304.BRMMessage = Encoding.ASCII.GetString(data, 46, 64);
- CMD304.VBIMessage = Encoding.ASCII.GetString(data, 110, 64);
- CMD304.ChargParameter = Encoding.ASCII.GetString(data, 174, 16);
- CMD304.ReadyState = ByteUtils.DToUInt16(data, 190);
- CMD304.ChargDemand = ByteUtils.DToUInt16(data, 198);
- CMD304.TotalState = Encoding.ASCII.GetString(data, 206, 16);
- CMD304.StateInfo = ByteUtils.DToUInt32(data, 222);
- CMD304.StopCharg = ByteUtils.DToUInt32(data, 226);
- CMD304.StatisticData = ByteUtils.DToUInt32(data, 230);
- CMD304.BEMMessage = ByteUtils.DToUInt32(data, 234);
- }
- return CMD304;
- }
- public CMD402 ConCMD402(uint func, byte[] data)
- {
- CMD402 CMD402 = null;
- if (data != null && data.Length > 0)
- {
- CMD402 = new CMD402();
- CMD402.Reserved1 = ByteUtils.DToUInt16(data, 8);
- CMD402.Reserved2 = ByteUtils.DToUInt16(data, 10);
- CMD402.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD402.PosType = data[44];
- CMD402.ChargGun = data[45];
- CMD402.ChargCardID = Encoding.ASCII.GetString(data, 46, 32);
- CMD402.ChargStartTime = Encoding.ASCII.GetString(data, 78, 8);
- CMD402.ChargEndTime = Encoding.ASCII.GetString(data, 86, 8);
- CMD402.ChargTimeLength = ByteUtils.DToUInt32(data, 94);
- CMD402.SOCStart = data[98];
- CMD402.SOCEnd = data[99];
- CMD402.ChargEndReason = Encoding.ASCII.GetString(data, 100, 4);
- if (func == 402)
- {
- CMD402.ChargCapacity = (ByteUtils.ToUInt32(data, 104) * 0.01).ToString("F2");
-
-
- CMD402.ChargCapacity01 = ((ByteUtils.DToUInt16(data, 167)) * 0.01).ToString("F2");
- CMD402.ChargCapacity02 = ((ByteUtils.DToUInt16(data, 169)) * 0.01).ToString("F2");
- CMD402.ChargCapacity03 = ((ByteUtils.DToUInt16(data, 171)) * 0.01).ToString("F2");
- CMD402.ChargCapacity04 = ((ByteUtils.DToUInt16(data, 173)) * 0.01).ToString("F2");
- CMD402.ChargCapacity05 = ((ByteUtils.DToUInt16(data, 175)) * 0.01).ToString("F2");
- CMD402.ChargCapacity06 = ((ByteUtils.DToUInt16(data, 177)) * 0.01).ToString("F2");
- CMD402.ChargCapacity07 = ((ByteUtils.DToUInt16(data, 179)) * 0.01).ToString("F2");
- CMD402.ChargCapacity08 = ((ByteUtils.DToUInt16(data, 181)) * 0.01).ToString("F2");
- CMD402.ChargCapacity09 = ((ByteUtils.DToUInt16(data, 183)) * 0.01).ToString("F2");
- CMD402.ChargCapacity10 = ((ByteUtils.DToUInt16(data, 185)) * 0.01).ToString("F2");
- CMD402.ChargCapacity11 = ((ByteUtils.DToUInt16(data, 187)) * 0.01).ToString("F2");
- CMD402.ChargCapacity12 = ((ByteUtils.DToUInt16(data, 189)) * 0.01).ToString("F2");
- CMD402.ChargCapacity13 = ((ByteUtils.DToUInt16(data, 191)) * 0.01).ToString("F2");
- CMD402.ChargCapacity14 = ((ByteUtils.DToUInt16(data, 193)) * 0.01).ToString("F2");
- CMD402.ChargCapacity15 = ((ByteUtils.DToUInt16(data, 195)) * 0.01).ToString("F2");
- CMD402.ChargCapacity16 = ((ByteUtils.DToUInt16(data, 197)) * 0.01).ToString("F2");
- CMD402.ChargCapacity17 = ((ByteUtils.DToUInt16(data, 199)) * 0.01).ToString("F2");
- CMD402.ChargCapacity18 = ((ByteUtils.DToUInt16(data, 201)) * 0.01).ToString("F2");
- CMD402.ChargCapacity19 = ((ByteUtils.DToUInt16(data, 203)) * 0.01).ToString("F2");
- CMD402.ChargCapacity20 = ((ByteUtils.DToUInt16(data, 205)) * 0.01).ToString("F2");
- CMD402.ChargCapacity21 = ((ByteUtils.DToUInt16(data, 207)) * 0.01).ToString("F2");
- CMD402.ChargCapacity22 = ((ByteUtils.DToUInt16(data, 209)) * 0.01).ToString("F2");
- CMD402.ChargCapacity23 = ((ByteUtils.DToUInt16(data, 211)) * 0.01).ToString("F2");
- CMD402.ChargCapacity24 = ((ByteUtils.DToUInt16(data, 213)) * 0.01).ToString("F2");
- CMD402.ChargCapacity25 = ((ByteUtils.DToUInt16(data, 215)) * 0.01).ToString("F2");
- CMD402.ChargCapacity26 = ((ByteUtils.DToUInt16(data, 217)) * 0.01).ToString("F2");
- CMD402.ChargCapacity27 = ((ByteUtils.DToUInt16(data, 219)) * 0.01).ToString("F2");
- CMD402.ChargCapacity28 = ((ByteUtils.DToUInt16(data, 221)) * 0.01).ToString("F2");
- CMD402.ChargCapacity29 = ((ByteUtils.DToUInt16(data, 223)) * 0.01).ToString("F2");
- CMD402.ChargCapacity30 = ((ByteUtils.DToUInt16(data, 225)) * 0.01).ToString("F2");
- CMD402.ChargCapacity31 = ((ByteUtils.DToUInt16(data, 227)) * 0.01).ToString("F2");
- CMD402.ChargCapacity32 = ((ByteUtils.DToUInt16(data, 229)) * 0.01).ToString("F2");
- CMD402.ChargCapacity33 = ((ByteUtils.DToUInt16(data, 231)) * 0.01).ToString("F2");
- CMD402.ChargCapacity34 = ((ByteUtils.DToUInt16(data, 233)) * 0.01).ToString("F2");
- CMD402.ChargCapacity35 = ((ByteUtils.DToUInt16(data, 235)) * 0.01).ToString("F2");
- CMD402.ChargCapacity36 = ((ByteUtils.DToUInt16(data, 237)) * 0.01).ToString("F2");
- CMD402.ChargCapacity37 = ((ByteUtils.DToUInt16(data, 239)) * 0.01).ToString("F2");
- CMD402.ChargCapacity38 = ((ByteUtils.DToUInt16(data, 241)) * 0.01).ToString("F2");
- CMD402.ChargCapacity39 = ((ByteUtils.DToUInt16(data, 243)) * 0.01).ToString("F2");
- CMD402.ChargCapacity40 = ((ByteUtils.DToUInt16(data, 245)) * 0.01).ToString("F2");
- CMD402.ChargCapacity41 = ((ByteUtils.DToUInt16(data, 247)) * 0.01).ToString("F2");
- CMD402.ChargCapacity42 = ((ByteUtils.DToUInt16(data, 249)) * 0.01).ToString("F2");
- CMD402.ChargCapacity43 = ((ByteUtils.DToUInt16(data, 251)) * 0.01).ToString("F2");
- CMD402.ChargCapacity44 = ((ByteUtils.DToUInt16(data, 253)) * 0.01).ToString("F2");
- CMD402.ChargCapacity45 = ((ByteUtils.DToUInt16(data, 255)) * 0.01).ToString("F2");
- CMD402.ChargCapacity46 = ((ByteUtils.DToUInt16(data, 257)) * 0.01).ToString("F2");
- CMD402.ChargCapacity47 = ((ByteUtils.DToUInt16(data, 259)) * 0.01).ToString("F2");
- CMD402.ChargCapacity48 = ((ByteUtils.DToUInt16(data, 261)) * 0.01).ToString("F2");
-
- CMD402.StartMode = data[263];
- CMD402.SerialNum = Encoding.ASCII.GetString(data, 264, 32);
- CMD402.ChargServiceCost = ByteUtils.DToUInt32(data, 296);
- CMD402.KilElectricity = (data[300] * 0.001).ToString("F4");
- CMD402.ParallelMark = data[301];
- }
- else if (func == 422)
- {
- CMD402.ChargCapacity = (ByteUtils.ToUInt32(data, 104) * 0.001).ToString("F3");
-
-
- CMD402.ChargCapacity01 = ((ByteUtils.DToUInt32(data, 167) * 0.001)).ToString("F3");
- CMD402.ChargCapacity02 = ((ByteUtils.DToUInt32(data, 171) * 0.001)).ToString("F3");
- CMD402.ChargCapacity03 = ((ByteUtils.DToUInt32(data, 175) * 0.001)).ToString("F3");
- CMD402.ChargCapacity04 = ((ByteUtils.DToUInt32(data, 179) * 0.001)).ToString("F3");
- CMD402.ChargCapacity05 = ((ByteUtils.DToUInt32(data, 183) * 0.001)).ToString("F3");
- CMD402.ChargCapacity06 = ((ByteUtils.DToUInt32(data, 187) * 0.001)).ToString("F3");
- CMD402.ChargCapacity07 = ((ByteUtils.DToUInt32(data, 191) * 0.001)).ToString("F3");
- CMD402.ChargCapacity08 = ((ByteUtils.DToUInt32(data, 195) * 0.001)).ToString("F3");
- CMD402.ChargCapacity09 = ((ByteUtils.DToUInt32(data, 199) * 0.001)).ToString("F3");
- CMD402.ChargCapacity10 = ((ByteUtils.DToUInt32(data, 203) * 0.001)).ToString("F3");
- CMD402.ChargCapacity11 = ((ByteUtils.DToUInt32(data, 207) * 0.001)).ToString("F3");
- CMD402.ChargCapacity12 = ((ByteUtils.DToUInt32(data, 211) * 0.001)).ToString("F3");
- CMD402.ChargCapacity13 = ((ByteUtils.DToUInt32(data, 215) * 0.001)).ToString("F3");
- CMD402.ChargCapacity14 = ((ByteUtils.DToUInt32(data, 219) * 0.001)).ToString("F3");
- CMD402.ChargCapacity15 = ((ByteUtils.DToUInt32(data, 223) * 0.001)).ToString("F3");
- CMD402.ChargCapacity16 = ((ByteUtils.DToUInt32(data, 227) * 0.001)).ToString("F3");
- CMD402.ChargCapacity17 = ((ByteUtils.DToUInt32(data, 231) * 0.001)).ToString("F3");
- CMD402.ChargCapacity18 = ((ByteUtils.DToUInt32(data, 235) * 0.001)).ToString("F3");
- CMD402.ChargCapacity19 = ((ByteUtils.DToUInt32(data, 239) * 0.001)).ToString("F3");
- CMD402.ChargCapacity20 = ((ByteUtils.DToUInt32(data, 243) * 0.001)).ToString("F3");
- CMD402.ChargCapacity21 = ((ByteUtils.DToUInt32(data, 247) * 0.001)).ToString("F3");
- CMD402.ChargCapacity22 = ((ByteUtils.DToUInt32(data, 251) * 0.001)).ToString("F3");
- CMD402.ChargCapacity23 = ((ByteUtils.DToUInt32(data, 255) * 0.001)).ToString("F3");
- CMD402.ChargCapacity24 = ((ByteUtils.DToUInt32(data, 259) * 0.001)).ToString("F3");
- CMD402.ChargCapacity25 = ((ByteUtils.DToUInt32(data, 263) * 0.001)).ToString("F3");
- CMD402.ChargCapacity26 = ((ByteUtils.DToUInt32(data, 267) * 0.001)).ToString("F3");
- CMD402.ChargCapacity27 = ((ByteUtils.DToUInt32(data, 271) * 0.001)).ToString("F3");
- CMD402.ChargCapacity28 = ((ByteUtils.DToUInt32(data, 275) * 0.001)).ToString("F3");
- CMD402.ChargCapacity29 = ((ByteUtils.DToUInt32(data, 279) * 0.001)).ToString("F3");
- CMD402.ChargCapacity30 = ((ByteUtils.DToUInt32(data, 283) * 0.001)).ToString("F3");
- CMD402.ChargCapacity31 = ((ByteUtils.DToUInt32(data, 287) * 0.001)).ToString("F3");
- CMD402.ChargCapacity32 = ((ByteUtils.DToUInt32(data, 291) * 0.001)).ToString("F3");
- CMD402.ChargCapacity33 = ((ByteUtils.DToUInt32(data, 295) * 0.001)).ToString("F3");
- CMD402.ChargCapacity34 = ((ByteUtils.DToUInt32(data, 299) * 0.001)).ToString("F3");
- CMD402.ChargCapacity35 = ((ByteUtils.DToUInt32(data, 303) * 0.001)).ToString("F3");
- CMD402.ChargCapacity36 = ((ByteUtils.DToUInt32(data, 307) * 0.001)).ToString("F3");
- CMD402.ChargCapacity37 = ((ByteUtils.DToUInt32(data, 311) * 0.001)).ToString("F3");
- CMD402.ChargCapacity38 = ((ByteUtils.DToUInt32(data, 315) * 0.001)).ToString("F3");
- CMD402.ChargCapacity39 = ((ByteUtils.DToUInt32(data, 319) * 0.001)).ToString("F3");
- CMD402.ChargCapacity40 = ((ByteUtils.DToUInt32(data, 323) * 0.001)).ToString("F3");
- CMD402.ChargCapacity41 = ((ByteUtils.DToUInt32(data, 327) * 0.001)).ToString("F3");
- CMD402.ChargCapacity42 = ((ByteUtils.DToUInt32(data, 331) * 0.001)).ToString("F3");
- CMD402.ChargCapacity43 = ((ByteUtils.DToUInt32(data, 335) * 0.001)).ToString("F3");
- CMD402.ChargCapacity44 = ((ByteUtils.DToUInt32(data, 339) * 0.001)).ToString("F3");
- CMD402.ChargCapacity45 = ((ByteUtils.DToUInt32(data, 343) * 0.001)).ToString("F3");
- CMD402.ChargCapacity46 = ((ByteUtils.DToUInt32(data, 347) * 0.001)).ToString("F3");
- CMD402.ChargCapacity47 = ((ByteUtils.DToUInt32(data, 351) * 0.001)).ToString("F3");
- CMD402.ChargCapacity48 = ((ByteUtils.DToUInt32(data, 355) * 0.001)).ToString("F3");
- CMD402.StartMode = data[359];
- CMD402.SerialNum = Encoding.ASCII.GetString(data, 360, 32);
- CMD402.ChargServiceCost = ByteUtils.DToUInt32(data, 392);
- CMD402.KilElectricity = (data[396] * 0.001).ToString("F4");
- CMD402.ParallelMark = data[397];
- }
-
- CMD402.SAmmeterValue = ByteUtils.DToUInt32(data, 108);
- CMD402.EAmmeterValue = ByteUtils.DToUInt32(data, 112);
- CMD402.ChargeAmount = ByteUtils.DToUInt32(data, 116);
- CMD402.IndexNum = ByteUtils.DToUInt32(data, 120);
- CMD402.InitialBalance = ByteUtils.DToUInt32(data, 124);
- CMD402.ChargRecordIndex = ByteUtils.DToUInt32(data, 128);
- CMD402.TotalChargeRecord = ByteUtils.DToUInt32(data, 132);
- CMD402.Reserved3 = data[136];
- CMD402.ChargStrategy = data[137];
- switch (data[137])
- {
- case 1:
- CMD402.ChargStrategyPara = (ByteUtils.ToUInt32(data, 138)).ToString();
- break;
- case 2:
- CMD402.ChargStrategyPara = ((float)ByteUtils.ToUInt32(data, 138) * 0.01).ToString("F2");
- break;
- case 3:
- CMD402.ChargStrategyPara = ((float)ByteUtils.ToUInt32(data, 138) * 0.01).ToString("F3");
- break;
- }
-
-
- CMD402.VINCar = Encoding.ASCII.GetString(data, 142, 17);
- CMD402.CarID = Encoding.ASCII.GetString(data, 159, 8);
-
- }
- return CMD402;
- }
- public CMD1002 ConCMD1002(byte[] data)
- {
- CMD1002 CMD1002 = null;
- if (data != null && data.Length > 0)
- {
- CMD1002 = new CMD1002();
- CMD1002.ErasurePercentage = data[8];
- }
- return CMD1002;
- }
- public CMD1004 ConCMD1004(byte[] data)
- {
- CMD1004 CMD1004 = null;
- if (data != null && data.Length > 0)
- {
- CMD1004 = new CMD1004();
- CMD1004.DataLength = data[8];
- }
- return CMD1004;
- }
- public CMD1006 ConCMD1006(byte[] data)
- {
- CMD1006 CMD1006 = null;
- if (data != null && data.Length > 0)
- {
- CMD1006 = new CMD1006();
- CMD1006.ResponseFlag = data[8];
- }
- return CMD1006;
- }
- public CMD1008 ConCMD1008(byte[] data)
- {
- CMD1008 CMD1008 = null;
- if (data != null && data.Length > 0)
- {
- CMD1008 = new CMD1008();
- CMD1008.ReceiveSN = data[8];
- CMD1008.WriteFlag = data[9];
- CMD1008.Reserved1 = (short)ByteUtils.DToUInt16(data, 10);
- CMD1008.Reserved2 = (int)ByteUtils.DToUInt32(data, 12);
- }
- return CMD1008;
- }
- public CMD1010 ConCMD1010(byte[] data)
- {
- CMD1010 CMD1010 = null;
- if (data != null && data.Length > 0)
- {
- CMD1010 = new CMD1010();
- CMD1010.Reserved1 = ByteUtils.DToUInt16(data, 8);
- }
- return CMD1010;
- }
- public CMD1012 ConCMD1012(byte[] data)
- {
- CMD1012 CMD1012 = null;
- if (data != null && data.Length > 0)
- {
- CMD1012 = new CMD1012();
- CMD1012.Reserved1 = (int)ByteUtils.DToUInt32(data, 8);
- }
- return CMD1012;
- }
- public CMD1022 ConCMD1022(byte[] data)
- {
- CMD1022 CMD1022 = null;
- if (data != null && data.Length > 0)
- {
- CMD1022 = new CMD1022();
- CMD1022.EquipmentCode = (int)ByteUtils.DToUInt32(data, 8);
- CMD1022.ProjectCode = (int)ByteUtils.DToUInt32(data, 12);
- CMD1022.SoftwareVersion = (int)ByteUtils.DToUInt32(data, 16);
- CMD1022.ReceiveFileSizeMax = (int)ByteUtils.DToUInt32(data, 20);
- CMD1022.DeviceDescripte = Encoding.ASCII.GetString(data, 24, 32);
- CMD1022.CommandFlag = (int)ByteUtils.DToUInt32(data, 56);
- CMD1022.Offset = (int)ByteUtils.DToUInt32(data, 60);
- CMD1022.ContinuatSN = data[64];
- CMD1022.DataLength = (int)ByteUtils.DToUInt32(data, 65);
- }
- return CMD1022;
- }
- public CMD1102 ConCMD1102(byte[] data)
- {
- CMD1102 CMD1102 = null;
- if (data != null && data.Length > 0)
- {
- CMD1102 = new CMD1102();
- CMD1102.StartHour1 = data[8];
- CMD1102.STartMin1 = data[9];
- CMD1102.EndHour1 = data[10];
- CMD1102.EndMin1 = data[11];
- CMD1102.Rate1 = ByteUtils.DToUInt32(data, 12);
-
- CMD1102.StartHour2 = data[16];
- CMD1102.STartMin2 = data[17];
- CMD1102.EndHour2 = data[18];
- CMD1102.EndMin2 = data[19];
- CMD1102.Rate2 = ByteUtils.DToUInt32(data, 20);
-
- CMD1102.StartHour3 = data[24];
- CMD1102.STartMin3 = data[25];
- CMD1102.EndHour3 = data[26];
- CMD1102.EndMin3 = data[27];
- CMD1102.Rate3 = ByteUtils.DToUInt32(data, 28);
-
- CMD1102.StartHour4 = data[32];
- CMD1102.STartMin4 = data[33];
- CMD1102.EndHour4 = data[34];
- CMD1102.EndMin4 = data[35];
- CMD1102.Rate4 = ByteUtils.DToUInt32(data, 36);
-
- CMD1102.StartHour5 = data[40];
- CMD1102.STartMin5 = data[41];
- CMD1102.EndHour5 = data[42];
- CMD1102.EndMin5 = data[43];
- CMD1102.Rate5 = ByteUtils.DToUInt32(data, 44);
-
- CMD1102.StartHour6 = data[48];
- CMD1102.STartMin6 = data[49];
- CMD1102.EndHour6 = data[50];
- CMD1102.EndMin6 = data[51];
- CMD1102.Rate6 = ByteUtils.DToUInt32(data, 52);
-
- CMD1102.StartHour7 = data[56];
- CMD1102.STartMin7 = data[57];
- CMD1102.EndHour7 = data[58];
- CMD1102.EndMin7 = data[59];
- CMD1102.Rate7 = ByteUtils.DToUInt32(data, 60);
-
- CMD1102.StartHour8 = data[64];
- CMD1102.STartMin8 = data[65];
- CMD1102.EndHour8 = data[66];
- CMD1102.EndMin8 = data[67];
- CMD1102.Rate8 = ByteUtils.DToUInt32(data, 68);
-
- CMD1102.StartHour9 = data[72];
- CMD1102.STartMin9 = data[73];
- CMD1102.EndHour9 = data[74];
- CMD1102.EndMin9 = data[75];
- CMD1102.Rate9 = ByteUtils.DToUInt32(data, 76);
-
- CMD1102.StartHour10 = data[80];
- CMD1102.STartMin10 = data[81];
- CMD1102.EndHour10 = data[82];
- CMD1102.EndMin10 = data[83];
- CMD1102.Rate10 = ByteUtils.DToUInt32(data, 84);
-
- CMD1102.StartHour11 = data[88];
- CMD1102.STartMin11 = data[89];
- CMD1102.EndHour11 = data[90];
- CMD1102.EndMin11 = data[91];
- CMD1102.Rate11 = ByteUtils.DToUInt32(data, 92);
-
- CMD1102.StartHour12 = data[96];
- CMD1102.STartMin12 = data[97];
- CMD1102.EndHour12 = data[98];
- CMD1102.EndMin12 = data[99];
- CMD1102.Rate12 = ByteUtils.DToUInt32(data, 100);
- }
- return CMD1102;
- }
- public CMD1104 ConCMD1104(byte[] data)
- {
- CMD1104 CMD1104 = null;
- if (data != null && data.Length > 0)
- {
- CMD1104 = new CMD1104();
- CMD1104.ConfirmResult = data[8];
- }
- return CMD1104;
- }
- public CMD1106 ConCMD1106(byte[] data)
- {
- CMD1106 CMD1106 = null;
- if (data != null && data.Length > 0)
- {
- CMD1106 = new CMD1106();
- CMD1106.ConfirmResult = data[8];
- }
- return CMD1106;
- }
- public CMD1108 ConCMD1108(byte[] data)
- {
- CMD1108 CMD1108 = null;
- if (data != null && data.Length > 0)
- {
- CMD1108 = new CMD1108();
- CMD1108.StartHour1 = data[8];
- CMD1108.STartMin1 = data[9];
- CMD1108.EndHour1 = data[10];
- CMD1108.EndMin1 = data[11];
- CMD1108.Rate1 = ByteUtils.DToUInt32(data, 12);
-
- CMD1108.StartHour2 = data[16];
- CMD1108.STartMin2 = data[17];
- CMD1108.EndHour2 = data[18];
- CMD1108.EndMin2 = data[19];
- CMD1108.Rate2 = ByteUtils.DToUInt32(data, 20);
-
- CMD1108.StartHour3 = data[24];
- CMD1108.STartMin3 = data[25];
- CMD1108.EndHour3 = data[26];
- CMD1108.EndMin3 = data[27];
- CMD1108.Rate3 = ByteUtils.DToUInt32(data, 28);
-
- CMD1108.StartHour4 = data[32];
- CMD1108.STartMin4 = data[33];
- CMD1108.EndHour4 = data[34];
- CMD1108.EndMin4 = data[35];
- CMD1108.Rate4 = ByteUtils.DToUInt32(data, 36);
-
- CMD1108.StartHour5 = data[40];
- CMD1108.STartMin5 = data[41];
- CMD1108.EndHour5 = data[42];
- CMD1108.EndMin5 = data[43];
- CMD1108.Rate5 = ByteUtils.DToUInt32(data, 44);
-
- CMD1108.StartHour6 = data[48];
- CMD1108.STartMin6 = data[49];
- CMD1108.EndHour6 = data[50];
- CMD1108.EndMin6 = data[51];
- CMD1108.Rate6 = ByteUtils.DToUInt32(data, 52);
-
- CMD1108.StartHour7 = data[56];
- CMD1108.STartMin7 = data[57];
- CMD1108.EndHour7 = data[58];
- CMD1108.EndMin7 = data[59];
- CMD1108.Rate7 = ByteUtils.DToUInt32(data, 60);
-
- CMD1108.StartHour8 = data[64];
- CMD1108.STartMin8 = data[65];
- CMD1108.EndHour8 = data[66];
- CMD1108.EndMin8 = data[67];
- CMD1108.Rate8 = ByteUtils.DToUInt32(data, 68);
-
- CMD1108.StartHour9 = data[72];
- CMD1108.STartMin9 = data[73];
- CMD1108.EndHour9 = data[74];
- CMD1108.EndMin9 = data[75];
- CMD1108.Rate9 = ByteUtils.DToUInt32(data, 76);
-
- CMD1108.StartHour10 = data[80];
- CMD1108.STartMin10 = data[81];
- CMD1108.EndHour10 = data[82];
- CMD1108.EndMin10 = data[83];
- CMD1108.Rate10 = ByteUtils.DToUInt32(data, 84);
-
- CMD1108.StartHour11 = data[88];
- CMD1108.STartMin11 = data[89];
- CMD1108.EndHour11 = data[90];
- CMD1108.EndMin11 = data[91];
- CMD1108.Rate11 = ByteUtils.DToUInt32(data, 92);
-
- CMD1108.StartHour12 = data[96];
- CMD1108.STartMin12 = data[97];
- CMD1108.EndHour12 = data[98];
- CMD1108.EndMin12 = data[99];
- CMD1108.Rate12 = ByteUtils.DToUInt32(data, 100);
-
- }
- return CMD1108;
- }
- public CMD1302 ConCMD1302(byte[] data)
- {
- CMD1302 CMD1302 = null;
- if (data != null && data.Length > 0)
- {
- CMD1302 = new CMD1302();
-
- CMD1302.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD1302.WhitelistType = data[44];
- CMD1302.Operate = data[45];
- CMD1302.ListVersioe = ByteUtils.DToUInt32(data, 46);
- CMD1302.OperatResult = data[50];
- }
- return CMD1302;
- }
- public CMD1402 ConCMD1402(byte[] data)
- {
- CMD1402 CMD1402 = null;
- if (data != null && data.Length > 0)
- {
- CMD1402 = new CMD1402();
-
- CMD1402.Result = data[12];
- }
- return CMD1402;
- }
- public CMD1403 ConCMD1403(byte[] data)
- {
- CMD1403 CMD1403 = null;
- if (data != null && data.Length > 0)
- {
- CMD1403 = new CMD1403();
-
- CMD1403.ScheduleResult = data[12];
- }
- return CMD1403;
- }
- public CMD1407 ConCMD1407(byte[] data)
- {
- CMD1407 CMD1407 = null;
- if (data != null && data.Length > 0)
- {
- CMD1407 = new CMD1407();
-
- CMD1407.Result = data[12];
- }
- return CMD1407;
- }
- public CMD1501 ConCMD1501(byte[] data)
- {
- CMD1501 CMD1501 = null;
- if (data != null && data.Length > 0)
- {
- CMD1501 = new CMD1501();
-
- CMD1501.ASCIINum = Encoding.ASCII.GetString(data, 12, 32);
- CMD1501.UpFileName = Encoding.ASCII.GetString(data, 44, 128);
- }
- return CMD1501;
- }
- public CMD1503 ConCMD1503(byte[] data)
- {
- CMD1503 CMD1503 = null;
- if (data != null && data.Length > 0)
- {
- CMD1503 = new CMD1503();
-
- CMD1503.DataLength = ByteUtils.DToUInt32(data, 12);
- CMD1503.MessageNum = ByteUtils.DToUInt32(data, 16);
- CMD1503.LogData = Encoding.ASCII.GetString(data, 20, (data.Length - 21)); ;
- }
- return CMD1503;
- }
- public CMD1505 ConCMD1505(byte[] data)
- {
- CMD1505 CMD1505 = null;
- if (data != null && data.Length > 0)
- {
- CMD1505 = new CMD1505();
- }
- return CMD1505;
- }
- }
-}
diff --git a/HybirdFrameworkEntity/MsgModel/Encode.cs b/HybirdFrameworkEntity/MsgModel/Encode.cs
deleted file mode 100644
index 142150b..0000000
--- a/HybirdFrameworkEntity/MsgModel/Encode.cs
+++ /dev/null
@@ -1,2792 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace HybirdFrameworkEntity
-{
- public class Encode
- {
- #region 服务器向充电桩设置/查询工作参数和命令
- ///
- /// (CMD=1)后台服务器下发充电桩整形工作参数
- ///
- ///
- ///
- ///
- ///
- ///
- public byte[] Send1(byte type, uint startAddress, byte num, byte[] setData)
- {
- APDUModel APDUModel;
-
- CMD1 CMD1 = new CMD1();
- CMD1.Type = type;
- CMD1.SetAddress = startAddress;
- CMD1.SelectNum = num;
- CMD1.SetByteNum = (ushort)(num * 4);
- CMD1.SetData = setData;
-
- byte[] bytes = new ChargerSendCMD().SendRCMD1(out APDUModel, CMD1);
-
- if (APDUModel != null)
- {
- string result = "1后台服务器下发充电桩整形工作参数-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- }
- return bytes;
- }
-
- ///
- /// (CMD=3)
- ///
- ///
- ///
- ///
- public byte[] Send3(byte type, uint startAddress, byte[] setData)
- {
- APDUModel APDUModel;
-
-
- CMD3 CMD3 = new CMD3();
- CMD3.Reserved1 = 0;
- CMD3.Reserved2 = 0;
- CMD3.Type = type;
- CMD3.SAddress = startAddress;
- CMD3.SBytes = cmd3StartAddress[startAddress];
- CMD3.SData = setData;
-
- byte[] bytes = new ChargerSendCMD().SendRCMD3(out APDUModel, CMD3);
-
- if (APDUModel != null)
- {
- string result = "3后台服务器下发充电桩字符型参数-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- }
- return bytes;
- }
-
-
- ///
- /// 后台服务器下发充电桩控制命令
- ///
- ///
- /// 充电枪口
- /// 启始命令地址
- /// 命令个数
- /// 命令参数
- public byte[] Send5(byte chargeMuzzle, uint startAddress, byte num, byte[] setData)
- {
-
- APDUModel APDUModel;
-
- CMD5 CMD = new CMD5();
- CMD.RechargeableMuzzle = chargeMuzzle;
- CMD.CommandAddress = startAddress;
- CMD.CommandNum = num;
- CMD.CommandLength = (ushort)(num * 4);
- CMD.CommandData = setData;
-
-
- byte[] bytes = new ChargerSendCMD().SendRCMD5(out APDUModel, CMD);
-
- if (APDUModel != null)
- {
- string result = "5后台服务器下发充电桩控制命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- }
- return bytes;
- }
-
-
-
- ///
- /// 后台服务器下发充电桩开启充电控制命令
- ///
- ///
- ///
- public byte[] Send7(CMD7 CMD)
- {
- APDUModel APDUModel;
-
- byte[] bytes = new ChargerSendCMD().SendRCMD7(out APDUModel, CMD);
- if (APDUModel != null)
- {
-
- string result = "7后台服务器下发充电桩开启充电控制命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- }
- return bytes;
- }
-
-
-
-
- public byte[] Send9(byte chargeMuzzle, uint executeResult, uint address, byte[] setData)
- {
- APDUModel APDUModel;
-
- CMD9 CMD = new CMD9();
-
- CMD.ChargGunNum = chargeMuzzle;
- CMD.FWResult = executeResult;
- CMD.CommandAddress = address;
- CMD.DataLength = 4;
- CMD.Datas = new byte[4];
-
- byte[] bytes = new ChargerSendCMD().SendRCMD9(out APDUModel, CMD);
-
- if (APDUModel != null)
- {
- string result = "9后台服务器应答桩上传命令请求(预留)-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- }
- return bytes;
- }
-
-
- #endregion
-
- #region 充电桩主动上传数据
- ///
- /// 服务器应答心跳包信息
- ///
- ///
- /// 心跳应答
- public byte[] Send101(ushort heartbeatNum)
- {
- APDUModel APDUModel;
-
- CMD101 CMD = new CMD101();
-
- CMD.HearResponse = heartbeatNum;
-
- byte[] bytes = new ChargerSendCMD().SendRCMD101(out APDUModel, CMD);
- if (APDUModel != null)
- {
-
- string result = "101服务器应答心跳包信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- }
- return bytes;
- }
-
- ///
- /// 服务器应答充电桩状态信息包
- ///
- ///
- /// 充电口号
- /// 是否立即上报一次104报文 0-否 、1-是
- public byte[] Send103(byte chargeNum, bool reportMessage)
- {
- APDUModel APDUModel;
-
-
- CMD103 CMD = new CMD103();
- CMD.ChargNum = chargeNum;
- CMD.Reported = reportMessage;
-
-
- byte[] bytes = new ChargerSendCMD().SendRCMD103(out APDUModel, CMD);
- if (APDUModel != null)
- {
- string result = "103服务器应答充电桩状态信息包-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- }
- return bytes;
- }
-
- ///
- /// 服务器应答充电桩签到命令
- ///
- ///
- ///
- public byte[] Send105(CMD105 CMD)
- {
- APDUModel APDUModel;
-
- byte[] bytes = new ChargerSendCMD().SendRCMD105(out APDUModel, CMD);
- if (APDUModel != null)
- {
- string result = "105服务器应答充电桩签到命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- }
- return bytes;
- }
-
- ///
- /// 服务器应答充电桩告警信息
- ///
- ///
- public byte[] Send107()
- {
- APDUModel APDUModel;
-
- CMD107 CMD = new CMD107();
-
- byte[] bytes = new ChargerSendCMD().SendRCMD107(out APDUModel, CMD);
- if (APDUModel != null)
- {
- string result = "107服务器应答充电桩告警信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- }
- return bytes;
- }
-
- ///
- /// 服务器应答充电桩告警信息
- ///
- ///
- public byte[] Send109()
- {
- APDUModel APDUModel;
-
-
-
- CMD109 CMD = new CMD109();
-
-
- byte[] bytes = new ChargerSendCMD().SendRCMD109(out APDUModel, CMD);
- if (APDUModel != null)
- {
- string result = "109服务器应答充电桩启动完成命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- }
- return bytes;
- }
-
- public byte[] Send111(byte messageType)
- {
- APDUModel APDUModel;
-
-
- CMD111 CMD = new CMD111();
-
- CMD.MessageType = messageType;
-
-
- byte[] bytes = new ChargerSendCMD().SendRCMD111(out APDUModel, CMD);
- if (APDUModel != null)
- {
- string result = "111服务器应答充电桩上报模块信息(预留)-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- }
- return bytes;
- }
-
- ///
- /// 服务器查询最近一次充电各时段信息
- ///
- ///
- /// 充电口号
- /// 标志
- public byte[] Send113(byte chargeNum, byte sign)
- {
- APDUModel APDUModel;
-
- CMD113 CMD = new CMD113();
-
- CMD.ChargNum = chargeNum;
- CMD.Sign = sign;
-
-
- byte[] bytes = new ChargerSendCMD().SendRCMD113(out APDUModel, CMD);
- if (APDUModel != null)
- {
- string result = "113服务器查询最近一次充电各时段信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- }
- return bytes;
- }
-
- #endregion
-
- #region 充电信息数据
-
- ///
- /// (CMD=5)
- ///
- ///
- ///
- ///
- public byte[] Send201(CMD201 CMD, uint func)
- {
-
- byte[] bytes = new ChargerSendCMD().SendRCMD201(out APDUModel APDUModel, CMD, func);
- string result = "201服务器应答充电桩上报充电信息报文-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
-
-
- public byte[] Send203(CMD203 CMD)
- {
- byte[] bytes = new ChargerSendCMD().SendRCMD203(out APDUModel APDUModel, CMD);
- string result = "203服务器应答账户查询信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
-
-
- public byte[] Send205(uint value03, uint value04)
- {
- CMD205 CMD = new CMD205();
- CMD.Reserved1 = 0;
- CMD.Reserved2 = 0;
- CMD.ResponseCode = value03;
- if (CMD.ResponseCode == 0)
- {
- CMD.Balance = value04;
- }
- else
- {
- CMD.Balance = 0;
- }
-
- byte[] bytes = new ChargerSendCMD().SendRCMD205(out APDUModel APDUModel, CMD);
- string result = "205服务器应答充电密码验证报文(预留)-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
-
-
- public byte[] Send207(CMD208 CMD208, string value06, string value07, byte value08, byte value09, uint value10, ulong value11)
- {
- CMD207 CMD = new CMD207();
- CMD.Reserved1 = 0;
- CMD.Reserved2 = 0;
- CMD.ASCIINum = CMD208.ASCIINum;
- CMD.ChargGunNum = CMD208.ChargGunNum;
- CMD.VINNum = CMD208.VINNum;
- CMD.VINBindAccount = value06;
- CMD.ChargSerialNum = value07;
- CMD.VerifyResult = value08;
- CMD.VerifyCause = value09;
- CMD.RechBalance = value10;
- CMD.StopCode = value11;
- byte[] bytes = new ChargerSendCMD().SendRCMD207(out APDUModel APDUModel, CMD);
- string result = "207平台回复“即插即充”请求充电结果-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
-
-
- public byte[] Send209(CMD210 CMD210, string value05)
- {
- CMD209 CMD = new CMD209();
- CMD.Reserved1 = CMD210.Reserved1;
- CMD.Reserved2 = CMD210.Reserved2;
- CMD.ASCIINum = CMD210.ASCIINum;
- CMD.ChargGunNum = CMD210.ChargGunNum;
- CMD.VINNum = value05;
- byte[] bytes = new ChargerSendCMD().SendRCMD209(out APDUModel APDUModel, CMD);
- string result = "209平台回复“即插即充”启动充电结果-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
- public byte[] Send221(CMD221 CMD221, uint value05)
- {
- CMD221 CMD = new CMD221();
- CMD.Reserved1 = CMD221.Reserved1;
- CMD.Reserved2 = CMD221.Reserved2;
- CMD.ChargNum = CMD221.ChargNum;
- CMD.ChargID = CMD221.ChargID;
- CMD.IndexNum = value05;
- byte[] bytes = new ChargerSendCMD().SendRCMD221(out APDUModel APDUModel, CMD);
- string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
-
- #endregion
-
- #region 直流充电桩 BMS 信息数据(预留)
-
- public byte[] Send301()
- {
- CMD301 CMD = new CMD301();
- CMD.Reserved1 = 0;
- CMD.Reserved2 = 0;
- byte[] bytes = new ChargerSendCMD().SendRCMD301(out APDUModel APDUModel, CMD);
- string result = "301服务器应答充电桩上报BMS信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
-
- public byte[] Send303()
- {
- CMD303 CMD = new CMD303();
- CMD.Reserved1 = 0;
- CMD.Reserved2 = 0;
- byte[] bytes = new ChargerSendCMD().SendRCMD303(out APDUModel APDUModel, CMD);
- string result = "303服务器应答充电桩上报BMS信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
- #endregion
-
- #region 历史记录
-
- public byte[] Send401(string chargingSerialNum, uint startIndex)
- {
- CMD401 CMD = new CMD401();
- CMD.Reserved1 = 0;
- CMD.Reserved2 = 0;
- CMD.SelectIndex = startIndex;
- CMD.ChargSerialNum = chargingSerialNum;
- byte[] bytes = new ChargerSendCMD().SendRCMD401(out APDUModel APDUModel, CMD);
- string result = "401/421服务器查询充电桩历史充电记录-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
- #endregion
-
- #region 升级命令
-
- public byte[] Send1001(uint instruct)
- {
- CMD1001 CMD = new CMD1001();
- CMD.CInstruction = instruct;
- byte[] bytes = new ChargerSendCMD().SendRCMD1001(out APDUModel APDUModel, CMD);
- string result = "1001服务器下发擦除指令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
- public byte[] Send1003(string fileName)
- {
- CMD1003 CMD = new CMD1003();
- CMD.Filename = fileName;
- byte[] bytes = new ChargerSendCMD().SendRCMD1003(out APDUModel APDUModel, CMD);
- string result = "1003服务器下发升级文件名指令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
- public byte[] Send1005(uint fileLength)
- {
- CMD1005 CMD = new CMD1005();
- CMD.FileLength = fileLength;
- byte[] bytes = new ChargerSendCMD().SendRCMD1005(out APDUModel APDUModel, CMD);
- string result = "1005服务器下发升级文件大小-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
- public byte[] Send1007(string updata)
- {
- CMD1007 CMD = new CMD1007();
- CMD.UpFileData = updata;
- byte[] bytes = new ChargerSendCMD().SendRCMD1007(out APDUModel APDUModel, CMD);
- string result = "1007服务器下发升级文件数据-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
- public byte[] Send1009(uint Reserved1)
- {
- CMD1009 CMD = new CMD1009();
- CMD.Reserved1 = Reserved1;
- byte[] bytes = new ChargerSendCMD().SendRCMD1009(out APDUModel APDUModel, CMD);
- string result = "1009服务器下发升级文件数据结束指令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
- public byte[] Send1011(uint Reserved1)
- {
- CMD1011 CMD = new CMD1011();
- CMD.Reserved1 = 0;
- byte[] bytes = new ChargerSendCMD().SendRCMD1011(out APDUModel APDUModel, CMD);
- string result = "1011服务器下发重启指令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
- public byte[] Send1021(uint results, string description)
- {
- CMD1021 CMD = new CMD1021();
- CMD.ResponseResult = results;
- CMD.ResponsExplain = description;
- byte[] bytes = new ChargerSendCMD().SendRCMD1021(out APDUModel APDUModel, CMD);
- string result = "1021服务器回复充电桩主动请求升级命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
- #endregion
-
- #region 与计费策略相关的指令
-
-
- public byte[] Send1101()
- {
- byte[] bytes = new ChargerSendCMD().SendRCMD1101(out APDUModel APDUModel);
- string result = "1101后台服务器查询24时电费计价策略信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
- public byte[] Send1103(CMD1103 CMD)
- {
- byte[] bytes = new ChargerSendCMD().SendRCMD1103(out APDUModel APDUModel, CMD);
- string result = "1103后台服务器设置24时段电费计价策略信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
- public byte[] Send1105(CMD1105 CMD)
- {
- byte[] bytes = new ChargerSendCMD().SendRCMD1105(out APDUModel APDUModel, CMD);
- string result = "1105后台服务器设置分时段计价策略信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
- public byte[] Send1107()
- {
- byte[] bytes = new ChargerSendCMD().SendRCMD1107(out APDUModel APDUModel);
- string result = "1107后台服务器查询分时电费计价策略信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
- #endregion
-
- #region 白名单报文
-
-
- public byte[] Send1301(CMD1301 CMD)
- {
- byte[] bytes = new ChargerSendCMD().SendRCMD1301(out APDUModel APDUModel, CMD);
- string result = "1301服务器下发白名单操作日志数据包-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
- #endregion
-
- #region FTP 远程升级和 FTP 方式日志上传
-
- public byte[] Send1401(CMD1401 CMD)
- {
- byte[] bytes = new ChargerSendCMD().SendRCMD1401(out APDUModel APDUModel, CMD);
- string result = "1401服务器下发FTP远程升级命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
- public byte[] Send1406(CMD1406 CMD)
- {
- byte[] bytes = new ChargerSendCMD().SendRCMD1406(out APDUModel APDUModel, CMD);
- string result = "1406服务器下发获取充电桩日志信息命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
- #endregion
-
- #region 协议方式日志上传
-
- public byte[] Send1502(uint responseCode)
- {
- CMD1502 CMD = new CMD1502();
-
- CMD.AnswerCode = responseCode;
- byte[] bytes = new ChargerSendCMD().SendRCMD1502(out APDUModel APDUModel, CMD);
- string result = "cmd1502 服务器允许上传-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
- public byte[] Send1504(uint logo, uint successReservedMessageNum)
- {
- CMD1504 CMD = new CMD1504();
- CMD.Reserved1 = 0;
- CMD.Reserved2 = 0;
- CMD.Sign = logo;
- CMD.ReceiveMessageNum = successReservedMessageNum;
- byte[] bytes = new ChargerSendCMD().SendRCMD1504(out APDUModel APDUModel, CMD);
- string result = "1504服务器应答上传日志-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
-
- public byte[] Send1506()
- {
- CMD1506 CMD = new CMD1506();
- CMD.Reserved1 = 0;
- CMD.Reserved1 = 0;
- byte[] bytes = new ChargerSendCMD().SendRCMD1506(out APDUModel APDUModel, CMD);
- string result = "1506当前文件接收完成-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
-
- //Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
- return bytes;
- }
- #endregion
-
- ///
- ///
- ///
- Dictionary cmd3StartAddress = new Dictionary()
- {
- {1, 32},
- {2, 8},
- {3, 8},
- {4, 8},
- {5, 6},
- {6, 16},
- {7, 256},
- {8, 16},
- {9, 16},
- {10, 256},
- {11, 128},
- {12, 12},
- {13, 64},
- {14, 8},
- {15, 256},
- {16, 256},
- {17, 256},
- {18, 256},
- {19, 256},
- { 20, 256},
- };
-
- }
-
- public class ChargerSendCMD
- {
- #region 协议格式
- public byte[] SendRCMD1(out APDUModel APDUModel, CMD1 CMD)
- {
-
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 1;
- model.checksumDomain = 0x01;
-
-
- model.dataDomain = GetRCMD1DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD1DataInfo(CMD1 CMD1)
- {
- byte[] results = null;
- if (CMD1 != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD1.WorkingData_Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD1.WorkingData_Reserved2));
- lstContent.Add(CMD1.Type);
- lstContent.AddRange(BitConverter.GetBytes(CMD1.SetAddress));//起始地址
- lstContent.Add(CMD1.SelectNum);//查询个数
- lstContent.AddRange(BitConverter.GetBytes(CMD1.SetByteNum));//参数字节数
- if (CMD1.Type == 1)
- {
- lstContent.AddRange(CMD1.SetData);
- }
-
- results = lstContent.ToArray();
- }
- return results;
- }
-
- public byte[] SendRCMD3(out APDUModel APDUModel, CMD3 CMD3)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 3;
- model.checksumDomain = 0x01;
-
-
- model.dataDomain = GetRCMD3DataInfo(CMD3); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD3DataInfo(CMD3 CMD)
- {
- byte[] results = null;
- if (CMD != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
- lstContent.Add(CMD.Type);
- lstContent.AddRange(BitConverter.GetBytes(CMD.SAddress));
- lstContent.AddRange(BitConverter.GetBytes(CMD.SBytes));
- if (CMD.Type == 1)
- {
- lstContent.AddRange(CMD.SData);
- }
- results = lstContent.ToArray();
- }
- return results;
- }
- public byte[] SendRCMD5(out APDUModel APDUModel, CMD5 cMD5)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 5;
- model.checksumDomain = 0x01;
-
- model.dataDomain = GetRCMD5DataInfo(cMD5); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD5DataInfo(CMD5 CMD)
- {
- byte[] results = null;
- if (CMD != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
- lstContent.Add(CMD.RechargeableMuzzle);
- lstContent.AddRange(BitConverter.GetBytes(CMD.CommandAddress));
- lstContent.Add(CMD.CommandNum);
- lstContent.AddRange(BitConverter.GetBytes(CMD.CommandLength));
- lstContent.AddRange(CMD.CommandData);
- results = lstContent.ToArray();
- }
- return results;
- }
-
-
- public byte[] SendRCMD7(out APDUModel APDUModel, CMD7 CMD)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 7;
- model.checksumDomain = 0x01;
-
-
-
- model.dataDomain = GetRCMD7DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD7DataInfo(CMD7 CMD)
- {
- byte[] results = null;
- if (CMD != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved));
- lstContent.Add(CMD.ChargMuzzle);
- lstContent.AddRange(BitConverter.GetBytes(CMD.ChargeType));
- lstContent.AddRange(BitConverter.GetBytes(CMD.ChargeStopPassword));
- lstContent.AddRange(BitConverter.GetBytes(CMD.ChargStrategy));
- lstContent.AddRange(BitConverter.GetBytes(CMD.ChargStrategyPara));
- lstContent.AddRange(BitConverter.GetBytes(CMD.ScheduleStartupTime));
- lstContent.Add(CMD.OutTime);
- lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.CardNumber, 32));
- lstContent.Add(CMD.NetOutageSign);
- lstContent.AddRange(BitConverter.GetBytes(CMD.MaxElectric));
- lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.SerialNum, 32));
- lstContent.Add(CMD.BMSVoltage);
- lstContent.AddRange(BitConverter.GetBytes(CMD.Balance));
- lstContent.Add(CMD.DisOrChargeMark);
- results = lstContent.ToArray();
- }
- return results;
- }
-
-
- public byte[] SendRCMD9(out APDUModel APDUModel, CMD9 CMD)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 9;
- model.checksumDomain = 0x01;
-
-
-
- model.dataDomain = GetRCMD9DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD9DataInfo(CMD9 CMD)
- {
- byte[] results = null;
- if (CMD != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
- lstContent.AddRange(BitConverter.GetBytes(CMD.ChargGunNum));
- lstContent.AddRange(BitConverter.GetBytes(CMD.FWResult));
- lstContent.AddRange(BitConverter.GetBytes(CMD.CommandAddress));
- lstContent.AddRange(BitConverter.GetBytes(CMD.DataLength));
- lstContent.AddRange(CMD.Datas);
-
- results = lstContent.ToArray();
- }
- return results;
- }
- #endregion
-
- #region 充电桩主动上传数据
-
- public byte[] SendRCMD101(out APDUModel APDUModel, CMD101 CMD)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 101;
- model.checksumDomain = 0x01;
-
-
-
- model.dataDomain = GetRCMD101DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD101DataInfo(CMD101 CMD)
- {
- byte[] results = null;
- if (CMD != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
- lstContent.AddRange(BitConverter.GetBytes(CMD.HearResponse));
-
- results = lstContent.ToArray();
- }
- return results;
- }
-
-
- public byte[] SendRCMD103(out APDUModel APDUModel, CMD103 CMD)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 103;
- model.checksumDomain = 0x01;
-
-
- model.dataDomain = GetRCMD103DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD103DataInfo(CMD103 CMD)
- {
- byte[] results = null;
- if (CMD != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
- lstContent.Add(CMD.ChargNum);
- lstContent.Add(Convert.ToByte(CMD.Reported));
-
- results = lstContent.ToArray();
- }
- return results;
- }
-
- public byte[] SendRCMD105(out APDUModel APDUModel, CMD105 CMD)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 105;
- model.checksumDomain = 0x01;
-
-
-
- model.dataDomain = GetRCMD105DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD105DataInfo(CMD105 CMD105)
- {
- byte[] results = null;
- if (CMD105 != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD105.Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD105.Reserved2));
- lstContent.AddRange(BitConverter.GetBytes(CMD105.NumResponse));
- lstContent.Add(CMD105.LoginVerify);
- lstContent.Add(CMD105.EncryptionFlag);
- if (CMD105.EncryptionFlag == 1)
- {
- lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD105.RSAComModule));
- lstContent.AddRange(BitConverter.GetBytes(CMD105.RSAComSecret));
- }
- lstContent.Add(CMD105.StSign);
- lstContent.AddRange(BitConverter.GetBytes(CMD105.BCDTime));
- lstContent.Add(CMD105.MessageUpload);
- if (CMD105.EncryptionFlag == 1)
- lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD105.AESSecretKey));
- results = lstContent.ToArray();
- }
- return results;
- }
-
-
- public byte[] SendRCMD107(out APDUModel APDUModel, CMD107 CMD)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 107;
- model.checksumDomain = 0x01;
-
-
-
- model.dataDomain = GetRCMD107DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD107DataInfo(CMD107 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));
-
- results = lstContent.ToArray();
- }
- return results;
- }
-
-
- public byte[] SendRCMD109(out APDUModel APDUModel, CMD109 CMD)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 109;
- model.checksumDomain = 0x01;
-
-
- model.dataDomain = GetRCMD109DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD109DataInfo(CMD109 CMD)
- {
- byte[] results = null;
- if (CMD != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
-
- results = lstContent.ToArray();
- }
- return results;
- }
-
-
- public byte[] SendRCMD111(out APDUModel APDUModel, CMD111 CMD)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 111;
- model.checksumDomain = 0x01;
-
-
- model.dataDomain = GetRCMD111DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD111DataInfo(CMD111 CMD)
- {
- byte[] results = null;
- if (CMD != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
- lstContent.AddRange(BitConverter.GetBytes(CMD.MessageType));
-
- results = lstContent.ToArray();
- }
- return results;
- }
-
- public byte[] SendRCMD113(out APDUModel APDUModel, CMD113 CMD)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 113;
- model.checksumDomain = 0x01;
-
- model.dataDomain = GetRCMD113DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD113DataInfo(CMD113 CMD)
- {
- byte[] results = null;
- if (CMD != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
- lstContent.Add(CMD.ChargNum);
- lstContent.Add(Convert.ToByte(CMD.Sign));
-
- results = lstContent.ToArray();
- }
- return results;
- }
- #endregion
-
- #region 充电信息数据
-
- public byte[] SendRCMD201(out APDUModel APDUModel, CMD201 CMD, uint func)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- 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); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD201DataInfo(CMD201 CMD)
- {
- byte[] results = null;
- if (CMD != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
- lstContent.AddRange(BitConverter.GetBytes(CMD.ChargNum));
- lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.ChargID, 32));
- lstContent.AddRange(BitConverter.GetBytes(CMD.IndexNum));
- lstContent.AddRange(BitConverter.GetBytes(CMD.ValidMark));
- lstContent.AddRange(BitConverter.GetBytes(CMD.InitialCost));
- lstContent.AddRange(BitConverter.GetBytes(CMD.DiscountCost));
- lstContent.AddRange(BitConverter.GetBytes(CMD.NetCost));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Balance));
- lstContent.AddRange(BitConverter.GetBytes(CMD.NetElectricCost));
- lstContent.AddRange(BitConverter.GetBytes(CMD.NetServiceCost));
-
- results = lstContent.ToArray();
- }
- return results;
- }
-
-
- public byte[] SendRCMD203(out APDUModel APDUModel, CMD203 CMD)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 203;
- model.checksumDomain = 0x01;
-
-
-
- model.dataDomain = GetRCMD203DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD203DataInfo(CMD203 CMD)
- {
- byte[] results = null;
- if (CMD != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
- lstContent.AddRange(BitConverter.GetBytes(CMD.ResCode));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Balance));
- lstContent.AddRange(BitConverter.GetBytes(CMD.SumEleRate));
- lstContent.AddRange(BitConverter.GetBytes(CMD.EleRate));
- lstContent.AddRange(BitConverter.GetBytes(CMD.ChargPassword));
- lstContent.AddRange(BitConverter.GetBytes(CMD.VINSign));
- lstContent.AddRange(BitConverter.GetBytes(CMD.CarIDVerify));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved3));
- lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.SerialNum, 32));
- lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.VIN, 17));
- lstContent.AddRange(BitConverter.GetBytes(CMD.ChargGunNum));
-
- results = lstContent.ToArray();
- }
- return results;
- }
-
-
- public byte[] SendRCMD205(out APDUModel APDUModel, CMD205 CMD)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 205;
- model.checksumDomain = 0x01;
-
-
-
-
- model.dataDomain = GetRCMD205DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD205DataInfo(CMD205 CMD)
- {
- byte[] results = null;
- if (CMD != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
- lstContent.AddRange(BitConverter.GetBytes(CMD.ResponseCode));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Balance));
-
- results = lstContent.ToArray();
- }
- return results;
- }
-
-
- public byte[] SendRCMD207(out APDUModel APDUModel, CMD207 CMD)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 207;
- model.checksumDomain = 0x01;
-
-
-
-
- model.dataDomain = GetRCMD207DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD207DataInfo(CMD207 CMD)
- {
- byte[] results = null;
- if (CMD != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
- lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.ASCIINum, 32));
- lstContent.AddRange(BitConverter.GetBytes(CMD.ChargGunNum));
- lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.VINNum, 17));
- lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.VINBindAccount, 32));
- lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.ChargSerialNum, 32));
- lstContent.AddRange(BitConverter.GetBytes(CMD.VerifyResult));
- lstContent.AddRange(BitConverter.GetBytes(CMD.VerifyCause));
- lstContent.AddRange(BitConverter.GetBytes(CMD.RechBalance));
- lstContent.AddRange(BitConverter.GetBytes(CMD.StopCode));
-
- results = lstContent.ToArray();
- }
- return results;
- }
-
-
- public byte[] SendRCMD209(out APDUModel APDUModel, CMD209 CMD)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 209;
- model.checksumDomain = 0x01;
-
-
- model.dataDomain = GetRCMD209DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD209DataInfo(CMD209 CMD)
- {
- byte[] results = null;
- if (CMD != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
- lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.ASCIINum, 32));
- lstContent.AddRange(BitConverter.GetBytes(CMD.ChargGunNum));
- lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.VINNum, 17));
-
- results = lstContent.ToArray();
- }
- 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(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.Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
- lstContent.AddRange(BitConverter.GetBytes(CMD.ChargNum));
- lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD.ChargID));
- lstContent.AddRange(BitConverter.GetBytes(CMD.IndexNum));
- lstContent.AddRange(BitConverter.GetBytes(CMD.ValidMark));
- lstContent.AddRange(BitConverter.GetBytes(CMD.InitialCost));
- lstContent.AddRange(BitConverter.GetBytes(CMD.DiscountCost));
- lstContent.AddRange(BitConverter.GetBytes(CMD.NetCost));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Balance));
- lstContent.AddRange(BitConverter.GetBytes(CMD.NetElectricCost));
- lstContent.AddRange(BitConverter.GetBytes(CMD.NetServiceCost));
-
- results = lstContent.ToArray();
- }
- return results;
- }
-
- #endregion
-
- #region 直流充电桩 BMS 信息数据(预留)
-
- public byte[] SendRCMD301(out APDUModel APDUModel, CMD301 CMD)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 301;
- model.checksumDomain = 0x01;
-
-
-
- model.dataDomain = GetRCMD301DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD301DataInfo(CMD301 CMD)
- {
- byte[] results = null;
- if (CMD != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
-
- results = lstContent.ToArray();
- }
- return results;
- }
-
-
- public byte[] SendRCMD303(out APDUModel APDUModel, CMD303 CMD)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 303;
- model.checksumDomain = 0x01;
-
-
-
- model.dataDomain = GetRCMD303DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD303DataInfo(CMD303 CMD)
- {
- byte[] results = null;
- if (CMD != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
-
- results = lstContent.ToArray();
- }
- return results;
- }
- #endregion
-
- #region 历史记录
- public byte[] SendRCMD401(out APDUModel APDUModel, CMD401 CMD)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 401;
- model.checksumDomain = 0x01;
-
-
-
- model.dataDomain = GetRCMD401DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD401DataInfo(CMD401 CMD)
- {
- byte[] results = null;
- if (CMD != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved1));
- lstContent.AddRange(BitConverter.GetBytes(CMD.Reserved2));
- lstContent.AddRange(BitConverter.GetBytes(CMD.SelectIndex));
- lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD.ChargSerialNum));
-
- results = lstContent.ToArray();
- }
- return results;
- }
- #endregion
-
- #region 升级命令
- public byte[] SendRCMD1001(out APDUModel APDUModel, CMD1001 CMD)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 1001;
- model.checksumDomain = 0x01;
-
-
-
- model.dataDomain = GetRCMD1001DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD1001DataInfo(CMD1001 CMD)
- {
- byte[] results = null;
- if (CMD != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(BitConverter.GetBytes(CMD.CInstruction));
-
- results = lstContent.ToArray();
- }
- return results;
- }
-
- public byte[] SendRCMD1003(out APDUModel APDUModel, CMD1003 CMD)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 1003;
- model.checksumDomain = 0x01;
-
-
-
- model.dataDomain = GetRCMD1003DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List lstResult = new List();
- lstResult.AddRange(APCI(model).ToArray());
- result = lstResult.ToArray();
-
- APDUModel = model;
- return result;
- }
-
- ///
- /// 获取鉴权消息体字节数组
- ///
- ///
- /// 鉴权消息体字节数组
- private byte[] GetRCMD1003DataInfo(CMD1003 CMD)
- {
- byte[] results = null;
- if (CMD != null)
- {
- List lstContent = new List();
-
- lstContent.AddRange(Encoding.ASCII.GetBytes(CMD.Filename));
-
- results = lstContent.ToArray();
- }
- return results;
- }
-
- public byte[] SendRCMD1005(out APDUModel APDUModel, CMD1005 CMD)
- {
- byte[] result = null;
-
- APDUModel model = new APDUModel();
- model.OriginDomain1 = 0xAA;
- model.OriginDomain2 = 0xF5;
- model.infoDomain = 0x02;
- model.SerialNumberDomain = 0xff;
- model.CMD = 1005;
- model.checksumDomain = 0x01;
-
-
-
- model.dataDomain = GetRCMD1005DataInfo(CMD); //数据域
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
-
- List