部分鉴权,远程停止msg修改,APCI修改

zw
CZ 8 months ago
parent 6f2c47dcc1
commit 7fac377cd7

@ -104,7 +104,12 @@ public class Decoder : ByteToMessageDecoder
data = new byte[totalFrameLength];
byteBuffer.ReadBytes(data);
//TODO bug length取值不对
//string ou = string.Empty;
//for (int i = 0; i < data.Length; i++)
//{
// ou += data[i].ToString("X2") + " ";
//}
//TODO bug length取值不对上述测试使用
int removeIndex = _delimiters.Length;
ushort cmd = byteBuffer.GetByte(14 + removeIndex);

@ -33,6 +33,13 @@ public class Encoder : MessageToByteEncoder<APCI>
byte[] bytes = obj.ToBytes();
Log.Info($"send {JsonConvert.SerializeObject(obj)}:{BitUtls.BytesToHexStr(bytes)} to {ChannelUtils.GetAttr(context.Channel, ChargerConst.ChargerSn)}");
//TODO::仅测试使用
//string ou = string.Empty;
//for(int i = 0; i < bytes.Length; i++)
//{
// ou += bytes[i].ToString("X2") + " ";
//}
output.WriteBytes(bytes);
}
}

@ -31,12 +31,17 @@ public abstract class APCI : IToBytes
var bodyBytes = GetBytes();
var list = new List<byte>();
list.AddRange(ChargerConst.StartChar);
list.AddRange(BitConverter.GetBytes(bodyBytes.Length + 12));
list.AddRange(BitConverter.GetBytes((ushort)(bodyBytes.Length + 12)));
list.AddRange(BitConverter.GetBytes(CtlArea));
if (DestAddr != null)
{
list.AddRange(DestAddr);
}
else
{
DestAddr=new byte[4];
list.AddRange(DestAddr);
}
list.AddRange(BitConverter.GetBytes(SrcAddr));
list.AddRange(bodyBytes);

@ -10,30 +10,31 @@ namespace Service.Charger.Msg.Host.Req
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
/// 客户端类型.1站控 2本地控制器 3测试客户端 4TCU模式 0未知设备
/// </summary>
[Property(0, 8)]
[Property(8, 8)]
public byte ClientType { get; set; }
/// <summary>
/// 连接序号
/// </summary>
[Property(8, 16)]
[Property(16, 16)]
public ushort ConnSeq { get; set; }
/// <summary>
/// 鉴权码字节数组
/// </summary>
[Property(24, 64)]
[Property(32, 64)]
public byte[] AuthCodes { get; set; }
/// <summary>
/// 鉴码KEY
/// </summary>
[Property(88, 8)]
[Property(96, 8)]
public byte AuthCodeKey { get; set; }
public Auth(ushort connseq, byte[] authcodes, byte authcodekey)

