|
|
@ -10,7 +10,7 @@ namespace BatCharging.Service
|
|
|
|
public class ChargerSendCMD
|
|
|
|
public class ChargerSendCMD
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#region 协议格式
|
|
|
|
#region 协议格式
|
|
|
|
public byte[] SendRCMD1(out APDUModel APDUModel, CMD1 t)
|
|
|
|
public byte[] SendRCMD1(out APDUModel APDUModel, CMD1 CMD)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
byte[] result = null;
|
|
|
|
byte[] result = null;
|
|
|
@ -24,7 +24,7 @@ namespace BatCharging.Service
|
|
|
|
model.checksumDomain = 0x01;
|
|
|
|
model.checksumDomain = 0x01;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model.dataDomain = GetRCMD1DataInfo(t); //数据域
|
|
|
|
model.dataDomain = GetRCMD1DataInfo(CMD); //数据域
|
|
|
|
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
|
|
|
|
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
|
|
|
|
|
|
|
|
|
|
|
|
List<byte> lstResult = new List<byte>();
|
|
|
|
List<byte> lstResult = new List<byte>();
|
|
|
@ -47,15 +47,15 @@ namespace BatCharging.Service
|
|
|
|
{
|
|
|
|
{
|
|
|
|
List<byte> lstContent = new List<byte>();
|
|
|
|
List<byte> lstContent = new List<byte>();
|
|
|
|
|
|
|
|
|
|
|
|
lstContent.AddRange(BitConverter.GetBytes(CMD1.value1));
|
|
|
|
lstContent.AddRange(ByteUtils.Int16ToByteArray((short)CMD1.value1));
|
|
|
|
lstContent.AddRange(BitConverter.GetBytes(CMD1.value2));
|
|
|
|
lstContent.AddRange(ByteUtils.Int16ToByteArray((short)CMD1.value2));
|
|
|
|
lstContent.Add(CMD1.value3);
|
|
|
|
lstContent.Add(CMD1.value3);
|
|
|
|
lstContent.AddRange(BitConverter.GetBytes(CMD1.value4));
|
|
|
|
lstContent.AddRange(ByteUtils.Int32ToByteArray((int)CMD1.value4));
|
|
|
|
|
|
|
|
|
|
|
|
if (CMD1.value3 == 1)
|
|
|
|
if (CMD1.value3 == 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
lstContent.Add(CMD1.value5);
|
|
|
|
lstContent.Add(CMD1.value5);
|
|
|
|
lstContent.AddRange(BitConverter.GetBytes(CMD1.value6));
|
|
|
|
lstContent.AddRange(ByteUtils.Int16ToByteArray((short)CMD1.value6));
|
|
|
|
lstContent.AddRange(CMD1.value7);
|
|
|
|
lstContent.AddRange(CMD1.value7);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -104,13 +104,13 @@ namespace BatCharging.Service
|
|
|
|
{
|
|
|
|
{
|
|
|
|
List<byte> lstContent = new List<byte>();
|
|
|
|
List<byte> lstContent = new List<byte>();
|
|
|
|
|
|
|
|
|
|
|
|
lstContent.AddRange(BitConverter.GetBytes(CMD.value1));
|
|
|
|
lstContent.AddRange(ByteUtils.Int16ToByteArray((short)CMD.value1));
|
|
|
|
lstContent.AddRange(BitConverter.GetBytes(CMD.value2));
|
|
|
|
lstContent.AddRange(ByteUtils.Int16ToByteArray((short)CMD.value2));
|
|
|
|
lstContent.Add(CMD.value3);
|
|
|
|
lstContent.Add(CMD.value3);
|
|
|
|
lstContent.AddRange(BitConverter.GetBytes(CMD.value4));
|
|
|
|
lstContent.AddRange(ByteUtils.Int32ToByteArray((int)CMD.value4));
|
|
|
|
if (CMD.value3 == 1)
|
|
|
|
if (CMD.value3 == 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
lstContent.AddRange(BitConverter.GetBytes(CMD.value5));
|
|
|
|
lstContent.AddRange(ByteUtils.Int16ToByteArray((short)CMD.value5));
|
|
|
|
lstContent.AddRange(CMD.value6);
|
|
|
|
lstContent.AddRange(CMD.value6);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|