master
CZ 8 months ago
commit 57befcd701

@ -22,6 +22,32 @@ namespace BatCharging.Model
public byte value3 { get; set; } public byte value3 { get; set; }
/// <summary> /// <summary>
/// 起始命令地址 /// 起始命令地址
/// <para>1-----预留</para>
/// <para>2-----停止充电</para>
/// <para>3-----预留</para>
/// <para>4-----充电控制方式</para>
/// <para>5-----预留</para>
/// <para>6-----预留</para>
/// <para>7-----电阻模式输出电压</para>
/// <para>8-----电阻模式输出电流</para>
/// <para>9-----充电模式</para>
/// <para>10----取消预约充电</para>
/// <para>11----设备重启</para>
/// <para>12----进入升级模式</para>
/// <para>13----进入正常应用模式</para>
/// <para>14----立即上报一次签到106 报文</para>
/// <para>15----立即上报一次桩状态信息 104 报文</para>
/// <para>16----扫描支付成功</para>
/// <para>17----实时充电(限制)最大充电功率</para>
/// <para>18----负载类型</para>
/// <para>19----绝缘检测</para>
/// <para>20----模块类型</para>
/// <para>21----本地计费</para>
/// <para>22----刷卡密码输入流程</para>
/// <para>23----充电暂停服务</para>
/// <para>24----输出电压较准</para>
/// <para>25----离线时默认限功率</para>
/// <para>26----充电机限电流</para>
/// </summary> /// </summary>
public UInt32 value4 { get; set; } public UInt32 value4 { get; set; }
/// <summary> /// <summary>

