0315修改CMD1-CMD113充电机发送

master
lch 10 months ago
parent aa087b32c2
commit b71546bf33

@ -37,7 +37,7 @@ namespace BatCharging.Model
/// <summary>
/// 设置数据
/// </summary>
public UInt32 value7 { get; set; }
public byte[] value7 { get; set; }
/*

@ -11,11 +11,11 @@ namespace BatCharging.Model
/// <summary>
/// 预留
/// </summary>
public byte value01 { get; set; }
public ushort value01 { get; set; }
/// <summary>
/// 预留
/// </summary>
public byte value02 { get; set; }
public ushort value02 { get; set; }
/// <summary>
/// 充电口号(这个字段与 104 报文字段 5 一致)
/// </summary>
@ -25,6 +25,6 @@ namespace BatCharging.Model
/// <para>0否</para>
/// <para>1是</para>
/// </summary>
public byte value04 { get; set; }
public bool value04 { get; set; }
}
}

@ -27,16 +27,12 @@ namespace BatCharging.Model
/// </summary>
public UInt32 value4 { get; set; }
/// <summary>
/// 设置/查询个数
/// </summary>
public byte value5 { get; set; }
/// <summary>
/// 设置参数字节数
/// </summary>
public UInt16 value6 { get; set; }
public UInt16 value5 { get; set; }
/// <summary>
/// 设置数据
/// </summary>
public UInt32 value7 { get; set; }
public byte[] value6 { get; set; }
}
}

@ -35,6 +35,6 @@ namespace BatCharging.Model
/// <summary>
/// 命令参数
/// </summary>
public UInt32 value7 { get; set; }
public byte[] value7 { get; set; }
}
}

@ -12,11 +12,11 @@ namespace BatCharging.Model
/// <summary>
/// 预留
/// </summary>
public byte value01 { get; set; }
public ushort value01 { get; set; }
/// <summary>
/// 预留
/// </summary>
public byte value02 { get; set; }
public ushort value02 { get; set; }
/// <summary>
/// 充电枪号
/// </summary>
@ -24,18 +24,18 @@ namespace BatCharging.Model
/// <summary>
/// 执行结果
/// </summary>
public byte value04 { get; set; }
public uint value04 { get; set; }
/// <summary>
/// 命令地址
/// </summary>
public byte value05 { get; set; }
public uint value05 { get; set; }
/// <summary>
/// 数据长度
/// </summary>
public byte value06 { get; set; }
public uint value06 { get; set; }
/// <summary>
/// 数据
/// </summary>
public string value07 { get; set; }
public byte[] value07 { get; set; }
}
}

@ -12,6 +12,7 @@
<ItemGroup>
<ProjectReference Include="..\BatCharging.Model\BatCharging.Model.csproj" />
<ProjectReference Include="..\CommonClass\CommonClass.csproj" />
<ProjectReference Include="..\Module.Socket.Tool\Module.Socket.Tool.csproj" />
<ProjectReference Include="..\Monitor.LogService\Monitor.LogService.csproj" />
</ItemGroup>

@ -3053,35 +3053,48 @@ namespace BatCharging.Service
#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()
public void Send1(byte type,uint startAddress,byte num,byte[] setData)
{
if (_chr_client != null)
{
if (_chr_client.Connected)
{
new ChargerSendMsgUtils().Send1(_chr_client);
new ChargerSendMsgUtils().Send1(_chr_client,type,startAddress,num, setData);
}
}
}
public void Send3()
/// <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);
new ChargerSendMsgUtils().Send3(_chr_client,type,startAddress,setData);
}
}
}
public void Send5()
public void Send5(byte type, uint startAddress, byte num, byte[] setData)
{
if (_chr_client != null)
{
if (_chr_client.Connected)
{
new ChargerSendMsgUtils().Send5(_chr_client);
new ChargerSendMsgUtils().Send5(_chr_client,type, startAddress, num, setData);
}
}
}

@ -7,6 +7,7 @@ using System.Threading.Tasks;
using System.Xml.Linq;
using BatCharging.Model;
using BatCharging.Service.Encoder.New;
using CommonClass;
using Module.Socket.Tool;
using Monitor.LogService;
using Newtonsoft.Json;
@ -19,6 +20,8 @@ namespace BatCharging.Service
/// </summary>
internal class ChargerSendMsgUtils
{
PubCommonClass pubCommonClass = new PubCommonClass();
#region
#region 充放电启动指令
@ -285,15 +288,31 @@ namespace BatCharging.Service
/// (CMD=1)后台服务器下发充电桩整形工作参数
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send1(TcpClientChargerTool tcp_client)
/// <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)
{
byte[] bytes = new ChargerSendCMD().SendRCMD1(out APDUModel APDUModel);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
APDUModel APDUModel;
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes);
CMD1 CMD1 = new CMD1();
CMD1.value1 = 0;
CMD1.value2 = 0;
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>
@ -302,172 +321,282 @@ namespace BatCharging.Service
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send3(TcpClientChargerTool tcp_client)
internal void Send3(TcpClientChargerTool tcp_client, byte type, uint startAddress, byte[] setData)
{
byte[] bytes = new ChargerSendCMD().SendRCMD3(out APDUModel APDUModel);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
APDUModel APDUModel;
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes);
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>
/// (CMD=5)
/// 后台服务器下发充电桩控制命令
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send5(TcpClientChargerTool tcp_client)
/// <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)
{
byte[] bytes = new ChargerSendCMD().SendRCMD5(out APDUModel APDUModel);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes);
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>
/// (CMD=5)
/// 后台服务器下发充电桩开启充电控制命令
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send7(TcpClientChargerTool tcp_client)
/// <param name="CMD"></param>
internal void Send7(TcpClientChargerTool tcp_client, CMD7 CMD)
{
byte[] bytes = new ChargerSendCMD().SendRCMD7(out APDUModel APDUModel);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
APDUModel APDUModel;
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes);
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>
/// (CMD=5)
/// 后台服务器应答桩上传命令请求(预留)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send9(TcpClientChargerTool tcp_client)
/// <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)
{
byte[] bytes = new ChargerSendCMD().SendRCMD9(out APDUModel APDUModel);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
APDUModel APDUModel;
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes);
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>
/// (CMD=5)
/// 服务器应答心跳包信息
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send101(TcpClientChargerTool tcp_client)
/// <param name="heartbeatNum">心跳应答</param>
internal void Send101(TcpClientChargerTool tcp_client, ushort heartbeatNum)
{
byte[] bytes = new ChargerSendCMD().SendRCMD101(out APDUModel APDUModel);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
APDUModel APDUModel;
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes);
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>
/// (CMD=5)
/// 服务器应答充电桩状态信息包
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send103(TcpClientChargerTool tcp_client)
/// <param name="chargeNum">充电口号</param>
/// <param name="reportMessage">是否立即上报一次104报文 0-否 、1-是</param>
internal void Send103(TcpClientChargerTool tcp_client, byte chargeNum, bool reportMessage)
{
byte[] bytes = new ChargerSendCMD().SendRCMD103(out APDUModel APDUModel);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
APDUModel APDUModel;
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes);
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>
/// (CMD=5)
/// 服务器应答充电桩签到命令
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send105(TcpClientChargerTool tcp_client)
/// <param name="cMD"></param>
internal void Send105(TcpClientChargerTool tcp_client, CMD105 CMD)
{
byte[] bytes = new ChargerSendCMD().SendRCMD105(out APDUModel APDUModel);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
APDUModel APDUModel;
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes);
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>
/// (CMD=5)
/// 服务器应答充电桩告警信息
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send107(TcpClientChargerTool tcp_client)
{
byte[] bytes = new ChargerSendCMD().SendRCMD107(out APDUModel APDUModel);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
APDUModel APDUModel;
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes);
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>
/// (CMD=5)
/// 服务器应答充电桩告警信息
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send109(TcpClientChargerTool tcp_client)
{
byte[] bytes = new ChargerSendCMD().SendRCMD109(out APDUModel APDUModel);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
APDUModel APDUModel;
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes);
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>
/// (CMD=5)
/// 服务器应答充电桩上报模块信息(预留)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send111(TcpClientChargerTool tcp_client)
/// <param name="messageType">报文类型</param>
internal void Send111(TcpClientChargerTool tcp_client, byte messageType)
{
byte[] bytes = new ChargerSendCMD().SendRCMD111(out APDUModel APDUModel);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
APDUModel APDUModel;
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes);
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>
/// (CMD=5)
/// 服务器查询最近一次充电各时段信息
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send113(TcpClientChargerTool tcp_client)
/// <param name="chargeNum">充电口号</param>
/// <param name="sign">标志</param>
internal void Send113(TcpClientChargerTool tcp_client, byte chargeNum, byte sign)
{
byte[] bytes = new ChargerSendCMD().SendRCMD113(out APDUModel APDUModel);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
APDUModel APDUModel;
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes);
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
@ -823,7 +952,7 @@ namespace BatCharging.Service
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send1502(TcpClientChargerTool tcp_client )
internal void Send1502(TcpClientChargerTool tcp_client)
{
CMD1502 CMD = new CMD1502();
CMD.reserved1 = 0;

@ -10,8 +10,9 @@ namespace BatCharging.Service
public class ChargerSendCMD
{
#region 协议格式
public byte[] SendRCMD1(out APDUModel APDUModel)
public byte[] SendRCMD1(out APDUModel APDUModel, CMD1 t)
{
byte[] result = null;
APDUModel model = new APDUModel();
@ -22,16 +23,8 @@ namespace BatCharging.Service
model.CMD = 1;
model.checksumDomain = 0x01;
CMD1 CMD1 = new CMD1();
CMD1.value1 = 0;
CMD1.value2 = 0;
CMD1.value3 = 0;
CMD1.value4 = 0;
CMD1.value5 = 1;
CMD1.value6 = 1;
CMD1.value7 = 1;
model.dataDomain = GetRCMD1DataInfo(CMD1); //数据域
model.dataDomain = GetRCMD1DataInfo(t); //数据域
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List<byte> lstResult = new List<byte>();
@ -58,21 +51,24 @@ namespace BatCharging.Service
lstContent.AddRange(BitConverter.GetBytes(CMD1.value2));
lstContent.Add(CMD1.value3);
lstContent.AddRange(BitConverter.GetBytes(CMD1.value4));
lstContent.Add(CMD1.value5);
lstContent.AddRange(BitConverter.GetBytes(CMD1.value7));
if (CMD1.value3 == 1)
{
CMD1.value4 = 1;
CMD1.value7 = 1;
lstContent.AddRange(BitConverter.GetBytes(CMD1.value4));
lstContent.AddRange(BitConverter.GetBytes(CMD1.value7));
lstContent.Add(CMD1.value5);
lstContent.AddRange(BitConverter.GetBytes(CMD1.value6));
lstContent.AddRange(CMD1.value7);
}
else
{
}
results = lstContent.ToArray();
}
return results;
}
public byte[] SendRCMD3(out APDUModel APDUModel)
public byte[] SendRCMD3(out APDUModel APDUModel, CMD3 CMD3)
{
byte[] result = null;
@ -84,14 +80,6 @@ namespace BatCharging.Service
model.CMD = 1;
model.checksumDomain = 0x01;
CMD3 CMD3 = new CMD3();
CMD3.value1 = 0;
CMD3.value2 = 0;
CMD3.value3 = 0;
CMD3.value4 = 0;
CMD3.value5 = 1;
CMD3.value6 = 1;
CMD3.value7 = 1;
model.dataDomain = GetRCMD3DataInfo(CMD3); //数据域
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
@ -120,20 +108,21 @@ namespace BatCharging.Service
lstContent.AddRange(BitConverter.GetBytes(CMD.value2));
lstContent.Add(CMD.value3);
lstContent.AddRange(BitConverter.GetBytes(CMD.value4));
lstContent.Add(CMD.value5);
lstContent.AddRange(BitConverter.GetBytes(CMD.value7));
lstContent.AddRange(CMD.value6);
if (CMD.value3 == 1)
{
CMD.value4 = 1;
CMD.value7 = 1;
lstContent.AddRange(BitConverter.GetBytes(CMD.value4));
lstContent.AddRange(BitConverter.GetBytes(CMD.value7));
lstContent.AddRange(BitConverter.GetBytes(CMD.value5));
lstContent.AddRange(CMD.value6);
}
else
{
}
results = lstContent.ToArray();
}
return results;
}
public byte[] SendRCMD5(out APDUModel APDUModel)
public byte[] SendRCMD5(out APDUModel APDUModel, CMD5 cMD5)
{
byte[] result = null;
@ -145,16 +134,9 @@ namespace BatCharging.Service
model.CMD = 1;
model.checksumDomain = 0x01;
CMD5 CMD = new CMD5();
CMD.value1 = 0;
CMD.value2 = 0;
CMD.value3 = 0;
CMD.value4 = 0;
CMD.value5 = 1;
CMD.value6 = 1;
CMD.value7 = 1;
model.dataDomain = GetRCMD5DataInfo(CMD); //数据域
model.dataDomain = GetRCMD5DataInfo(cMD5); //数据域
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List<byte> lstResult = new List<byte>();
@ -196,7 +178,7 @@ namespace BatCharging.Service
}
public byte[] SendRCMD7(out APDUModel APDUModel)
public byte[] SendRCMD7(out APDUModel APDUModel, CMD7 CMD)
{
byte[] result = null;
@ -208,23 +190,7 @@ namespace BatCharging.Service
model.CMD = 1;
model.checksumDomain = 0x01;
CMD7 CMD = new CMD7();
CMD.value01 = 0;
CMD.value02 = 0;
CMD.value03 = 0;
CMD.value04 = 0;
CMD.value05 = 1;
CMD.value06 = 1;
CMD.value07 = 1;
CMD.value08 = 1;
CMD.value09 = 1;
CMD.value10 = 1;
CMD.value11 = 1;
CMD.value12 = 1;
CMD.value13 = null;
CMD.value14 = 1;
CMD.value15 = 1;
CMD.value16 = 1;
model.dataDomain = GetRCMD7DataInfo(CMD); //数据域
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
@ -270,7 +236,7 @@ namespace BatCharging.Service
}
public byte[] SendRCMD9(out APDUModel APDUModel)
public byte[] SendRCMD9(out APDUModel APDUModel,CMD9 CMD)
{
byte[] result = null;
@ -282,14 +248,7 @@ namespace BatCharging.Service
model.CMD = 1;
model.checksumDomain = 0x01;
CMD9 CMD = new CMD9();
CMD.value01 = 0;
CMD.value02 = 0;
CMD.value03 = 0;
CMD.value04 = 0;
CMD.value05 = 1;
CMD.value06 = 1;
CMD.value07 = null;
model.dataDomain = GetRCMD9DataInfo(CMD); //数据域
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
@ -330,7 +289,7 @@ namespace BatCharging.Service
#region 充电桩主动上传数据
public byte[] SendRCMD101(out APDUModel APDUModel)
public byte[] SendRCMD101(out APDUModel APDUModel, CMD101 CMD)
{
byte[] result = null;
@ -342,10 +301,7 @@ namespace BatCharging.Service
model.CMD = 1;
model.checksumDomain = 0x01;
CMD101 CMD = new CMD101();
CMD.value01 = 0;
CMD.value02 = 0;
CMD.value03 = 0;
model.dataDomain = GetRCMD101DataInfo(CMD); //数据域
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
@ -380,7 +336,7 @@ namespace BatCharging.Service
}
public byte[] SendRCMD103(out APDUModel APDUModel)
public byte[] SendRCMD103(out APDUModel APDUModel, CMD103 CMD)
{
byte[] result = null;
@ -392,11 +348,6 @@ namespace BatCharging.Service
model.CMD = 1;
model.checksumDomain = 0x01;
CMD103 CMD = new CMD103();
CMD.value01 = 0;
CMD.value02 = 0;
CMD.value03 = 0;
CMD.value04 = 0;
model.dataDomain = GetRCMD103DataInfo(CMD); //数据域
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
@ -431,7 +382,7 @@ namespace BatCharging.Service
return results;
}
public byte[] SendRCMD105(out APDUModel APDUModel)
public byte[] SendRCMD105(out APDUModel APDUModel, CMD105 CMD)
{
byte[] result = null;
@ -443,20 +394,9 @@ namespace BatCharging.Service
model.CMD = 1;
model.checksumDomain = 0x01;
CMD105 CMD105 = new CMD105();
CMD105.value1 = 1;
CMD105.value2 = 1;
CMD105.value3 = 1;
CMD105.value4 = 1;
CMD105.value5 = 0;
CMD105.value6 = null;
CMD105.value7 = 1;
CMD105.value8 = 1;
CMD105.value9 = 1;
CMD105.value10 = 0xDE;
CMD105.value11 = null;
model.dataDomain = GetRCMD105DataInfo(CMD105); //数据域
model.dataDomain = GetRCMD105DataInfo(CMD); //数据域
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
List<byte> lstResult = new List<byte>();
@ -500,7 +440,7 @@ namespace BatCharging.Service
}
public byte[] SendRCMD107(out APDUModel APDUModel)
public byte[] SendRCMD107(out APDUModel APDUModel, CMD107 CMD)
{
byte[] result = null;
@ -512,10 +452,7 @@ namespace BatCharging.Service
model.CMD = 1;
model.checksumDomain = 0x01;
CMD107 CMD = new CMD107();
//CMD.value01 = 0;
//CMD.value02 = 0;
//CMD.value03 = 0;
model.dataDomain = GetRCMD107DataInfo(CMD); //数据域
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
@ -550,7 +487,7 @@ namespace BatCharging.Service
}
public byte[] SendRCMD109(out APDUModel APDUModel)
public byte[] SendRCMD109(out APDUModel APDUModel, CMD109 CMD)
{
byte[] result = null;
@ -562,9 +499,6 @@ namespace BatCharging.Service
model.CMD = 1;
model.checksumDomain = 0x01;
CMD109 CMD = new CMD109();
CMD.value01 = 0;
CMD.value02 = 0;
model.dataDomain = GetRCMD109DataInfo(CMD); //数据域
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
@ -598,7 +532,7 @@ namespace BatCharging.Service
}
public byte[] SendRCMD111(out APDUModel APDUModel)
public byte[] SendRCMD111(out APDUModel APDUModel, CMD111 CMD)
{
byte[] result = null;
@ -610,10 +544,6 @@ namespace BatCharging.Service
model.CMD = 1;
model.checksumDomain = 0x01;
CMD111 CMD = new CMD111();
CMD.value01 = 0;
CMD.value02 = 0;
CMD.value03 = 0;
model.dataDomain = GetRCMD111DataInfo(CMD); //数据域
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
@ -647,7 +577,7 @@ namespace BatCharging.Service
return results;
}
public byte[] SendRCMD113(out APDUModel APDUModel)
public byte[] SendRCMD113(out APDUModel APDUModel, CMD113 CMD)
{
byte[] result = null;
@ -659,11 +589,7 @@ namespace BatCharging.Service
model.CMD = 1;
model.checksumDomain = 0x01;
CMD113 CMD = new CMD113();
CMD.value01 = 0;
CMD.value02 = 0;
CMD.value03 = 0;
CMD.value04 = 0;
model.dataDomain = GetRCMD113DataInfo(CMD); //数据域
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度

@ -13,6 +13,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BatCharging.Service", "BatC
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Module.Socket.Tool", "Module.Socket.Tool\Module.Socket.Tool.csproj", "{5ECD672B-72BD-4A3A-9160-219F17FC9B9C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommonClass", "CommonClass\CommonClass.csproj", "{03F698D6-A474-4408-9B92-A0F7977CCCFE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -39,6 +41,10 @@ Global
{5ECD672B-72BD-4A3A-9160-219F17FC9B9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5ECD672B-72BD-4A3A-9160-219F17FC9B9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5ECD672B-72BD-4A3A-9160-219F17FC9B9C}.Release|Any CPU.Build.0 = Release|Any CPU
{03F698D6-A474-4408-9B92-A0F7977CCCFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{03F698D6-A474-4408-9B92-A0F7977CCCFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{03F698D6-A474-4408-9B92-A0F7977CCCFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{03F698D6-A474-4408-9B92-A0F7977CCCFE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

@ -0,0 +1,40 @@
namespace CommonClass
{
/// <summary>
/// 公共通用类库参数
/// </summary>
public class PubCommonClass
{
/// <summary>
///
/// </summary>
public Dictionary<uint, ushort> cmd3StartAddress = new Dictionary<uint, ushort>();
public void SetCmd3StartAddress()
{
cmd3StartAddress.Add(1, 32);
cmd3StartAddress.Add(2, 8);
cmd3StartAddress.Add(3, 8);
cmd3StartAddress.Add(4, 8);
cmd3StartAddress.Add(5, 6);
cmd3StartAddress.Add(6, 16);
cmd3StartAddress.Add(7, 256);
cmd3StartAddress.Add(8, 16);
cmd3StartAddress.Add(9, 16);
cmd3StartAddress.Add(10, 256);
cmd3StartAddress.Add(11, 128);
cmd3StartAddress.Add(12, 12);
cmd3StartAddress.Add(13, 64);
cmd3StartAddress.Add(14, 8);
cmd3StartAddress.Add(15, 256);
cmd3StartAddress.Add(16, 256);
cmd3StartAddress.Add(17, 256);
cmd3StartAddress.Add(18, 256);
cmd3StartAddress.Add(19, 256);
cmd3StartAddress.Add(20, 256);
}
}
}
Loading…
Cancel
Save