diff --git a/HybirdFrameworkServices/Charger/BatCharging.Model/ReceiveCMD/CMD202.cs b/HybirdFrameworkServices/Charger/BatCharging.Model/ReceiveCMD/CMD202.cs
index 4b7c2ec..8d1fda6 100644
--- a/HybirdFrameworkServices/Charger/BatCharging.Model/ReceiveCMD/CMD202.cs
+++ b/HybirdFrameworkServices/Charger/BatCharging.Model/ReceiveCMD/CMD202.cs
@@ -3,97 +3,138 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using DotNetty.Buffers;
+using HybirdFrameworkServices.ChargerManage.Msg;
namespace HybirdFrameworkServices
{
- public class CMD202
+ /**
+ * 充电桩上报充电记录信息 (CMD=202/222)
+ */
+ public class CMD202 : BaseMsg
{
+
+ public CMD202()
+ {
+ }
+
+ //调用父类的构造函数
+ public CMD202(IByteBuffer byteBuffer,string clientIp) : base(byteBuffer,clientIp)
+ {
+ }
+
+ public override void ParseBody()
+ {
+
+ }
+
///
/// 预留
///
public ushort Reserved1 { get; set; }
+
///
/// 预留
///
public ushort Reserved2 { get; set; }
+
///
/// 充电桩编码
///
public string ASCIINum { get; set; }
+
///
/// 充电枪位置类型
/// 1-直流
/// 2-交流
///
public byte PosType { get; set; }
+
///
/// 充电枪口
///
public byte ChargGun { get; set; }
+
///
/// 充电卡号 32
///
public string ChargID { get; set; }
+
///
/// 充电开始时间
///
public string StartTime { get; set; }
+
///
/// 充电结束时间
///
public string EndTime { get; set; }
+
///
/// 充电时间长度
///
public uint TimeSpan { get; set; }
+
///
/// 开始 SOC
///
public byte SOCStart { get; set; }
+
///
/// 结束 SOC
///
public byte SOCEnd { get; set; }
+
///
/// 充电结束原因
///
public uint EndReason { get; set; }
+
///
/// 本次充电电量
///
public string ChargCapacityNow { get; set; }
+
///
/// 充电前电表读数
///
public string SAmmeterValue { get; set; }
+
///
/// 充电后电表读数
///
public string EAmmeterValue { get; set; }
+
///
/// 本次充电金额
///
public uint ChargeAmount { get; set; }
+
///
/// 内部索引号
///
public int IndexNum { get; set; }
+
///
/// 充电前卡余额
///
public uint CardBalance { get; set; }
+
///
/// 当前充电记录索引
///
public uint ChargRecord { get; set; }
+
///
/// 总充电记录条目
///
public uint SumChargRecord { get; set; }
+
///
/// 预留
///
public byte Reserved3 { get; set; }
+
///
/// 充电策略
/// 0:充满为止
@@ -102,6 +143,7 @@ namespace HybirdFrameworkServices
/// 3:电量控制充电
///
public byte ChargStrategy { get; set; }
+
///
/// 充电策略参数
/// 时间单位为 1 秒
@@ -109,210 +151,261 @@ namespace HybirdFrameworkServices
/// 电量时单位为 0.01kw
///
public string ChargStrategyPara { get; set; }
+
///
/// 车辆 VIN 17
///
public string CarVIN { get; set; }
+
///
/// 车牌号
///
public string CarID { get; set; }
+
///
/// 时段 1 充电电量
/// 命令 202 报文此字段是 2 字节,
/// 命令 222 报文此字段是 4 字节
///
public string ChargCapacity01 { get; set; }
+
///
///
///
public string ChargCapacity02 { get; set; }
+
///
///
///
public string ChargCapacity03 { get; set; }
+
///
///
///
public string ChargCapacity04 { get; set; }
+
///
///
///
public string ChargCapacity05 { get; set; }
+
///
///
///
public string ChargCapacity06 { get; set; }
+
///
///
///
public string ChargCapacity07 { get; set; }
+
///
///
///
public string ChargCapacity08 { get; set; }
+
///
///
///
public string ChargCapacity09 { get; set; }
+
///
///
///
public string ChargCapacity10 { get; set; }
+
///
///
///
public string ChargCapacity11 { get; set; }
+
///
///
///
public string ChargCapacity12 { get; set; }
+
///
///
///
public string ChargCapacity13 { get; set; }
+
///
///
///
public string ChargCapacity14 { get; set; }
+
///
///
///
public string ChargCapacity15 { get; set; }
+
///
///
///
public string ChargCapacity16 { get; set; }
+
///
///
///
public string ChargCapacity17 { get; set; }
+
///
///
///
public string ChargCapacity18 { get; set; }
+
///
///
///
public string ChargCapacity19 { get; set; }
+
///
///
///
public string ChargCapacity20 { get; set; }
+
///
///
///
public string ChargCapacity21 { get; set; }
+
///
///
///
public string ChargCapacity22 { get; set; }
+
///
///
///
public string ChargCapacity23 { get; set; }
+
///
///
///
public string ChargCapacity24 { get; set; }
+
///
///
///
public string ChargCapacity25 { get; set; }
+
///
///
///
public string ChargCapacity26 { get; set; }
+
///
///
///
public string ChargCapacity27 { get; set; }
+
///
///
///
public string ChargCapacity28 { get; set; }
+
///
///
///
public string ChargCapacity29 { get; set; }
+
///
///
///
public string ChargCapacity30 { get; set; }
+
///
///
///
public string ChargCapacity31 { get; set; }
+
///
///
///
public string ChargCapacity32 { get; set; }
+
///
///
///
public string ChargCapacity33 { get; set; }
+
///
///
///
public string ChargCapacity34 { get; set; }
+
///
///
///
public string ChargCapacity35 { get; set; }
+
///
///
///
public string ChargCapacity36 { get; set; }
+
///
///
///
public string ChargCapacity37 { get; set; }
+
///
///
///
public string ChargCapacity38 { get; set; }
+
///
///
///
public string ChargCapacity39 { get; set; }
+
///
///
///
public string ChargCapacity40 { get; set; }
+
///
///
///
public string ChargCapacity41 { get; set; }
+
///
///
///
public string ChargCapacity42 { get; set; }
+
///
///
///
public string ChargCapacity43 { get; set; }
+
///
///
///
public string ChargCapacity44 { get; set; }
+
///
///
///
public string ChargCapacity45 { get; set; }
+
///
///
///
public string ChargCapacity46 { get; set; }
+
///
///
///
public string ChargCapacity47 { get; set; }
+
///
/// 时段 48 充电电量
/// 命令 202 报文此字段是 2 字节,
/// 命令 222 报文此字段是 4 字节
///
public string ChargCapacity48 { get; set; }
+
///
/// 启动方式
/// 0:本地刷卡启动
@@ -324,18 +417,22 @@ namespace HybirdFrameworkServices
/// 6:迪文界面流程启动
///
public byte StartMode { get; set; }
+
///
/// 充电流水号 32
///
public string ChargSerialNum { get; set; }
+
///
/// 充电服务费
///
public uint ChargServiceCost { get; set; }
+
///
/// 千分位电量
///
public byte KilElectricity { get; set; }
+
///
/// 并充标志
/// 0/1-单枪充电
@@ -343,6 +440,7 @@ namespace HybirdFrameworkServices
/// 3-双机柜双枪并充充电
///
public byte ParallelMark { get; set; }
+
///
/// 充放电标志
///
@@ -351,6 +449,7 @@ namespace HybirdFrameworkServices
/// 非协议定义值,都表示充电
///
public byte ChargeOrDisMark { get; set; }
+
///
/// 电表加密数据
///
@@ -363,14 +462,17 @@ namespace HybirdFrameworkServices
/// 1 字节端钮历史状态(0 正常,1 发生过端钮盖打开时间)
///
public string MeterEncData { get; set; }
+
///
/// 电表表号 6
///
public string MeterNum { get; set; }
+
///
/// 电表协议版本
///
public ushort MeterProVersion { get; set; }
+
///
/// 加密方式
/// 当前加密方式(工厂模式下配置,抄读无任何限制)
@@ -382,6 +484,5 @@ namespace HybirdFrameworkServices
/// 05:其他
///
public byte EncMode { get; set; }
-
}
-}
+}
\ No newline at end of file
diff --git a/HybirdFrameworkServices/Charger/BatCharging.Model/ReceiveCMD/CMD206.cs b/HybirdFrameworkServices/Charger/BatCharging.Model/ReceiveCMD/CMD206.cs
index 20d0fce..4eb4887 100644
--- a/HybirdFrameworkServices/Charger/BatCharging.Model/ReceiveCMD/CMD206.cs
+++ b/HybirdFrameworkServices/Charger/BatCharging.Model/ReceiveCMD/CMD206.cs
@@ -3,11 +3,46 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using DotNetty.Buffers;
+using HybirdFrameworkServices.ChargerManage.Msg;
+/**
+ * (CMD=206)充电桩上传用户密码验证报文(预留)
+ */
namespace HybirdFrameworkServices
{
- public class CMD206
+ public class CMD206 : BaseMsg
{
+
+ public CMD206()
+ {
+ }
+
+ //调用父类的构造函数
+ public CMD206(IByteBuffer byteBuffer,string clientIp) : base(byteBuffer,clientIp)
+ {
+ }
+
+ public override void ParseBody()
+ {
+ this.Reserved1=this.ByteBuffer.GetUnsignedShortLE(BaseMsg.StartBodyIndex);
+ this.Reserved2=this.ByteBuffer.GetUnsignedShortLE(BaseMsg.StartBodyIndex+2);
+ ByteBuffer.SetReaderIndex(12);
+ // 读取接下来的32字节
+ byte[] no = new byte[32];
+ ByteBuffer.ReadBytes(no);
+ this.ASCIINum = Encoding.ASCII.GetString(no);
+
+ no = new byte[32];
+ ByteBuffer.ReadBytes(no);
+ this.ChargID = Encoding.ASCII.GetString(no);
+ no = new byte[32];
+ ByteBuffer.ReadBytes(no);
+ this.ChargPassword = Encoding.ASCII.GetString(no);
+ no = new byte[48];
+ ByteBuffer.ReadBytes(no);
+ this.RandomData = Encoding.ASCII.GetString(no);
+ }
///
/// 预留
///
diff --git a/HybirdFrameworkServices/Charger/BatCharging.Service/ChargerMgrTool.cs b/HybirdFrameworkServices/Charger/BatCharging.Service/ChargerMgrTool.cs
index 6d200a3..5da2602 100644
--- a/HybirdFrameworkServices/Charger/BatCharging.Service/ChargerMgrTool.cs
+++ b/HybirdFrameworkServices/Charger/BatCharging.Service/ChargerMgrTool.cs
@@ -15,20 +15,20 @@ using HybirdFrameworkServices.Charger.BatCharging.Service;
namespace HybirdFrameworkServices
{
///
- /// 1ų
+ /// 1号充电机管理工具
///
public class ChargerMgrTool
{
Server Server = new Server();
- #region
+ #region 定义锁
- private object lockObj = new object(); //߳ͬ
+ private object lockObj = new object(); //线程同步锁
- #endregion
+ #endregion 定义锁
- #region ֶ
+ #region 字段属性
- #region Ϣ
+ #region 充电机信息
private IChannelId _id;
public IChannelId ID
{
@@ -43,12 +43,12 @@ namespace HybirdFrameworkServices
}
///
- /// IPַ
+ /// IP地址
///
private string _ip_addr;
///
- /// IPַ
+ /// 网络IP地址
///
public string F_IPAddr
{
@@ -63,12 +63,12 @@ namespace HybirdFrameworkServices
}
///
- /// ˿ں
+ /// 网络端口号
///
private int _ip_port = 4567;
///
- /// ˿ں
+ /// 网络端口号
///
public int F_Port
{
@@ -83,12 +83,12 @@ namespace HybirdFrameworkServices
}
///
- /// ͨѶǷ
+ /// 通讯是否已连接
///
private bool _net_connected = false;
///
- /// ͨѶǷ
+ /// 通讯是否已连接
///
public bool F_NetConnected
{
@@ -102,11 +102,11 @@ namespace HybirdFrameworkServices
}
}
///
- /// ߳Ƿ
+ /// 线程是否启动
///
private bool _thread_start;
///
- /// ߳Ƿ
+ /// 线程是否启动
///
public bool F_ThreadStart
{
@@ -121,12 +121,12 @@ namespace HybirdFrameworkServices
}
///
- /// ǷѾȨ
+ /// 是否与充电机已经鉴权
///
private bool _is_authed = false;
///
- /// վǷѾȨ
+ /// 站控与充电机是否已经鉴权
///
public bool F_IsAuthed
{
@@ -142,12 +142,12 @@ namespace HybirdFrameworkServices
///
- /// ͨѶж϶߳ʱʱ䣨λ룩
+ /// 通讯判断断线超时时间(单位:秒)
///
private int _net_check_time_out = 30;
///
- /// ͨѶж϶߳ʱʱ䣨λ룩
+ /// 通讯判断断线超时时间(单位:秒)
///
public int F_NetCheckTimeOut
{
@@ -162,11 +162,11 @@ namespace HybirdFrameworkServices
}
///
- ///
+ /// 充电机编码
///
private string _eqmcode;
///
- ///
+ /// 充电机编码
///
public string F_EqmCode
{
@@ -181,11 +181,11 @@ namespace HybirdFrameworkServices
}
///
- /// ܱʶ
+ /// 加密标识
///
private bool _sign;
///
- /// ܱʶ
+ /// 加密标识
///
public bool F_Sign
{
@@ -200,12 +200,12 @@ namespace HybirdFrameworkServices
}
///
- /// ʱ
+ /// 接收数据时刻
///
private DateTime _recving_data_time = DateTime.Now;
///
- /// ʱ
+ /// 接收数据时刻
///
public DateTime F_RecvingDataTime
{
@@ -219,11 +219,11 @@ namespace HybirdFrameworkServices
}
}
///
- /// ۼֵ
+ /// 心跳累加值
///
private ushort _accumulation;
///
- /// ۼֵ
+ /// 心跳累加值
///
public ushort F_Accumulation
{
@@ -244,12 +244,12 @@ namespace HybirdFrameworkServices
///
- /// ǷѾʼ
+ /// 是否已经开始充电
///
private bool _is_charged = false;
///
- /// ǷѾʼ
+ /// 充电机是否已经开始充电
///
public bool F_IsCharged
{
@@ -264,12 +264,12 @@ namespace HybirdFrameworkServices
}
///
- /// Ƿֹͣ
+ /// 是否停止充电
///
private bool _is_stoped = false;
///
- /// Ƿֹͣ
+ /// 是否停止充电
///
public bool F_IsStoped
{
@@ -285,12 +285,12 @@ namespace HybirdFrameworkServices
///
- /// 翪ʼʱ䣨Ĭ2000-1-1
+ /// 充电开始时间(默认2000-1-1)
///
private DateTime _charging_start_time = Convert.ToDateTime("2000-1-1");
///
- /// 翪ʼʱ䣨Ĭ2000-1-1
+ /// 充电开始时间(默认2000-1-1)
///
public DateTime F_ChargingStartTime
{
@@ -305,12 +305,12 @@ namespace HybirdFrameworkServices
}
///
- /// ֹͣʱ䣨Ĭ2000-1-1
+ /// 充电停止时间(默认2000-1-1)
///
private DateTime _charging_stop_time = Convert.ToDateTime("2000-1-1");
///
- /// ֹͣʱ䣨Ĭ2000-1-1
+ /// 充电停止时间(默认2000-1-1)
///
public DateTime F_ChargingStopTime
{
@@ -325,12 +325,12 @@ namespace HybirdFrameworkServices
}
///
- /// óֹͣԭ.0ͣ 1쳣,ǿͣ
+ /// 设置充电停止的原因.0正常停机 1服务器发现桩异常,强制停机
///
private byte _stop_reason = 0;
///
- /// óֹͣԭ.0ͣ 1쳣,ǿͣ
+ /// 设置充电停止的原因.0正常停机 1服务器发现桩异常,强制停机
///
public byte F_StopReason
{
@@ -345,12 +345,12 @@ namespace HybirdFrameworkServices
}
///
- /// ѭԶָֹͣյظֹͣɺΪFalse
+ /// 能循环发送远程停止充电指令,收到充电机回复充电停止完成后,置为False
///
private bool _is_can_send_stop_cmd = true;
///
- /// óֹͣԭ.0ͣ 1쳣,ǿͣ
+ /// 设置充电停止的原因.0正常停机 1服务器发现桩异常,强制停机
///
public bool F_IsCanSendStopCmd
{
@@ -365,12 +365,12 @@ namespace HybirdFrameworkServices
}
///
- /// ¼ǷѾƽ̨
+ /// 充电记录是否已经发送给云平台
///
internal bool _record_to_cloud_sended = false;
///
- /// ¼ǷѾƽ̨
+ /// 充电记录是否已经发送给云平台
///
public bool F_RecordToCloudSended
{
@@ -386,12 +386,12 @@ namespace HybirdFrameworkServices
///
- /// ״̬-ңݰеõ0:12ɣ3/ŵͣ
+ /// 充电机工作状态-从遥信数据包中得到。0:待机;1:工作;2:工作完成;3:充/放电暂停
///
private byte _workstate;
///
- /// ״̬-ңݰеõ0:12ɣ3/ŵͣ
+ /// 充电机工作状态-从遥信数据包中得到。0:待机;1:工作;2:工作完成;3:充/放电暂停
///
public byte F_WorkState
{
@@ -406,12 +406,12 @@ namespace HybirdFrameworkServices
}
///
- ///
+ ///充电机发生故障
///
private bool _is_fault;
///
- /// -true:ϣfalse:
+ /// 充电机发生故障-true:故障;false:正常
///
public bool F_IsFault
{
@@ -426,12 +426,12 @@ namespace HybirdFrameworkServices
}
///
- ///
+ ///充电机发生报警
///
private bool _is_alarm;
///
- /// -true:false:
+ /// 充电机发生报警-true:报警;false:正常
///
public bool F_IsAlarm
{
@@ -446,12 +446,12 @@ namespace HybirdFrameworkServices
}
///
- ///
+ /// 故障码
///
private int _fault_number = 0;
///
- ///
+ /// 故障码
///
public int F_FaultNumber
{
@@ -466,12 +466,12 @@ namespace HybirdFrameworkServices
}
///
- /// ϱб
+ /// 故障报警列表
///
private List _fault_alaram_no_list = new List();
///
- /// ϱб
+ /// 故障报警列表
///
public List F_FaultAlarmNoList
{
@@ -486,12 +486,12 @@ namespace HybirdFrameworkServices
}
///
- ///SOC
+ ///充电机充电电池SOC
///
private byte _soc = 0;
///
- /// SOC
+ /// 充电机充电电池SOC
///
public byte F_SOC
{
@@ -506,12 +506,12 @@ namespace HybirdFrameworkServices
}
///
- ///ʵʱ繦
+ ///充电机实时充电功率
///
private float _power = 0;
///
- /// ʵʱ繦
+ /// 充电机实时充电功率
///
public float F_Power
{
@@ -528,7 +528,7 @@ namespace HybirdFrameworkServices
//private int alarmProcessCounter = 0;
///
- ///
+ /// 心跳进程
///
private static ushort HeartBeatProcessCounter = 0;
@@ -536,18 +536,18 @@ namespace HybirdFrameworkServices
- #endregion Ϣ
+ #endregion 充电机信息
- #region Ϣ
+ #region 电池信息
- #endregion Ϣ
+ #endregion 电池信息
- #endregion ֶ
+ #endregion 字段属性
- #region ṹ
+ #region 类结构体
public ChargerMgrTool()
{
@@ -555,10 +555,10 @@ namespace HybirdFrameworkServices
///
- /// ṹ
+ /// 类结构体
///
- /// IPַ
- /// ˿ں
+ /// IP地址
+ /// 网络端口号
public ChargerMgrTool(string ipAddr, int port)
{
_ip_addr = ipAddr;
@@ -568,9 +568,9 @@ namespace HybirdFrameworkServices
///
///
///
- /// IPַ
- /// ˿ں
- /// Ŀĵַֽ
+ /// IP地址
+ /// 网络端口号
+ /// 充电机目的地址字节数组
public ChargerMgrTool(IChannelId id, string ipAddr, int port, string eqmcode)
{
_id = id;
@@ -579,20 +579,20 @@ namespace HybirdFrameworkServices
_eqmcode = eqmcode;
}
- #endregion ṹ
+ #endregion 类结构体
- #region ¼
+ #region 事件定义
- #endregion ¼
+ #endregion 事件定义
- #region ¼
+ #region 事件处理
- #endregion ¼
+ #endregion 事件处理
- #region ͨѶ߳
+ #region 通讯线程
///
- /// ߳
+ /// 充电机线程启动
///
public void ChargerNetCheckThread()
{
@@ -603,16 +603,16 @@ namespace HybirdFrameworkServices
///
- /// жǷ߳.£30δյϢΪߣҪ
- /// ȡ͵˳ı
+ /// 充电机判断是否断线线程.充电机在连接情况下,30秒未收到信息,则认为断线,需要重新连接
+ /// 读取发送到此充电机的报文
///
private void ChargerNetCheckFunc()
{
while (F_ThreadStart)
{
- //if (F_IsAuthed)//ǷȨ
- // if (F_NetConnected)//Ƿ
- if (F_NetConnected)//Ƿ
+ //if (F_IsAuthed)//是否鉴权
+ // if (F_NetConnected)//是否连接
+ if (F_NetConnected)//是否连接
{
Thread.Sleep(2000);
@@ -627,9 +627,9 @@ namespace HybirdFrameworkServices
}
}
- #endregion ͨѶ߳
+ #endregion 通讯线程
- #region ݽ
+ #region 数据接收
public void decode(byte[] data)
@@ -639,63 +639,63 @@ namespace HybirdFrameworkServices
if (func == 106 || F_IsAuthed)
switch (func)
{
- #region /ѯ
+ #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" + "");
+ 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" + "");
+ 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" + "");
+ 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" + "");
+ 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" + "");
+ 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 ϴ
+ #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" + "");
+ string result = "(CMD=10)充电桩上传心跳包信息 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ result += "\r\n" + "(CMD=10)充电桩上传心跳包信息对象:" + JsonConvert.SerializeObject(CMD102);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
HeartBeatProcessCounter += 1;
byte[] bytes = Send101(HeartBeatProcessCounter);
@@ -708,22 +708,22 @@ namespace HybirdFrameworkServices
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" + "");
+ 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:
- //106ǩȨ
+ //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" + "");
+ string result = "(CMD=10)充电桩签到信息上报 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ result += "\r\n" + "(CMD=10)充电桩签到信息上报对象:" + JsonConvert.SerializeObject(CMD106);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
if (CMD106 != null)
{
- //ظ106ǩ
+ //回复106签到报文
{
F_EqmCode = CMD106.ASCIINum;
F_Sign = CMD106.Sign == 1 ? true : false;
@@ -747,12 +747,12 @@ namespace HybirdFrameworkServices
Server.Send(bytes);
}
}
- //CMD3ʱ
+ //CMD3对时报文
{
- byte type = 1;//0-ѯ 1-
- uint startAddress = 2;///ѯʼַ
+ byte type = 1;//0-查询 1-设置
+ uint startAddress = 2;//设置/查询参数启始地址
- byte[] setData = new byte[8];//
+ byte[] setData = new byte[8];//设置数据
setData = BcdTimeConverter.ConvertToBcdTimeByte(DateTime.Now);
byte[] bytes = Send3(type, startAddress, setData);
@@ -767,273 +767,273 @@ namespace HybirdFrameworkServices
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" + "");
+ 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" + "");
+ 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" + "");
+ 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" + "");
+ 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 Ϣ
+ #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" + "");
+ 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" + "");
+ 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" + "");
+ 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" + "");
+ 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" + "");
+ string result = "充电桩上报“即插即充”启动充电结果 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ result += "\r\n" + "充电桩上报“即插即充”启动充电结果:" + JsonConvert.SerializeObject(CMD210);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
#endregion
- #region ֱ BMS Ϣ(Ԥ)
+ #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" + "");
+ 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" + "");
+ string result = "充电桩上报BMS信息(预留-暂时不用) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ result += "\r\n" + "充电桩上报BMS信息(预留-暂时不用)对象:" + JsonConvert.SerializeObject(CMD304);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
#endregion
- #region ʷ¼
+ #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" + "");
+ string result = "充电桩上报历史的充电记录 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ result += "\r\n" + "充电桩上报历史的充电记录:" + JsonConvert.SerializeObject(CMD402);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
#endregion
- #region
+ #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" + "");
+ 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" + "");
+ 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" + "");
+ 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" + "");
+ 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" + "");
+ 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" + "");
+ 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" + "");
+ string result = "充电桩主动请求升级命令 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ result += "\r\n" + "充电桩主动请求升级命令对象:" + JsonConvert.SerializeObject(CMD1022);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
#endregion
- #region ƷѲصָ
+ #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" + "");
+ 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" + "");
+ 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" + "");
+ 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" + "");
+ string result = "充电桩回复分时电费计价策略信息 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ result += "\r\n" + "充电桩回复分时电费计价策略信息对象:" + JsonConvert.SerializeObject(CMD1108);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
#endregion
- #region
+ #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" + "");
+ string result = "充电桩应答白名单操作日志数据包 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ result += "\r\n" + "充电桩应答白名单操作日志数据包对象:" + JsonConvert.SerializeObject(CMD1302);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
#endregion
- #region FTPԶFTPʽ־ϴ
+ #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" + "");
+ 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" + "");
+ 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" + "");
+ string result = "充电桩应答服务器下发获取充电桩日志命令 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ result += "\r\n" + "充电桩应答服务器下发获取充电桩日志命令对象:" + JsonConvert.SerializeObject(CMD1407);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
#endregion
- #region Э鷽ʽ־ϴ
+ #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" + "");
+ 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" + "");
+ 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://ɣҪر
+ 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" + "");
+ string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
+ result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1505);
+ //Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
}
break;
#endregion
@@ -1041,17 +1041,17 @@ namespace HybirdFrameworkServices
}
- #endregion ݽ
+ #endregion 数据接收
- #region ݷ
+ #region 数据发送
public void Send(byte[] bytes)
{
Server.Send(bytes, ID);
}
- #region /ѯ
+ #region 服务器向充电桩设置/查询工作参数和命令
///
- /// (CMD=1)̨·ι
+ /// (CMD=1)后台服务器下发充电桩整形工作参数
///
///
///
@@ -1073,7 +1073,7 @@ namespace HybirdFrameworkServices
if (APDUModel != null)
{
- string result = "1̨·ι-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "1后台服务器下发充电桩整形工作参数-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
}
return bytes;
@@ -1102,7 +1102,7 @@ namespace HybirdFrameworkServices
if (APDUModel != null)
{
- string result = "3̨·ַͲ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "3后台服务器下发充电桩字符型参数-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
}
return bytes;
@@ -1110,13 +1110,13 @@ namespace HybirdFrameworkServices
///
- /// ̨·
+ /// 后台服务器下发充电桩控制命令
///
///
- /// ǹ
- /// ʼַ
- ///
- ///
+ /// 充电枪口
+ /// 启始命令地址
+ /// 命令个数
+ /// 命令参数
public byte[] Send5(byte chargeMuzzle, uint startAddress, byte num, byte[] setData)
{
@@ -1134,7 +1134,7 @@ namespace HybirdFrameworkServices
if (APDUModel != null)
{
- string result = "5̨·-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "5后台服务器下发充电桩控制命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
}
@@ -1144,7 +1144,7 @@ namespace HybirdFrameworkServices
///
- /// ̨·
+ /// 后台服务器下发充电桩开启充电控制命令
///
///
///
@@ -1156,7 +1156,7 @@ namespace HybirdFrameworkServices
if (APDUModel != null)
{
- string result = "7̨·-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "7后台服务器下发充电桩开启充电控制命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
}
@@ -1182,7 +1182,7 @@ namespace HybirdFrameworkServices
if (APDUModel != null)
{
- string result = "9̨Ӧϴ(Ԥ)-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "9后台服务器应答桩上传命令请求(预留)-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
}
@@ -1192,12 +1192,12 @@ namespace HybirdFrameworkServices
#endregion
- #region ϴ
+ #region 充电桩主动上传数据
///
- /// ӦϢ
+ /// 服务器应答心跳包信息
///
///
- /// Ӧ
+ /// 心跳应答
public byte[] Send101(ushort heartbeatNum)
{
APDUModel APDUModel;
@@ -1210,7 +1210,7 @@ namespace HybirdFrameworkServices
if (APDUModel != null)
{
- string result = "101ӦϢ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "101服务器应答心跳包信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
}
@@ -1218,11 +1218,11 @@ namespace HybirdFrameworkServices
}
///
- /// Ӧ״̬Ϣ
+ /// 服务器应答充电桩状态信息包
///
///
- /// ں
- /// Ƿϱһ104 0- 1-
+ /// 充电口号
+ /// 是否立即上报一次104报文 0-否 、1-是
public byte[] Send103(byte chargeNum, bool reportMessage)
{
APDUModel APDUModel;
@@ -1236,7 +1236,7 @@ namespace HybirdFrameworkServices
byte[] bytes = new ChargerSendCMD().SendRCMD103(out APDUModel, CMD);
if (APDUModel != null)
{
- string result = "103Ӧ״̬Ϣ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "103服务器应答充电桩状态信息包-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
}
@@ -1244,7 +1244,7 @@ namespace HybirdFrameworkServices
}
///
- /// Ӧǩ
+ /// 服务器应答充电桩签到命令
///
///
///
@@ -1255,7 +1255,7 @@ namespace HybirdFrameworkServices
byte[] bytes = new ChargerSendCMD().SendRCMD105(out APDUModel, CMD);
if (APDUModel != null)
{
- string result = "105Ӧǩ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "105服务器应答充电桩签到命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
}
@@ -1263,7 +1263,7 @@ namespace HybirdFrameworkServices
}
///
- /// Ӧ澯Ϣ
+ /// 服务器应答充电桩告警信息
///
///
public byte[] Send107()
@@ -1275,7 +1275,7 @@ namespace HybirdFrameworkServices
byte[] bytes = new ChargerSendCMD().SendRCMD107(out APDUModel, CMD);
if (APDUModel != null)
{
- string result = "107Ӧ澯Ϣ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "107服务器应答充电桩告警信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
}
@@ -1283,7 +1283,7 @@ namespace HybirdFrameworkServices
}
///
- /// Ӧ澯Ϣ
+ /// 服务器应答充电桩告警信息
///
///
public byte[] Send109()
@@ -1298,7 +1298,7 @@ namespace HybirdFrameworkServices
byte[] bytes = new ChargerSendCMD().SendRCMD109(out APDUModel, CMD);
if (APDUModel != null)
{
- string result = "109Ӧ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "109服务器应答充电桩启动完成命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
}
@@ -1318,7 +1318,7 @@ namespace HybirdFrameworkServices
byte[] bytes = new ChargerSendCMD().SendRCMD111(out APDUModel, CMD);
if (APDUModel != null)
{
- string result = "111ӦϱģϢԤ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "111服务器应答充电桩上报模块信息(预留)-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
}
@@ -1326,11 +1326,11 @@ namespace HybirdFrameworkServices
}
///
- /// ѯһγʱϢ
+ /// 服务器查询最近一次充电各时段信息
///
///
- /// ں
- /// ־
+ /// 充电口号
+ /// 标志
public byte[] Send113(byte chargeNum, byte sign)
{
APDUModel APDUModel;
@@ -1344,7 +1344,7 @@ namespace HybirdFrameworkServices
byte[] bytes = new ChargerSendCMD().SendRCMD113(out APDUModel, CMD);
if (APDUModel != null)
{
- string result = "113ѯһγʱϢ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "113服务器查询最近一次充电各时段信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
}
@@ -1353,7 +1353,7 @@ namespace HybirdFrameworkServices
#endregion
- #region Ϣ
+ #region 充电信息数据
///
/// (CMD=5)
@@ -1365,7 +1365,7 @@ namespace HybirdFrameworkServices
{
byte[] bytes = new ChargerSendCMD().SendRCMD201(out APDUModel APDUModel, CMD, func);
- string result = "201ӦϱϢ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "201服务器应答充电桩上报充电信息报文-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1376,7 +1376,7 @@ namespace HybirdFrameworkServices
public byte[] Send203(CMD203 CMD)
{
byte[] bytes = new ChargerSendCMD().SendRCMD203(out APDUModel APDUModel, CMD);
- string result = "203Ӧ˻ѯϢ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "203服务器应答账户查询信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1400,7 +1400,7 @@ namespace HybirdFrameworkServices
}
byte[] bytes = new ChargerSendCMD().SendRCMD205(out APDUModel APDUModel, CMD);
- string result = "205Ӧ֤ģԤ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "205服务器应答充电密码验证报文(预留)-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1423,7 +1423,7 @@ namespace HybirdFrameworkServices
CMD.RechBalance = value10;
CMD.StopCode = value11;
byte[] bytes = new ChargerSendCMD().SendRCMD207(out APDUModel APDUModel, CMD);
- string result = "207ƽ̨ظ弴䡱-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "207平台回复“即插即充”请求充电结果-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1440,7 +1440,7 @@ namespace HybirdFrameworkServices
CMD.ChargGunNum = CMD210.ChargGunNum;
CMD.VINNum = value05;
byte[] bytes = new ChargerSendCMD().SendRCMD209(out APDUModel APDUModel, CMD);
- string result = "209ƽ̨ظ弴䡱-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "209平台回复“即插即充”启动充电结果-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1455,7 +1455,7 @@ namespace HybirdFrameworkServices
CMD.ChargID = CMD221.ChargID;
CMD.IndexNum = value05;
byte[] bytes = new ChargerSendCMD().SendRCMD221(out APDUModel APDUModel, CMD);
- string result = "վӦŵϱģ״̬-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1464,7 +1464,7 @@ namespace HybirdFrameworkServices
#endregion
- #region ֱ BMS Ϣ(Ԥ)
+ #region 直流充电桩 BMS 信息数据(预留)
public byte[] Send301()
{
@@ -1472,7 +1472,7 @@ namespace HybirdFrameworkServices
CMD.Reserved1 = 0;
CMD.Reserved2 = 0;
byte[] bytes = new ChargerSendCMD().SendRCMD301(out APDUModel APDUModel, CMD);
- string result = "301ӦϱBMSϢ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "301服务器应答充电桩上报BMS信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1485,14 +1485,14 @@ namespace HybirdFrameworkServices
CMD.Reserved1 = 0;
CMD.Reserved2 = 0;
byte[] bytes = new ChargerSendCMD().SendRCMD303(out APDUModel APDUModel, CMD);
- string result = "303ӦϱBMSϢ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "303服务器应答充电桩上报BMS信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
}
#endregion
- #region ʷ¼
+ #region 历史记录
public byte[] Send401(string chargingSerialNum, uint startIndex)
{
@@ -1502,21 +1502,21 @@ namespace HybirdFrameworkServices
CMD.SelectIndex = startIndex;
CMD.ChargSerialNum = chargingSerialNum;
byte[] bytes = new ChargerSendCMD().SendRCMD401(out APDUModel APDUModel, CMD);
- string result = "401/421ѯʷ¼-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "401/421服务器查询充电桩历史充电记录-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
}
#endregion
- #region
+ #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) + "";
+ string result = "1001服务器下发擦除指令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1527,7 +1527,7 @@ namespace HybirdFrameworkServices
CMD1003 CMD = new CMD1003();
CMD.Filename = fileName;
byte[] bytes = new ChargerSendCMD().SendRCMD1003(out APDUModel APDUModel, CMD);
- string result = "1003·ļָ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "1003服务器下发升级文件名指令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1538,7 +1538,7 @@ namespace HybirdFrameworkServices
CMD1005 CMD = new CMD1005();
CMD.FileLength = fileLength;
byte[] bytes = new ChargerSendCMD().SendRCMD1005(out APDUModel APDUModel, CMD);
- string result = "1005·ļС-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "1005服务器下发升级文件大小-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1549,7 +1549,7 @@ namespace HybirdFrameworkServices
CMD1007 CMD = new CMD1007();
CMD.UpFileData = updata;
byte[] bytes = new ChargerSendCMD().SendRCMD1007(out APDUModel APDUModel, CMD);
- string result = "1007·ļ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "1007服务器下发升级文件数据-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1560,7 +1560,7 @@ namespace HybirdFrameworkServices
CMD1009 CMD = new CMD1009();
CMD.Reserved1 = Reserved1;
byte[] bytes = new ChargerSendCMD().SendRCMD1009(out APDUModel APDUModel, CMD);
- string result = "1009·ļݽָ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "1009服务器下发升级文件数据结束指令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1571,7 +1571,7 @@ namespace HybirdFrameworkServices
CMD1011 CMD = new CMD1011();
CMD.Reserved1 = 0;
byte[] bytes = new ChargerSendCMD().SendRCMD1011(out APDUModel APDUModel, CMD);
- string result = "1011·ָ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "1011服务器下发重启指令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1583,20 +1583,20 @@ namespace HybirdFrameworkServices
CMD.ResponseResult = results;
CMD.ResponsExplain = description;
byte[] bytes = new ChargerSendCMD().SendRCMD1021(out APDUModel APDUModel, CMD);
- string result = "1021ظ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "1021服务器回复充电桩主动请求升级命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
}
#endregion
- #region ƷѲصָ
+ #region 与计费策略相关的指令
public byte[] Send1101()
{
byte[] bytes = new ChargerSendCMD().SendRCMD1101(out APDUModel APDUModel);
- string result = "1101̨ѯ24ʱѼƼ۲Ϣ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "1101后台服务器查询24时电费计价策略信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1605,7 +1605,7 @@ namespace HybirdFrameworkServices
public byte[] Send1103(CMD1103 CMD)
{
byte[] bytes = new ChargerSendCMD().SendRCMD1103(out APDUModel APDUModel, CMD);
- string result = "1103̨24ʱεѼƼ۲Ϣ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "1103后台服务器设置24时段电费计价策略信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1614,7 +1614,7 @@ namespace HybirdFrameworkServices
public byte[] Send1105(CMD1105 CMD)
{
byte[] bytes = new ChargerSendCMD().SendRCMD1105(out APDUModel APDUModel, CMD);
- string result = "1105̨÷ʱμƼ۲Ϣ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "1105后台服务器设置分时段计价策略信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1623,20 +1623,20 @@ namespace HybirdFrameworkServices
public byte[] Send1107()
{
byte[] bytes = new ChargerSendCMD().SendRCMD1107(out APDUModel APDUModel);
- string result = "1107̨ѯʱѼƼ۲Ϣ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "1107后台服务器查询分时电费计价策略信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
}
#endregion
- #region
+ #region 白名单报文
public byte[] Send1301(CMD1301 CMD)
{
byte[] bytes = new ChargerSendCMD().SendRCMD1301(out APDUModel APDUModel, CMD);
- string result = "1301·־ݰ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "1301服务器下发白名单操作日志数据包-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1644,12 +1644,12 @@ namespace HybirdFrameworkServices
#endregion
- #region FTP Զ FTP ʽ־ϴ
+ #region FTP 远程升级和 FTP 方式日志上传
public byte[] Send1401(CMD1401 CMD)
{
byte[] bytes = new ChargerSendCMD().SendRCMD1401(out APDUModel APDUModel, CMD);
- string result = "1401·FTPԶ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "1401服务器下发FTP远程升级命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1658,14 +1658,14 @@ namespace HybirdFrameworkServices
public byte[] Send1406(CMD1406 CMD)
{
byte[] bytes = new ChargerSendCMD().SendRCMD1406(out APDUModel APDUModel, CMD);
- string result = "1406·ȡ־Ϣ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "1406服务器下发获取充电桩日志信息命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
}
#endregion
- #region Э鷽ʽ־ϴ
+ #region 协议方式日志上传
public byte[] Send1502(uint responseCode)
{
@@ -1673,7 +1673,7 @@ namespace HybirdFrameworkServices
CMD.AnswerCode = responseCode;
byte[] bytes = new ChargerSendCMD().SendRCMD1502(out APDUModel APDUModel, CMD);
- string result = "cmd1502 ϴ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "cmd1502 服务器允许上传-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1687,7 +1687,7 @@ namespace HybirdFrameworkServices
CMD.Sign = logo;
CMD.ReceiveMessageNum = successReservedMessageNum;
byte[] bytes = new ChargerSendCMD().SendRCMD1504(out APDUModel APDUModel, CMD);
- string result = "1504Ӧϴ־-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "1504服务器应答上传日志-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1699,7 +1699,7 @@ namespace HybirdFrameworkServices
CMD.Reserved1 = 0;
CMD.Reserved1 = 0;
byte[] bytes = new ChargerSendCMD().SendRCMD1506(out APDUModel APDUModel, CMD);
- string result = "1506ǰļ-ֽݣ" + ByteUtils.BytesToHexStr(bytes) + "";
+ string result = "1506当前文件接收完成-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
//Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
return bytes;
@@ -1735,7 +1735,7 @@ namespace HybirdFrameworkServices
#endregion
- #region ݽ
+ #region 数据解码
public CMD2 ConCMD2(byte[] data)
{
@@ -2008,7 +2008,7 @@ namespace HybirdFrameworkServices
ushort year = ByteUtils.DToUInt16(data, 108);
- CMD110.BRMBMSSoftVerNum = VersionSerialNum.ToString() + year.ToString() + "" + month.ToString() + "" + day.ToString() + "";
+ 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);
@@ -3120,11 +3120,11 @@ namespace HybirdFrameworkServices
- #endregion ݷ
+ #endregion 数据发送
}
public class ChargerSendCMD
{
- #region /ѯ
+ #region 设置/查询工作参数和命令
public byte[] SendRCMD1(out APDUModel APDUModel, CMD1 CMD)
{
@@ -3139,8 +3139,8 @@ namespace HybirdFrameworkServices
model.checksumDomain = 0x01;
- model.dataDomain = GetRCMD1DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD1DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -3151,10 +3151,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD1DataInfo(CMD1 CMD1)
{
byte[] results = null;
@@ -3165,9 +3165,9 @@ namespace HybirdFrameworkServices
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));//ֽ
+ lstContent.AddRange(BitConverter.GetBytes(CMD1.SetAddress));//起始地址
+ lstContent.Add(CMD1.SelectNum);//查询个数
+ lstContent.AddRange(BitConverter.GetBytes(CMD1.SetByteNum));//参数字节数
if (CMD1.Type == 1)
{
lstContent.AddRange(CMD1.SetData);
@@ -3191,8 +3191,8 @@ namespace HybirdFrameworkServices
model.checksumDomain = 0x01;
- model.dataDomain = GetRCMD3DataInfo(CMD3); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD3DataInfo(CMD3); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -3203,10 +3203,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD3DataInfo(CMD3 CMD)
{
byte[] results = null;
@@ -3239,8 +3239,8 @@ namespace HybirdFrameworkServices
model.CMD = 5;
model.checksumDomain = 0x01;
- model.dataDomain = GetRCMD5DataInfo(cMD5); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD5DataInfo(cMD5); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -3251,10 +3251,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD5DataInfo(CMD5 CMD)
{
byte[] results = null;
@@ -3289,8 +3289,8 @@ namespace HybirdFrameworkServices
- model.dataDomain = GetRCMD7DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD7DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -3301,10 +3301,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD7DataInfo(CMD7 CMD)
{
byte[] results = null;
@@ -3348,8 +3348,8 @@ namespace HybirdFrameworkServices
- model.dataDomain = GetRCMD9DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD9DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -3360,10 +3360,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD9DataInfo(CMD9 CMD)
{
byte[] results = null;
@@ -3385,7 +3385,7 @@ namespace HybirdFrameworkServices
}
#endregion
- #region ϴ
+ #region 充电桩主动上传数据
public byte[] SendRCMD101(out APDUModel APDUModel, CMD101 CMD)
{
@@ -3401,8 +3401,8 @@ namespace HybirdFrameworkServices
- model.dataDomain = GetRCMD101DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD101DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -3413,10 +3413,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD101DataInfo(CMD101 CMD)
{
byte[] results = null;
@@ -3447,8 +3447,8 @@ namespace HybirdFrameworkServices
model.checksumDomain = 0x01;
- model.dataDomain = GetRCMD103DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD103DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -3459,10 +3459,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD103DataInfo(CMD103 CMD)
{
byte[] results = null;
@@ -3494,8 +3494,8 @@ namespace HybirdFrameworkServices
- model.dataDomain = GetRCMD105DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD105DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -3506,10 +3506,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD105DataInfo(CMD105 CMD105)
{
byte[] results = null;
@@ -3552,8 +3552,8 @@ namespace HybirdFrameworkServices
- model.dataDomain = GetRCMD107DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD107DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -3564,10 +3564,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD107DataInfo(CMD107 CMD)
{
byte[] results = null;
@@ -3598,8 +3598,8 @@ namespace HybirdFrameworkServices
model.checksumDomain = 0x01;
- model.dataDomain = GetRCMD109DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD109DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -3610,10 +3610,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD109DataInfo(CMD109 CMD)
{
byte[] results = null;
@@ -3643,8 +3643,8 @@ namespace HybirdFrameworkServices
model.checksumDomain = 0x01;
- model.dataDomain = GetRCMD111DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD111DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -3655,10 +3655,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD111DataInfo(CMD111 CMD)
{
byte[] results = null;
@@ -3687,8 +3687,8 @@ namespace HybirdFrameworkServices
model.CMD = 113;
model.checksumDomain = 0x01;
- model.dataDomain = GetRCMD113DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD113DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -3699,10 +3699,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD113DataInfo(CMD113 CMD)
{
byte[] results = null;
@@ -3721,7 +3721,7 @@ namespace HybirdFrameworkServices
}
#endregion
- #region Ϣ
+ #region 充电信息数据
public byte[] SendRCMD201(out APDUModel APDUModel, CMD201 CMD, uint func)
{
@@ -3742,8 +3742,8 @@ namespace HybirdFrameworkServices
}
model.checksumDomain = 0x01;
- model.dataDomain = GetRCMD201DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD201DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -3754,10 +3754,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD201DataInfo(CMD201 CMD)
{
byte[] results = null;
@@ -3798,8 +3798,8 @@ namespace HybirdFrameworkServices
- model.dataDomain = GetRCMD203DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD203DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -3810,10 +3810,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD203DataInfo(CMD203 CMD)
{
byte[] results = null;
@@ -3856,8 +3856,8 @@ namespace HybirdFrameworkServices
- model.dataDomain = GetRCMD205DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD205DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -3868,10 +3868,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD205DataInfo(CMD205 CMD)
{
byte[] results = null;
@@ -3905,8 +3905,8 @@ namespace HybirdFrameworkServices
- model.dataDomain = GetRCMD207DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD207DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -3917,10 +3917,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD207DataInfo(CMD207 CMD)
{
byte[] results = null;
@@ -3959,8 +3959,8 @@ namespace HybirdFrameworkServices
model.checksumDomain = 0x01;
- model.dataDomain = GetRCMD209DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD209DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -3970,10 +3970,10 @@ namespace HybirdFrameworkServices
return result;
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD209DataInfo(CMD209 CMD)
{
byte[] results = null;
@@ -4005,8 +4005,8 @@ namespace HybirdFrameworkServices
model.checksumDomain = 0x01;
- model.dataDomain = GetRCMD221DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD221DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -4016,10 +4016,10 @@ namespace HybirdFrameworkServices
return result;
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD221DataInfo(CMD221 CMD)
{
byte[] results = null;
@@ -4047,7 +4047,7 @@ namespace HybirdFrameworkServices
#endregion
- #region ֱ BMS Ϣ(Ԥ)
+ #region 直流充电桩 BMS 信息数据(预留)
public byte[] SendRCMD301(out APDUModel APDUModel, CMD301 CMD)
{
@@ -4063,8 +4063,8 @@ namespace HybirdFrameworkServices
- model.dataDomain = GetRCMD301DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD301DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -4075,10 +4075,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD301DataInfo(CMD301 CMD)
{
byte[] results = null;
@@ -4109,8 +4109,8 @@ namespace HybirdFrameworkServices
- model.dataDomain = GetRCMD303DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD303DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -4121,10 +4121,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD303DataInfo(CMD303 CMD)
{
byte[] results = null;
@@ -4141,7 +4141,7 @@ namespace HybirdFrameworkServices
}
#endregion
- #region ʷ¼
+ #region 历史记录
public byte[] SendRCMD401(out APDUModel APDUModel, CMD401 CMD)
{
byte[] result = null;
@@ -4156,8 +4156,8 @@ namespace HybirdFrameworkServices
- model.dataDomain = GetRCMD401DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD401DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -4168,10 +4168,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD401DataInfo(CMD401 CMD)
{
byte[] results = null;
@@ -4190,7 +4190,7 @@ namespace HybirdFrameworkServices
}
#endregion
- #region
+ #region 升级命令
public byte[] SendRCMD1001(out APDUModel APDUModel, CMD1001 CMD)
{
byte[] result = null;
@@ -4205,8 +4205,8 @@ namespace HybirdFrameworkServices
- model.dataDomain = GetRCMD1001DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD1001DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -4217,10 +4217,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD1001DataInfo(CMD1001 CMD)
{
byte[] results = null;
@@ -4249,8 +4249,8 @@ namespace HybirdFrameworkServices
- model.dataDomain = GetRCMD1003DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD1003DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -4261,10 +4261,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD1003DataInfo(CMD1003 CMD)
{
byte[] results = null;
@@ -4293,8 +4293,8 @@ namespace HybirdFrameworkServices
- model.dataDomain = GetRCMD1005DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD1005DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -4305,10 +4305,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD1005DataInfo(CMD1005 CMD)
{
byte[] results = null;
@@ -4337,8 +4337,8 @@ namespace HybirdFrameworkServices
- model.dataDomain = GetRCMD1007DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD1007DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -4349,10 +4349,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD1007DataInfo(CMD1007 CMD)
{
byte[] results = null;
@@ -4381,8 +4381,8 @@ namespace HybirdFrameworkServices
- model.dataDomain = GetRCMD1009DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD1009DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -4393,10 +4393,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD1009DataInfo(CMD1009 CMD)
{
byte[] results = null;
@@ -4426,8 +4426,8 @@ namespace HybirdFrameworkServices
- model.dataDomain = GetRCMD1011DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD1011DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -4438,10 +4438,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD1011DataInfo(CMD1011 CMD)
{
byte[] results = null;
@@ -4470,8 +4470,8 @@ namespace HybirdFrameworkServices
- model.dataDomain = GetRCMD1021DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD1021DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -4482,10 +4482,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD1021DataInfo(CMD1021 CMD)
{
byte[] results = null;
@@ -4503,7 +4503,7 @@ namespace HybirdFrameworkServices
#endregion
- #region ƷѲصָ
+ #region 与计费策略相关的指令
public byte[] SendRCMD1101(out APDUModel APDUModel)
{
@@ -4519,8 +4519,8 @@ namespace HybirdFrameworkServices
CMD1101 CMD = new CMD1101();
- model.dataDomain = GetRCMD1101DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD1101DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -4531,10 +4531,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD1101DataInfo(CMD1101 CMD)
{
byte[] results = null;
@@ -4560,8 +4560,8 @@ namespace HybirdFrameworkServices
model.CMD = 1103;
model.checksumDomain = 0x01;
- model.dataDomain = GetRCMD1103DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD1103DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -4572,10 +4572,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD1103DataInfo(CMD1103 CMD)
{
byte[] results = null;
@@ -4672,8 +4672,8 @@ namespace HybirdFrameworkServices
model.CMD = 1105;
model.checksumDomain = 0x01;
- model.dataDomain = GetRCMD1105DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD1105DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -4684,10 +4684,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD1105DataInfo(CMD1105 CMD)
{
byte[] results = null;
@@ -4798,8 +4798,8 @@ namespace HybirdFrameworkServices
CMD1107 CMD = new CMD1107();
- model.dataDomain = GetRCMD1107DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD1107DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -4810,10 +4810,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD1107DataInfo(CMD1107 CMD)
{
byte[] results = null;
@@ -4828,7 +4828,7 @@ namespace HybirdFrameworkServices
#endregion
- #region
+ #region 白名单报文
public byte[] SendRCMD1301(out APDUModel APDUModel, CMD1301 CMD)
{
@@ -4842,8 +4842,8 @@ namespace HybirdFrameworkServices
model.CMD = 1301;
model.checksumDomain = 0x01;
- model.dataDomain = GetRCMD1301DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD1301DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -4854,7 +4854,7 @@ namespace HybirdFrameworkServices
}
///
- /// CMD1301 翨 30byte\0
+ /// 针对CMD1301 充电卡号 不足30byte补\0
///
///
///
@@ -4873,11 +4873,11 @@ namespace HybirdFrameworkServices
///
- /// ȡȨϢֽ
- /// 1-翨 32byte\2-VIN 17byte
+ /// 获取鉴权消息体字节数组
+ /// 白名单1-充电卡号 32byte\2-VIN码 17byte
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD1301DataInfo(CMD1301 CMD)
{
byte[] results = null;
@@ -4890,7 +4890,7 @@ namespace HybirdFrameworkServices
lstContent.Add(CMD.WhitelistType);
lstContent.Add(CMD.Operate);
lstContent.AddRange(BitConverter.GetBytes(CMD.WhitelistVersioNum));
- //Ϊѯ =4ֶβҪ
+ //操作为查询 即=4,后面字段不需要
if (CMD.Operate != 4)
{
lstContent.AddRange(BitConverter.GetBytes(CMD.WhitelistNum));
@@ -4927,7 +4927,7 @@ namespace HybirdFrameworkServices
}
#endregion
- #region FTP Զ FTP ʽ־ϴ
+ #region FTP 远程升级和 FTP 方式日志上传
public byte[] SendRCMD1401(out APDUModel APDUModel, CMD1401 CMD)
{
@@ -4941,8 +4941,8 @@ namespace HybirdFrameworkServices
model.CMD = 1401;
model.checksumDomain = 0x01;
- model.dataDomain = GetRCMD1401DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD1401DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -4953,10 +4953,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD1401DataInfo(CMD1401 CMD)
{
byte[] results = null;
@@ -4993,8 +4993,8 @@ namespace HybirdFrameworkServices
model.CMD = 1406;
model.checksumDomain = 0x01;
- model.dataDomain = GetRCMD1406DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD1406DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -5005,10 +5005,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD1406DataInfo(CMD1406 CMD)
{
byte[] results = null;
@@ -5031,7 +5031,7 @@ namespace HybirdFrameworkServices
}
#endregion
- #region Э鷽ʽ־ϴ
+ #region 协议方式日志上传
public byte[] SendRCMD1502(out APDUModel APDUModel, CMD1502 CMD)
{
@@ -5046,8 +5046,8 @@ namespace HybirdFrameworkServices
model.checksumDomain = 0x01;
- model.dataDomain = GetRCMD1502DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD1502DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -5058,10 +5058,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD1502DataInfo(CMD1502 CMD)
{
byte[] results = null;
@@ -5090,8 +5090,8 @@ namespace HybirdFrameworkServices
model.CMD = 1504;
model.checksumDomain = 0x01;
- model.dataDomain = GetRCMD1504DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD1504DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -5102,10 +5102,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD1504DataInfo(CMD1504 CMD)
{
byte[] results = null;
@@ -5136,8 +5136,8 @@ namespace HybirdFrameworkServices
model.checksumDomain = 0x01;
- model.dataDomain = GetRCMD1506DataInfo(CMD); //
- model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //ij
+ model.dataDomain = GetRCMD1506DataInfo(CMD); //数据域
+ model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List lstResult = new List();
lstResult.AddRange(APCI(model).ToArray());
@@ -5148,10 +5148,10 @@ namespace HybirdFrameworkServices
}
///
- /// ȡȨϢֽ
+ /// 获取鉴权消息体字节数组
///
///
- /// ȨϢֽ
+ /// 鉴权消息体字节数组
private byte[] GetRCMD1506DataInfo(CMD1506 CMD)
{
byte[] results = null;
@@ -5173,30 +5173,30 @@ namespace HybirdFrameworkServices
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;
}
///
- /// ݰ-У
+ /// 数据包发送-计算校验和
///
///
///
@@ -5204,7 +5204,7 @@ namespace HybirdFrameworkServices
{
int checksum = 0;
- for (int i = 6; i < data.Count(); i++)//ûУԲһ
+ for (int i = 6; i < data.Count(); i++)//这里没校验域所以不减一
{
checksum += data[i];
}
@@ -5213,7 +5213,7 @@ namespace HybirdFrameworkServices
//{
// checksum += b;
//}
- // ȡУ͵ĵ8λ
+ // 取校验和的低8位
return (byte)(checksum & 0xFF);
}
}
diff --git a/HybirdFrameworkServices/ChargerManage/ChargerInfo.cs b/HybirdFrameworkServices/ChargerManage/ChargerInfo.cs
new file mode 100644
index 0000000..88fd02e
--- /dev/null
+++ b/HybirdFrameworkServices/ChargerManage/ChargerInfo.cs
@@ -0,0 +1,38 @@
+namespace HybirdFrameworkServices.ChargerManage;
+
+/**
+ * 充电机对象实体类
+ */
+public class ChargerInfo
+{
+
+ public static Dictionary ChargerInfoMap = new Dictionary();
+ //充电机编号
+ public string? ChargerNo { get; set; }
+
+
+ //通道id
+ public string? ChannelId { get; set; }
+
+ //ip
+ public string? Ip { get; set; }
+
+
+ //端口
+ public int Port { get; set; }
+
+ public bool Status { get; set; }
+
+
+ //构造方法
+ public ChargerInfo(string chargerNo, string channelId, string ip, int port)
+ {
+ this.ChannelId = channelId;
+
+ this.Ip = ip;
+
+ this.Port = port;
+
+ this.ChargerNo = chargerNo;
+ }
+}
\ No newline at end of file
diff --git a/HybirdFrameworkServices/ChargerManage/Handler/CMD206Handler.cs b/HybirdFrameworkServices/ChargerManage/Handler/CMD206Handler.cs
new file mode 100644
index 0000000..775ac05
--- /dev/null
+++ b/HybirdFrameworkServices/ChargerManage/Handler/CMD206Handler.cs
@@ -0,0 +1,27 @@
+using DotNetty.Transport.Channels;
+using HybirdFrameworkServices.ChargerManage.Msg;
+
+namespace HybirdFrameworkServices.ChargerManage.Handler;
+
+public class CMD206Handler:SimpleChannelInboundHandler
+{
+ protected override void ChannelRead0(IChannelHandlerContext ctx, CMD206 msg)
+ {
+ //处理
+ string chargeNo = msg.MHeader.ChargerNo;
+ ChargerInfo chargerInfo;
+ ChargerInfo.ChargerInfoMap.TryGetValue(chargeNo, out chargerInfo);
+
+ if (null == chargerInfo)
+ {
+ throw new Exception("充电机未注册");
+ }
+ //TODO:: 业务(数据库交互)
+
+
+
+ //TODO:: 返回
+ ctx.WriteAndFlushAsync(msg);
+
+ }
+}
\ No newline at end of file
diff --git a/HybirdFrameworkServices/ChargerManage/Msg/BaseMsg.cs b/HybirdFrameworkServices/ChargerManage/Msg/BaseMsg.cs
new file mode 100644
index 0000000..319a348
--- /dev/null
+++ b/HybirdFrameworkServices/ChargerManage/Msg/BaseMsg.cs
@@ -0,0 +1,149 @@
+using System.Text;
+using DotNetty.Buffers;
+
+namespace HybirdFrameworkServices.ChargerManage.Msg;
+
+/**
+ * 基础信息实体
+ */
+public class BaseMsg
+{
+ public static int StartBodyIndex = 8;
+
+ //请求头
+ public Header MHeader = new Header();
+
+ public string ClientIp;
+
+
+ //请求体
+ protected IByteBuffer ByteBuffer { get; set; }
+
+ public BaseMsg()
+ {
+ }
+
+
+ public void Parse()
+ {
+ this.ParseHeader();
+ this.ParseBody();
+ this.ByteBuffer.Release();
+ }
+
+ public BaseMsg(IByteBuffer byteBuffer, string clientIp)
+ {
+ this.ByteBuffer = byteBuffer;
+ this.ClientIp = clientIp;
+ }
+
+ protected void ParseHeader()
+ {
+ MHeader.LengthDomain = this.ByteBuffer.GetUnsignedShortLE(2);
+
+ byte[] bytes = new byte[MHeader.LengthDomain];
+ ByteBuffer.ReadBytes(bytes);
+
+ int checksum = 0;
+ for (int i = 6; i < bytes.Count() - 1; i++) //这里有校验域所以减一
+ {
+ checksum += bytes[i];
+ }
+
+ // 取校验和的低8位
+ //byte b1 = (byte)(checksum & 0xFF);
+ //byte b2 = (byte)(bytes[bytes.Count() - 1] & 0xFF);
+
+ bool checkFlag = (byte)(bytes[bytes.Count() - 1] & 0xFF) == (byte)(checksum & 0xFF);
+ if (!checkFlag)
+ {
+ throw new Exception("报文校验不通过");
+ }
+
+
+ var info = bytes[4];
+
+ //TODO:: 修改解密 (目前流转使用的bytebuffer)
+ if ((info & (1 << 1)) != 0) //AES加密
+ {
+ //这里要解密
+ List byteList = bytes.ToList();
+ byteList.Remove(8);
+ byteList.Remove(8); //移除前面两个长度
+ bytes = byteList.ToArray();
+ }
+
+ MHeader.InfoDomain = this.ByteBuffer.GetByte(4);
+ MHeader.SerialNumberDomain = this.ByteBuffer.GetByte(5);
+ MHeader.CMD = this.ByteBuffer.GetUnsignedShortLE(6);
+ MHeader.ChecksumDomain = this.ByteBuffer.GetByte(MHeader.LengthDomain - 1);
+ //看是否读到chargerNo 否则回塞 :主要解决一些应答报文不带充电机编号的问题(4位cmd 非业务报文 回塞充电机编号)
+ if (MHeader.CMD > 1000)
+ {
+ Dictionary ipNoMap =
+ ChargerInfo.ChargerInfoMap.Values.ToDictionary(kvp => kvp.Ip, kvp => kvp.ChargerNo);
+ string value;
+ ipNoMap.TryGetValue(MHeader.Ip, out value);
+ MHeader.ChargerNo = value;
+ }
+ else
+ {
+ ByteBuffer.SetReaderIndex(12);
+ // 读取接下来的32字节
+ byte[] no = new byte[32];
+ ByteBuffer.ReadBytes(no);
+ MHeader.ChargerNo = Encoding.ASCII.GetString(no);
+ }
+ }
+
+ public virtual void ParseBody()
+ {
+ }
+
+ public class Header
+ {
+ public string Ip { get; set; }
+
+ ///
+ /// 起始域
+ ///
+ public ushort OriginDomain1 { get; set; } = 0xAAF5;
+
+
+ ///
+ /// 长度域 2
+ ///
+ public UInt16 LengthDomain { get; set; }
+
+ ///
+ /// 信息域
+ ///
+ /// 除了 CMD=1202 加密能用 RSA 加密方式,
+ /// 其他报文若是加密,全部是采用 AES方式加密。
+ /// bit0-3 当前协议是V2.6值填0x02
+ ///
+ public byte InfoDomain { get; set; }
+
+ ///
+ /// 序列号域
+ ///
+ public byte SerialNumberDomain { get; set; }
+
+ ///
+ /// 命令代CMD
+ ///
+ public UInt16 CMD { get; set; }
+
+ ///
+ /// 数据域
+ ///
+ public byte[] DataDomain { get; set; }
+
+ ///
+ /// 校验和域
+ ///
+ public byte ChecksumDomain { get; set; }
+
+ public string ChargerNo { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/HybirdFrameworkServices/Netty/Server.cs b/HybirdFrameworkServices/Netty/Server.cs
index e4ddb0f..0ce9064 100644
--- a/HybirdFrameworkServices/Netty/Server.cs
+++ b/HybirdFrameworkServices/Netty/Server.cs
@@ -10,6 +10,7 @@ using DotNetty.Transport.Bootstrapping;
using DotNetty.Transport.Channels;
using DotNetty.Transport.Channels.Sockets;
using HybirdFrameworkCore.Autofac.Attribute;
+using HybirdFrameworkServices.ChargerManage.Handler;
using HybirdFrameworkServices.System;
using log4net;
@@ -57,11 +58,8 @@ namespace HybirdFrameworkServices.Netty
pipeline.AddLast(new CustomFrameDecoder(new IByteBuffer[] { delimiter }, false, false));
pipeline.AddLast(new CustomFrameEncoder());
- //// 添加客户端连接监控Handler
- pipeline.AddLast(new ClientConnectionMonitorHandler());
- //pipeline.AddLast("idleStateHandler", new IdleStateHandler(30, 0, 0)); // 触发读取超时
- //pipeline.AddLast(new ReconnectHandler(this));
- //pipeline.AddLast(new ClientHandler(this));
+ pipeline.AddLast(new CMD206Handler());
+
}));
Begin(_port);
}
diff --git a/HybirdFrameworkServices/Tool/CustomFrameDecoder.cs b/HybirdFrameworkServices/Tool/CustomFrameDecoder.cs
index d76f759..a678072 100644
--- a/HybirdFrameworkServices/Tool/CustomFrameDecoder.cs
+++ b/HybirdFrameworkServices/Tool/CustomFrameDecoder.cs
@@ -8,13 +8,19 @@ using DotNetty.Codecs;
using DotNetty.Transport.Channels;
using System;
using System.Collections.Generic;
+using System.Net;
+using System.Numerics;
using System.Text.RegularExpressions;
using HybirdFrameworkEntity;
+using HybirdFrameworkServices.ChargerManage;
+using HybirdFrameworkServices.ChargerManage.Msg;
namespace HybirdFrameworkServices
{
public class CustomFrameDecoder : ByteToMessageDecoder
{
+
+
private readonly IByteBuffer[] delimiters;
private readonly bool stripDelimiter;
private readonly bool failFast;
@@ -49,83 +55,46 @@ namespace HybirdFrameworkServices
// 读取长度字段
int frameLength = buffer.GetUnsignedShortLE(buffer.ReaderIndex + frameLengthIndex);
- int totalFrameLength = delimiterIndex + delimiter.Capacity + 2 + frameLength;
- if (buffer.ReadableBytes < totalFrameLength)
+ if (buffer.ReadableBytes < frameLength)
{
// 数据不足,等待更多数据
return;
}
+ ;
+ IPEndPoint remoteAddress = (IPEndPoint)ctx.Channel.RemoteAddress;
+ string clientIP = remoteAddress.Address.ToString();
+
+ output.Add( this.Parse(buffer,clientIP));
+ }
+ }
- byte[] bytes = new byte[frameLength];
- buffer.ReadBytes(bytes);
-
- {
- int checksum = 0;
- for (int i = 6; i < bytes.Count() - 1; i++)//这里有校验域所以减一
- {
- checksum += bytes[i];
- }
- // 取校验和的低8位
- //byte b1 = (byte)(checksum & 0xFF);
- //byte b2 = (byte)(bytes[bytes.Count() - 1] & 0xFF);
- if ((byte)(bytes[bytes.Count() - 1] & 0xFF) == (byte)(checksum & 0xFF))
- {
- var info = bytes[4];
- if ((info & (1 << 1)) != 0)//AES加密
- {
- //这里要解密
- List byteList = bytes.ToList();
- byteList.Remove(8);
- byteList.Remove(8);//移除前面两个长度
- bytes = byteList.ToArray();
-
- CmnChargingsEqmInfo._CHR01.decode(bytes);
- }
- else //不加密
- {
- //CmnChargingsEqmInfo._CHR01.decode(bytes);
-
- string input = ctx.Channel.RemoteAddress.ToString();
-
- // 正则表达式匹配IPv4地址和端口号
- string pattern = @"\[(::ffff:)?(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\]:(\d+)";
- Match match = Regex.Match(input, pattern);
-
- // 获取IP地址(不包括IPv6前缀)
- string ipAddress = match.Groups[2].Value;
- switch (ipAddress)
- {
- case "127.0.0.1":
- CmnChargingsEqmInfo._CHR01.ID = ctx.Channel.Id;
- CmnChargingsEqmInfo._CHR01.decode(bytes);
- break;
- case "127.0.0.2":
- CmnChargingsEqmInfo._CHR02.ID = ctx.Channel.Id;
- CmnChargingsEqmInfo._CHR02.decode(bytes);
- break;
- case "127.0.0.3":
- CmnChargingsEqmInfo._CHR03.ID = ctx.Channel.Id;
- CmnChargingsEqmInfo._CHR03.decode(bytes);
- break;
- case "127.0.0.4":
- break;
- case "127.0.0.5":
- break;
- case "127.0.0.6":
- break;
- case "127.0.0.7":
- break;
- case "127.0.0.8":
- break;
- }
- }
- }
- //ctx.Channel.WriteAndFlushAsync(bytes);
- }
- output.Add(bytes);
- }
+ //将消息给每个充电机对象
+ public BaseMsg Parse(IByteBuffer byteBuffer,string clientIp)
+ {
+ BaseMsg baseMsg = null;
+ //将cmd解析出来
+ ushort cmd = byteBuffer.GetUnsignedShortLE(6);
+ baseMsg = cmd switch
+ {
+ 206 => new CMD206(byteBuffer,clientIp),
+ 202=> new CMD202(byteBuffer,clientIp),
+
+ _ => new BaseMsg(byteBuffer,clientIp),
+ };
+ baseMsg.Parse();
+
+ return baseMsg;
+
+
+
+
+
+
+
+
+
}
private IByteBuffer FindDelimiter(IByteBuffer buffer)