@ -15,7 +15,7 @@ namespace Service.Charger.Msg.Host.Req
public RemoteStopCharging(byte stopReason)
{
FrameTypeNo = 50;
FrameTypeNo = 48;
MsgBodyCount = 1;
TransReason = 3;
PublicAddr = 0;

@ -31,447 +31,490 @@ partial class Form2
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.grpData = new System.Windows.Forms.GroupBox();
this.rTxtData = new System.Windows.Forms.RichTextBox();
this.grpMsg = new System.Windows.Forms.GroupBox();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.rTxtSend = new System.Windows.Forms.RichTextBox();
this.groupBox7 = new System.Windows.Forms.GroupBox();
this.rTxtReceive = new System.Windows.Forms.RichTextBox();
this.grpCmd = new System.Windows.Forms.GroupBox();
this.btnReadBatteryInfo = new System.Windows.Forms.Button();
this.btnChangeInOrOut = new System.Windows.Forms.Button();
this.btnSetPrice = new System.Windows.Forms.Button();
this.btnSendOutEnableCharge = new System.Windows.Forms.Button();
this.btnOfflineStopCharge = new System.Windows.Forms.Button();
this.btnSetChargeRate = new System.Windows.Forms.Button();
this.btnChangePower = new System.Windows.Forms.Button();
this.btnSendAuxiliaryPower = new System.Windows.Forms.Button();
this.btnStopCharge = new System.Windows.Forms.Button();
this.btnStartCharge = new System.Windows.Forms.Button();
this.btnSendBinStatus = new System.Windows.Forms.Button();
this.btnAuth = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.lblConnStatus = new System.Windows.Forms.Label();
this.btnConn = new System.Windows.Forms.Button();
this.txtDestAddr = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.txtPort = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.txtIp = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.btnRefreshData = new System.Windows.Forms.Button();
this.lblBatterNo = new System.Windows.Forms.Label();
this.lblChargeOrderNo = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.grpData.SuspendLayout();
this.grpMsg.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.groupBox6.SuspendLayout();
this.groupBox7.SuspendLayout();
this.grpCmd.SuspendLayout();
this.groupBox2.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.grpData);
this.groupBox1.Controls.Add(this.grpMsg);
this.groupBox1.Controls.Add(this.grpCmd);
this.groupBox1.Controls.Add(this.groupBox2);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(1118, 1150);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "充电机测试程序";
//
// grpData
//
this.grpData.Controls.Add(this.panel1);
this.grpData.Controls.Add(this.rTxtData);
this.grpData.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpData.Location = new System.Drawing.Point(3, 718);
this.grpData.Name = "grpData";
this.grpData.Size = new System.Drawing.Size(1112, 429);
this.grpData.TabIndex = 3;
this.grpData.TabStop = false;
this.grpData.Text = "数据展示";
//
// rTxtData
//
this.rTxtData.Dock = System.Windows.Forms.DockStyle.Left;
this.rTxtData.Location = new System.Drawing.Point(3, 19);
this.rTxtData.Name = "rTxtData";
this.rTxtData.Size = new System.Drawing.Size(613, 407);
this.rTxtData.TabIndex = 0;
this.rTxtData.Text = "";
//
// grpMsg
//
this.grpMsg.Controls.Add(this.splitContainer1);
this.grpMsg.Dock = System.Windows.Forms.DockStyle.Top;
this.grpMsg.Location = new System.Drawing.Point(3, 326);
this.grpMsg.Name = "grpMsg";
this.grpMsg.Size = new System.Drawing.Size(1112, 392);
this.grpMsg.TabIndex = 2;
this.grpMsg.TabStop = false;
this.grpMsg.Text = "报文展示";
//
// splitContainer1
//
this.splitContainer1.Cursor = System.Windows.Forms.Cursors.VSplit;
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(3, 19);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.groupBox6);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.groupBox7);
this.splitContainer1.Size = new System.Drawing.Size(1106, 370);
this.splitContainer1.SplitterDistance = 563;
this.splitContainer1.TabIndex = 0;
//
// groupBox6
//
this.groupBox6.Controls.Add(this.rTxtSend);
this.groupBox6.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox6.Location = new System.Drawing.Point(0, 0);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(563, 370);
this.groupBox6.TabIndex = 0;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "发送报文";
//
// rTxtSend
//
this.rTxtSend.Dock = System.Windows.Forms.DockStyle.Fill;
this.rTxtSend.Location = new System.Drawing.Point(3, 19);
this.rTxtSend.Name = "rTxtSend";
this.rTxtSend.Size = new System.Drawing.Size(557, 348);
this.rTxtSend.TabIndex = 1;
this.rTxtSend.Text = "";
//
// groupBox7
//
this.groupBox7.Controls.Add(this.rTxtReceive);
this.groupBox7.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox7.Location = new System.Drawing.Point(0, 0);
this.groupBox7.Name = "groupBox7";
this.groupBox7.Size = new System.Drawing.Size(539, 370);
this.groupBox7.TabIndex = 0;
this.groupBox7.TabStop = false;
this.groupBox7.Text = "接收报文";
//
// rTxtReceive
//
this.rTxtReceive.Dock = System.Windows.Forms.DockStyle.Fill;
this.rTxtReceive.Location = new System.Drawing.Point(3, 19);
this.rTxtReceive.Name = "rTxtReceive";
this.rTxtReceive.Size = new System.Drawing.Size(533, 348);
this.rTxtReceive.TabIndex = 0;
this.rTxtReceive.Text = "";
//
// grpCmd
//
this.grpCmd.Controls.Add(this.btnReadBatteryInfo);
this.grpCmd.Controls.Add(this.btnChangeInOrOut);
this.grpCmd.Controls.Add(this.btnSetPrice);
this.grpCmd.Controls.Add(this.btnSendOutEnableCharge);
this.grpCmd.Controls.Add(this.btnOfflineStopCharge);
this.grpCmd.Controls.Add(this.btnSetChargeRate);
this.grpCmd.Controls.Add(this.btnChangePower);
this.grpCmd.Controls.Add(this.btnSendAuxiliaryPower);
this.grpCmd.Controls.Add(this.btnStopCharge);
this.grpCmd.Controls.Add(this.btnStartCharge);
this.grpCmd.Controls.Add(this.btnSendBinStatus);
this.grpCmd.Controls.Add(this.btnAuth);
this.grpCmd.Dock = System.Windows.Forms.DockStyle.Top;
this.grpCmd.Location = new System.Drawing.Point(3, 115);
this.grpCmd.Name = "grpCmd";
this.grpCmd.Size = new System.Drawing.Size(1112, 211);
this.grpCmd.TabIndex = 1;
this.grpCmd.TabStop = false;
this.grpCmd.Text = "操作指令";
//
// btnReadBatteryInfo
//
this.btnReadBatteryInfo.Location = new System.Drawing.Point(379, 153);
this.btnReadBatteryInfo.Name = "btnReadBatteryInfo";
this.btnReadBatteryInfo.Size = new System.Drawing.Size(130, 23);
this.btnReadBatteryInfo.TabIndex = 18;
this.btnReadBatteryInfo.Text = "读取电池信息";
this.btnReadBatteryInfo.UseVisualStyleBackColor = true;
this.btnReadBatteryInfo.Click += new System.EventHandler(this.btnReadBatteryInfo_Click);
//
// btnChangeInOrOut
//
this.btnChangeInOrOut.Location = new System.Drawing.Point(218, 153);
this.btnChangeInOrOut.Name = "btnChangeInOrOut";
this.btnChangeInOrOut.Size = new System.Drawing.Size(130, 23);
this.btnChangeInOrOut.TabIndex = 17;
this.btnChangeInOrOut.Text = "切换站内外充电";
this.btnChangeInOrOut.UseVisualStyleBackColor = true;
this.btnChangeInOrOut.Click += new System.EventHandler(this.btnChangeInOrOut_Click);
//
// btnSetPrice
//
this.btnSetPrice.Location = new System.Drawing.Point(63, 153);
this.btnSetPrice.Name = "btnSetPrice";
this.btnSetPrice.Size = new System.Drawing.Size(130, 23);
this.btnSetPrice.TabIndex = 16;
this.btnSetPrice.Text = "设置尖峰平谷";
this.btnSetPrice.UseVisualStyleBackColor = true;
this.btnSetPrice.Click += new System.EventHandler(this.btnSetPrice_Click);
//
// btnSendOutEnableCharge
//
this.btnSendOutEnableCharge.Location = new System.Drawing.Point(526, 99);
this.btnSendOutEnableCharge.Name = "btnSendOutEnableCharge";
this.btnSendOutEnableCharge.Size = new System.Drawing.Size(165, 23);
this.btnSendOutEnableCharge.TabIndex = 15;
this.btnSendOutEnableCharge.Text = "下发站外允许充电SOC";
this.btnSendOutEnableCharge.UseVisualStyleBackColor = true;
this.btnSendOutEnableCharge.Click += new System.EventHandler(this.btnSendOutEnableCharge_Click);
//
// btnOfflineStopCharge
//
this.btnOfflineStopCharge.Location = new System.Drawing.Point(379, 99);
this.btnOfflineStopCharge.Name = "btnOfflineStopCharge";
this.btnOfflineStopCharge.Size = new System.Drawing.Size(130, 23);
this.btnOfflineStopCharge.TabIndex = 14;
this.btnOfflineStopCharge.Text = "掉线停止充电";
this.btnOfflineStopCharge.UseVisualStyleBackColor = true;
this.btnOfflineStopCharge.Click += new System.EventHandler(this.btnOfflineStopCharge_Click);
//
// btnSetChargeRate
//
this.btnSetChargeRate.Location = new System.Drawing.Point(218, 99);
this.btnSetChargeRate.Name = "btnSetChargeRate";
this.btnSetChargeRate.Size = new System.Drawing.Size(130, 23);
this.btnSetChargeRate.TabIndex = 13;
this.btnSetChargeRate.Text = "充电速率设置";
this.btnSetChargeRate.UseVisualStyleBackColor = true;
this.btnSetChargeRate.Click += new System.EventHandler(this.btnSetChargeRate_Click);
//
// btnChangePower
//
this.btnChangePower.Location = new System.Drawing.Point(63, 99);
this.btnChangePower.Name = "btnChangePower";
this.btnChangePower.Size = new System.Drawing.Size(130, 23);
this.btnChangePower.TabIndex = 12;
this.btnChangePower.Text = "功率调节";
this.btnChangePower.UseVisualStyleBackColor = true;
this.btnChangePower.Click += new System.EventHandler(this.btnChangePower_Click);
//
// btnSendAuxiliaryPower
//
this.btnSendAuxiliaryPower.Location = new System.Drawing.Point(316, 43);
this.btnSendAuxiliaryPower.Name = "btnSendAuxiliaryPower";
this.btnSendAuxiliaryPower.Size = new System.Drawing.Size(130, 23);
this.btnSendAuxiliaryPower.TabIndex = 11;
this.btnSendAuxiliaryPower.Text = "下发辅助源控制";
this.btnSendAuxiliaryPower.UseVisualStyleBackColor = true;
this.btnSendAuxiliaryPower.Click += new System.EventHandler(this.btnSendAuxiliaryPower_Click);
//
// btnStopCharge
//
this.btnStopCharge.Location = new System.Drawing.Point(633, 43);
this.btnStopCharge.Name = "btnStopCharge";
this.btnStopCharge.Size = new System.Drawing.Size(130, 23);
this.btnStopCharge.TabIndex = 10;
this.btnStopCharge.Text = "停止充电";
this.btnStopCharge.UseVisualStyleBackColor = true;
this.btnStopCharge.Click += new System.EventHandler(this.btnStopCharge_Click);
//
// btnStartCharge
//
this.btnStartCharge.Location = new System.Drawing.Point(479, 43);
this.btnStartCharge.Name = "btnStartCharge";
this.btnStartCharge.Size = new System.Drawing.Size(130, 23);
this.btnStartCharge.TabIndex = 9;
this.btnStartCharge.Text = "开始充电";
this.btnStartCharge.UseVisualStyleBackColor = true;
this.btnStartCharge.Click += new System.EventHandler(this.btnStartCharge_Click);
//
// btnSendBinStatus
//
this.btnSendBinStatus.Location = new System.Drawing.Point(159, 43);
this.btnSendBinStatus.Name = "btnSendBinStatus";
this.btnSendBinStatus.Size = new System.Drawing.Size(130, 23);
this.btnSendBinStatus.TabIndex = 8;
this.btnSendBinStatus.Text = "下发电池仓状态";
this.btnSendBinStatus.UseVisualStyleBackColor = true;
this.btnSendBinStatus.Click += new System.EventHandler(this.btnSendBinStatus_Click);
//
// btnAuth
//
this.btnAuth.Location = new System.Drawing.Point(63, 43);
this.btnAuth.Name = "btnAuth";
this.btnAuth.Size = new System.Drawing.Size(75, 23);
this.btnAuth.TabIndex = 7;
this.btnAuth.Text = "鉴权";
this.btnAuth.UseVisualStyleBackColor = true;
this.btnAuth.Click += new System.EventHandler(this.btnAuth_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.lblConnStatus);
this.groupBox2.Controls.Add(this.btnConn);
this.groupBox2.Controls.Add(this.txtDestAddr);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.txtPort);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.txtIp);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox2.Location = new System.Drawing.Point(3, 19);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(1112, 96);
this.groupBox2.TabIndex = 0;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "充电机连接";
//
// lblConnStatus
//
this.lblConnStatus.AutoSize = true;
this.lblConnStatus.Location = new System.Drawing.Point(1018, 32);
this.lblConnStatus.Name = "lblConnStatus";
this.lblConnStatus.Size = new System.Drawing.Size(46, 15);
this.lblConnStatus.TabIndex = 7;
this.lblConnStatus.Text = "未连接";
//
// btnConn
//
this.btnConn.Location = new System.Drawing.Point(908, 28);
this.btnConn.Name = "btnConn";
this.btnConn.Size = new System.Drawing.Size(75, 23);
this.btnConn.TabIndex = 6;
this.btnConn.Text = "连接";
this.btnConn.UseVisualStyleBackColor = true;
this.btnConn.Click += new System.EventHandler(this.btnConn_Click);
//
// txtDestAddr
//
this.txtDestAddr.Location = new System.Drawing.Point(657, 29);
this.txtDestAddr.Name = "txtDestAddr";
this.txtDestAddr.Size = new System.Drawing.Size(202, 23);
this.txtDestAddr.TabIndex = 5;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(592, 32);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(59, 15);
this.label3.TabIndex = 4;
this.label3.Text = "DestAddr:";
//
// txtPort
//
this.txtPort.Location = new System.Drawing.Point(354, 29);
this.txtPort.Name = "txtPort";
this.txtPort.Size = new System.Drawing.Size(202, 23);
this.txtPort.TabIndex = 3;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(300, 32);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(48, 15);
this.label2.TabIndex = 2;
this.label2.Text = "PORT";
//
// txtIp
//
this.txtIp.Location = new System.Drawing.Point(63, 29);
this.txtIp.Name = "txtIp";
this.txtIp.Size = new System.Drawing.Size(202, 23);
this.txtIp.TabIndex = 1;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(27, 32);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(30, 15);
this.label1.TabIndex = 0;
this.label1.Text = "IP";
//
// panel1
//
this.panel1.Controls.Add(this.lblChargeOrderNo);
this.panel1.Controls.Add(this.lblBatterNo);
this.panel1.Controls.Add(this.btnRefreshData);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(616, 19);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(493, 407);
this.panel1.TabIndex = 1;
//
// btnRefreshData
//
this.btnRefreshData.Location = new System.Drawing.Point(28, 31);
this.btnRefreshData.Name = "btnRefreshData";
this.btnRefreshData.Size = new System.Drawing.Size(75, 23);
this.btnRefreshData.TabIndex = 19;
this.btnRefreshData.Text = "刷新数据";
this.btnRefreshData.UseVisualStyleBackColor = true;
this.btnRefreshData.Click += new System.EventHandler(this.btnRefreshData_Click);
//
// lblBatterNo
//
this.lblBatterNo.AutoSize = true;
this.lblBatterNo.Location = new System.Drawing.Point(148, 35);
this.lblBatterNo.Name = "lblBatterNo";
this.lblBatterNo.Size = new System.Drawing.Size(0, 15);
this.lblBatterNo.TabIndex = 20;
//
// lblChargeOrderNo
//
this.lblChargeOrderNo.AutoSize = true;
this.lblChargeOrderNo.Location = new System.Drawing.Point(148, 77);
this.lblChargeOrderNo.Name = "lblChargeOrderNo";
this.lblChargeOrderNo.Size = new System.Drawing.Size(0, 15);
this.lblChargeOrderNo.TabIndex = 21;
//
// Form2
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1118, 1150);
this.Controls.Add(this.groupBox1);
this.Name = "Form2";
this.Text = "Form2";
this.groupBox1.ResumeLayout(false);
this.grpData.ResumeLayout(false);
this.grpMsg.ResumeLayout(false);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.groupBox6.ResumeLayout(false);
this.groupBox7.ResumeLayout(false);
this.grpCmd.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
groupBox1 = new GroupBox();
grpData = new GroupBox();
panel1 = new Panel();
lblChargeOrderNo = new Label();
lblBatterNo = new Label();
btnRefreshData = new Button();
rTxtData = new RichTextBox();
grpMsg = new GroupBox();
splitContainer1 = new SplitContainer();
groupBox6 = new GroupBox();
rTxtSend = new RichTextBox();
groupBox7 = new GroupBox();
rTxtReceive = new RichTextBox();
grpCmd = new GroupBox();
btnReadBatteryInfo = new Button();
btnChangeInOrOut = new Button();
btnSetPrice = new Button();
btnSendOutEnableCharge = new Button();
btnOfflineStopCharge = new Button();
btnSetChargeRate = new Button();
btnChangePower = new Button();
btnSendAuxiliaryPower = new Button();
btnStopCharge = new Button();
btnStartCharge = new Button();
btnSendBinStatus = new Button();
btnAuth = new Button();
groupBox2 = new GroupBox();
lblConnStatus = new Label();
btnConn = new Button();
txtDestAddr = new TextBox();
label3 = new Label();
txtPort = new TextBox();
label2 = new Label();
txtIp = new TextBox();
label1 = new Label();
groupBox1.SuspendLayout();
grpData.SuspendLayout();
panel1.SuspendLayout();
grpMsg.SuspendLayout();
((ISupportInitialize)splitContainer1).BeginInit();
splitContainer1.Panel1.SuspendLayout();
splitContainer1.Panel2.SuspendLayout();
splitContainer1.SuspendLayout();
groupBox6.SuspendLayout();
groupBox7.SuspendLayout();
grpCmd.SuspendLayout();
groupBox2.SuspendLayout();
SuspendLayout();
//
// groupBox1
//
groupBox1.Controls.Add(grpData);
groupBox1.Controls.Add(grpMsg);
groupBox1.Controls.Add(grpCmd);
groupBox1.Controls.Add(groupBox2);
groupBox1.Dock = DockStyle.Fill;
groupBox1.Location = new Point(0, 0);
groupBox1.Margin = new Padding(4, 4, 4, 4);
groupBox1.Name = "groupBox1";
groupBox1.Padding = new Padding(4, 4, 4, 4);
groupBox1.Size = new Size(1437, 1055);
groupBox1.TabIndex = 0;
groupBox1.TabStop = false;
groupBox1.Text = "充电机测试程序";
//
// grpData
//
grpData.Controls.Add(panel1);
grpData.Controls.Add(rTxtData);
grpData.Dock = DockStyle.Fill;
grpData.Location = new Point(4, 956);
grpData.Margin = new Padding(4, 4, 4, 4);
grpData.Name = "grpData";
grpData.Padding = new Padding(4, 4, 4, 4);
grpData.Size = new Size(1429, 95);
grpData.TabIndex = 3;
grpData.TabStop = false;
grpData.Text = "数据展示";
//
// panel1
//
panel1.Controls.Add(lblChargeOrderNo);
panel1.Controls.Add(lblBatterNo);
panel1.Controls.Add(btnRefreshData);
panel1.Dock = DockStyle.Fill;
panel1.Location = new Point(791, 24);
panel1.Margin = new Padding(4, 4, 4, 4);
panel1.Name = "panel1";
panel1.Size = new Size(634, 67);
panel1.TabIndex = 1;
//
// lblChargeOrderNo
//
lblChargeOrderNo.AutoSize = true;
lblChargeOrderNo.Location = new Point(190, 103);
lblChargeOrderNo.Margin = new Padding(4, 0, 4, 0);
lblChargeOrderNo.Name = "lblChargeOrderNo";
lblChargeOrderNo.Size = new Size(0, 20);
lblChargeOrderNo.TabIndex = 21;
//
// lblBatterNo
//
lblBatterNo.AutoSize = true;
lblBatterNo.Location = new Point(190, 47);
lblBatterNo.Margin = new Padding(4, 0, 4, 0);
lblBatterNo.Name = "lblBatterNo";
lblBatterNo.Size = new Size(0, 20);
lblBatterNo.TabIndex = 20;
//
// btnRefreshData
//
btnRefreshData.Location = new Point(36, 41);
btnRefreshData.Margin = new Padding(4, 4, 4, 4);
btnRefreshData.Name = "btnRefreshData";
btnRefreshData.Size = new Size(96, 31);
btnRefreshData.TabIndex = 19;
btnRefreshData.Text = "刷新数据";
btnRefreshData.UseVisualStyleBackColor = true;
btnRefreshData.Click += btnRefreshData_Click;
//
// rTxtData
//
rTxtData.Dock = DockStyle.Left;
rTxtData.Location = new Point(4, 24);
rTxtData.Margin = new Padding(4, 4, 4, 4);
rTxtData.Name = "rTxtData";
rTxtData.Size = new Size(787, 67);
rTxtData.TabIndex = 0;
rTxtData.Text = "";
//
// grpMsg
//
grpMsg.Controls.Add(splitContainer1);
grpMsg.Dock = DockStyle.Top;
grpMsg.Location = new Point(4, 433);
grpMsg.Margin = new Padding(4, 4, 4, 4);
grpMsg.Name = "grpMsg";
grpMsg.Padding = new Padding(4, 4, 4, 4);
grpMsg.Size = new Size(1429, 523);
grpMsg.TabIndex = 2;
grpMsg.TabStop = false;
grpMsg.Text = "报文展示";
//
// splitContainer1
//
splitContainer1.Cursor = Cursors.VSplit;
splitContainer1.Dock = DockStyle.Fill;
splitContainer1.Location = new Point(4, 24);
splitContainer1.Margin = new Padding(4, 4, 4, 4);
splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
splitContainer1.Panel1.Controls.Add(groupBox6);
//
// splitContainer1.Panel2
//
splitContainer1.Panel2.Controls.Add(groupBox7);
splitContainer1.Size = new Size(1421, 495);
splitContainer1.SplitterDistance = 723;
splitContainer1.SplitterWidth = 5;
splitContainer1.TabIndex = 0;
//
// groupBox6
//
groupBox6.Controls.Add(rTxtSend);
groupBox6.Dock = DockStyle.Fill;
groupBox6.Location = new Point(0, 0);
groupBox6.Margin = new Padding(4, 4, 4, 4);
groupBox6.Name = "groupBox6";
groupBox6.Padding = new Padding(4, 4, 4, 4);
groupBox6.Size = new Size(723, 495);
groupBox6.TabIndex = 0;
groupBox6.TabStop = false;
groupBox6.Text = "发送报文";
//
// rTxtSend
//
rTxtSend.Dock = DockStyle.Fill;
rTxtSend.Location = new Point(4, 24);
rTxtSend.Margin = new Padding(4, 4, 4, 4);
rTxtSend.Name = "rTxtSend";
rTxtSend.Size = new Size(715, 467);
rTxtSend.TabIndex = 1;
rTxtSend.Text = "";
//
// groupBox7
//
groupBox7.Controls.Add(rTxtReceive);
groupBox7.Dock = DockStyle.Fill;
groupBox7.Location = new Point(0, 0);
groupBox7.Margin = new Padding(4, 4, 4, 4);
groupBox7.Name = "groupBox7";
groupBox7.Padding = new Padding(4, 4, 4, 4);
groupBox7.Size = new Size(693, 495);
groupBox7.TabIndex = 0;
groupBox7.TabStop = false;
groupBox7.Text = "接收报文";
//
// rTxtReceive
//
rTxtReceive.Dock = DockStyle.Fill;
rTxtReceive.Location = new Point(4, 24);
rTxtReceive.Margin = new Padding(4, 4, 4, 4);
rTxtReceive.Name = "rTxtReceive";
rTxtReceive.Size = new Size(685, 467);
rTxtReceive.TabIndex = 0;
rTxtReceive.Text = "";
//
// grpCmd
//
grpCmd.Controls.Add(btnReadBatteryInfo);
grpCmd.Controls.Add(btnChangeInOrOut);
grpCmd.Controls.Add(btnSetPrice);
grpCmd.Controls.Add(btnSendOutEnableCharge);
grpCmd.Controls.Add(btnOfflineStopCharge);
grpCmd.Controls.Add(btnSetChargeRate);
grpCmd.Controls.Add(btnChangePower);
grpCmd.Controls.Add(btnSendAuxiliaryPower);
grpCmd.Controls.Add(btnStopCharge);
grpCmd.Controls.Add(btnStartCharge);
grpCmd.Controls.Add(btnSendBinStatus);
grpCmd.Controls.Add(btnAuth);
grpCmd.Dock = DockStyle.Top;
grpCmd.Location = new Point(4, 152);
grpCmd.Margin = new Padding(4, 4, 4, 4);
grpCmd.Name = "grpCmd";
grpCmd.Padding = new Padding(4, 4, 4, 4);
grpCmd.Size = new Size(1429, 281);
grpCmd.TabIndex = 1;
grpCmd.TabStop = false;
grpCmd.Text = "操作指令";
//
// btnReadBatteryInfo
//
btnReadBatteryInfo.Location = new Point(487, 204);
btnReadBatteryInfo.Margin = new Padding(4, 4, 4, 4);
btnReadBatteryInfo.Name = "btnReadBatteryInfo";
btnReadBatteryInfo.Size = new Size(167, 31);
btnReadBatteryInfo.TabIndex = 18;
btnReadBatteryInfo.Text = "读取电池信息";
btnReadBatteryInfo.UseVisualStyleBackColor = true;
btnReadBatteryInfo.Click += btnReadBatteryInfo_Click;
//
// btnChangeInOrOut
//
btnChangeInOrOut.Location = new Point(280, 204);
btnChangeInOrOut.Margin = new Padding(4, 4, 4, 4);
btnChangeInOrOut.Name = "btnChangeInOrOut";
btnChangeInOrOut.Size = new Size(167, 31);
btnChangeInOrOut.TabIndex = 17;
btnChangeInOrOut.Text = "切换站内外充电";
btnChangeInOrOut.UseVisualStyleBackColor = true;
btnChangeInOrOut.Click += btnChangeInOrOut_Click;
//
// btnSetPrice
//
btnSetPrice.Location = new Point(81, 204);
btnSetPrice.Margin = new Padding(4, 4, 4, 4);
btnSetPrice.Name = "btnSetPrice";
btnSetPrice.Size = new Size(167, 31);
btnSetPrice.TabIndex = 16;
btnSetPrice.Text = "设置尖峰平谷";
btnSetPrice.UseVisualStyleBackColor = true;
btnSetPrice.Click += btnSetPrice_Click;
//
// btnSendOutEnableCharge
//
btnSendOutEnableCharge.Location = new Point(676, 132);
btnSendOutEnableCharge.Margin = new Padding(4, 4, 4, 4);
btnSendOutEnableCharge.Name = "btnSendOutEnableCharge";
btnSendOutEnableCharge.Size = new Size(212, 31);
btnSendOutEnableCharge.TabIndex = 15;
btnSendOutEnableCharge.Text = "下发站外允许充电SOC";
btnSendOutEnableCharge.UseVisualStyleBackColor = true;
btnSendOutEnableCharge.Click += btnSendOutEnableCharge_Click;
//
// btnOfflineStopCharge
//
btnOfflineStopCharge.Location = new Point(487, 132);
btnOfflineStopCharge.Margin = new Padding(4, 4, 4, 4);
btnOfflineStopCharge.Name = "btnOfflineStopCharge";
btnOfflineStopCharge.Size = new Size(167, 31);
btnOfflineStopCharge.TabIndex = 14;
btnOfflineStopCharge.Text = "掉线停止充电";
btnOfflineStopCharge.UseVisualStyleBackColor = true;
btnOfflineStopCharge.Click += btnOfflineStopCharge_Click;
//
// btnSetChargeRate
//
btnSetChargeRate.Location = new Point(280, 132);
btnSetChargeRate.Margin = new Padding(4, 4, 4, 4);
btnSetChargeRate.Name = "btnSetChargeRate";
btnSetChargeRate.Size = new Size(167, 31);
btnSetChargeRate.TabIndex = 13;
btnSetChargeRate.Text = "充电速率设置";
btnSetChargeRate.UseVisualStyleBackColor = true;
btnSetChargeRate.Click += btnSetChargeRate_Click;
//
// btnChangePower
//
btnChangePower.Location = new Point(81, 132);
btnChangePower.Margin = new Padding(4, 4, 4, 4);
btnChangePower.Name = "btnChangePower";
btnChangePower.Size = new Size(167, 31);
btnChangePower.TabIndex = 12;
btnChangePower.Text = "功率调节";
btnChangePower.UseVisualStyleBackColor = true;
btnChangePower.Click += btnChangePower_Click;
//
// btnSendAuxiliaryPower
//
btnSendAuxiliaryPower.Location = new Point(406, 57);
btnSendAuxiliaryPower.Margin = new Padding(4, 4, 4, 4);
btnSendAuxiliaryPower.Name = "btnSendAuxiliaryPower";
btnSendAuxiliaryPower.Size = new Size(167, 31);
btnSendAuxiliaryPower.TabIndex = 11;
btnSendAuxiliaryPower.Text = "下发辅助源控制";
btnSendAuxiliaryPower.UseVisualStyleBackColor = true;
btnSendAuxiliaryPower.Click += btnSendAuxiliaryPower_Click;
//
// btnStopCharge
//
btnStopCharge.Location = new Point(814, 57);
btnStopCharge.Margin = new Padding(4, 4, 4, 4);
btnStopCharge.Name = "btnStopCharge";
btnStopCharge.Size = new Size(167, 31);
btnStopCharge.TabIndex = 10;
btnStopCharge.Text = "停止充电";
btnStopCharge.UseVisualStyleBackColor = true;
btnStopCharge.Click += btnStopCharge_Click;
//
// btnStartCharge
//
btnStartCharge.Location = new Point(616, 57);
btnStartCharge.Margin = new Padding(4, 4, 4, 4);
btnStartCharge.Name = "btnStartCharge";
btnStartCharge.Size = new Size(167, 31);
btnStartCharge.TabIndex = 9;
btnStartCharge.Text = "开始充电";
btnStartCharge.UseVisualStyleBackColor = true;
btnStartCharge.Click += btnStartCharge_Click;
//
// btnSendBinStatus
//
btnSendBinStatus.Location = new Point(204, 57);
btnSendBinStatus.Margin = new Padding(4, 4, 4, 4);
btnSendBinStatus.Name = "btnSendBinStatus";
btnSendBinStatus.Size = new Size(167, 31);
btnSendBinStatus.TabIndex = 8;
btnSendBinStatus.Text = "下发电池仓状态";
btnSendBinStatus.UseVisualStyleBackColor = true;
btnSendBinStatus.Click += btnSendBinStatus_Click;
//
// btnAuth
//
btnAuth.Location = new Point(81, 57);
btnAuth.Margin = new Padding(4, 4, 4, 4);
btnAuth.Name = "btnAuth";
btnAuth.Size = new Size(96, 31);
btnAuth.TabIndex = 7;
btnAuth.Text = "鉴权";
btnAuth.UseVisualStyleBackColor = true;
btnAuth.Click += btnAuth_Click;
//
// groupBox2
//
groupBox2.Controls.Add(lblConnStatus);
groupBox2.Controls.Add(btnConn);
groupBox2.Controls.Add(txtDestAddr);
groupBox2.Controls.Add(label3);
groupBox2.Controls.Add(txtPort);
groupBox2.Controls.Add(label2);
groupBox2.Controls.Add(txtIp);
groupBox2.Controls.Add(label1);
groupBox2.Dock = DockStyle.Top;
groupBox2.Location = new Point(4, 24);
groupBox2.Margin = new Padding(4, 4, 4, 4);
groupBox2.Name = "groupBox2";
groupBox2.Padding = new Padding(4, 4, 4, 4);
groupBox2.Size = new Size(1429, 128);
groupBox2.TabIndex = 0;
groupBox2.TabStop = false;
groupBox2.Text = "充电机连接";
//
// lblConnStatus
//
lblConnStatus.AutoSize = true;
lblConnStatus.Location = new Point(1309, 43);
lblConnStatus.Margin = new Padding(4, 0, 4, 0);
lblConnStatus.Name = "lblConnStatus";
lblConnStatus.Size = new Size(54, 20);
lblConnStatus.TabIndex = 7;
lblConnStatus.Text = "未连接";
//
// btnConn
//
btnConn.Location = new Point(1167, 37);
btnConn.Margin = new Padding(4, 4, 4, 4);
btnConn.Name = "btnConn";
btnConn.Size = new Size(96, 31);
btnConn.TabIndex = 6;
btnConn.Text = "连接";
btnConn.UseVisualStyleBackColor = true;
btnConn.Click += btnConn_Click;
//
// txtDestAddr
//
txtDestAddr.Location = new Point(845, 39);
txtDestAddr.Margin = new Padding(4, 4, 4, 4);
txtDestAddr.Name = "txtDestAddr";
txtDestAddr.Size = new Size(259, 27);
txtDestAddr.TabIndex = 5;
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(761, 43);
label3.Margin = new Padding(4, 0, 4, 0);
label3.Name = "label3";
label3.Size = new Size(83, 20);
label3.TabIndex = 4;
label3.Text = "DestAddr:";
//
// txtPort
//
txtPort.Location = new Point(455, 39);
txtPort.Margin = new Padding(4, 4, 4, 4);
txtPort.Name = "txtPort";
txtPort.Size = new Size(259, 27);
txtPort.TabIndex = 3;
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(386, 43);
label2.Margin = new Padding(4, 0, 4, 0);
label2.Name = "label2";
label2.Size = new Size(64, 20);
label2.TabIndex = 2;
label2.Text = "PORT";
//
// txtIp
//
txtIp.Location = new Point(81, 39);
txtIp.Margin = new Padding(4, 4, 4, 4);
txtIp.Name = "txtIp";
txtIp.Size = new Size(259, 27);
txtIp.TabIndex = 1;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(35, 43);
label1.Margin = new Padding(4, 0, 4, 0);
label1.Name = "label1";
label1.Size = new Size(37, 20);
label1.TabIndex = 0;
label1.Text = "IP";
//
// Form2
//
AutoScaleDimensions = new SizeF(9F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1437, 1055);
Controls.Add(groupBox1);
Margin = new Padding(4, 4, 4, 4);
Name = "Form2";
Text = "Form2";
groupBox1.ResumeLayout(false);
grpData.ResumeLayout(false);
panel1.ResumeLayout(false);
panel1.PerformLayout();
grpMsg.ResumeLayout(false);
splitContainer1.Panel1.ResumeLayout(false);
splitContainer1.Panel2.ResumeLayout(false);
((ISupportInitialize)splitContainer1).EndInit();
splitContainer1.ResumeLayout(false);
groupBox6.ResumeLayout(false);
groupBox7.ResumeLayout(false);
grpCmd.ResumeLayout(false);
groupBox2.ResumeLayout(false);
groupBox2.PerformLayout();
ResumeLayout(false);
}
#endregion

