|
|
using System.Xml.Linq;
|
|
|
using BatCharging.Model;
|
|
|
using BatCharging.Service.Encoder.New;
|
|
|
using CommonClass;
|
|
|
using Module.Socket.Tool;
|
|
|
using Monitor.LogService;
|
|
|
using Newtonsoft.Json;
|
|
|
using static BatCharging.Service.Encoder.New.UpModelStationRespEcoder;
|
|
|
|
|
|
namespace BatCharging.Service
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 1号充电机发送字节消息类
|
|
|
/// </summary>
|
|
|
internal class ChargerSendMsgUtils
|
|
|
{
|
|
|
|
|
|
PubCommonClass pubCommonClass = new PubCommonClass();
|
|
|
#region
|
|
|
#region 充放电启动指令
|
|
|
|
|
|
/// <summary>
|
|
|
/// 充电鉴权
|
|
|
/// </summary>
|
|
|
/// <returns>是否写成功</returns>
|
|
|
internal Auth SendCharingSignIn(TcpClientChargerTool tcp_client, byte[] dest_addr)
|
|
|
{
|
|
|
Auth auth;
|
|
|
byte[] bytes = new MsgSignCmdEncoder().GetMsgPackSignIn(dest_addr, out auth);
|
|
|
|
|
|
string result = "充电鉴权-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
result += "\r\n" + "充电鉴权对象:" + JsonConvert.SerializeObject(auth);
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
if (auth != null)
|
|
|
{
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
return auth;
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 监控平台应答充电设备登录签到
|
|
|
/// </summary>
|
|
|
/// <returns>是否写成功</returns>
|
|
|
internal void SendCharingLoginRes(TcpClientChargerTool tcp_client, byte[] dest_addr)
|
|
|
{
|
|
|
LoginRes lgRes = new LoginRes();
|
|
|
byte[] bytes = new MsgLoginResEncoder().GetMsgLoginRes(dest_addr, lgRes);
|
|
|
|
|
|
string result1 = "监控平台应答充电设备登录签到-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
result1 = "\r\n" + "监控平台应答充电设备登录签到对象:" + JsonConvert.SerializeObject(lgRes);
|
|
|
|
|
|
Log.LogInstance.WriteLog(result1, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 监控平台心跳应答
|
|
|
/// </summary>
|
|
|
/// <returns>是否写成功</returns>
|
|
|
internal void SendCharingHeartRes(TcpClientChargerTool tcp_client, byte[] dest_addr)
|
|
|
{
|
|
|
byte[] bytes = new MsgHeartResEncoder().GetMsgPackHeartRes(dest_addr);
|
|
|
string result = "监控平台心跳应答-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 监控平台发送远程开始充电指令
|
|
|
/// </summary>
|
|
|
/// <param name="socLimit">SOC限制.百分比</param>
|
|
|
/// <param name="changePowerCmdType">功率调节指令类型.默认1 绝对功率值</param>
|
|
|
/// <param name="changePower">0.1kw/位,默认3600</param>
|
|
|
/// <returns>是否写成功</returns>
|
|
|
internal void SendRemoteStartCharing(TcpClientChargerTool tcp_client, byte[] dest_addr, byte socLimit, byte changePowerCmdType, ushort changePower, byte startModel)
|
|
|
{
|
|
|
RemoteStartCharging startChrg = new RemoteStartCharging(socLimit, changePowerCmdType, changePower, startModel);
|
|
|
byte[] bytes = new MsgStartChrgEncoder().GetMsgPackRomoteStartCharging(dest_addr, startChrg);
|
|
|
string result = "发送远程开始充电-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
result = "\r\n" + "发送远程开始充电对象:" + JsonConvert.SerializeObject(startChrg);
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 监控平台发送远程停止充电指令
|
|
|
/// </summary>
|
|
|
/// <param name="stopReason">停止原因.0正常停机 1服务器发现桩异常,强制停机</param>
|
|
|
/// <returns>是否写成功</returns>
|
|
|
internal void SendRemoteStopCharing(TcpClientChargerTool tcp_client, byte[] dest_addr, byte stopReason)
|
|
|
{
|
|
|
byte[] bytes = new MsgStopChrgEncoder().GetMsgPackRomoteStopCharging(dest_addr, stopReason);
|
|
|
string result = "发送远程停止充电-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 监控平台应答充电启动完成帧
|
|
|
/// </summary>
|
|
|
/// <param name="resResult">成功标识.0:成功;1:失败</param>
|
|
|
/// <param name="failReason">失败原因.0:成功 1:交易流水号数据异常 2:充电方式数据异常 </param>
|
|
|
internal void SendStartChargingFinishedRes(TcpClientChargerTool tcp_client, byte[] dest_addr, byte resResult, byte failReason)
|
|
|
{
|
|
|
byte[] bytes = new MsgStartFsdResEncoder().GetStartChargingFinishedRes(dest_addr, resResult, failReason);
|
|
|
string result = "监控平台应答充电启动完成帧-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 监控平台应答充电停止完成帧-4.1.9
|
|
|
/// </summary>
|
|
|
/// <param name="resResult">成功标识.0:成功;1:失败</param>
|
|
|
internal void SendStopChargingFinishedRes(TcpClientChargerTool tcp_client, byte[] dest_addr, byte resResult)
|
|
|
{
|
|
|
byte[] bytes = new MsgStopFsdResEncoder().GetStopChargingFinishedRes(dest_addr, resResult);
|
|
|
string result = "监控平台应答充电停止完成帧-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
|
|
|
#endregion 充放电启动指令
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 3.4.1 监控平台发送功率调节指令 帧类型45 记录类型 5
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="expectePower"></param>
|
|
|
internal void SendPowerRegulate(TcpClientChargerTool tcp_client, byte[] dest_addr, ushort expectePower)
|
|
|
{
|
|
|
byte[] bytes = new MsgPowerRegulateEncoder().GetPowerRegulateMsg(dest_addr, expectePower);
|
|
|
string result = "监控平台发送功率调节指令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 3.4.3 监控平台下发辅源控制指令
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="onAuxiliaryFlag">打开辅助电源标志 1:电池包辅助电源导通 0:电池包辅助电源断开</param>
|
|
|
internal void SendAuxiliaryPowerControl(TcpClientChargerTool tcp_client, byte[] dest_addr, byte onAuxiliaryFlag)
|
|
|
{
|
|
|
byte[] bytes = new MsgAuxiliaryPowerControlEncoder().GetAuxiliaryPowerControl(dest_addr, onAuxiliaryFlag);
|
|
|
string result = "监控平台下发辅源控制指令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 3.4.5 监控平台下发掉线停止充电
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="responseResults">应答结果</param>
|
|
|
/// <param name="reserve">保留</param>
|
|
|
internal void SendDisconnectStopCharge(TcpClientChargerTool tcp_client, byte[] dest_addr, byte responseResults, ushort reserve)
|
|
|
{
|
|
|
byte[] bytes = new MsgDisconnectStopChargeEncoder().GetDisconnectStopChargeMsg(dest_addr, responseResults, reserve);
|
|
|
string result = "监控平台下发掉线停止充电-发送字节内容:" + ByteUtils.BytesToHexStr(bytes);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 3.4.7 监控平台下发站外允许充电SOC
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="SOCLimitValue">SOC限制值</param>
|
|
|
internal void SendOutsideAllowChargeSOC(TcpClientChargerTool tcp_client, byte[] dest_addr, byte SOCLimitValue)
|
|
|
{
|
|
|
byte[] bytes = new MsgOutsideAllowChargeSOCEcoder().GetOutsideAllowChargeSOCEcoderMsg(dest_addr, SOCLimitValue);
|
|
|
string result = "监控平台下发站外允许充电SOC-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 3.4.9 站控设置尖峰平谷时间段标识
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="timeRng"></param>
|
|
|
internal void SendPeakTimePeriod(TcpClientChargerTool tcp_client, byte[] dest_addr, SharpPeakTimeRangeIde timeRng)
|
|
|
{
|
|
|
byte[] bytes = new MsgPeakTimeEncoder().GetMsgPeakTimePeriod(dest_addr, timeRng);
|
|
|
string result = "站控设置尖峰平谷时间段标识-发送字节内容:" + ByteUtils.BytesToHexStr(bytes);
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 3.4.11 监控平台下发版本号查询
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
internal void SendVersionNumber(TcpClientChargerTool tcp_client, byte[] dest_addr)
|
|
|
{
|
|
|
byte[] bytes = new MsgVerNumEncoder().GetMsgPackRomoteStopCharging(dest_addr);
|
|
|
string result = "充电鉴权-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 3.5.7 主动上送充电记录响应
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="reserve1">保留1</param>
|
|
|
/// <param name="reserve2">保留2</param>
|
|
|
internal void SendRecordChargResp(TcpClientChargerTool tcp_client, byte[] dest_addr, byte reserve1, byte reserve2)
|
|
|
{
|
|
|
byte[] bytes = new MsgChargRespEcoder().GetRecordChargRespEcoderMsg(dest_addr, reserve1, reserve2);
|
|
|
string result = "主动上送充电记录响应-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 3.5.8 站控查询监控网关尖峰平谷设置
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="reserve1"></param>
|
|
|
internal void SendQueryPeakTime(TcpClientChargerTool tcp_client, byte[] dest_addr, byte reserve)
|
|
|
{
|
|
|
byte[] bytes = new MsgQueryPeakTimeEcoder().GetQueryPeakTimeEcoderMsg(dest_addr, reserve);
|
|
|
string result = "站控查询监控网关尖峰平谷设置-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 站控响应充放电机上报模块状态
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void SendUpModelStationResp(TcpClientChargerTool tcp_client, byte[] dest_addr, byte respResult)
|
|
|
{
|
|
|
byte[] bytes = new UpModelStationRespEcoder().GetUpModelStationRespEcoderMsg(dest_addr, respResult);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 服务器向充电桩设置/查询工作参数和命令
|
|
|
/// <summary>
|
|
|
/// (CMD=1)后台服务器下发充电桩整形工作参数
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="type"></param>
|
|
|
/// <param name="startAddress"></param>
|
|
|
/// <param name="num"></param>
|
|
|
/// <param name="setData"></param>
|
|
|
internal void Send1(TcpClientChargerTool tcp_client, byte type, uint startAddress, byte num, byte[] setData)
|
|
|
{
|
|
|
APDUModel APDUModel;
|
|
|
|
|
|
CMD1 CMD1 = new CMD1();
|
|
|
CMD1.value3 = type;
|
|
|
CMD1.value4 = startAddress;
|
|
|
CMD1.value5 = num;
|
|
|
CMD1.value6 = (ushort)(num * 4);
|
|
|
CMD1.value7 = setData;
|
|
|
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD1(out APDUModel, CMD1);
|
|
|
|
|
|
if (APDUModel != null)
|
|
|
{
|
|
|
string result = "后台服务器下发充电桩整形工作参数-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// (CMD=3)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send3(TcpClientChargerTool tcp_client, byte type, uint startAddress, byte[] setData)
|
|
|
{
|
|
|
APDUModel APDUModel;
|
|
|
|
|
|
|
|
|
CMD3 CMD3 = new CMD3();
|
|
|
CMD3.value1 = 0;
|
|
|
CMD3.value2 = 0;
|
|
|
CMD3.value3 = type;
|
|
|
CMD3.value4 = startAddress;
|
|
|
CMD3.value5 = PubCommonClass.cmd3StartAddress[startAddress];
|
|
|
CMD3.value6 = setData;
|
|
|
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD3(out APDUModel, CMD3);
|
|
|
|
|
|
if (APDUModel != null)
|
|
|
{
|
|
|
string result = "后台服务器下发充电桩字符型参数-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 后台服务器下发充电桩控制命令
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="chargeMuzzle">充电枪口</param>
|
|
|
/// <param name="startAddress">启始命令地址</param>
|
|
|
/// <param name="num">命令个数</param>
|
|
|
/// <param name="setData">命令参数</param>
|
|
|
internal void Send5(TcpClientChargerTool tcp_client, byte chargeMuzzle, uint startAddress, byte num, byte[] setData)
|
|
|
{
|
|
|
|
|
|
APDUModel APDUModel;
|
|
|
|
|
|
CMD5 CMD = new CMD5();
|
|
|
CMD.value3 = chargeMuzzle;
|
|
|
CMD.value4 = startAddress;
|
|
|
CMD.value5 = num;
|
|
|
CMD.value6 = (ushort)(num * 4);
|
|
|
CMD.value7 = setData;
|
|
|
|
|
|
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD5(out APDUModel, CMD);
|
|
|
|
|
|
if (APDUModel != null)
|
|
|
{
|
|
|
string result = "后台服务器下发充电桩控制命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 后台服务器下发充电桩开启充电控制命令
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="CMD"></param>
|
|
|
internal void Send7(TcpClientChargerTool tcp_client, CMD7 CMD)
|
|
|
{
|
|
|
APDUModel APDUModel;
|
|
|
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD7(out APDUModel, CMD);
|
|
|
if (APDUModel != null)
|
|
|
{
|
|
|
|
|
|
string result = "后台服务器下发充电桩开启充电控制命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 后台服务器应答桩上传命令请求(预留)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="chargeMuzzle">充电枪号</param>
|
|
|
/// <param name="executeResult">执行结果</param>
|
|
|
/// <param name="address">命令地址</param>
|
|
|
/// <param name="setData">数据</param>
|
|
|
internal void Send9(TcpClientChargerTool tcp_client, byte chargeMuzzle, uint executeResult, uint address, byte[] setData)
|
|
|
{
|
|
|
APDUModel APDUModel;
|
|
|
|
|
|
CMD9 CMD = new CMD9();
|
|
|
|
|
|
CMD.value03 = chargeMuzzle;
|
|
|
CMD.value04 = executeResult;
|
|
|
CMD.value05 = address;
|
|
|
CMD.value06 = 4;
|
|
|
CMD.value07 = null;
|
|
|
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD9(out APDUModel, CMD);
|
|
|
|
|
|
if (APDUModel != null)
|
|
|
{
|
|
|
string result = "后台服务器应答桩上传命令请求(预留)-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 充电桩主动上传数据
|
|
|
/// <summary>
|
|
|
/// 服务器应答心跳包信息
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="heartbeatNum">心跳应答</param>
|
|
|
internal void Send101(TcpClientChargerTool tcp_client, ushort heartbeatNum)
|
|
|
{
|
|
|
APDUModel APDUModel;
|
|
|
|
|
|
CMD101 CMD = new CMD101();
|
|
|
|
|
|
CMD.value03 = heartbeatNum;
|
|
|
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD101(out APDUModel, CMD);
|
|
|
if (APDUModel != null)
|
|
|
{
|
|
|
|
|
|
string result = "服务器应答心跳包信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 服务器应答充电桩状态信息包
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="chargeNum">充电口号</param>
|
|
|
/// <param name="reportMessage">是否立即上报一次104报文 0-否 、1-是</param>
|
|
|
internal void Send103(TcpClientChargerTool tcp_client, byte chargeNum, bool reportMessage)
|
|
|
{
|
|
|
APDUModel APDUModel;
|
|
|
|
|
|
|
|
|
CMD103 CMD = new CMD103();
|
|
|
CMD.value03 = chargeNum;
|
|
|
CMD.value04 = reportMessage;
|
|
|
|
|
|
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD103(out APDUModel, CMD);
|
|
|
if (APDUModel != null)
|
|
|
{
|
|
|
string result = "服务器应答充电桩状态信息包-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 服务器应答充电桩签到命令
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="cMD"></param>
|
|
|
internal void Send105(TcpClientChargerTool tcp_client, CMD105 CMD)
|
|
|
{
|
|
|
APDUModel APDUModel;
|
|
|
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD105(out APDUModel, CMD);
|
|
|
if (APDUModel != null)
|
|
|
{
|
|
|
string result = "服务器应答充电桩签到命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 服务器应答充电桩告警信息
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
internal void Send107(TcpClientChargerTool tcp_client)
|
|
|
{
|
|
|
APDUModel APDUModel;
|
|
|
|
|
|
CMD107 CMD = new CMD107();
|
|
|
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD107(out APDUModel, CMD);
|
|
|
if (APDUModel != null)
|
|
|
{
|
|
|
string result = "服务器应答充电桩告警信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 服务器应答充电桩告警信息
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
internal void Send109(TcpClientChargerTool tcp_client)
|
|
|
{
|
|
|
APDUModel APDUModel;
|
|
|
|
|
|
|
|
|
|
|
|
CMD109 CMD = new CMD109();
|
|
|
|
|
|
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD109(out APDUModel, CMD);
|
|
|
if (APDUModel != null)
|
|
|
{
|
|
|
string result = "服务器应答充电桩告警信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 服务器应答充电桩上报模块信息(预留)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="messageType">报文类型</param>
|
|
|
internal void Send111(TcpClientChargerTool tcp_client, byte messageType)
|
|
|
{
|
|
|
APDUModel APDUModel;
|
|
|
|
|
|
|
|
|
CMD111 CMD = new CMD111();
|
|
|
|
|
|
CMD.value03 = messageType;
|
|
|
|
|
|
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD111(out APDUModel, CMD);
|
|
|
if (APDUModel != null)
|
|
|
{
|
|
|
string result = "服务器应答充电桩上报模块信息(预留)-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 服务器查询最近一次充电各时段信息
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="chargeNum">充电口号</param>
|
|
|
/// <param name="sign">标志</param>
|
|
|
internal void Send113(TcpClientChargerTool tcp_client, byte chargeNum, byte sign)
|
|
|
{
|
|
|
APDUModel APDUModel;
|
|
|
|
|
|
CMD113 CMD = new CMD113();
|
|
|
|
|
|
CMD.value03 = chargeNum;
|
|
|
CMD.value04 = sign;
|
|
|
|
|
|
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD113(out APDUModel, CMD);
|
|
|
if (APDUModel != null)
|
|
|
{
|
|
|
string result = "服务器查询最近一次充电各时段信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 充电信息数据
|
|
|
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send201(TcpClientChargerTool tcp_client, CMD202 CMD202, byte value06, uint value07, uint value08, uint value09, uint value10, uint value11, uint value12)
|
|
|
{
|
|
|
CMD201 CMD = new CMD201();
|
|
|
CMD.value01 = 0;
|
|
|
CMD.value02 = 0;
|
|
|
CMD.value03 = CMD202.value05;
|
|
|
CMD.value04 = CMD202.value06;
|
|
|
CMD.value05 = CMD202.value17;
|
|
|
CMD.value06 = value06;
|
|
|
CMD.value07 = value07;
|
|
|
CMD.value08 = value08;
|
|
|
CMD.value09 = value09;
|
|
|
CMD.value10 = value10;
|
|
|
CMD.value11 = value11;
|
|
|
CMD.value12 = value12;
|
|
|
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD201(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send203(TcpClientChargerTool tcp_client, CMD204 CMD204, uint value03, uint value04, ushort value05, ushort value06, byte value07, byte value08, byte value09, byte value10, string value11, string value12)
|
|
|
{
|
|
|
CMD203 CMD = new CMD203();
|
|
|
CMD.value01 = 0;
|
|
|
CMD.value02 = 0;
|
|
|
CMD.value03 = value03;
|
|
|
CMD.value04 = value04;
|
|
|
CMD.value05 = value05;
|
|
|
CMD.value06 = value06;
|
|
|
CMD.value07 = value07;
|
|
|
CMD.value08 = value08;
|
|
|
CMD.value09 = value09;
|
|
|
CMD.value10 = value10;
|
|
|
CMD.value11 = value11;
|
|
|
CMD.value12 = value12;
|
|
|
CMD.value13 = CMD204.value11;
|
|
|
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD203(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send205(TcpClientChargerTool tcp_client, uint value03, uint value04)
|
|
|
{
|
|
|
CMD205 CMD = new CMD205();
|
|
|
CMD.value01 = 0;
|
|
|
CMD.value02 = 0;
|
|
|
CMD.value03 = value03;
|
|
|
if (CMD.value03 == 0)
|
|
|
{
|
|
|
CMD.value04 = value04;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
CMD.value04 = 0;
|
|
|
}
|
|
|
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD205(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send207(TcpClientChargerTool tcp_client, CMD208 CMD208, string value06, string value07, byte value08, byte value09, uint value10, ulong value11)
|
|
|
{
|
|
|
CMD207 CMD = new CMD207();
|
|
|
CMD.value01 = 0;
|
|
|
CMD.value02 = 0;
|
|
|
CMD.value03 = CMD208.value03;
|
|
|
CMD.value04 = CMD208.value04;
|
|
|
CMD.value05 = CMD208.value05;
|
|
|
CMD.value06 = value06;
|
|
|
CMD.value07 = value07;
|
|
|
CMD.value08 = value08;
|
|
|
CMD.value09 = value09;
|
|
|
CMD.value10 = value10;
|
|
|
CMD.value11 = value11;
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD207(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send209(TcpClientChargerTool tcp_client, CMD210 CMD210, string value05)
|
|
|
{
|
|
|
CMD209 CMD = new CMD209();
|
|
|
CMD.value01 = CMD210.value01;
|
|
|
CMD.value02 = CMD210.value02;
|
|
|
CMD.value03 = CMD210.value03;
|
|
|
CMD.value04 = CMD210.value04;
|
|
|
CMD.value05 = value05;
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD209(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 直流充电桩 BMS 信息数据(预留)
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send301(TcpClientChargerTool tcp_client)
|
|
|
{
|
|
|
CMD301 CMD = new CMD301();
|
|
|
CMD.reserved1 = 0;
|
|
|
CMD.reserved2 = 0;
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD301(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send303(TcpClientChargerTool tcp_client)
|
|
|
{
|
|
|
CMD303 CMD = new CMD303();
|
|
|
CMD.reserved1 = 0;
|
|
|
CMD.reserved2 = 0;
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD303(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 历史记录
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send401(TcpClientChargerTool tcp_client, string chargingSerialNum, uint startIndex)
|
|
|
{
|
|
|
CMD401 CMD = new CMD401();
|
|
|
CMD.reserved1 = 0;
|
|
|
CMD.reserved2 = 0;
|
|
|
CMD.startingIndexOfQueryRecord = startIndex;
|
|
|
CMD.chargingSerialNumber = chargingSerialNum;
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD401(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 升级命令
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send1001(TcpClientChargerTool tcp_client, int instruct)
|
|
|
{
|
|
|
CMD1001 CMD = new CMD1001();
|
|
|
CMD.eraseOrQueryInstructions = instruct;
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD1001(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send1003(TcpClientChargerTool tcp_client, string fileName)
|
|
|
{
|
|
|
CMD1003 CMD = new CMD1003();
|
|
|
CMD.fileName = fileName;
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD1003(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send1005(TcpClientChargerTool tcp_client, uint fileLength)
|
|
|
{
|
|
|
CMD1005 CMD = new CMD1005();
|
|
|
CMD.fileLength = fileLength;
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD1005(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send1007(TcpClientChargerTool tcp_client, string updata)
|
|
|
{
|
|
|
CMD1007 CMD = new CMD1007();
|
|
|
CMD.upgradeFileData = updata;
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD1007(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send1009(TcpClientChargerTool tcp_client)
|
|
|
{
|
|
|
CMD1009 CMD = new CMD1009();
|
|
|
CMD.Value01 = 0;
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD1009(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send1011(TcpClientChargerTool tcp_client)
|
|
|
{
|
|
|
CMD1011 CMD = new CMD1011();
|
|
|
CMD.reserved1 = 0;
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD1011(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send1021(TcpClientChargerTool tcp_client, uint results, string description)
|
|
|
{
|
|
|
CMD1021 CMD = new CMD1021();
|
|
|
CMD.responseResults = results;
|
|
|
CMD.responseDescription = description;
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD1021(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 与计费策略相关的指令
|
|
|
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send1101(TcpClientChargerTool tcp_client)
|
|
|
{
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD1101(out APDUModel APDUModel);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send1103(TcpClientChargerTool tcp_client, CMD1103 CMD)
|
|
|
{
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD1103(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send1105(TcpClientChargerTool tcp_client, CMD1105 CMD)
|
|
|
{
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD1105(out APDUModel APDUModel,CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send1107(TcpClientChargerTool tcp_client)
|
|
|
{
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD1107(out APDUModel APDUModel);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 白名单报文
|
|
|
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send1301(TcpClientChargerTool tcp_client, CMD1301 CMD)
|
|
|
{
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD1301(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region FTP 远程升级和 FTP 方式日志上传
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="UpgradeSoftwareFileVersionNum"></param>
|
|
|
/// <param name="ftpServerIPaddress"></param>
|
|
|
/// <param name="ftpUserName"></param>
|
|
|
/// <param name="ftpPassWord"></param>
|
|
|
/// <param name="ftpDownloadPath"></param>
|
|
|
/// <param name="executeWay"></param>
|
|
|
/// <param name="nowUpgradeDeviceType"></param>
|
|
|
internal void Send1401(TcpClientChargerTool tcp_client, CMD1401 CMD)
|
|
|
{
|
|
|
//CMD1401 CMD = new CMD1401();
|
|
|
//CMD.reserved1 = 0;
|
|
|
//CMD.reserved2 = 0;
|
|
|
//CMD.UpgradeSoftwareFileVersionNum = UpgradeSoftwareFileVersionNum;
|
|
|
//CMD.ftpServerIPaddress = ftpServerIPaddress;
|
|
|
//CMD.ftpUserName = ftpUserName;
|
|
|
//CMD.ftpPassWord = ftpPassWord;
|
|
|
//CMD.ftpDownloadPath = ftpDownloadPath;
|
|
|
//CMD.executeWay = executeWay;
|
|
|
//CMD.nowUpgradeDeviceType = nowUpgradeDeviceType;
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD1401(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send1406(TcpClientChargerTool tcp_client, CMD1406 CMD)
|
|
|
{
|
|
|
//CMD1406 CMD = new CMD1406();
|
|
|
//CMD.reserved1 = 0;
|
|
|
//CMD.reserved2 = 0;
|
|
|
//CMD.getLogType = 0;
|
|
|
//CMD.ftpServerIPaddress = null;
|
|
|
//CMD.ftpUserName = null;
|
|
|
//CMD.ftpPassWord = null;
|
|
|
//CMD.ftpSavePath = null;
|
|
|
//CMD.executeWay = 0;
|
|
|
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD1406(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 协议方式日志上传
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client"></param>
|
|
|
/// <param name="dest_addr"></param>
|
|
|
/// <param name="respResult"></param>
|
|
|
internal void Send1502(TcpClientChargerTool tcp_client,ushort responseCode)
|
|
|
{
|
|
|
CMD1502 CMD = new CMD1502();
|
|
|
CMD.reserved1 = 0;
|
|
|
CMD.reserved2 = 0;
|
|
|
CMD.responseCode = responseCode;
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD1502(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client">TCP</param>
|
|
|
/// <param name="logo">标识</param>
|
|
|
/// <param name="successReservedMessageNum">已成功接收的报文编号
|
|
|
/// 这个要与最后一次收到的 1503 报文中的字段 4 一样。</param>
|
|
|
internal void Send1504(TcpClientChargerTool tcp_client, uint logo,uint successReservedMessageNum)
|
|
|
{
|
|
|
CMD1504 CMD = new CMD1504();
|
|
|
CMD.reserved1 = 0;
|
|
|
CMD.reserved2 = 0;
|
|
|
CMD.logo = logo;
|
|
|
CMD.successReservedMessageNum = successReservedMessageNum;
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD1504(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// (CMD=5)
|
|
|
/// </summary>
|
|
|
/// <param name="tcp_client">TCP</param>
|
|
|
/// <param name="logo">标识</param>
|
|
|
/// <param name="successReservedMessageNum">已成功接收的报文编号
|
|
|
/// 这个要与最后一次收到的 1503 报文中的字段 4 一样。</param>
|
|
|
internal void Send1506(TcpClientChargerTool tcp_client)
|
|
|
{
|
|
|
CMD1506 CMD = new CMD1506();
|
|
|
CMD.value01 = 0;
|
|
|
CMD.value01 = 0;
|
|
|
byte[] bytes = new ChargerSendCMD().SendRCMD1506(out APDUModel APDUModel, CMD);
|
|
|
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ";";
|
|
|
|
|
|
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
|
|
|
tcp_client.Write(bytes);
|
|
|
}
|
|
|
#endregion
|
|
|
}
|
|
|
}
|