|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
using BatCharging.Model;
|
|
|
using Monitor.LogService;
|
|
|
using Module.Socket.Tool;
|
|
|
using BatCharging.Service.Encoder.New;
|
|
|
using BatCharging.Service.Decoder.New;
|
|
|
using Module.TBox.Can.Tool;
|
|
|
using System.Net.Http;
|
|
|
using Newtonsoft.Json;
|
|
|
using System.Security.AccessControl;
|
|
|
using BatCharging.Service.DataRlt;
|
|
|
//using HslCommunication.Enthernet.Redis;
|
|
|
|
|
|
namespace BatCharging.Service
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 1号充电机管理工具
|
|
|
/// </summary>
|
|
|
public class ChargerMgrTool
|
|
|
{
|
|
|
|
|
|
#region 定义锁
|
|
|
private object lockObj = new object(); //线程同步锁
|
|
|
#endregion 定义锁
|
|
|
|
|
|
#region 字段属性
|
|
|
/// <summary>
|
|
|
/// IP地址
|
|
|
/// </summary>
|
|
|
private string _ip_addr;
|
|
|
/// <summary>
|
|
|
/// 网络IP地址
|
|
|
/// </summary>
|
|
|
public string F_IPAddr
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _ip_addr;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_ip_addr = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 网络端口号
|
|
|
/// </summary>
|
|
|
private int _ip_port = 4567;
|
|
|
/// <summary>
|
|
|
/// 网络端口号
|
|
|
/// </summary>
|
|
|
public int F_Port
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _ip_port;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_ip_port = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 通讯是否已连接
|
|
|
/// </summary>
|
|
|
private bool _net_connected = false;
|
|
|
/// <summary>
|
|
|
/// 通讯是否已连接
|
|
|
/// </summary>
|
|
|
public bool F_NetConnected
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _net_connected;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_net_connected = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 通讯使能
|
|
|
/// </summary>
|
|
|
private bool _net_connect_enabled = true;
|
|
|
/// <summary>
|
|
|
/// 通讯是否已连接
|
|
|
/// </summary>
|
|
|
public bool F_NetConnectEnabled
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _net_connect_enabled;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_net_connect_enabled = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 通讯判断断线超时时间(单位:秒)
|
|
|
/// </summary>
|
|
|
private int _net_check_time_out = 30;
|
|
|
/// <summary>
|
|
|
/// 通讯是否已连接
|
|
|
/// </summary>
|
|
|
public int F_NetCheckTimeOut
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _net_check_time_out;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_net_check_time_out = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// TCP客户端
|
|
|
/// </summary>
|
|
|
private TcpClientChargerTool _chr_client;
|
|
|
/// <summary>
|
|
|
/// 充电机连接客户端
|
|
|
/// </summary>
|
|
|
public TcpClientChargerTool F_ChrClient
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _chr_client;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_chr_client = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 是否已经开始充电
|
|
|
/// </summary>
|
|
|
private bool _is_charged = false;
|
|
|
/// <summary>
|
|
|
/// 充电机是否已经开始充电
|
|
|
/// </summary>
|
|
|
public bool F_IsCharged
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _is_charged;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_is_charged = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 是否停止充电
|
|
|
/// </summary>
|
|
|
private bool _is_stoped = false;
|
|
|
/// <summary>
|
|
|
/// 是否停止充电
|
|
|
/// </summary>
|
|
|
public bool F_IsStoped
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _is_stoped;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_is_stoped = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 充电状态。0:无效值;1:鉴权成功;2:鉴权失败;3:开始充电成功;4:开始充电失败;5:正在充电;6:停止充电成功;7:停止充电失败;
|
|
|
/// </summary>
|
|
|
private UInt16 _charging_status = 0;
|
|
|
/// <summary>
|
|
|
/// 充电状态。0:无效值;1:鉴权成功;2:鉴权失败;3:开始充电成功;4:开始充电失败;5:正在充电;6:停止充电成功;7:停止充电失败;
|
|
|
/// </summary>
|
|
|
public UInt16 F_ChargingStatus
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _charging_status;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_charging_status = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 充电开始时间(默认2000-1-1)
|
|
|
/// </summary>
|
|
|
private DateTime _charging_start_time = Convert.ToDateTime("2000-1-1");
|
|
|
/// <summary>
|
|
|
/// 充电开始时间(默认2000-1-1)
|
|
|
/// </summary>
|
|
|
public DateTime F_ChargingStartTime
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _charging_start_time;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_charging_start_time = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 充电停止时间(默认2000-1-1)
|
|
|
/// </summary>
|
|
|
private DateTime _charging_stop_time = Convert.ToDateTime("2000-1-1");
|
|
|
/// <summary>
|
|
|
/// 充电停止时间(默认2000-1-1)
|
|
|
/// </summary>
|
|
|
public DateTime F_ChargingStopTime
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _charging_stop_time;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_charging_stop_time = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//是否与充电机已经鉴权
|
|
|
private bool _is_authed = false;
|
|
|
/// <summary>
|
|
|
/// 站控与充电机是否已经鉴权
|
|
|
/// </summary>
|
|
|
public bool F_IsAuthed
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _is_authed;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_is_authed = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 设置充电停止的原因.0正常停机 1服务器发现桩异常,强制停机
|
|
|
/// </summary>
|
|
|
private byte _stop_reason = 0;
|
|
|
/// <summary>
|
|
|
/// 设置充电停止的原因.0正常停机 1服务器发现桩异常,强制停机
|
|
|
/// </summary>
|
|
|
public byte F_StopReason
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _stop_reason;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_stop_reason = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 能循环发送远程停止充电指令,收到充电机回复充电停止完成后,置为False
|
|
|
/// </summary>
|
|
|
private bool _is_can_send_stop_cmd = true;
|
|
|
/// <summary>
|
|
|
/// 设置充电停止的原因.0正常停机 1服务器发现桩异常,强制停机
|
|
|
/// </summary>
|
|
|
public bool F_IsCanSendStopCmd
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _is_can_send_stop_cmd;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_is_can_send_stop_cmd = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 充电机的目的地址
|
|
|
/// </summary>
|
|
|
private byte[] _dest_addr = new byte[] { 0x13, 0, 0, 0x10 };
|
|
|
/// <summary>
|
|
|
/// 充电机的目的地址(外部设定).
|
|
|
/// </summary>
|
|
|
public byte[] F_DestAddr
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _dest_addr;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_dest_addr = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 充电记录是否已经发送给云平台
|
|
|
/// </summary>
|
|
|
internal bool _record_to_cloud_sended = false;
|
|
|
/// <summary>
|
|
|
/// 充电记录是否已经发送给云平台
|
|
|
/// </summary>
|
|
|
public bool F_RecordToCloudSended
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _record_to_cloud_sended;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_record_to_cloud_sended = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 充电机发送与接收的结果
|
|
|
/// </summary>
|
|
|
private ChgResult _result;
|
|
|
/// <summary>
|
|
|
/// 充电机发送与接收的结果.
|
|
|
/// </summary>
|
|
|
public ChgResult F_Result
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _result;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_result = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 充电机编码
|
|
|
/// </summary>
|
|
|
private string _eqmcode;
|
|
|
/// <summary>
|
|
|
/// 充电机编码
|
|
|
/// </summary>
|
|
|
public string F_EqmCode
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _eqmcode;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_eqmcode = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 充电机工作状态-从遥信数据包中得到。0:待机;1:工作;2:工作完成;3:充/放电暂停
|
|
|
/// </summary>
|
|
|
private byte _workstate;
|
|
|
/// <summary>
|
|
|
/// 充电机工作状态-从遥信数据包中得到。0:待机;1:工作;2:工作完成;3:充/放电暂停
|
|
|
/// </summary>
|
|
|
public byte F_WorkState
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _workstate;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_workstate = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
///充电机发生故障
|
|
|
/// </summary>
|
|
|
private bool _is_fault;
|
|
|
/// <summary>
|
|
|
/// 充电机发生故障-true:故障;false:正常
|
|
|
/// </summary>
|
|
|
public bool F_IsFault
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _is_fault;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_is_fault = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
///充电机发生报警
|
|
|
/// </summary>
|
|
|
private bool _is_alarm;
|
|
|
/// <summary>
|
|
|
/// 充电机发生报警-true:报警;false:正常
|
|
|
/// </summary>
|
|
|
public bool F_IsAlarm
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _is_alarm;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_is_alarm = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 故障码
|
|
|
/// </summary>
|
|
|
private int _fault_code = 0;
|
|
|
/// <summary>
|
|
|
/// 故障码
|
|
|
/// </summary>
|
|
|
public int F_FaultCode
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _fault_code;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_fault_code = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 故障报警列表
|
|
|
/// </summary>
|
|
|
private List<int> _fault_alaram_no_list = new List<int>();
|
|
|
/// <summary>
|
|
|
/// 故障报警列表
|
|
|
/// </summary>
|
|
|
public List<int> F_FaultAlarmNoList
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _fault_alaram_no_list;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_fault_alaram_no_list = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
///充电机充电电池SOC
|
|
|
/// </summary>
|
|
|
private byte _soc = 0;
|
|
|
/// <summary>
|
|
|
/// 充电机充电电池SOC
|
|
|
/// </summary>
|
|
|
public byte F_SOC
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _soc;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_soc = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
///充电机实时充电功率
|
|
|
/// </summary>
|
|
|
private float _power = 0;
|
|
|
/// <summary>
|
|
|
/// 充电机实时充电功率
|
|
|
/// </summary>
|
|
|
public float F_Power
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _power;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_power = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
///充电机遥信数据
|
|
|
/// </summary>
|
|
|
private RemoteData _remote_data = new RemoteData();
|
|
|
/// <summary>
|
|
|
/// 充电机遥信数据
|
|
|
/// </summary>
|
|
|
public RemoteData F_RemoteData
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _remote_data;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_remote_data = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
///充电机遥测数据
|
|
|
/// </summary>
|
|
|
private TelemetryData _telem_data = new TelemetryData();
|
|
|
/// <summary>
|
|
|
/// 充电机遥测数据
|
|
|
/// </summary>
|
|
|
public TelemetryData F_TelemData
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _telem_data;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_telem_data = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 接收数据时刻
|
|
|
/// </summary>
|
|
|
private DateTime _recving_data_time = DateTime.Now;
|
|
|
/// <summary>
|
|
|
/// 接收数据时刻
|
|
|
/// </summary>
|
|
|
public DateTime F_RecvingDataTime
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _recving_data_time;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_recving_data_time = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 接收到的消息
|
|
|
/// </summary>
|
|
|
private SBMUCanRecvMsg _msg_recv = new SBMUCanRecvMsg();
|
|
|
/// <summary>
|
|
|
/// 接收到的消息
|
|
|
/// </summary>
|
|
|
public SBMUCanRecvMsg F_Msg_Recv
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _msg_recv;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
lock (lockObj)
|
|
|
{
|
|
|
_msg_recv = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion 字段属性
|
|
|
|
|
|
#region 类结构体
|
|
|
public ChargerMgrTool() { }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 类结构体
|
|
|
/// </summary>
|
|
|
/// <param name="dest_addr">充电机目的地址字节数组</param>
|
|
|
public ChargerMgrTool(byte[] dest_addr)
|
|
|
{
|
|
|
_dest_addr = dest_addr;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 类结构体
|
|
|
/// </summary>
|
|
|
/// <param name="ipAddr">IP地址</param>
|
|
|
/// <param name="port">网络端口号</param>
|
|
|
public ChargerMgrTool(string ipAddr, int port)
|
|
|
{
|
|
|
_ip_addr = ipAddr;
|
|
|
_ip_port = port;
|
|
|
}
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
/// <param name="ipAddr">IP地址</param>
|
|
|
/// <param name="port">网络端口号</param>
|
|
|
/// <param name="dest_addr">充电机目的地址字节数组</param>
|
|
|
public ChargerMgrTool(string ipAddr, int port, byte[] dest_addr)
|
|
|
{
|
|
|
_ip_addr = ipAddr;
|
|
|
_ip_port = port;
|
|
|
_dest_addr = dest_addr;
|
|
|
}
|
|
|
#endregion 类结构体
|
|
|
|
|
|
#region 事件定义
|
|
|
public event EventHandler<LogEventArgs> ConnectedStatusChanged;
|
|
|
public event EventHandler<DataRecvedEventArgs> DataReceived;
|
|
|
public event EventHandler<DataSendedEventArgs> DataSended;
|
|
|
#endregion 事件定义
|
|
|
|
|
|
#region 事件处理
|
|
|
|
|
|
/// <summary>
|
|
|
/// 接收到的数据信息事件方法
|
|
|
/// </summary>
|
|
|
/// <param name="msg"></param>
|
|
|
private void ConnectedStatusEventFunc(bool isConnected, string msg)
|
|
|
{
|
|
|
if (!String.IsNullOrEmpty(msg))
|
|
|
{
|
|
|
EventHandler<LogEventArgs> ConnectedHandler;
|
|
|
ConnectedHandler = ConnectedStatusChanged;
|
|
|
if (ConnectedHandler != null)
|
|
|
{
|
|
|
ConnectedHandler.Invoke(null, new LogEventArgs() { ConnectedStatus = isConnected, IsContent = msg });
|
|
|
}
|
|
|
|
|
|
string strConnected = "Connected Failure";
|
|
|
if (isConnected)
|
|
|
{
|
|
|
strConnected = "Connected Success";
|
|
|
}
|
|
|
string result = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "]" + "CONNECT STATUS:" + strConnected;
|
|
|
result += "\r\n" + msg;
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, _eqmcode + "ConnectedLog");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 接收到的数据事件方法
|
|
|
/// </summary>
|
|
|
/// <param name="msg"></param>
|
|
|
private void DataReceivedEventFunc(byte[] msg)
|
|
|
{
|
|
|
if (msg != null)
|
|
|
{
|
|
|
EventHandler<DataRecvedEventArgs> DataReceivedHandler;
|
|
|
DataReceivedHandler = DataReceived;
|
|
|
if (DataReceivedHandler != null)
|
|
|
{
|
|
|
DataReceivedHandler.Invoke(null, new DataRecvedEventArgs() { Data = msg });
|
|
|
}
|
|
|
|
|
|
string result = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "]" + "RECV HEX:";
|
|
|
result += ByteUtils.BytesToHexStr(msg);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, _eqmcode + "RecvedLog");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 发送的数据事件方法
|
|
|
/// </summary>
|
|
|
/// <param name="msg"></param>
|
|
|
private void DataSendedEventFunc(byte[] msg)
|
|
|
{
|
|
|
if (msg != null)
|
|
|
{
|
|
|
EventHandler<DataSendedEventArgs> DataSendedHandler;
|
|
|
DataSendedHandler = DataSended;
|
|
|
if (DataSendedHandler != null)
|
|
|
{
|
|
|
DataSendedHandler.Invoke(null, new DataSendedEventArgs() { Data = msg });
|
|
|
}
|
|
|
|
|
|
string result = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "]" + "SEND HEX:";
|
|
|
result += ByteUtils.BytesToHexStr(msg);
|
|
|
//var log = LogManager.GetLogger(typeof(ChargerMgrTool));
|
|
|
//log.Info(result);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Run, "chargerProtocolTestLog");
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, _eqmcode + "SendedLog");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion 事件处理
|
|
|
|
|
|
#region 通讯连接
|
|
|
|
|
|
|
|
|
///// <summary>
|
|
|
///// 充电机连接线程
|
|
|
///// </summary>
|
|
|
//public void ChargerNetConnectThread()
|
|
|
//{
|
|
|
// Thread chrgConnectedThread = new Thread(ChargerConnectFunc);
|
|
|
// chrgConnectedThread.IsBackground = true;
|
|
|
// chrgConnectedThread.Start();
|
|
|
//}
|
|
|
|
|
|
///// <summary>
|
|
|
///// 充电机通讯连接
|
|
|
///// </summary>
|
|
|
//private void ChargerConnectFunc()
|
|
|
//{
|
|
|
// while (_net_connect_enabled)
|
|
|
// {
|
|
|
// if (!_net_connected)
|
|
|
// {
|
|
|
// ChargerConnect();
|
|
|
// }
|
|
|
// Thread.Sleep(30 * 1000);
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
///// <summary>
|
|
|
///// 充电机连接
|
|
|
///// </summary>
|
|
|
//public void ChargerConnect()
|
|
|
//{
|
|
|
// if (!string.IsNullOrEmpty(_ip_addr))
|
|
|
// {
|
|
|
// _chr_client = new TcpClientChargerTool(_ip_addr, _ip_port);
|
|
|
// _chr_client.ConnectedStatusChanged += Client_ConnectedStatusChanged;
|
|
|
// _chr_client.ClientConnect();
|
|
|
// if (_chr_client.Connected)
|
|
|
// {
|
|
|
// if (_result == null)
|
|
|
// {
|
|
|
// _result = new ChgResult();
|
|
|
// }
|
|
|
// _chr_client.DataReceived += Client_DataReceived;
|
|
|
// _chr_client.DataSended += Client_DataSended;
|
|
|
// Thread.Sleep(100);
|
|
|
// SendCharingSignIn();
|
|
|
// Thread.Sleep(100);
|
|
|
// _recving_data_time = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
|
|
// Thread.Sleep(100);
|
|
|
// //充电机判断是否断线线程
|
|
|
// ChargerNetCheckThread();
|
|
|
// }
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 充电机连接
|
|
|
/// </summary>
|
|
|
/// <param name="ipAddr">ip</param>
|
|
|
/// <param name="port">ip</param>
|
|
|
/// <param name="destAddr">站号</param>
|
|
|
public void ChargerConnect(string ipAddr, int port, int destAddr)
|
|
|
{
|
|
|
_ip_addr = ipAddr;
|
|
|
_ip_port = port;
|
|
|
_dest_addr = new byte[] { Convert.ToByte(destAddr), 0, 0, 0x10 };
|
|
|
|
|
|
_chr_client = new Module.Socket.Tool.TcpClientChargerTool(ipAddr, port);
|
|
|
_chr_client.ConnectedStatusChanged += Client_ConnectedStatusChanged;
|
|
|
_chr_client.ClientConnect();
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
string result = ipAddr + ":" + port + "连接成功";
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, _eqmcode + "ConnectedLog");
|
|
|
|
|
|
if (_result == null)
|
|
|
{
|
|
|
_result = new ChgResult();
|
|
|
}
|
|
|
Thread.Sleep(100);
|
|
|
//充电鉴权
|
|
|
SendCharingSignIn();
|
|
|
_recving_data_time = DateTime.Now;
|
|
|
|
|
|
_chr_client.DataReceived += Client_DataReceived;
|
|
|
_chr_client.DataSended += Client_DataSended;
|
|
|
|
|
|
Thread.Sleep(100);
|
|
|
//充电机判断是否断线线程
|
|
|
ChargerNetCheckThread();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 充电机断开连接
|
|
|
/// </summary>
|
|
|
public void ChargerDisConnect()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
_chr_client.Disconnect();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 连接事件
|
|
|
/// </summary>
|
|
|
/// <param name="sender"></param>
|
|
|
/// <param name="e"></param>
|
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
|
private void Client_ConnectedStatusChanged(object sender, Module.Socket.Tool.ViewLogEventArgs e)
|
|
|
{
|
|
|
_net_connected = e.ConnectedStatus;
|
|
|
ConnectedStatusEventFunc(e.ConnectedStatus, e.IsContent);
|
|
|
}
|
|
|
|
|
|
#endregion 通讯连接
|
|
|
|
|
|
#region 数据接收
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 充电机判断是否断线线程
|
|
|
/// </summary>
|
|
|
public void ChargerNetCheckThread()
|
|
|
{
|
|
|
Thread chargerThread = new Thread(ChargerNetCheckFunc);
|
|
|
chargerThread.IsBackground = true;
|
|
|
chargerThread.Start();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 充电机判断是否断线线程.充电机在连接情况下,30秒未收到信息,则认为断线,需要重新连接
|
|
|
/// </summary>
|
|
|
private void ChargerNetCheckFunc()
|
|
|
{
|
|
|
while (_net_connect_enabled)
|
|
|
{
|
|
|
if (_net_connected)
|
|
|
{
|
|
|
DateTime recvTime = DateTime.Now;
|
|
|
int seconds = Convert.ToInt32(recvTime.Subtract(F_RecvingDataTime).TotalSeconds);
|
|
|
if (seconds >= _net_check_time_out)
|
|
|
{
|
|
|
ChargerDisConnect();
|
|
|
}
|
|
|
}
|
|
|
Thread.Sleep(10000);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 接收事件
|
|
|
/// </summary>
|
|
|
/// <param name="sender"></param>
|
|
|
/// <param name="e"></param>
|
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
|
private void Client_DataReceived(object sender, Module.Socket.Tool.TcpDataReceivedEventArgs e)
|
|
|
{
|
|
|
byte[] data = e.Data;
|
|
|
if (data != null)
|
|
|
{
|
|
|
_recving_data_time = DateTime.Now;
|
|
|
|
|
|
//记录接收到的消息日志
|
|
|
DataReceivedEventFunc(data);//解析显示到窗体
|
|
|
ProcDataRecved(data);//解析数据
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private ushort ToUInt16(byte[] value, int offset)
|
|
|
{
|
|
|
return (ushort)(value[offset] + (value[offset + 1] << 8));
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 处理接收到的数值
|
|
|
/// </summary>
|
|
|
/// <param name="data">接收到的字节数组</param>
|
|
|
private void ProcDataRecved(byte[] data)
|
|
|
{
|
|
|
if (data != null)
|
|
|
{
|
|
|
if (data.Length > 24)
|
|
|
{
|
|
|
{
|
|
|
UInt16 func = ToUInt16(data, 6);
|
|
|
switch (func)
|
|
|
{
|
|
|
#region 协议格式
|
|
|
|
|
|
case 2:
|
|
|
{
|
|
|
CMD2 CMD2 = new MsgReceiveCMDCom().ConCMD2(data);
|
|
|
string result = "(CMD=2)充电桩参数整形设置/查询应答 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=2)充电桩参数整形设置/查询应答对象:" + JsonConvert.SerializeObject(CMD2);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD2 != null)
|
|
|
{
|
|
|
//(CMD=1)后台服务器下发充电桩整形工作参数
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send1();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 4:
|
|
|
{
|
|
|
CMD4 CMD4 = new MsgReceiveCMDCom().ConCMD4(data);
|
|
|
string result = "(CMD=4)充电桩参数字符形设置/查询应答 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=4)充电桩参数字符形设置/查询应答对象:" + JsonConvert.SerializeObject(CMD4);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD4 != null)
|
|
|
{
|
|
|
//(CMD=3)后台服务器下发充电桩字符型参数
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send3();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 6:
|
|
|
{
|
|
|
CMD6 CMD6 = new MsgReceiveCMDCom().ConCMD6(data);
|
|
|
string result = "(CMD=6)充电桩对后台控制命令应答- 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=6)充电桩对后台控制命令应答对象:" + JsonConvert.SerializeObject(CMD6);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD6 != null)
|
|
|
{
|
|
|
//(CMD=5)后台服务器下发充电桩控制命令
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send5();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 8:
|
|
|
{
|
|
|
CMD8 CMD8 = new MsgReceiveCMDCom().ConCMD8(data);
|
|
|
string result = "(CMD=8) 充电桩对后台下发的充电桩开启充电控制应答 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=8) 充电桩对后台下发的充电桩开启充电控制应答对象:" + JsonConvert.SerializeObject(CMD8);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD8 != null)
|
|
|
{
|
|
|
//(CMD=1)后台服务器下发充电桩整形工作参数
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send7();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 10:
|
|
|
{
|
|
|
CMD10 CMD10 = new MsgReceiveCMDCom().ConCMD10(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD10);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD10 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send9();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
#endregion
|
|
|
|
|
|
#region 充电桩主动上传数据
|
|
|
|
|
|
case 102:
|
|
|
{
|
|
|
CMD102 CMD102 = new MsgReceiveCMDCom().ConCMD102(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD102);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD102 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send101();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 104:
|
|
|
{
|
|
|
CMD104 CMD104 = new MsgReceiveCMDCom().ConCMD104(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD104);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD104 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send103();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 106:
|
|
|
{
|
|
|
CMD106 CMD106 = new MsgReceiveCMDCom().ConCMD106(data);
|
|
|
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)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send105();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 108:
|
|
|
{
|
|
|
CMD108 CMD108 = new MsgReceiveCMDCom().ConCMD108(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD108);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD108 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send107();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 110:
|
|
|
{
|
|
|
CMD110 CMD110 = new MsgReceiveCMDCom().ConCMD110(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD110);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD110 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send109();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 112:
|
|
|
{
|
|
|
CMD112 CMD112 = new MsgReceiveCMDCom().ConCMD112(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD112);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD112 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send111();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 114:
|
|
|
{
|
|
|
CMD114 CMD114 = new MsgReceiveCMDCom().ConCMD114(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD114);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD114 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send113();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
#endregion
|
|
|
|
|
|
#region 充电信息数据
|
|
|
|
|
|
case 202:
|
|
|
{
|
|
|
CMD202 CMD202 = new MsgReceiveCMDCom().ConCMD202(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD202);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD202 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send201();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 204:
|
|
|
{
|
|
|
CMD204 CMD204 = new MsgReceiveCMDCom().ConCMD204(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD204);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD204 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send203();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 206:
|
|
|
{
|
|
|
CMD206 CMD206 = new MsgReceiveCMDCom().ConCMD206(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD206);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD206 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send205();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 208:
|
|
|
{
|
|
|
CMD208 CMD208 = new MsgReceiveCMDCom().ConCMD208(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD208);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD208 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send207();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 210:
|
|
|
{
|
|
|
CMD210 CMD210 = new MsgReceiveCMDCom().ConCMD210(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD210);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD210 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send209();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
#endregion
|
|
|
|
|
|
#region 直流充电桩 BMS 信息数据(预留)
|
|
|
case 302:
|
|
|
{
|
|
|
CMD302 CMD302 = new MsgReceiveCMDCom().ConCMD302(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD302);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD302 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send301();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 304:
|
|
|
{
|
|
|
CMD304 CMD304 = new MsgReceiveCMDCom().ConCMD304(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD304);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD304 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send303();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
#endregion
|
|
|
|
|
|
#region 历史记录
|
|
|
case 402:
|
|
|
{
|
|
|
CMD402 CMD402 = new MsgReceiveCMDCom().ConCMD402(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD402);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD402 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send401();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
#endregion
|
|
|
|
|
|
#region 升级命令
|
|
|
case 1002:
|
|
|
{
|
|
|
CMD1002 CMD1002 = new MsgReceiveCMDCom().ConCMD1002(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1002);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD1002 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send1001();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 1004:
|
|
|
{
|
|
|
CMD1004 CMD1004 = new MsgReceiveCMDCom().ConCMD1004(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1004);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD1004 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send1003();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 1006:
|
|
|
{
|
|
|
CMD1006 CMD1006 = new MsgReceiveCMDCom().ConCMD1006(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1006);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD1006 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send1005();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 1008:
|
|
|
{
|
|
|
CMD1008 CMD1008 = new MsgReceiveCMDCom().ConCMD1008(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1008);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD1008 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send1007();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 1010:
|
|
|
{
|
|
|
CMD1010 CMD1010 = new MsgReceiveCMDCom().ConCMD1010(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1010);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD1010 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send1009();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 1012:
|
|
|
{
|
|
|
CMD1012 CMD1012 = new MsgReceiveCMDCom().ConCMD1012(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1012);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD1012 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send1011();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 1022:
|
|
|
{
|
|
|
CMD1022 CMD1022 = new MsgReceiveCMDCom().ConCMD1022(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1022);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD1022 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send1021();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
#endregion
|
|
|
|
|
|
#region 与计费策略相关的指令
|
|
|
case 1102:
|
|
|
{
|
|
|
CMD1102 CMD1102 = new MsgReceiveCMDCom().ConCMD1102(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1102);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD1102 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send1101();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 1104:
|
|
|
{
|
|
|
CMD1104 CMD1104 = new MsgReceiveCMDCom().ConCMD1104(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1104);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD1104 != null)
|
|
|
{
|
|
|
CMD1103 CMD = new CMD1103();
|
|
|
CMD.startHour1 = 0;
|
|
|
CMD.startMinute1 = 0;
|
|
|
CMD.endHour1 = 0;
|
|
|
CMD.endMinute1 = 0;
|
|
|
CMD.rate1 = 0;
|
|
|
|
|
|
CMD.startHour2 = 0;
|
|
|
CMD.startMinute2 = 0;
|
|
|
CMD.endHour2 = 0;
|
|
|
CMD.endMinute2 = 0;
|
|
|
CMD.rate2 = 0;
|
|
|
|
|
|
CMD.startHour3 = 0;
|
|
|
CMD.startMinute3 = 0;
|
|
|
CMD.endHour3 = 0;
|
|
|
CMD.endMinute3 = 0;
|
|
|
CMD.rate3 = 0;
|
|
|
|
|
|
CMD.startHour4 = 0;
|
|
|
CMD.startMinute4 = 0;
|
|
|
CMD.endHour4 = 0;
|
|
|
CMD.endMinute4 = 0;
|
|
|
CMD.rate4 = 0;
|
|
|
|
|
|
CMD.startHour5 = 0;
|
|
|
CMD.startMinute5 = 0;
|
|
|
CMD.endHour5 = 0;
|
|
|
CMD.endMinute5 = 0;
|
|
|
CMD.rate5 = 0;
|
|
|
|
|
|
CMD.startHour6 = 0;
|
|
|
CMD.startMinute6 = 0;
|
|
|
CMD.endHour6 = 0;
|
|
|
CMD.endMinute6 = 0;
|
|
|
CMD.rate6 = 0;
|
|
|
|
|
|
CMD.startHour7 = 0;
|
|
|
CMD.startMinute7 = 0;
|
|
|
CMD.endHour7 = 0;
|
|
|
CMD.endMinute7 = 0;
|
|
|
CMD.rate7 = 0;
|
|
|
|
|
|
CMD.startHour8 = 0;
|
|
|
CMD.startMinute8 = 0;
|
|
|
CMD.endHour8 = 0;
|
|
|
CMD.endMinute8 = 0;
|
|
|
CMD.rate8 = 0;
|
|
|
|
|
|
CMD.startHour9 = 0;
|
|
|
CMD.startMinute9 = 0;
|
|
|
CMD.endHour9 = 0;
|
|
|
CMD.endMinute9 = 0;
|
|
|
CMD.rate9 = 0;
|
|
|
|
|
|
CMD.startHour10 = 0;
|
|
|
CMD.startMinute10 = 0;
|
|
|
CMD.endHour10 = 0;
|
|
|
CMD.endMinute10 = 0;
|
|
|
CMD.rate10 = 0;
|
|
|
|
|
|
CMD.startHour11 = 0;
|
|
|
CMD.startMinute11 = 0;
|
|
|
CMD.endHour11 = 0;
|
|
|
CMD.endMinute11 = 0;
|
|
|
CMD.rate11 = 0;
|
|
|
|
|
|
CMD.startHour12 = 0;
|
|
|
CMD.startMinute12 = 0;
|
|
|
CMD.endHour12 = 0;
|
|
|
CMD.endMinute12 = 0;
|
|
|
CMD.rate12 = 0;
|
|
|
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send1103(CMD);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 1106:
|
|
|
{
|
|
|
CMD1106 CMD1106 = new MsgReceiveCMDCom().ConCMD1106(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1106);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD1106 != null)
|
|
|
{
|
|
|
CMD1105 CMD = new CMD1105();
|
|
|
CMD.startHour1 = 0;
|
|
|
CMD.startMinute1 = 0;
|
|
|
CMD.endHour1 = 0;
|
|
|
CMD.endMinute1 = 0;
|
|
|
CMD.rate1 = 0;
|
|
|
CMD.reserveRate1 = 0;
|
|
|
|
|
|
CMD.startHour2 = 0;
|
|
|
CMD.startMinute2 = 0;
|
|
|
CMD.endHour2 = 0;
|
|
|
CMD.endMinute2 = 0;
|
|
|
CMD.rate2 = 0;
|
|
|
CMD.reserveRate2 = 0;
|
|
|
|
|
|
CMD.startHour3 = 0;
|
|
|
CMD.startMinute3 = 0;
|
|
|
CMD.endHour3 = 0;
|
|
|
CMD.endMinute3 = 0;
|
|
|
CMD.rate3 = 0;
|
|
|
CMD.reserveRate3 = 0;
|
|
|
|
|
|
CMD.startHour4 = 0;
|
|
|
CMD.startMinute4 = 0;
|
|
|
CMD.endHour4 = 0;
|
|
|
CMD.endMinute4 = 0;
|
|
|
CMD.rate4 = 0;
|
|
|
CMD.reserveRate4 = 0;
|
|
|
|
|
|
CMD.startHour5 = 0;
|
|
|
CMD.startMinute5 = 0;
|
|
|
CMD.endHour5 = 0;
|
|
|
CMD.endMinute5 = 0;
|
|
|
CMD.rate5 = 0;
|
|
|
CMD.reserveRate5 = 0;
|
|
|
|
|
|
CMD.startHour6 = 0;
|
|
|
CMD.startMinute6 = 0;
|
|
|
CMD.endHour6 = 0;
|
|
|
CMD.endMinute6 = 0;
|
|
|
CMD.rate6 = 0;
|
|
|
CMD.reserveRate6 = 0;
|
|
|
|
|
|
CMD.startHour7 = 0;
|
|
|
CMD.startMinute7 = 0;
|
|
|
CMD.endHour7 = 0;
|
|
|
CMD.endMinute7 = 0;
|
|
|
CMD.rate7 = 0;
|
|
|
CMD.reserveRate7 = 0;
|
|
|
|
|
|
CMD.startHour8 = 0;
|
|
|
CMD.startMinute8 = 0;
|
|
|
CMD.endHour8 = 0;
|
|
|
CMD.endMinute8 = 0;
|
|
|
CMD.rate8 = 0;
|
|
|
CMD.reserveRate8 = 0;
|
|
|
|
|
|
CMD.startHour9 = 0;
|
|
|
CMD.startMinute9 = 0;
|
|
|
CMD.endHour9 = 0;
|
|
|
CMD.endMinute9 = 0;
|
|
|
CMD.rate9 = 0;
|
|
|
CMD.reserveRate9 = 0;
|
|
|
|
|
|
CMD.startHour10 = 0;
|
|
|
CMD.startMinute10 = 0;
|
|
|
CMD.endHour10 = 0;
|
|
|
CMD.endMinute10 = 0;
|
|
|
CMD.rate10 = 0;
|
|
|
CMD.reserveRate10 = 0;
|
|
|
|
|
|
CMD.startHour11 = 0;
|
|
|
CMD.startMinute11 = 0;
|
|
|
CMD.endHour11 = 0;
|
|
|
CMD.endMinute11 = 0;
|
|
|
CMD.rate11 = 0;
|
|
|
CMD.reserveRate11 = 0;
|
|
|
|
|
|
CMD.startHour12 = 0;
|
|
|
CMD.startMinute12 = 0;
|
|
|
CMD.endHour12 = 0;
|
|
|
CMD.endMinute12 = 0;
|
|
|
CMD.rate12 = 0;
|
|
|
CMD.reserveRate12 = 0;
|
|
|
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send1105(CMD);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 1108:
|
|
|
{
|
|
|
CMD1108 CMD1108 = new MsgReceiveCMDCom().ConCMD1108(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1108);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD1108 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send1107();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
#endregion
|
|
|
|
|
|
#region 白名单报文
|
|
|
case 1302:
|
|
|
{
|
|
|
CMD1302 CMD1302 = new MsgReceiveCMDCom().ConCMD1302(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1302);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD1302 != null)
|
|
|
{
|
|
|
|
|
|
CMD1301 CMD = new CMD1301();
|
|
|
CMD.reserved1 = 0;
|
|
|
CMD.reserved2 = 0;
|
|
|
//CMD.chargingStationCode = chargingStationCode;
|
|
|
//CMD.whitelistType = whitelistType;
|
|
|
//CMD.operation = operation;
|
|
|
//CMD.whitelistVersionNum = whitelistVersionNum;
|
|
|
//CMD.DistributeWhitelistNum = DistributeWhitelistNum;
|
|
|
//CMD.carVinOrChargCardNum01 = carVinOrChargCardNum01;
|
|
|
//CMD.carVinOrChargCardNum02 = carVinOrChargCardNum02;
|
|
|
//CMD.carVinOrChargCardNum03 = carVinOrChargCardNum03;
|
|
|
//CMD.carVinOrChargCardNum04 = carVinOrChargCardNum04;
|
|
|
//CMD.carVinOrChargCardNum05 = carVinOrChargCardNum05;
|
|
|
//CMD.carVinOrChargCardNum06 = carVinOrChargCardNum06;
|
|
|
//CMD.carVinOrChargCardNum07 = carVinOrChargCardNum07;
|
|
|
//CMD.carVinOrChargCardNum08 = carVinOrChargCardNum08;
|
|
|
//CMD.carVinOrChargCardNum09 = carVinOrChargCardNum09;
|
|
|
//CMD.carVinOrChargCardNum10 = carVinOrChargCardNum10;
|
|
|
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send1301(CMD);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
#endregion
|
|
|
|
|
|
#region FTP远程升级和FTP方式日志上传
|
|
|
case 1402:
|
|
|
{
|
|
|
CMD1402 CMD1402 = new MsgReceiveCMDCom().ConCMD1402(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1402);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD1402 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
//CmnChargerParam._CHR00TCPCLIENT.Send1401();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 1403:
|
|
|
{
|
|
|
CMD1403 CMD1403 = new MsgReceiveCMDCom().ConCMD1403(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1403);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD1403 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
//CmnChargerParam._CHR00TCPCLIENT.Send9();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 1407:
|
|
|
{
|
|
|
CMD1407 CMD1407 = new MsgReceiveCMDCom().ConCMD1407(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1407);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD1407 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
//CmnChargerParam._CHR00TCPCLIENT.Send9();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
#endregion
|
|
|
|
|
|
#region 协议方式日志上传
|
|
|
case 1501:
|
|
|
{
|
|
|
CMD1501 CMD1501 = new MsgReceiveCMDCom().ConCMD1501(data);
|
|
|
string result = "(CMD=1501)申请上传文件 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=1501)申请上传文件对象:" + JsonConvert.SerializeObject(CMD1501);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD1501 != null)
|
|
|
{
|
|
|
PublicProgram.failName01 = CMD1501.value03 + "/" + CMD1501.value04 + "/" + DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
|
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send1502(0);
|
|
|
|
|
|
//获取桌面路径
|
|
|
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
|
|
|
|
|
// 检查文件夹是否已经存在
|
|
|
if (!Directory.Exists(folderPath))
|
|
|
{
|
|
|
// 如果文件夹不存在,则创建它
|
|
|
Directory.CreateDirectory(folderPath);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 1503:
|
|
|
{
|
|
|
CMD1503 CMD1503 = new MsgReceiveCMDCom().ConCMD1503(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1503);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD1503 != null)
|
|
|
{
|
|
|
//要加防止重复(未加)
|
|
|
//要判断是否接收成功
|
|
|
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send1504(0, (uint)CMD1503.value04);
|
|
|
|
|
|
Log.LogInstance.WriteLog(CMD1503.value05, LogType.Information, PublicProgram.failName01);
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 1505://接收完成,要保存关闭
|
|
|
{
|
|
|
CMD1505 CMD1505 = new MsgReceiveCMDCom().ConCMD1505(data);
|
|
|
string result = "(CMD=10)充电桩上传命令请求(预留) - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result += "\r\n" + "(CMD=10)充电桩上传命令请求(预留)对象:" + JsonConvert.SerializeObject(CMD1505);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
|
|
|
|
|
|
if (CMD1505 != null)
|
|
|
{
|
|
|
//(CMD=9)后台服务器应答桩上传命令请求(预留)
|
|
|
CmnChargerParam._CHR00TCPCLIENT.Send1506();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
#endregion
|
|
|
}
|
|
|
}
|
|
|
|
|
|
{
|
|
|
byte frameTypeNo = data[15]; //帧类型号
|
|
|
byte infoNums = data[16]; //信息体个数
|
|
|
|
|
|
switch (frameTypeNo)
|
|
|
{
|
|
|
|
|
|
#region 42主动上送充电记录
|
|
|
case 42: //主动上送充电记录(有116)
|
|
|
{
|
|
|
ASDU baseAsdu = MsgHeadAsduDecoder.GetBaseASDUMsg(data);
|
|
|
RecordCharg _record_charg = new MsgRecChaDecoder().mRecordCharg(data);
|
|
|
string result = "主动上送充电记录 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result = "\r\n" + "主动上送充电记录对象:" + JsonConvert.SerializeObject(_record_charg);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
if (_result._record_charg != null)
|
|
|
{
|
|
|
//主动上送充电记录响应
|
|
|
SendRecordChargResp(0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
if (_record_charg != null)
|
|
|
{
|
|
|
if (_result._record_charg.startTime.Trim() == _record_charg.startTime.Trim())
|
|
|
{
|
|
|
//是否需要主动发送给云平台充电订单
|
|
|
_record_to_cloud_sended = false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
_result._record_charg = _record_charg;
|
|
|
//是否需要主动发送给云平台充电订单
|
|
|
_record_to_cloud_sended = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (_record_charg != null)
|
|
|
{
|
|
|
_result._record_charg = _record_charg;
|
|
|
//是否需要主动发送给云平台充电订单
|
|
|
_record_to_cloud_sended = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
#endregion 42主动上送充电记录
|
|
|
|
|
|
#region 帧类型45
|
|
|
case 45:
|
|
|
{
|
|
|
ASDU baseAsdu = MsgHeadAsduDecoder.GetBaseASDUMsg(data);
|
|
|
if (baseAsdu != null)
|
|
|
{
|
|
|
byte recordType = baseAsdu.MsgBodyContents[0];
|
|
|
switch (recordType)
|
|
|
{
|
|
|
case 1: //充放电机上送充电启动完成帧-4.1.6
|
|
|
{
|
|
|
byte sucVal = baseAsdu.MsgBodyContents[1];
|
|
|
if (sucVal == 0)
|
|
|
{
|
|
|
_is_charged = true;
|
|
|
}
|
|
|
else if (sucVal == 1)
|
|
|
{
|
|
|
_is_charged = false;
|
|
|
}
|
|
|
//解析反馈的其他参数值(匹配)
|
|
|
if (baseAsdu.MsgBodyContents.Count() > 20)
|
|
|
{
|
|
|
StartComFrame startComFrame = (new MsgStaComFraDecoder()).GetMsgStartComFrame(data);
|
|
|
string result = "充放电机上送充电启动完成帧 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result = "\r\n" + "充放电机上送充电启动完成帧对象:" + JsonConvert.SerializeObject(startComFrame);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
if (startComFrame != null)
|
|
|
{
|
|
|
//应答充电启动完成帧
|
|
|
SendStartChargingFinishedRes(0, 0);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//应答充电启动完成帧
|
|
|
SendStartChargingFinishedRes(1, 2);
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
case 3: //充放电机上送充电停止帧-4.1.8
|
|
|
{
|
|
|
//此次解析有问题,需要重新审核优化
|
|
|
//ChargeStopFrame chargestopframe = (new msgchastopfradecoder()).getmsgchargestopframe(data);
|
|
|
//System.Diagnostics.Debug.WriteLine("充放电机上送充电停止帧(chargestopframe): "+ JsonConvert.SerializeObject(chargestopframe));
|
|
|
//string result = "充放电机上送充电停止帧 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";" + "充放电机上送充电停止帧对象:" + JsonConvert.SerializeObject(chargestopframe);
|
|
|
//Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
_is_can_send_stop_cmd = false;
|
|
|
//应答充电停止完成帧
|
|
|
SendStopChargingFinishedRes(0);
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
case 6: //3.4.2 充放电机应答站功率调节指令
|
|
|
{
|
|
|
|
|
|
PowerRegulateResult powerRegulateResult = (new PowerRegulateDecoder()).GetPowerRegulateResult(data);
|
|
|
string result = "充放电机应答站功率调节指令 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result = "\r\n" + "充放电机应答站功率调节指令对象:" + JsonConvert.SerializeObject(powerRegulateResult);
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 10: //3.4.4 充放电机应答辅助控制
|
|
|
{
|
|
|
|
|
|
AuxiliaryPowerControlResult auxiliaryPowerControlResult = (new AuxiliaryPowerControlDecoder()).GetAuxiliaryPowerControlResult(data);
|
|
|
string result = "充放电机应答辅助控制 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result = "\r\n" + "充放电机应答辅助控制对象:" + JsonConvert.SerializeObject(auxiliaryPowerControlResult);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 11: //充放电机登陆签到
|
|
|
{
|
|
|
ChaDisMacLoginsign chaDisMacLoginsign = (new MsgChaDisMacLogDecoder()).GetMsgChaDisMacLoginsign(data);
|
|
|
string result = "充放电机登陆签到 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";" + "充放电机登陆签到:" + JsonConvert.SerializeObject(chaDisMacLoginsign);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
System.Diagnostics.Debug.WriteLine("充放电机登陆签到(ChaDisMacLoginsign): " + JsonConvert.SerializeObject(chaDisMacLoginsign));
|
|
|
if (chaDisMacLoginsign != null)
|
|
|
{
|
|
|
//监控平台应答充电设备登录签到
|
|
|
SendCharingLoginRes();
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
case 13: //充电设备心跳上报
|
|
|
{
|
|
|
string result = "充电设备心跳上报 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
//监控平台心跳应答
|
|
|
SendCharingHeartRes();
|
|
|
break;
|
|
|
}
|
|
|
case 25: //充放电机应答鉴权认证-3.3.2
|
|
|
{
|
|
|
AuthRes auRes = (new MsgSignResDecoder()).GetAuthResMsg(data);
|
|
|
string result = "充放电机应答鉴权认证 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result = "\r\n" + "充放电机应答鉴权认证对象:" + JsonConvert.SerializeObject(auRes);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
|
|
|
|
|
|
//充电机认证确认
|
|
|
if (auRes != null)
|
|
|
{
|
|
|
if (_result._auth_rlt != null)
|
|
|
{
|
|
|
if (_result._auth_rlt.F_Auth != null)
|
|
|
{
|
|
|
if (_result._auth_rlt.F_ID == auRes.ConnSeq)
|
|
|
{
|
|
|
_is_authed = true;
|
|
|
_charging_status = 1;
|
|
|
_result._auth_rlt.F_HaveRes = true;
|
|
|
_result._auth_rlt.F_AuthRes = auRes;
|
|
|
_charging_start_time = Convert.ToDateTime("2000-1-1");
|
|
|
_charging_stop_time = Convert.ToDateTime("2000-1-1");
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
_is_authed = false;
|
|
|
_charging_status = 2;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 44: //3.4.6 充放电机应答监控平台掉线停止充电
|
|
|
{
|
|
|
//返回值为 应答结果 0成功 1失败
|
|
|
byte result = (new DisconnectStopChargeDecoder()).DisconnectStopChargeResult(data);
|
|
|
string result1 = "充放电机应答监控平台掉线停止充电-接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result1 = "\r\n" + "应答结果(0成功 1失败):" + result;
|
|
|
Log.LogInstance.WriteLog(result1, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
case 46: //3.4.8 充放电机应答监控平台下发站外允许充电SOC
|
|
|
{
|
|
|
//返回值为 SOC限制值
|
|
|
byte result = (new OutsideAllowChargeSOCDecoder()).OutsideAllowChargeSOCResult(data);
|
|
|
string result1 = "充放电机应答监控平台下发站外允许充电SOC: " + "接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result1 = "\r\n" + "SOC限制值:" + result;
|
|
|
Log.LogInstance.WriteLog(result1, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 48: //3.4.10监控网关响应尖峰平谷设置 00:成功 01:失败
|
|
|
{
|
|
|
byte rlt = (new MsgPeakResDecoder()).GetPeakTimePeriodResMsg(data);
|
|
|
string result1 = "监控网关响应尖峰平谷设置: " + "接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result1 = "\r\n" + "尖峰平谷设置结果(00:成功 01:失败):" + rlt;
|
|
|
Log.LogInstance.WriteLog(result1, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
case 50: // 3.5.9 监控网关上送尖峰平谷设置
|
|
|
{
|
|
|
SdUpPkFtValSet sdUpPkFtValSet = null;
|
|
|
MsgSdUpPkFtValSetDecoder msgSdUpPkFtValSetDecoder = new MsgSdUpPkFtValSetDecoder();
|
|
|
sdUpPkFtValSet = msgSdUpPkFtValSetDecoder.GetMsgSdUpPkFtValSet(data);
|
|
|
string result = "监控网关上送尖峰平谷设置 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result = "\r\n" + "监控网关上送尖峰平谷设置对象:" + JsonConvert.SerializeObject(sdUpPkFtValSet);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
|
|
|
case 75://4.3.10 充放电机上报模块状态
|
|
|
{
|
|
|
UpModelStation upModelStation = null;
|
|
|
MsgUpModelStationDecoder msgUpModelStationDecoder = new MsgUpModelStationDecoder();
|
|
|
upModelStation = msgUpModelStationDecoder.GetMsgUpModelStation(data);
|
|
|
|
|
|
string result = "监控网关上送尖峰平谷设置 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result = "\r\n" + "监控网关上送尖峰平谷设置对象:" + JsonConvert.SerializeObject(upModelStation);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
if (upModelStation != null)
|
|
|
{
|
|
|
|
|
|
|
|
|
SendUpModelStationResp(0);
|
|
|
|
|
|
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
case 83: //4.2.12 充放电机应答版本号
|
|
|
{
|
|
|
MsgAnsVerNumDecoder msgAnsVerNumDecoder = new MsgAnsVerNumDecoder();
|
|
|
AnsVerNum ansVerNum = msgAnsVerNumDecoder.GetMsgAnsVerNum(data);
|
|
|
string result = "充放电机应答版本号 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result = "\r\n" + "充放电机应答版本号对象:" + JsonConvert.SerializeObject(ansVerNum);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
#endregion 45充放电机上送充电启动完成帧
|
|
|
|
|
|
case 46:
|
|
|
{
|
|
|
ASDU baseAsdu = MsgHeadAsduDecoder.GetBaseASDUMsg(data);
|
|
|
byte recordType = baseAsdu.MsgBodyContents[0];//信息体内容
|
|
|
|
|
|
if (data.Length >= 36)
|
|
|
{
|
|
|
byte[] canData = { data[28], data[29], data[30], data[31], data[32], data[33], data[34], data[35] };
|
|
|
|
|
|
switch (recordType)
|
|
|
{
|
|
|
#region New
|
|
|
|
|
|
case 2:
|
|
|
{
|
|
|
_msg_recv.S2MStatus = SBMUCANDecoderUtils.Decode0X040141(canData);
|
|
|
string result = "S2MStatus - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MStatus);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 3:
|
|
|
{
|
|
|
_msg_recv.S2MALARM1 = SBMUCANDecoderUtils.Decode0X040241(canData);
|
|
|
string result = "S2MALARM1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MALARM1);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 4:
|
|
|
{
|
|
|
_msg_recv.S2MALARM2 = SBMUCANDecoderUtils.Decode0X040341(canData);
|
|
|
string result = "S2MALARM2 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MALARM2);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 5:
|
|
|
{
|
|
|
_msg_recv.S2MPACKINFO = SBMUCANDecoderUtils.Decode0X040441(canData);
|
|
|
string result = "S2MPACKINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MPACKINFO);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 6:
|
|
|
{
|
|
|
_msg_recv.S2MBRANCHCURR = SBMUCANDecoderUtils.Decode0X040541(canData);
|
|
|
string result = "S2MBRANCHCURR - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBRANCHCURR);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 7:
|
|
|
{
|
|
|
_msg_recv.S2MRELAYSTATUS = SBMUCANDecoderUtils.Decode0X040641(canData);
|
|
|
string result = "S2MRELAYSTATUS - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MRELAYSTATUS);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 8:
|
|
|
{
|
|
|
_msg_recv.S2MPACKCURRLMT = SBMUCANDecoderUtils.Decode0X040741(canData);
|
|
|
string result = "S2MPACKCURRLMT - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MPACKCURRLMT);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 9:
|
|
|
{
|
|
|
_msg_recv.S2MRUNSTATUSINFO = SBMUCANDecoderUtils.Decode0X040841(canData);
|
|
|
string result = "S2MRUNSTATUSINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MRUNSTATUSINFO);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 10:
|
|
|
{
|
|
|
_msg_recv.S2MSUMVOLT = SBMUCANDecoderUtils.Decode0X080141(canData);
|
|
|
string result = "S2MSUMVOLT - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MSUMVOLT);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 11:
|
|
|
{
|
|
|
_msg_recv.S2MSUMTEMP = SBMUCANDecoderUtils.Decode0X080241(canData);
|
|
|
string result = "S2MSUMTEMP - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MSUMTEMP);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 12:
|
|
|
{
|
|
|
_msg_recv.S2MCHRGACCUINFO = SBMUCANDecoderUtils.Decode0X080341(canData);
|
|
|
string result = "S2MCHRGACCUINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MCHRGACCUINFO);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 13:
|
|
|
{
|
|
|
_msg_recv.S2MDISCHRGACCUINFO = SBMUCANDecoderUtils.Decode0X080441(canData);
|
|
|
string result = "S2MDISCHRGACCUINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MDISCHRGACCUINFO);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 14:
|
|
|
{
|
|
|
_msg_recv.S2MRECHRGACCUINFO = SBMUCANDecoderUtils.Decode0X080541(canData);
|
|
|
string result = "S2MRECHRGACCUINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MRECHRGACCUINFO);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 15:
|
|
|
{
|
|
|
_msg_recv.S2MISOINFO = SBMUCANDecoderUtils.Decode0X080641(canData);
|
|
|
string result = "S2MISOINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MISOINFO);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 16:
|
|
|
{
|
|
|
_msg_recv.S2MBRACHSUMVOLT1 = SBMUCANDecoderUtils.Decode0X080741(canData);
|
|
|
string result = "S2MBRACHSUMVOLT1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBRACHSUMVOLT1);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 17:
|
|
|
{
|
|
|
_msg_recv.S2MBRACHSUMVOLT2 = SBMUCANDecoderUtils.Decode0X080841(canData);
|
|
|
string result = "S2MBRACHSUMVOLT2 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBRACHSUMVOLT2);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 18:
|
|
|
{
|
|
|
_msg_recv.S2MBRACHSUMVOTL3 = SBMUCANDecoderUtils.Decode0X080941(canData);
|
|
|
string result = "S2MBRACHSUMVOTL3 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBRACHSUMVOTL3);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 19:
|
|
|
{
|
|
|
_msg_recv.S2MBRACHSUMTEMP1 = SBMUCANDecoderUtils.Decode0X081041(canData);
|
|
|
string result = "S2MBRACHSUMTEMP1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBRACHSUMTEMP1);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 20:
|
|
|
{
|
|
|
_msg_recv.S2MBRACHSUMTEMP2 = SBMUCANDecoderUtils.Decode0X081141(canData);
|
|
|
string result = "S2MBRACHSUMTEMP2 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBRACHSUMTEMP2);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 21:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT1 = SBMUCANDecoderUtils.Decode0X0C0141(canData);
|
|
|
string result = "S2MVOLT1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT1);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 22:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT2 = SBMUCANDecoderUtils.Decode0X0C0241(canData);
|
|
|
string result = "S2MVOLT2 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT2);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 23:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT3 = SBMUCANDecoderUtils.Decode0X0C0341(canData);
|
|
|
string result = "S2MVOLT3 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT3);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 24:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT4 = SBMUCANDecoderUtils.Decode0X0C0441(canData);
|
|
|
string result = "S2MVOLT4 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT4);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 25:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT5 = SBMUCANDecoderUtils.Decode0X0C0541(canData);
|
|
|
string result = "S2MVOLT5 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT5);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 26:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT6 = SBMUCANDecoderUtils.Decode0X0C0641(canData);
|
|
|
string result = "S2MVOLT6 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT6);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 27:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT7 = SBMUCANDecoderUtils.Decode0X0C0741(canData);
|
|
|
string result = "S2MVOLT7 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT7);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 28:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT8 = SBMUCANDecoderUtils.Decode0X0C0841(canData);
|
|
|
string result = "S2MVOLT8 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT8);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 29:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT9 = SBMUCANDecoderUtils.Decode0X0C0941(canData);
|
|
|
string result = "S2MVOLT9 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT9);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 30:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT10 = SBMUCANDecoderUtils.Decode0X0C0A41(canData);
|
|
|
string result = "S2MVOLT10 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT10);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 31:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT11 = SBMUCANDecoderUtils.Decode0X0C0B41(canData);
|
|
|
string result = "S2MVOLT11 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT11);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 32:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT12 = SBMUCANDecoderUtils.Decode0X0C0C41(canData);
|
|
|
string result = "S2MVOLT12 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT12);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 33:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT13 = SBMUCANDecoderUtils.Decode0X0C0D41(canData);
|
|
|
string result = "S2MVOLT13 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT13);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 34:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT14 = SBMUCANDecoderUtils.Decode0X0C0E41(canData);
|
|
|
string result = "S2MVOLT14 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT14);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 35:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT15 = SBMUCANDecoderUtils.Decode0X0C0F41(canData);
|
|
|
string result = "S2MVOLT15 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT15);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 36:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT16 = SBMUCANDecoderUtils.Decode0X0C1041(canData);
|
|
|
string result = "S2MVOLT16 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT16);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 37:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT17 = SBMUCANDecoderUtils.Decode0X0C1141(canData);
|
|
|
string result = "S2MVOLT17 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT17);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 38:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT18 = SBMUCANDecoderUtils.Decode0X0C1241(canData);
|
|
|
string result = "S2MVOLT18 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT18);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 39:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT19 = SBMUCANDecoderUtils.Decode0X0C1341(canData);
|
|
|
string result = "S2MVOLT19 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT19);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 40:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT20 = SBMUCANDecoderUtils.Decode0X0C1441(canData);
|
|
|
string result = "S2MVOLT20 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT20);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 41:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT21 = SBMUCANDecoderUtils.Decode0X0C1541(canData);
|
|
|
string result = "S2MVOLT21 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT21);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 42:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT22 = SBMUCANDecoderUtils.Decode0X0C1641(canData);
|
|
|
string result = "S2MVOLT22 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT22);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 43:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT23 = SBMUCANDecoderUtils.Decode0X0C1741(canData);
|
|
|
string result = "S2MALARM1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MALARM1);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 44:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT24 = SBMUCANDecoderUtils.Decode0X0C1841(canData);
|
|
|
string result = "S2MVOLT24 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT24);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 45:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT25 = SBMUCANDecoderUtils.Decode0X0C1941(canData);
|
|
|
string result = "S2MVOLT25 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT25);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 46:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT26 = SBMUCANDecoderUtils.Decode0X0C1A41(canData);
|
|
|
string result = "S2MVOLT26 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT26);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 47:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT27 = SBMUCANDecoderUtils.Decode0X0C1B41(canData);
|
|
|
string result = "S2MVOLT27 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT27);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 48:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT28 = SBMUCANDecoderUtils.Decode0X0C1C41(canData);
|
|
|
string result = "S2MVOLT28 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT28);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 49:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT29 = SBMUCANDecoderUtils.Decode0X0C1D41(canData);
|
|
|
string result = "S2MVOLT29 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT29);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 50:
|
|
|
{
|
|
|
_msg_recv.S2MVOLT30 = SBMUCANDecoderUtils.Decode0X0C1E41(canData);
|
|
|
string result = "S2MVOLT30 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MVOLT30);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 51:
|
|
|
{
|
|
|
_msg_recv.S2MTEMP1 = SBMUCANDecoderUtils.Decode0X0C1F41(canData);
|
|
|
string result = "S2MTEMP1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTEMP1);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 52:
|
|
|
{
|
|
|
_msg_recv.S2MTEMP2 = SBMUCANDecoderUtils.Decode0X0C2041(canData);
|
|
|
string result = "S2MTEMP2 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTEMP2);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 53:
|
|
|
{
|
|
|
_msg_recv.S2MTEMP3 = SBMUCANDecoderUtils.Decode0X0C2141(canData);
|
|
|
string result = "S2MTEMP3 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTEMP3);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 54:
|
|
|
{
|
|
|
_msg_recv.S2MTEMP4 = SBMUCANDecoderUtils.Decode0X0C2241(canData);
|
|
|
string result = "S2MTEMP4 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTEMP4);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 55:
|
|
|
{
|
|
|
_msg_recv.S2MTEMP5 = SBMUCANDecoderUtils.Decode0X0C2341(canData);
|
|
|
string result = "S2MTEMP5 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTEMP5);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 56:
|
|
|
{
|
|
|
_msg_recv.S2MTEMP6 = SBMUCANDecoderUtils.Decode0X0C2441(canData);
|
|
|
string result = "S2MTEMP6 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTEMP6);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 57:
|
|
|
{
|
|
|
_msg_recv.S2MCSCSUMVOLT = SBMUCANDecoderUtils.Decode0X0C2541(canData);
|
|
|
string result = "S2MCSCSUMVOLT - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MCSCSUMVOLT);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 58:
|
|
|
{
|
|
|
_msg_recv.S2MCSCSUMTEMP = SBMUCANDecoderUtils.Decode0X0C2641(canData);
|
|
|
string result = "S2MCSCSUMTEMP - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MCSCSUMTEMP);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 59:
|
|
|
{
|
|
|
_msg_recv.S2MTIMINGINFO = SBMUCANDecoderUtils.Decode0X140141(canData);
|
|
|
string result = "S2MTIMINGINFO - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MTIMINGINFO);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 142:
|
|
|
{
|
|
|
_msg_recv.S2MBATTENERGYINFO1 = SBMUCANDecoderUtils.Decode0X050141(canData);
|
|
|
string result = "S2MBATTENERGYINFO1 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBATTENERGYINFO1);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 143:
|
|
|
{
|
|
|
_msg_recv.S2MBATTENERGYINFO2 = SBMUCANDecoderUtils.Decode0X050241(canData);
|
|
|
string result = "S2MBATTENERGYINFO2 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBATTENERGYINFO2);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 144:
|
|
|
{
|
|
|
_msg_recv.S2MBATTENERGYINFO3 = SBMUCANDecoderUtils.Decode0X050341(canData);
|
|
|
string result = "S2MBATTENERGYINFO3 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBATTENERGYINFO3);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
break;
|
|
|
}
|
|
|
case 145:
|
|
|
{
|
|
|
_msg_recv.S2MBATTENERGYINFO4 = SBMUCANDecoderUtils.Decode0X050441(canData);
|
|
|
string result = "S2MBATTENERGYINFO4 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBATTENERGYINFO4);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 146:
|
|
|
{
|
|
|
_msg_recv.S2MBATTENERGYINFO5 = SBMUCANDecoderUtils.Decode0X050541(canData);
|
|
|
string result = "S2MBATTENERGYINFO5 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBATTENERGYINFO5);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 147:
|
|
|
{
|
|
|
_msg_recv.S2MBATTENERGYINFO6 = SBMUCANDecoderUtils.Decode0X050641(canData);
|
|
|
string result = "S2MBATTENERGYINFO6 - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MBATTENERGYINFO6);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
case 148:
|
|
|
{
|
|
|
_msg_recv.S2MSYSCODE = SBMUCANDecoderUtils.Decode0X050741(canData);
|
|
|
string result = "S2MSYSCODE - 接收字节内容:" + ByteUtils.BytesToHexStr(canData) + ";";
|
|
|
result = "\r\n" + JsonConvert.SerializeObject(_msg_recv.S2MSYSCODE);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
case 72://充放电机上送BMS基本参数2
|
|
|
{
|
|
|
BatterCycleUpBMS batterCycleUpBMS = null;
|
|
|
MsgBatCycUpBMSDecoder msgBatCycUpBMSDecoder = new MsgBatCycUpBMSDecoder();
|
|
|
batterCycleUpBMS = msgBatCycUpBMSDecoder.GetMsgBatterCycleUpBMS(data);
|
|
|
break;
|
|
|
}
|
|
|
//case 74://充放电机上传BMS设备状态(只有40)
|
|
|
// {
|
|
|
// BatterCycleUpBMS batterCycleUpBMS = null;
|
|
|
// MsgBatCycUpBMSDecoder msgBatCycUpBMSDecoder = new MsgBatCycUpBMSDecoder();
|
|
|
// batterCycleUpBMS = msgBatCycUpBMSDecoder.GetMsgBatterCycleUpBMS(data);
|
|
|
// break;
|
|
|
// }
|
|
|
default:
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
|
|
|
}
|
|
|
case 49:
|
|
|
{
|
|
|
//充放电机响应远程启动充电
|
|
|
RemoteStartChargingRes startChargingRes = (new MsgStartChgResDecoder()).GetStartChargingResMsg(data);
|
|
|
|
|
|
string result = "充放电机响应远程启动充电 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result = "\r\n" + "充放电机响应远程启动充电对象:" + JsonConvert.SerializeObject(startChargingRes);
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
if (startChargingRes != null)
|
|
|
{
|
|
|
if (startChargingRes.Result == 0)
|
|
|
{
|
|
|
_is_stoped = false;
|
|
|
_charging_status = 3;
|
|
|
_charging_start_time = DateTime.Now;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
_charging_status = 4;
|
|
|
_charging_start_time = Convert.ToDateTime("2000-1-1");
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
_charging_status = 4;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
case 50:
|
|
|
{
|
|
|
//充放电机响应远程停止充电
|
|
|
RemoteStopChargingRes stopChargingRes = (new MsgStopChgResDecoder()).GetStopChargingResMsg(data);
|
|
|
string result = "充放电机响应远程停止充电 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result = "\r\n" + "充放电机响应远程停止充电对象:" + JsonConvert.SerializeObject(stopChargingRes);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
if (stopChargingRes != null)
|
|
|
{
|
|
|
if (stopChargingRes.Result == 0)
|
|
|
{
|
|
|
_is_can_send_stop_cmd = false;
|
|
|
_is_stoped = true;
|
|
|
_charging_status = 6;
|
|
|
_is_charged = false;
|
|
|
_charging_stop_time = DateTime.Now;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
_is_stoped = false;
|
|
|
_charging_status = 7;
|
|
|
_charging_stop_time = Convert.ToDateTime("2000-1-1");
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
_is_stoped = false;
|
|
|
_charging_status = 7;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
case 5: //遥信
|
|
|
{
|
|
|
RemoteData mRemoteData = new MsgRemoteDataDecoder().BRemoteDataToValue(data);
|
|
|
string result = "遥信数据上报 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result = "\r\n" + "遥信数据上报对象:" + JsonConvert.SerializeObject(mRemoteData);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
if (mRemoteData != null)
|
|
|
{
|
|
|
_workstate = mRemoteData.WorkDev;
|
|
|
_is_fault = mRemoteData.TotalFault == 1 ? true : false;
|
|
|
_is_alarm = mRemoteData.CommonAlarm == 1 ? true : false;
|
|
|
_remote_data = mRemoteData;
|
|
|
|
|
|
GetFalutAlarmNoList(mRemoteData);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
case 11: //遥测
|
|
|
{
|
|
|
TelemetryData mTelemetryData = new MsgTelDataDecoder().BTelemetryDataToValue(data);
|
|
|
string result = "遥测数据上报 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ";";
|
|
|
result = "\r\n" + "遥测数据上报对象:" + JsonConvert.SerializeObject(mTelemetryData);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "RecvedLog");
|
|
|
|
|
|
if (mTelemetryData != null)
|
|
|
{
|
|
|
_telem_data = mTelemetryData;
|
|
|
_soc = mTelemetryData.Soc;
|
|
|
_power = mTelemetryData.HighVoltageAcquisitionVoltage * mTelemetryData.HighVoltageAcquisitionCurrent;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取故障报警编号列表
|
|
|
/// </summary>
|
|
|
/// <param name="nowRemoteData"></param>
|
|
|
/// <param name="preRemoteData"></param>
|
|
|
/// <returns></returns>
|
|
|
private void GetFalutAlarmNoList(RemoteData nowRemoteData)
|
|
|
{
|
|
|
if (nowRemoteData != null)
|
|
|
{
|
|
|
//总告警【3】
|
|
|
ProcFaultResult(nowRemoteData.CommonAlarm, 3);
|
|
|
//急停按钮动作故障【4】
|
|
|
ProcFaultResult(nowRemoteData.EmergencyStop, 4);
|
|
|
//烟感故障【5】
|
|
|
ProcFaultResult(nowRemoteData.SmokeFault, 5);
|
|
|
//直流母线正极输出 接触器拒动/误 动故障【7】
|
|
|
ProcFaultResult(nowRemoteData.AGunPositiveFault, 7);
|
|
|
//直流母线负极输出 接触器拒动/误 动故障【8】
|
|
|
ProcFaultResult(nowRemoteData.AGunNegativeEleFault, 8);
|
|
|
//直流母线正级输出 熔断器故障【9】
|
|
|
ProcFaultResult(nowRemoteData.AGunPFuseFaulty, 9);
|
|
|
//直流母线负级输出 熔断器故障【10】
|
|
|
ProcFaultResult(nowRemoteData.AGunNPositiveFuseFaulty, 10);
|
|
|
//充电桩风扇故障【12】
|
|
|
ProcFaultResult(nowRemoteData.FanFailure, 12);
|
|
|
//绝缘监测故障【15】
|
|
|
ProcFaultResult(nowRemoteData.InsMonFault, 15);
|
|
|
//电池极性反接故障【16】
|
|
|
ProcFaultResult(nowRemoteData.BatPReverseConFault, 16);
|
|
|
//充电中车辆控制导引故障【17】
|
|
|
ProcFaultResult(nowRemoteData.VeConGuidanceFailure, 17);
|
|
|
//充电桩过温故障【18】
|
|
|
ProcFaultResult(nowRemoteData.OveCausesBarrier, 18);
|
|
|
//充电接口过温故障【19】
|
|
|
ProcFaultResult(nowRemoteData.InterfaceOverFaulty, 19);
|
|
|
//BMS通信故障【22】
|
|
|
ProcFaultResult(nowRemoteData.BMSComFaulty, 22);
|
|
|
//充电桩输入电压过压故障【23】
|
|
|
ProcFaultResult(nowRemoteData.ChaPilePnpVolOveFault, 23);
|
|
|
//充电桩输入电压欠压故障【24】
|
|
|
ProcFaultResult(nowRemoteData.InputVoltageUndFault, 24);
|
|
|
//直流母线输出过压故障【25】
|
|
|
ProcFaultResult(nowRemoteData.OvervoltageFault, 25);
|
|
|
//直流母线输出欠压故障【26】
|
|
|
ProcFaultResult(nowRemoteData.UndervoltageFault, 26);
|
|
|
//门禁故障【33】
|
|
|
ProcFaultResult(nowRemoteData.AccessConFailure, 33);
|
|
|
//正极直流输出接触器粘连故障【34】
|
|
|
ProcFaultResult(nowRemoteData.AGunPConA3dhesionFailure, 34);
|
|
|
//负极直流输出接触器粘连故故障【35】
|
|
|
ProcFaultResult(nowRemoteData.AGunNConadhesionFailure, 35);
|
|
|
//泄放回路故障【36】
|
|
|
ProcFaultResult(nowRemoteData.DischargeLoopFaulty, 36);
|
|
|
//充电桩交流输入接触器据动/误动故(预留位置供其他适用) 【37】
|
|
|
ProcFaultResult(nowRemoteData.ConActivated, 37);
|
|
|
//充电桩交流输入接触器粘连故障(预留位置供其他适用) 【38】
|
|
|
ProcFaultResult(nowRemoteData.ConAdhesionFailure, 38);
|
|
|
//辅助电源故障【39】
|
|
|
ProcFaultResult(nowRemoteData.OutputReverseCon, 39);
|
|
|
//模块输出反接【40】
|
|
|
ProcFaultResult(nowRemoteData.ModuleOutputRev, 40);
|
|
|
//充电枪过温告警【42】
|
|
|
ProcFaultResult(nowRemoteData.ChaGunOvertAlarmGen, 42);
|
|
|
//充电桩过温告警【43】
|
|
|
ProcFaultResult(nowRemoteData.ChaPileOvertAlarm, 43);
|
|
|
//电表通信异常【44】
|
|
|
ProcFaultResult(nowRemoteData.AGunMeterComAbnormal, 44);
|
|
|
//电表电度异常【45】
|
|
|
ProcFaultResult(nowRemoteData.AGunMeterAbnormal, 45);
|
|
|
//水浸告警【46】
|
|
|
ProcFaultResult(nowRemoteData.FloodingAlarm, 46);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 故障记录处理
|
|
|
/// </summary>
|
|
|
/// <param name="faultVal">故障报警记录值</param>
|
|
|
/// <param name="faultCode">故障报警码</param>
|
|
|
private void ProcFaultResult(byte faultVal, int faultCode)
|
|
|
{
|
|
|
if (faultVal == 1)
|
|
|
{
|
|
|
if (!_fault_alaram_no_list.Contains(faultCode))
|
|
|
{
|
|
|
_fault_code = faultCode;
|
|
|
_fault_alaram_no_list.Add(faultCode);
|
|
|
//将故障报警记录存入数据库
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (_fault_alaram_no_list.Contains(faultCode))
|
|
|
{
|
|
|
_fault_alaram_no_list.Remove(faultCode);
|
|
|
//将故障报警消除的信息存入数据库
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion 数据接收
|
|
|
|
|
|
#region 数据发送
|
|
|
|
|
|
/// <summary>
|
|
|
/// 发送事件
|
|
|
/// </summary>
|
|
|
/// <param name="sender"></param>
|
|
|
/// <param name="e"></param>
|
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
|
private void Client_DataSended(object sender, Module.Socket.Tool.TcpDataSendEventArgs e)
|
|
|
{
|
|
|
DataSendedEventFunc(e.Data);
|
|
|
}
|
|
|
|
|
|
#region 充电机发送指令方法
|
|
|
|
|
|
#region 充放电启动指令
|
|
|
/// <summary>
|
|
|
/// 充电鉴权
|
|
|
/// </summary>
|
|
|
/// <returns>是否写成功</returns>
|
|
|
public void SendCharingSignIn()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
Auth auth = new ChargerSendMsgUtils().SendCharingSignIn(_chr_client, _dest_addr);
|
|
|
if (auth != null)
|
|
|
{
|
|
|
if (_result._auth_rlt == null)
|
|
|
{
|
|
|
_result._auth_rlt = new AuthResult();
|
|
|
}
|
|
|
|
|
|
//将发送结果保持到公共变量结果中
|
|
|
_result._auth_rlt.F_ID = auth.ConnSeq;
|
|
|
_result._auth_rlt.F_HaveRes = false;
|
|
|
_result._auth_rlt.F_Auth = auth;
|
|
|
_result._auth_rlt.F_AuthRes = null;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 监控平台应答充电设备登录签到
|
|
|
/// </summary>
|
|
|
/// <returns>是否写成功</returns>
|
|
|
public void SendCharingLoginRes()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().SendCharingLoginRes(_chr_client, _dest_addr);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 监控平台心跳应答
|
|
|
/// </summary>
|
|
|
/// <returns>是否写成功</returns>
|
|
|
public void SendCharingHeartRes()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().SendCharingHeartRes(_chr_client, _dest_addr);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 监控平台发送远程开始充电指令
|
|
|
/// </summary>
|
|
|
/// <param name="socLimit">SOC限制.百分比</param>
|
|
|
/// <param name="changePowerCmdType">功率调节指令类型.默认1 绝对功率值</param>
|
|
|
/// <param name="changePower">0.1kw/位,默认3600</param>
|
|
|
/// <returns>是否写成功</returns>
|
|
|
public void SendRemoteStartCharing(byte socLimit, byte changePowerCmdType, UInt16 changePower, byte startModel)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().SendRemoteStartCharing(_chr_client, _dest_addr, socLimit, changePowerCmdType, changePower, startModel);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#region 远程停止充电指令发送
|
|
|
|
|
|
/// <summary>
|
|
|
/// 停止充电-一直发送直到收到充电机响应为止,调用此方法时,需要将F_StopReason赋值,判断F_IsCanSendStopCmd是否为False,如果是,则赋值为True,否则不可重复发送
|
|
|
/// </summary>
|
|
|
public void SendRemoteStopCmdThread()
|
|
|
{
|
|
|
//发送停止充电指令线程
|
|
|
Thread sendRemoteStopThread = new Thread(SendRemoteStopChargingCmd);
|
|
|
sendRemoteStopThread.IsBackground = true;
|
|
|
sendRemoteStopThread.Start();
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 发送停止充电指令线程
|
|
|
/// </summary>
|
|
|
private void SendRemoteStopChargingCmd()
|
|
|
{
|
|
|
while (_is_can_send_stop_cmd)
|
|
|
{
|
|
|
SendRemoteStopCharing(_stop_reason);
|
|
|
Thread.Sleep(2000);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 监控平台发送远程停止充电指令
|
|
|
/// </summary>
|
|
|
/// <param name="stopReason">停止原因.0正常停机 1服务器发现桩异常,强制停机</param>
|
|
|
private void SendRemoteStopCharing(byte stopReason)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().SendRemoteStopCharing(_chr_client, _dest_addr, stopReason);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion 远程停止充电指令发送
|
|
|
|
|
|
/// <summary>
|
|
|
/// 监控平台应答充电启动完成帧
|
|
|
/// </summary>
|
|
|
/// <param name="resResult">成功标识.0:成功;1:失败</param>
|
|
|
/// <param name="failReason">失败原因.0:成功 1:交易流水号数据异常 2:充电方式数据异常 </param>
|
|
|
public void SendStartChargingFinishedRes(byte resResult, byte failReason)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().SendStartChargingFinishedRes(_chr_client, _dest_addr, resResult, failReason);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 监控平台应答充电停止完成帧
|
|
|
/// </summary>
|
|
|
/// <param name="resResult">成功标识.0:成功;1:失败</param>
|
|
|
public void SendStopChargingFinishedRes(byte resResult)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().SendStopChargingFinishedRes(_chr_client, _dest_addr, resResult);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion 充放电启动指令
|
|
|
|
|
|
/// <summary>
|
|
|
/// 监控平台下发版本号查询
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public void SendVersionNumber()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().SendVersionNumber(_chr_client, _dest_addr);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 站控设置尖峰平谷时间段标识
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public void SendPeakTimePeriod(SharpPeakTimeRangeIde timeRng)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().SendPeakTimePeriod(_chr_client, _dest_addr, timeRng);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 3.5.7 主动上送充电记录响应
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public void SendRecordChargResp(byte reserve1, byte reserve2)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().SendRecordChargResp(_chr_client, _dest_addr, reserve1, reserve2);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 3.4.1 监控平台发送功率调节指令 帧类型45 记录类型 5
|
|
|
/// </summary>
|
|
|
/// <param name="expectePower"></param>
|
|
|
public void SendPowerRegulate(ushort expectePower)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().SendPowerRegulate(_chr_client, _dest_addr, expectePower);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 监控平台下发辅源控制指令
|
|
|
/// </summary>
|
|
|
/// <param name="onAuxiliaryFlag"></param>
|
|
|
public void SendAuxiliaryPowerControl(byte onAuxiliaryFlag)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().SendAuxiliaryPowerControl(_chr_client, _dest_addr, onAuxiliaryFlag);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 监控平台下发掉线停止充电
|
|
|
/// </summary>
|
|
|
/// <param name="responseResults"></param>
|
|
|
/// <param name="reserve"></param>
|
|
|
public void SendDisconnectStopCharge(byte responseResults, ushort reserve)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().SendDisconnectStopCharge(_chr_client, _dest_addr, responseResults, reserve);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 监控平台下发站外允许充电SOC
|
|
|
/// </summary>
|
|
|
/// <param name="SOCLimitValue"></param>
|
|
|
public void SendOutsideAllowChargeSOC(byte SOCLimitValue)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().SendOutsideAllowChargeSOC(_chr_client, _dest_addr, SOCLimitValue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public void SendQueryPeakTime(byte reserve)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().SendQueryPeakTime(_chr_client, _dest_addr, reserve);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#region New
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 3.4.1 监控平台发送功率调节指令 帧类型45 记录类型 5
|
|
|
/// </summary>
|
|
|
public void SendPowerRegulateCmd(ushort expectePower)
|
|
|
{
|
|
|
SendPowerRegulate(expectePower);
|
|
|
|
|
|
}
|
|
|
|
|
|
public void SendAuxiliaryPowerControlCmd(byte onAuxiliaryFlag)
|
|
|
{
|
|
|
SendAuxiliaryPowerControl(onAuxiliaryFlag);
|
|
|
|
|
|
}
|
|
|
|
|
|
public void SendDisconnectStopChargeCmd(byte responseResults, ushort reserve)
|
|
|
{
|
|
|
SendDisconnectStopCharge(responseResults, reserve);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
public void SendOutsideAllowChargeSOCCmd(byte SOCLimitValue)
|
|
|
{
|
|
|
SendOutsideAllowChargeSOC(SOCLimitValue);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SendVersionNumberCmd()
|
|
|
{
|
|
|
SendVersionNumber();
|
|
|
|
|
|
}
|
|
|
public void SendQueryPeakTimeCmd(byte reserve)
|
|
|
{
|
|
|
SendQueryPeakTime(reserve);
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 3.5.11 站控响应充放电机上报模块状态
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public void SendUpModelStationResp(byte respResult)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().SendUpModelStationResp(_chr_client, _dest_addr, respResult);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion New
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion 充电机发送指令方法
|
|
|
|
|
|
#endregion 数据发送
|
|
|
|
|
|
#region 协议格式
|
|
|
/// <summary>
|
|
|
/// (CMD=1)后台服务器下发充电桩整形工作参数
|
|
|
/// </summary>
|
|
|
/// <param name="type">类型 0-查询/1-设置</param>
|
|
|
/// <param name="startAddress">设置/查询参数起始地址</param>
|
|
|
/// <param name="num">设置/查询个数</param>
|
|
|
/// <param name="vs">设置数据</param>
|
|
|
|
|
|
public void Send1(byte type,uint startAddress,byte num,byte[] setData)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send1(_chr_client,type,startAddress,num, setData);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 后台服务器下发充电桩字符型参数
|
|
|
/// </summary>
|
|
|
/// <param name="type">类型 0-查询 1-设置</param>
|
|
|
/// <param name="startAddress">设置/查询参数起始地址</param>
|
|
|
/// <param name="setData">设置数据</param>
|
|
|
public void Send3(byte type, uint startAddress, byte[] setData)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send3(_chr_client,type,startAddress,setData);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void Send5(byte type, uint startAddress, byte num, byte[] setData)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send5(_chr_client,type, startAddress, num, setData);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public void Send7()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send7(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public void Send9()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send9(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
#endregion 协议格式
|
|
|
|
|
|
#region 充电桩主动上传数据
|
|
|
public void Send101()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send101(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
public void Send103()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send9(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void Send105()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send105(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
public void Send107()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send107(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
public void Send109()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send109(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
public void Send111()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send111(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
public void Send113()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send113(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 充电信息数据
|
|
|
|
|
|
public void Send201()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send201(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void Send203()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send203(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void Send205()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send205(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void Send207()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send207(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void Send209()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send209(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region- 直流充电桩 BMS 信息数据(预留)
|
|
|
|
|
|
public void Send301()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send301(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void Send303()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send303(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 历史记录
|
|
|
|
|
|
public void Send401()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send401(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 升级命令
|
|
|
|
|
|
public void Send1001()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send1001(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void Send1003()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send1003(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void Send1005()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send1005(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void Send1007()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send1007(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void Send1009()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send1009(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void Send1011()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send1011(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void Send1021()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send1021(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 与计费策略相关的指令
|
|
|
|
|
|
public void Send1101()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send1101(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void Send1103(CMD1103 CMD)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send1103(_chr_client, CMD);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void Send1105(CMD1105 CMD)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send1105(_chr_client, CMD);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void Send1107()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send1107(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 白名单报文
|
|
|
|
|
|
public void Send1301(CMD1301 CMD)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send1301(_chr_client, CMD);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region FTP 远程升级和 FTP 方式日志上传
|
|
|
|
|
|
public void Send1401(CMD1401 CMD)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send1401(_chr_client, CMD);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void Send1406(CMD1406 CMD)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send1406(_chr_client, CMD);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 协议方式日志上传
|
|
|
|
|
|
public void Send1502(ushort responseCode)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send1502(_chr_client, responseCode);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void Send1504(uint logo, uint successReservedMessageNum)
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send1504(_chr_client, logo, successReservedMessageNum);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void Send1506()
|
|
|
{
|
|
|
if (_chr_client != null)
|
|
|
{
|
|
|
if (_chr_client.Connected)
|
|
|
{
|
|
|
new ChargerSendMsgUtils().Send1506(_chr_client);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
}
|
|
|
}
|