@ -11,7 +11,7 @@ namespace WinFormStarter;
public partial class Form2 : Form
{
private ChargerClient? _chargerClient;
private Timer _timer= new Timer();
private Timer _timer = new Timer();
public Form2()
{
@ -21,8 +21,8 @@ public partial class Form2 : Form
private void Init()
{
this.txtIp.Text = @"127.0.0.1";
this.txtPort.Text = @"9998";
this.txtIp.Text = @"172.0.30.13";
this.txtPort.Text = @"2408";
this.txtDestAddr.Text = @"03,01,01,02";
this.grpCmd.Enabled = false;
@ -41,8 +41,8 @@ public partial class Form2 : Form
{
if (_chargerClient != null)
{
SetText(this.rTxtSend, _chargerClient?.CurrentCmd?? "");
SetText(this.rTxtReceive, _chargerClient?.CurrentMsg?? "");
SetText(this.rTxtSend, _chargerClient?.CurrentCmd ?? "");
SetText(this.rTxtReceive, _chargerClient?.CurrentMsg ?? "");
SetText(this.rTxtData, JsonConvert.SerializeObject(_chargerClient, Formatting.Indented));
}
}
@ -215,7 +215,7 @@ public partial class Form2 : Form
DisplayData();
}
private void btnSendOutEnableCharge_Click(object sender, EventArgs e)
{
}
@ -250,7 +250,7 @@ public partial class Form2 : Form
TimePeak7 = 2,
TimePeak8 = 1
};
_chargerClient.SendSetPeakValleyTime(setPeakValleyTime);
MessageBox.Show(@"发送成功");
DisplayData();

@ -12,9 +12,9 @@
}
],
"additionalProbingPaths": [
"C:\\Users\\64558\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\64558\\.nuget\\packages",
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
"C:\\Users\\CZ\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\CZ\\.nuget\\packages",
"D:\\vs2019\\共享组件\\NuGetPackages"
],
"configProperties": {
"Microsoft.NETCore.DotNetHostPolicy.SetAppPaths": true

Loading…
Cancel
Save