@ -47,21 +47,16 @@ namespace BatCharging.Service
{ {
List<byte> lstContent = new List<byte>(); List<byte> lstContent = new List<byte>();
lstContent.AddRange(ByteUtils.Int16ToByteArray((short)CMD1.value1)); lstContent.AddRange(BitConverter.GetBytes(CMD1.value1));
lstContent.AddRange(ByteUtils.Int16ToByteArray((short)CMD1.value2)); lstContent.AddRange(BitConverter.GetBytes(CMD1.value2));
lstContent.Add(CMD1.value3); lstContent.Add(CMD1.value3);
lstContent.AddRange(ByteUtils.Int32ToByteArray((int)CMD1.value4)); lstContent.AddRange(BitConverter.GetBytes(CMD1.value4));
lstContent.Add(CMD1.value5);
lstContent.AddRange(BitConverter.GetBytes(CMD1.value6));
if (CMD1.value3 == 1) if (CMD1.value3 == 1)
{ {
lstContent.Add(CMD1.value5);
lstContent.AddRange(ByteUtils.Int16ToByteArray((short)CMD1.value6));
lstContent.AddRange(CMD1.value7); lstContent.AddRange(CMD1.value7);
} }
else
{
}
results = lstContent.ToArray(); results = lstContent.ToArray();
} }
@ -104,18 +99,14 @@ namespace BatCharging.Service
{ {
List<byte> lstContent = new List<byte>(); List<byte> lstContent = new List<byte>();
lstContent.AddRange(ByteUtils.Int16ToByteArray((short)CMD.value1)); lstContent.AddRange(BitConverter.GetBytes(CMD.value1));
lstContent.AddRange(ByteUtils.Int16ToByteArray((short)CMD.value2)); lstContent.AddRange(BitConverter.GetBytes(CMD.value2));
lstContent.Add(CMD.value3); lstContent.Add(CMD.value3);
lstContent.AddRange(ByteUtils.Int32ToByteArray((int)CMD.value4)); lstContent.AddRange(BitConverter.GetBytes(CMD.value4));
lstContent.AddRange(BitConverter.GetBytes(CMD.value5));
if (CMD.value3 == 1) if (CMD.value3 == 1)
{ {
lstContent.AddRange(ByteUtils.Int16ToByteArray((short)CMD.value5));
lstContent.AddRange(CMD.value6); lstContent.AddRange(CMD.value6);
}
else
{
} }
results = lstContent.ToArray(); results = lstContent.ToArray();
} }
@ -133,8 +124,6 @@ namespace BatCharging.Service
model.CMD = 5; model.CMD = 5;
model.checksumDomain = 0x01; model.checksumDomain = 0x01;
model.dataDomain = GetRCMD5DataInfo(cMD5); //数据域 model.dataDomain = GetRCMD5DataInfo(cMD5); //数据域
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度 model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
@ -163,11 +152,8 @@ namespace BatCharging.Service
lstContent.Add(CMD.value3); lstContent.Add(CMD.value3);
lstContent.AddRange(BitConverter.GetBytes(CMD.value4)); lstContent.AddRange(BitConverter.GetBytes(CMD.value4));
lstContent.Add(CMD.value5); lstContent.Add(CMD.value5);
if (CMD.value3 == 1) lstContent.AddRange(BitConverter.GetBytes(CMD.value6));
{ lstContent.AddRange(CMD.value7);
lstContent.AddRange(BitConverter.GetBytes(CMD.value4));
lstContent.AddRange(CMD.value7);
}
results = lstContent.ToArray(); results = lstContent.ToArray();
} }
return results; return results;
@ -668,7 +654,7 @@ namespace BatCharging.Service
lstContent.AddRange(BitConverter.GetBytes(CMD.value01)); lstContent.AddRange(BitConverter.GetBytes(CMD.value01));
lstContent.AddRange(BitConverter.GetBytes(CMD.value02)); lstContent.AddRange(BitConverter.GetBytes(CMD.value02));
lstContent.AddRange(BitConverter.GetBytes(CMD.value03)); lstContent.AddRange(BitConverter.GetBytes(CMD.value03));
lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.value04,32)); lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.value04, 32));
lstContent.AddRange(BitConverter.GetBytes(CMD.value05)); lstContent.AddRange(BitConverter.GetBytes(CMD.value05));
lstContent.AddRange(BitConverter.GetBytes(CMD.value06)); lstContent.AddRange(BitConverter.GetBytes(CMD.value06));
lstContent.AddRange(BitConverter.GetBytes(CMD.value07)); lstContent.AddRange(BitConverter.GetBytes(CMD.value07));
@ -1483,76 +1469,76 @@ namespace BatCharging.Service
{ {
List<byte> lstContent = new List<byte>(); List<byte> lstContent = new List<byte>();
lstContent.AddRange(BitConverter.GetBytes(CMD.startHour1)); lstContent.Add(CMD.startHour1);
lstContent.AddRange(BitConverter.GetBytes(CMD.startMinute1)); lstContent.Add(CMD.startMinute1);
lstContent.AddRange(BitConverter.GetBytes(CMD.endHour1)); lstContent.Add(CMD.endHour1);
lstContent.AddRange(BitConverter.GetBytes(CMD.endMinute1)); lstContent.Add(CMD.endMinute1);
lstContent.AddRange(BitConverter.GetBytes(CMD.rate1)); lstContent.AddRange(BitConverter.GetBytes(CMD.rate1));
lstContent.AddRange(BitConverter.GetBytes(CMD.startHour2)); lstContent.Add(CMD.startHour2);
lstContent.AddRange(BitConverter.GetBytes(CMD.startMinute2)); lstContent.Add(CMD.startMinute2);
lstContent.AddRange(BitConverter.GetBytes(CMD.endHour2)); lstContent.Add(CMD.endHour2);
lstContent.AddRange(BitConverter.GetBytes(CMD.endMinute2)); lstContent.Add(CMD.endMinute2);
lstContent.AddRange(BitConverter.GetBytes(CMD.rate2)); lstContent.AddRange(BitConverter.GetBytes(CMD.rate2));
lstContent.AddRange(BitConverter.GetBytes(CMD.startHour3)); lstContent.Add(CMD.startHour3);
lstContent.AddRange(BitConverter.GetBytes(CMD.startMinute3)); lstContent.Add(CMD.startMinute3);
lstContent.AddRange(BitConverter.GetBytes(CMD.endHour3)); lstContent.Add(CMD.endHour3);
lstContent.AddRange(BitConverter.GetBytes(CMD.endMinute3)); lstContent.Add(CMD.endMinute3);
lstContent.AddRange(BitConverter.GetBytes(CMD.rate3)); lstContent.AddRange(BitConverter.GetBytes(CMD.rate3));
lstContent.AddRange(BitConverter.GetBytes(CMD.startHour4)); lstContent.Add(CMD.startHour4);
lstContent.AddRange(BitConverter.GetBytes(CMD.startMinute4)); lstContent.Add(CMD.startMinute4);
lstContent.AddRange(BitConverter.GetBytes(CMD.endHour4)); lstContent.Add(CMD.endHour4);
lstContent.AddRange(BitConverter.GetBytes(CMD.endMinute4)); lstContent.Add(CMD.endMinute4);
lstContent.AddRange(BitConverter.GetBytes(CMD.rate4)); lstContent.AddRange(BitConverter.GetBytes(CMD.rate4));
lstContent.AddRange(BitConverter.GetBytes(CMD.startHour5)); lstContent.Add(CMD.startHour5);
lstContent.AddRange(BitConverter.GetBytes(CMD.startMinute5)); lstContent.Add(CMD.startMinute5);
lstContent.AddRange(BitConverter.GetBytes(CMD.endHour5)); lstContent.Add(CMD.endHour5);
lstContent.AddRange(BitConverter.GetBytes(CMD.endMinute5)); lstContent.Add(CMD.endMinute5);
lstContent.AddRange(BitConverter.GetBytes(CMD.rate5)); lstContent.AddRange(BitConverter.GetBytes(CMD.rate5));
lstContent.AddRange(BitConverter.GetBytes(CMD.startHour6)); lstContent.Add(CMD.startHour6);
lstContent.AddRange(BitConverter.GetBytes(CMD.startMinute6)); lstContent.Add(CMD.startMinute6);
lstContent.AddRange(BitConverter.GetBytes(CMD.endHour6)); lstContent.Add(CMD.endHour6);
lstContent.AddRange(BitConverter.GetBytes(CMD.endMinute6)); lstContent.Add(CMD.endMinute6);
lstContent.AddRange(BitConverter.GetBytes(CMD.rate6)); lstContent.AddRange(BitConverter.GetBytes(CMD.rate6));
lstContent.AddRange(BitConverter.GetBytes(CMD.startHour7)); lstContent.Add(CMD.startHour7);
lstContent.AddRange(BitConverter.GetBytes(CMD.startMinute7)); lstContent.Add(CMD.startMinute7);
lstContent.AddRange(BitConverter.GetBytes(CMD.endHour7)); lstContent.Add(CMD.endHour7);
lstContent.AddRange(BitConverter.GetBytes(CMD.endMinute7)); lstContent.Add(CMD.endMinute7);
lstContent.AddRange(BitConverter.GetBytes(CMD.rate7)); lstContent.AddRange(BitConverter.GetBytes(CMD.rate7));
lstContent.AddRange(BitConverter.GetBytes(CMD.startHour8)); lstContent.Add(CMD.startHour8);
lstContent.AddRange(BitConverter.GetBytes(CMD.startMinute8)); lstContent.Add(CMD.startMinute8);
lstContent.AddRange(BitConverter.GetBytes(CMD.endHour8)); lstContent.Add(CMD.endHour8);
lstContent.AddRange(BitConverter.GetBytes(CMD.endMinute8)); lstContent.Add(CMD.endMinute8);
lstContent.AddRange(BitConverter.GetBytes(CMD.rate8)); lstContent.AddRange(BitConverter.GetBytes(CMD.rate8));
lstContent.AddRange(BitConverter.GetBytes(CMD.startHour9)); lstContent.Add(CMD.startHour9);
lstContent.AddRange(BitConverter.GetBytes(CMD.startMinute9)); lstContent.Add(CMD.startMinute9);
lstContent.AddRange(BitConverter.GetBytes(CMD.endHour9)); lstContent.Add(CMD.endHour9);
lstContent.AddRange(BitConverter.GetBytes(CMD.endMinute9)); lstContent.Add(CMD.endMinute9);
lstContent.AddRange(BitConverter.GetBytes(CMD.rate9)); lstContent.AddRange(BitConverter.GetBytes(CMD.rate9));
lstContent.AddRange(BitConverter.GetBytes(CMD.startHour10)); lstContent.Add(CMD.startHour10);
lstContent.AddRange(BitConverter.GetBytes(CMD.startMinute10)); lstContent.Add(CMD.startMinute10);
lstContent.AddRange(BitConverter.GetBytes(CMD.endHour10)); lstContent.Add(CMD.endHour10);
lstContent.AddRange(BitConverter.GetBytes(CMD.endMinute10)); lstContent.Add(CMD.endMinute10);
lstContent.AddRange(BitConverter.GetBytes(CMD.rate10)); lstContent.AddRange(BitConverter.GetBytes(CMD.rate10));
lstContent.AddRange(BitConverter.GetBytes(CMD.startHour11)); lstContent.Add(CMD.startHour11);
lstContent.AddRange(BitConverter.GetBytes(CMD.startMinute11)); lstContent.Add(CMD.startMinute11);
lstContent.AddRange(BitConverter.GetBytes(CMD.endHour11)); lstContent.Add(CMD.endHour11);
lstContent.AddRange(BitConverter.GetBytes(CMD.endMinute11)); lstContent.Add(CMD.endMinute11);
lstContent.AddRange(BitConverter.GetBytes(CMD.rate11)); lstContent.AddRange(BitConverter.GetBytes(CMD.rate11));
lstContent.AddRange(BitConverter.GetBytes(CMD.startHour12)); lstContent.Add(CMD.startHour12);
lstContent.AddRange(BitConverter.GetBytes(CMD.startMinute12)); lstContent.Add(CMD.startMinute12);
lstContent.AddRange(BitConverter.GetBytes(CMD.endHour12)); lstContent.Add(CMD.endHour12);
lstContent.AddRange(BitConverter.GetBytes(CMD.endMinute12)); lstContent.Add(CMD.endMinute12);
lstContent.AddRange(BitConverter.GetBytes(CMD.rate12)); lstContent.AddRange(BitConverter.GetBytes(CMD.rate12));
results = lstContent.ToArray(); results = lstContent.ToArray();

@ -245,7 +245,7 @@ namespace Monitor.ChargeTest
/// <param name="e"></param> /// <param name="e"></param>
private void button15_Click(object sender, EventArgs e) private void button15_Click(object sender, EventArgs e)
{ {
byte type = 0;//0-查询 1-设置 byte type = 1;//0-查询 1-设置
uint startAddress = 1;//设置/查询参数启始地址 uint startAddress = 1;//设置/查询参数启始地址
byte[] setData = new byte[8];//设置数据 byte[] setData = new byte[8];//设置数据
setData[0] = 0; setData[0] = 0;

Loading…
Cancel
Save