diff --git a/BatCharging.Service/ChargerMgrTool.cs b/BatCharging.Service/ChargerMgrTool.cs index 8538ea5..1466c0d 100644 --- a/BatCharging.Service/ChargerMgrTool.cs +++ b/BatCharging.Service/ChargerMgrTool.cs @@ -1014,8 +1014,8 @@ namespace BatCharging.Service if (CMD4 != null) { byte type = 0; - uint startAddress = 0; - byte[] setData = null; + uint startAddress = 1; + byte[] setData = new byte[4]; //(CMD=3)后台服务器下发充电桩字符型参数 CmnChargerParam._CHR00TCPCLIENT.Send3(type, startAddress, setData); @@ -1035,7 +1035,7 @@ namespace BatCharging.Service byte type = 0; uint startAddress = 0; byte num = 0; - byte[] setData = null; + byte[] setData = new byte[4]; //(CMD=5)后台服务器下发充电桩控制命令 CmnChargerParam._CHR00TCPCLIENT.Send5(type, startAddress, num, setData); diff --git a/BatCharging.Service/ChargerSendMsg.cs b/BatCharging.Service/ChargerSendMsg.cs index 1cfe0a9..1c0a441 100644 --- a/BatCharging.Service/ChargerSendMsg.cs +++ b/BatCharging.Service/ChargerSendMsg.cs @@ -323,7 +323,7 @@ namespace BatCharging.Service CMD3.value2 = 0; CMD3.value3 = type; CMD3.value4 = startAddress; - CMD3.value5 = pubCommonClass.cmd3StartAddress[startAddress]; + CMD3.value5 = PubCommonClass.cmd3StartAddress[startAddress]; CMD3.value6 = setData; byte[] bytes = new ChargerSendCMD().SendRCMD3(out APDUModel, CMD3); diff --git a/BatCharging.Service/Common/PublicProgram.cs b/BatCharging.Service/Common/PublicProgram.cs index 6117db4..903c4eb 100644 --- a/BatCharging.Service/Common/PublicProgram.cs +++ b/BatCharging.Service/Common/PublicProgram.cs @@ -52,7 +52,7 @@ namespace BatCharging.Service { int checksum = 0; - for (int i = 8; i < data.Count(); i++)//这里没校验域所以不减一 + for (int i = 6; i < data.Count(); i++)//这里没校验域所以不减一 { checksum += data[i]; } diff --git a/BatCharging.Service/发送方法/ChargerSendCMD.cs b/BatCharging.Service/发送方法/ChargerSendCMD.cs index 4193890..955528a 100644 --- a/BatCharging.Service/发送方法/ChargerSendCMD.cs +++ b/BatCharging.Service/发送方法/ChargerSendCMD.cs @@ -17,7 +17,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -74,7 +74,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -128,7 +128,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -182,7 +182,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -240,7 +240,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -293,7 +293,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -340,7 +340,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -386,7 +386,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -444,7 +444,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -491,7 +491,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -536,7 +536,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -581,7 +581,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -631,7 +631,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -684,7 +684,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -741,7 +741,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -790,7 +790,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -846,7 +846,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -897,7 +897,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -943,7 +943,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -990,7 +990,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -1039,7 +1039,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -1083,7 +1083,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -1127,7 +1127,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -1171,7 +1171,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -1215,7 +1215,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -1260,7 +1260,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -1304,7 +1304,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -1353,7 +1353,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -1396,7 +1396,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -1508,7 +1508,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -1632,7 +1632,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -1678,7 +1678,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -1738,7 +1738,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; @@ -1788,7 +1788,7 @@ namespace BatCharging.Service APDUModel model = new APDUModel(); model.OriginDomain1 = 0xAA; - model.OriginDomain1 = 0xF5; + model.OriginDomain2 = 0xF5; model.infoDomain = 0x02; model.SerialNumberDomain = 0xff; model.CMD = 1; diff --git a/CommonClass/PubCommonClass.cs b/CommonClass/PubCommonClass.cs index 6980cc7..f7ef88f 100644 --- a/CommonClass/PubCommonClass.cs +++ b/CommonClass/PubCommonClass.cs @@ -8,7 +8,7 @@ /// /// /// - public Dictionary cmd3StartAddress = new Dictionary(); + public static Dictionary cmd3StartAddress = new Dictionary(); //public Dictionary<> diff --git a/Module.Socket.Tool/AesEncryption.cs b/Module.Socket.Tool/AesEncryption.cs new file mode 100644 index 0000000..8129655 --- /dev/null +++ b/Module.Socket.Tool/AesEncryption.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using System.Threading.Tasks; + +namespace Module.Socket.Tool +{ + /// + /// AES加密 + /// + public class AesEncryption + { + private static readonly byte[] Key = Encoding.UTF8.GetBytes("YourSecretKeyHere12345678"); // 必须是32字节(256位) + private static readonly byte[] Iv = Encoding.UTF8.GetBytes("YourInitializationVectorHere"); // 必须是16字节(128位) + + public static byte[] EncryptStringToBytes(string plainText) + { + if (plainText == null || plainText.Length <= 0) + throw new ArgumentNullException(nameof(plainText)); + if (Key == null || Key.Length != 32) + throw new ArgumentNullException(nameof(Key)); + if (Iv == null || Iv.Length != 16) + throw new ArgumentNullException(nameof(Iv)); + + byte[] encrypted; + + using (Aes aesAlg = Aes.Create()) + { + aesAlg.Key = Key; + aesAlg.IV = Iv; + + ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV); + + using (MemoryStream msEncrypt = new MemoryStream()) + { + using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write)) + using (StreamWriter swEncrypt = new StreamWriter(csEncrypt)) + { + swEncrypt.Write(plainText); + } + encrypted = msEncrypt.ToArray(); + } + } + + return encrypted; + } + + public static string DecryptBytesToString(byte[] cipherText) + { + if (cipherText == null || cipherText.Length <= 0) + throw new ArgumentNullException(nameof(cipherText)); + if (Key == null || Key.Length != 32) + throw new ArgumentNullException(nameof(Key)); + if (Iv == null || Iv.Length != 16) + throw new ArgumentNullException(nameof(Iv)); + + string plaintext = null; + + using (Aes aesAlg = Aes.Create()) + { + aesAlg.Key = Key; + aesAlg.IV = Iv; + + ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV); + + using (MemoryStream msDecrypt = new MemoryStream(cipherText)) + using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read)) + using (StreamReader srDecrypt = new StreamReader(csDecrypt)) + { + plaintext = srDecrypt.ReadToEnd(); + } + } + + return plaintext; + } + } +} diff --git a/Module.Socket.Tool/Module.Socket.Tool.csproj b/Module.Socket.Tool/Module.Socket.Tool.csproj index a48860f..22e324b 100644 --- a/Module.Socket.Tool/Module.Socket.Tool.csproj +++ b/Module.Socket.Tool/Module.Socket.Tool.csproj @@ -42,6 +42,7 @@ + diff --git a/Module.Socket.Tool/TcpClientChargerTool.cs b/Module.Socket.Tool/TcpClientChargerTool.cs index e7c0b4a..56eb4bd 100644 --- a/Module.Socket.Tool/TcpClientChargerTool.cs +++ b/Module.Socket.Tool/TcpClientChargerTool.cs @@ -392,7 +392,7 @@ namespace Module.Socket.Tool bool bResult = false; int checksum = 0; - for (int i = 8; i < data.Count() - 1; i++)//这里有校验域所以减一 + for (int i = 6; i < data.Count() - 1; i++)//这里有校验域所以减一 { checksum += data[i]; } @@ -438,7 +438,22 @@ namespace Module.Socket.Tool //校验域是否正确 if (checksumDomainReceive(newBytes)) - lstResult.Add(newBytes); + { + var info = newBytes[4]; + if ((info & (1 << 1)) != 0)//AES加密 + { + + List byteList = newBytes.ToList(); + byteList.Remove(8); + byteList.Remove(8);//移除前面两个长度 + newBytes= byteList.ToArray(); + lstResult.Add(newBytes); + } + else //不加密 + { + lstResult.Add(newBytes); + } + } } } } diff --git a/Monitor.ChargeTest/FrmChargeResult.Designer.cs b/Monitor.ChargeTest/FrmChargeResult.Designer.cs index e55944d..3d4c54b 100644 --- a/Monitor.ChargeTest/FrmChargeResult.Designer.cs +++ b/Monitor.ChargeTest/FrmChargeResult.Designer.cs @@ -74,6 +74,29 @@ this.button8 = new System.Windows.Forms.Button(); this.button9 = new System.Windows.Forms.Button(); this.button10 = new System.Windows.Forms.Button(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.groupBox7 = new System.Windows.Forms.GroupBox(); + this.groupBox10 = new System.Windows.Forms.GroupBox(); + this.groupBox13 = new System.Windows.Forms.GroupBox(); + this.button11 = new System.Windows.Forms.Button(); + this.button13 = new System.Windows.Forms.Button(); + this.button25 = new System.Windows.Forms.Button(); + this.button31 = new System.Windows.Forms.Button(); + this.groupBox14 = new System.Windows.Forms.GroupBox(); + this.button33 = new System.Windows.Forms.Button(); + this.button34 = new System.Windows.Forms.Button(); + this.groupBox15 = new System.Windows.Forms.GroupBox(); + this.button36 = new System.Windows.Forms.Button(); + this.groupBox16 = new System.Windows.Forms.GroupBox(); + this.button37 = new System.Windows.Forms.Button(); + this.button38 = new System.Windows.Forms.Button(); + this.button39 = new System.Windows.Forms.Button(); + this.button40 = new System.Windows.Forms.Button(); + this.button32 = new System.Windows.Forms.Button(); + this.button35 = new System.Windows.Forms.Button(); + this.button41 = new System.Windows.Forms.Button(); + this.button42 = new System.Windows.Forms.Button(); this.groupBox3.SuspendLayout(); this.groupBox1.SuspendLayout(); this.groupBox5.SuspendLayout(); @@ -81,7 +104,14 @@ this.groupBox11.SuspendLayout(); this.groupBox8.SuspendLayout(); this.groupBox12.SuspendLayout(); - this.groupBox2.SuspendLayout(); + this.groupBox4.SuspendLayout(); + this.groupBox6.SuspendLayout(); + this.groupBox7.SuspendLayout(); + this.groupBox10.SuspendLayout(); + this.groupBox13.SuspendLayout(); + this.groupBox14.SuspendLayout(); + this.groupBox15.SuspendLayout(); + this.groupBox16.SuspendLayout(); this.SuspendLayout(); // // groupBox3 @@ -110,7 +140,7 @@ // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(359, 38); + this.label3.Location = new System.Drawing.Point(343, 33); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(94, 20); this.label3.TabIndex = 20; @@ -209,7 +239,7 @@ // this.groupBox5.Controls.Add(this.lstSendFrameInfo); this.groupBox5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.groupBox5.Location = new System.Drawing.Point(6, 571); + this.groupBox5.Location = new System.Drawing.Point(6, 477); this.groupBox5.Margin = new System.Windows.Forms.Padding(5); this.groupBox5.Name = "groupBox5"; this.groupBox5.Padding = new System.Windows.Forms.Padding(5); @@ -487,137 +517,390 @@ // // lstRecvFrameInfo // - this.lstRecvFrameInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.lstRecvFrameInfo.Anchor = System.Windows.Forms.AnchorStyles.None; this.lstRecvFrameInfo.FormattingEnabled = true; this.lstRecvFrameInfo.ItemHeight = 20; - this.lstRecvFrameInfo.Location = new System.Drawing.Point(10, 20); + this.lstRecvFrameInfo.Location = new System.Drawing.Point(8, 659); this.lstRecvFrameInfo.Margin = new System.Windows.Forms.Padding(5); this.lstRecvFrameInfo.Name = "lstRecvFrameInfo"; - this.lstRecvFrameInfo.Size = new System.Drawing.Size(1528, 224); + this.lstRecvFrameInfo.Size = new System.Drawing.Size(1536, 124); this.lstRecvFrameInfo.TabIndex = 72; // // groupBox2 // this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); - this.groupBox2.Controls.Add(this.lstRecvFrameInfo); this.groupBox2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.groupBox2.Location = new System.Drawing.Point(6, 753); this.groupBox2.Margin = new System.Windows.Forms.Padding(5); this.groupBox2.Name = "groupBox2"; this.groupBox2.Padding = new System.Windows.Forms.Padding(5); - this.groupBox2.Size = new System.Drawing.Size(1545, 288); + this.groupBox2.Size = new System.Drawing.Size(1545, 0); this.groupBox2.TabIndex = 81; this.groupBox2.TabStop = false; this.groupBox2.Text = "接收数据帧信息"; // // button1 // - this.button1.Location = new System.Drawing.Point(19, 212); + this.button1.Location = new System.Drawing.Point(6, 26); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(115, 37); this.button1.TabIndex = 118; this.button1.Text = "1101"; this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // - this.button2.Location = new System.Drawing.Point(164, 212); + this.button2.Location = new System.Drawing.Point(149, 26); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(115, 37); this.button2.TabIndex = 119; this.button2.Text = "1103"; this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); // // button3 // - this.button3.Location = new System.Drawing.Point(309, 212); + this.button3.Location = new System.Drawing.Point(294, 26); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(115, 37); this.button3.TabIndex = 120; this.button3.Text = "1105"; this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); // // button4 // - this.button4.Location = new System.Drawing.Point(454, 212); + this.button4.Location = new System.Drawing.Point(439, 26); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(115, 37); this.button4.TabIndex = 121; this.button4.Text = "1107"; this.button4.UseVisualStyleBackColor = true; + this.button4.Click += new System.EventHandler(this.button4_Click); // // button5 // - this.button5.Location = new System.Drawing.Point(599, 212); + this.button5.Location = new System.Drawing.Point(6, 26); this.button5.Name = "button5"; this.button5.Size = new System.Drawing.Size(115, 37); this.button5.TabIndex = 122; this.button5.Text = "1301"; this.button5.UseVisualStyleBackColor = true; + this.button5.Click += new System.EventHandler(this.button5_Click); // // button6 // - this.button6.Location = new System.Drawing.Point(744, 212); + this.button6.Location = new System.Drawing.Point(6, 26); this.button6.Name = "button6"; this.button6.Size = new System.Drawing.Size(115, 37); this.button6.TabIndex = 123; this.button6.Text = "1401"; this.button6.UseVisualStyleBackColor = true; + this.button6.Click += new System.EventHandler(this.button6_Click); // // button7 // - this.button7.Location = new System.Drawing.Point(889, 212); + this.button7.Location = new System.Drawing.Point(127, 26); this.button7.Name = "button7"; this.button7.Size = new System.Drawing.Size(115, 37); this.button7.TabIndex = 124; this.button7.Text = "1406"; this.button7.UseVisualStyleBackColor = true; + this.button7.Click += new System.EventHandler(this.button7_Click); // // button8 // - this.button8.Location = new System.Drawing.Point(1034, 212); + this.button8.Location = new System.Drawing.Point(5, 26); this.button8.Name = "button8"; this.button8.Size = new System.Drawing.Size(115, 37); this.button8.TabIndex = 125; this.button8.Text = "1502"; this.button8.UseVisualStyleBackColor = true; + this.button8.Click += new System.EventHandler(this.button8_Click); // // button9 // - this.button9.Location = new System.Drawing.Point(1179, 212); + this.button9.Location = new System.Drawing.Point(147, 26); this.button9.Name = "button9"; this.button9.Size = new System.Drawing.Size(115, 37); this.button9.TabIndex = 126; this.button9.Text = "1504"; this.button9.UseVisualStyleBackColor = true; + this.button9.Click += new System.EventHandler(this.button9_Click); // // button10 // - this.button10.Location = new System.Drawing.Point(1324, 212); + this.button10.Location = new System.Drawing.Point(289, 26); this.button10.Name = "button10"; this.button10.Size = new System.Drawing.Size(115, 37); this.button10.TabIndex = 127; this.button10.Text = "1506"; this.button10.UseVisualStyleBackColor = true; + this.button10.Click += new System.EventHandler(this.button10_Click); + // + // groupBox4 + // + this.groupBox4.Controls.Add(this.button3); + this.groupBox4.Controls.Add(this.button1); + this.groupBox4.Controls.Add(this.button2); + this.groupBox4.Controls.Add(this.button4); + this.groupBox4.Location = new System.Drawing.Point(9, 381); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(562, 75); + this.groupBox4.TabIndex = 128; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "与计费策略相关的指令"; + // + // groupBox6 + // + this.groupBox6.Controls.Add(this.button5); + this.groupBox6.Location = new System.Drawing.Point(602, 381); + this.groupBox6.Name = "groupBox6"; + this.groupBox6.Size = new System.Drawing.Size(130, 75); + this.groupBox6.TabIndex = 129; + this.groupBox6.TabStop = false; + this.groupBox6.Text = "白名单报文"; + // + // groupBox7 + // + this.groupBox7.Controls.Add(this.button6); + this.groupBox7.Controls.Add(this.button7); + this.groupBox7.Location = new System.Drawing.Point(758, 381); + this.groupBox7.Name = "groupBox7"; + this.groupBox7.Size = new System.Drawing.Size(250, 75); + this.groupBox7.TabIndex = 129; + this.groupBox7.TabStop = false; + this.groupBox7.Text = "FTP远程升级、FTP日志上传"; + // + // groupBox10 + // + this.groupBox10.Controls.Add(this.button9); + this.groupBox10.Controls.Add(this.button8); + this.groupBox10.Controls.Add(this.button10); + this.groupBox10.Location = new System.Drawing.Point(1034, 381); + this.groupBox10.Name = "groupBox10"; + this.groupBox10.Size = new System.Drawing.Size(410, 75); + this.groupBox10.TabIndex = 130; + this.groupBox10.TabStop = false; + this.groupBox10.Text = "协议方式日志上传"; + // + // groupBox13 + // + this.groupBox13.Controls.Add(this.button32); + this.groupBox13.Controls.Add(this.button11); + this.groupBox13.Controls.Add(this.button13); + this.groupBox13.Controls.Add(this.button25); + this.groupBox13.Controls.Add(this.button31); + this.groupBox13.Location = new System.Drawing.Point(11, 212); + this.groupBox13.Name = "groupBox13"; + this.groupBox13.Size = new System.Drawing.Size(712, 75); + this.groupBox13.TabIndex = 129; + this.groupBox13.TabStop = false; + this.groupBox13.Text = "充电信息数据"; + // + // button11 + // + this.button11.Location = new System.Drawing.Point(294, 26); + this.button11.Name = "button11"; + this.button11.Size = new System.Drawing.Size(115, 37); + this.button11.TabIndex = 120; + this.button11.Text = "205"; + this.button11.UseVisualStyleBackColor = true; + this.button11.Click += new System.EventHandler(this.button11_Click); + // + // button13 + // + this.button13.Location = new System.Drawing.Point(6, 26); + this.button13.Name = "button13"; + this.button13.Size = new System.Drawing.Size(115, 37); + this.button13.TabIndex = 118; + this.button13.Text = "201/221"; + this.button13.UseVisualStyleBackColor = true; + this.button13.Click += new System.EventHandler(this.button13_Click); + // + // button25 + // + this.button25.Location = new System.Drawing.Point(149, 26); + this.button25.Name = "button25"; + this.button25.Size = new System.Drawing.Size(115, 37); + this.button25.TabIndex = 119; + this.button25.Text = "203"; + this.button25.UseVisualStyleBackColor = true; + this.button25.Click += new System.EventHandler(this.button25_Click); + // + // button31 + // + this.button31.Location = new System.Drawing.Point(439, 26); + this.button31.Name = "button31"; + this.button31.Size = new System.Drawing.Size(115, 37); + this.button31.TabIndex = 121; + this.button31.Text = "207"; + this.button31.UseVisualStyleBackColor = true; + this.button31.Click += new System.EventHandler(this.button31_Click); + // + // groupBox14 + // + this.groupBox14.Controls.Add(this.button33); + this.groupBox14.Controls.Add(this.button34); + this.groupBox14.Location = new System.Drawing.Point(740, 212); + this.groupBox14.Name = "groupBox14"; + this.groupBox14.Size = new System.Drawing.Size(273, 75); + this.groupBox14.TabIndex = 130; + this.groupBox14.TabStop = false; + this.groupBox14.Text = "直流充电桩BMS信息数据(预留)"; + // + // button33 + // + this.button33.Location = new System.Drawing.Point(6, 26); + this.button33.Name = "button33"; + this.button33.Size = new System.Drawing.Size(115, 37); + this.button33.TabIndex = 118; + this.button33.Text = "301"; + this.button33.UseVisualStyleBackColor = true; + this.button33.Click += new System.EventHandler(this.button33_Click); + // + // button34 + // + this.button34.Location = new System.Drawing.Point(140, 26); + this.button34.Name = "button34"; + this.button34.Size = new System.Drawing.Size(115, 37); + this.button34.TabIndex = 119; + this.button34.Text = "303"; + this.button34.UseVisualStyleBackColor = true; + this.button34.Click += new System.EventHandler(this.button34_Click); + // + // groupBox15 + // + this.groupBox15.Controls.Add(this.button36); + this.groupBox15.Location = new System.Drawing.Point(1039, 212); + this.groupBox15.Name = "groupBox15"; + this.groupBox15.Size = new System.Drawing.Size(130, 75); + this.groupBox15.TabIndex = 130; + this.groupBox15.TabStop = false; + this.groupBox15.Text = "历史数据"; + // + // button36 + // + this.button36.Location = new System.Drawing.Point(6, 26); + this.button36.Name = "button36"; + this.button36.Size = new System.Drawing.Size(115, 37); + this.button36.TabIndex = 122; + this.button36.Text = "401"; + this.button36.UseVisualStyleBackColor = true; + this.button36.Click += new System.EventHandler(this.button36_Click); + // + // groupBox16 + // + this.groupBox16.Controls.Add(this.button42); + this.groupBox16.Controls.Add(this.button41); + this.groupBox16.Controls.Add(this.button35); + this.groupBox16.Controls.Add(this.button37); + this.groupBox16.Controls.Add(this.button38); + this.groupBox16.Controls.Add(this.button39); + this.groupBox16.Controls.Add(this.button40); + this.groupBox16.Location = new System.Drawing.Point(6, 293); + this.groupBox16.Name = "groupBox16"; + this.groupBox16.Size = new System.Drawing.Size(1007, 75); + this.groupBox16.TabIndex = 130; + this.groupBox16.TabStop = false; + this.groupBox16.Text = "升级命令"; + // + // button37 + // + this.button37.Location = new System.Drawing.Point(294, 26); + this.button37.Name = "button37"; + this.button37.Size = new System.Drawing.Size(115, 37); + this.button37.TabIndex = 120; + this.button37.Text = "1005"; + this.button37.UseVisualStyleBackColor = true; + this.button37.Click += new System.EventHandler(this.button37_Click); + // + // button38 + // + this.button38.Location = new System.Drawing.Point(6, 26); + this.button38.Name = "button38"; + this.button38.Size = new System.Drawing.Size(115, 37); + this.button38.TabIndex = 118; + this.button38.Text = "1001"; + this.button38.UseVisualStyleBackColor = true; + this.button38.Click += new System.EventHandler(this.button38_Click); + // + // button39 + // + this.button39.Location = new System.Drawing.Point(150, 26); + this.button39.Name = "button39"; + this.button39.Size = new System.Drawing.Size(115, 37); + this.button39.TabIndex = 119; + this.button39.Text = "1003"; + this.button39.UseVisualStyleBackColor = true; + this.button39.Click += new System.EventHandler(this.button39_Click); + // + // button40 + // + this.button40.Location = new System.Drawing.Point(438, 26); + this.button40.Name = "button40"; + this.button40.Size = new System.Drawing.Size(115, 37); + this.button40.TabIndex = 121; + this.button40.Text = "1007"; + this.button40.UseVisualStyleBackColor = true; + this.button40.Click += new System.EventHandler(this.button40_Click); + // + // button32 + // + this.button32.Location = new System.Drawing.Point(576, 26); + this.button32.Name = "button32"; + this.button32.Size = new System.Drawing.Size(115, 37); + this.button32.TabIndex = 122; + this.button32.Text = "209"; + this.button32.UseVisualStyleBackColor = true; + this.button32.Click += new System.EventHandler(this.button32_Click); + // + // button35 + // + this.button35.Location = new System.Drawing.Point(582, 26); + this.button35.Name = "button35"; + this.button35.Size = new System.Drawing.Size(115, 37); + this.button35.TabIndex = 122; + this.button35.Text = "1009"; + this.button35.UseVisualStyleBackColor = true; + this.button35.Click += new System.EventHandler(this.button35_Click); + // + // button41 + // + this.button41.Location = new System.Drawing.Point(726, 26); + this.button41.Name = "button41"; + this.button41.Size = new System.Drawing.Size(115, 37); + this.button41.TabIndex = 123; + this.button41.Text = "1011"; + this.button41.UseVisualStyleBackColor = true; + this.button41.Click += new System.EventHandler(this.button41_Click); + // + // button42 + // + this.button42.Location = new System.Drawing.Point(870, 26); + this.button42.Name = "button42"; + this.button42.Size = new System.Drawing.Size(115, 37); + this.button42.TabIndex = 124; + this.button42.Text = "1021"; + this.button42.UseVisualStyleBackColor = true; + this.button42.Click += new System.EventHandler(this.button42_Click); // // FrmChargeResult // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1563, 1055); - this.Controls.Add(this.button10); - this.Controls.Add(this.button9); - this.Controls.Add(this.button8); - this.Controls.Add(this.button7); - this.Controls.Add(this.button6); - this.Controls.Add(this.button5); - this.Controls.Add(this.button4); - this.Controls.Add(this.button3); - this.Controls.Add(this.button2); - this.Controls.Add(this.button1); + this.ClientSize = new System.Drawing.Size(1563, 900); + this.Controls.Add(this.lstRecvFrameInfo); + this.Controls.Add(this.groupBox16); + this.Controls.Add(this.groupBox15); + this.Controls.Add(this.groupBox14); + this.Controls.Add(this.groupBox13); + this.Controls.Add(this.groupBox10); + this.Controls.Add(this.groupBox7); + this.Controls.Add(this.groupBox6); + this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox9); this.Controls.Add(this.groupBox11); this.Controls.Add(this.groupBox5); @@ -635,7 +918,14 @@ this.groupBox11.ResumeLayout(false); this.groupBox8.ResumeLayout(false); this.groupBox12.ResumeLayout(false); - this.groupBox2.ResumeLayout(false); + this.groupBox4.ResumeLayout(false); + this.groupBox6.ResumeLayout(false); + this.groupBox7.ResumeLayout(false); + this.groupBox10.ResumeLayout(false); + this.groupBox13.ResumeLayout(false); + this.groupBox14.ResumeLayout(false); + this.groupBox15.ResumeLayout(false); + this.groupBox16.ResumeLayout(false); this.ResumeLayout(false); } @@ -688,5 +978,28 @@ private System.Windows.Forms.Button button8; private System.Windows.Forms.Button button9; private System.Windows.Forms.Button button10; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.GroupBox groupBox6; + private System.Windows.Forms.GroupBox groupBox7; + private System.Windows.Forms.GroupBox groupBox10; + private System.Windows.Forms.GroupBox groupBox13; + private System.Windows.Forms.Button button11; + private System.Windows.Forms.Button button13; + private System.Windows.Forms.Button button25; + private System.Windows.Forms.Button button31; + private System.Windows.Forms.Button button32; + private System.Windows.Forms.GroupBox groupBox14; + private System.Windows.Forms.Button button33; + private System.Windows.Forms.Button button34; + private System.Windows.Forms.GroupBox groupBox15; + private System.Windows.Forms.Button button36; + private System.Windows.Forms.GroupBox groupBox16; + private System.Windows.Forms.Button button42; + private System.Windows.Forms.Button button41; + private System.Windows.Forms.Button button35; + private System.Windows.Forms.Button button37; + private System.Windows.Forms.Button button38; + private System.Windows.Forms.Button button39; + private System.Windows.Forms.Button button40; } } diff --git a/Monitor.ChargeTest/FrmChargeResult.cs b/Monitor.ChargeTest/FrmChargeResult.cs index 1d7668f..451c46d 100644 --- a/Monitor.ChargeTest/FrmChargeResult.cs +++ b/Monitor.ChargeTest/FrmChargeResult.cs @@ -171,21 +171,7 @@ namespace Monitor.ChargeTest CmnChargerParam._CHR00TCPCLIENT.DataSended += ChargerMgrTool_DataSended; CmnChargerParam._CHR00TCPCLIENT.DataReceived += ChargerMgrTool_DataReceived; } - /// - /// 充电机断开连接 - /// - /// - /// - private void BtnCloseConnect_Click(object sender, EventArgs e) - { - if (CmnChargerParam._CHR00TCPCLIENT != null) - { - if (CmnChargerParam._CHR00TCPCLIENT.F_NetConnected) - { - CmnChargerParam._CHR00TCPCLIENT.ChargerDisConnect(); - } - } - } + /// /// 数据接收解析 @@ -229,423 +215,416 @@ namespace Monitor.ChargeTest lstBoxConnect.Invoke(MsgConnectLogCallBack, e.IsContent); } - private void FrmChargeResult_Load(object sender, EventArgs e) - { - } + #region 协议格式 /// - /// 获取充电机尖峰平谷对象值 + /// (CMD=1)后台服务器下发充电桩整形工作参数 /// - /// - private SharpPeakTimeRangeIde GetSharpPeakTimeRange() + /// + /// + private void button14_Click(object sender, EventArgs e) { - SharpPeakTimeRangeIde timeRng = new SharpPeakTimeRangeIde(); - timeRng.RecordType = 47; - timeRng.NumTimePeriods = 24; - - timeRng.StartTimePeriod1 = "00:00"; - timeRng.TimePeriodPeakIden1 = 4; - - timeRng.StartTimePeriod2 = "08:00"; - timeRng.TimePeriodPeakIden2 = 3; - - timeRng.StartTimePeriod3 = "15:00"; - timeRng.TimePeriodPeakIden3 = 2; - - timeRng.StartTimePeriod4 = "19:00"; - timeRng.TimePeriodPeakIden4 = 1; - - timeRng.StartTimePeriod5 = "22:00"; - timeRng.TimePeriodPeakIden5 = 2; - - timeRng.StartTimePeriod6 = "23:00"; - timeRng.TimePeriodPeakIden6 = 3; - - timeRng.StartTimePeriod7 = "00:00"; - timeRng.TimePeriodPeakIden7 = 4; - - timeRng.StartTimePeriod8 = "00:00"; - timeRng.TimePeriodPeakIden8 = 3; - - timeRng.StartTimePeriod9 = "00:00"; - timeRng.TimePeriodPeakIden9 = 2; - - timeRng.StartTimePeriod10 = "00:00"; - timeRng.TimePeriodPeakIden10 = 1; - - timeRng.StartTimePeriod11 = "00:00"; - timeRng.TimePeriodPeakIden11 = 2; - - timeRng.StartTimePeriod12 = "00:00"; - timeRng.TimePeriodPeakIden12 = 3; - - timeRng.StartTimePeriod13 = "00:00"; - timeRng.TimePeriodPeakIden13 = 4; - - timeRng.StartTimePeriod14 = "00:00"; - timeRng.TimePeriodPeakIden14 = 3; - - timeRng.StartTimePeriod15 = "00:00"; - timeRng.TimePeriodPeakIden15 = 2; - - timeRng.StartTimePeriod16 = "00:00"; - timeRng.TimePeriodPeakIden16 = 1; - - timeRng.StartTimePeriod17 = "00:00"; - timeRng.TimePeriodPeakIden17 = 2; - - timeRng.StartTimePeriod18 = "00:00"; - timeRng.TimePeriodPeakIden18 = 3; - - timeRng.StartTimePeriod19 = "00:00"; - timeRng.TimePeriodPeakIden19 = 4; - - timeRng.StartTimePeriod20 = "00:00"; - timeRng.TimePeriodPeakIden20 = 3; - - timeRng.StartTimePeriod21 = "00:00"; - timeRng.TimePeriodPeakIden21 = 2; - - timeRng.StartTimePeriod22 = "00:00"; - timeRng.TimePeriodPeakIden22 = 1; - - timeRng.StartTimePeriod23 = "00:00"; - timeRng.TimePeriodPeakIden23 = 2; - - timeRng.StartTimePeriod24 = "00:00"; - timeRng.TimePeriodPeakIden24 = 3; - return timeRng; + //CmnChargerParam._CHR00TCPCLIENT.Send1(); } - - /// - /// 设置充电机尖峰平谷 + /// (CMD=3)后台服务器下发充电桩字符型参数 /// /// /// - private void BtnChrg01SharpPeak_Click(object sender, EventArgs e) + private void button15_Click(object sender, EventArgs e) { - SharpPeakTimeRangeIde timeRng = GetSharpPeakTimeRange(); - CmnChargerParam._CHR00TCPCLIENT.SendPeakTimePeriod(timeRng); + //CmnChargerParam._CHR00TCPCLIENT.Send3(); } - - - /// - /// 开启充电 + /// (CMD=5)后台服务器下发充电桩控制命令 /// /// /// - private void BtnChrg01Start_Click(object sender, EventArgs e) + private void button16_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.SendRemoteStartCharing(100, 1, 3600, 0); + //CmnChargerParam._CHR00TCPCLIENT.Send5(); } - /// - /// 充电机停止充电 + /// (CMD=7)后台服务器下发充电桩开启充电控制命令 /// /// /// - private void BtnChrg01Stop_Click(object sender, EventArgs e) + private void button17_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.F_StopReason = 0; - CmnChargerParam._CHR00TCPCLIENT.F_IsCanSendStopCmd = true; - CmnChargerParam._CHR00TCPCLIENT.SendRemoteStopCmdThread(); + //CmnChargerParam._CHR00TCPCLIENT.Send7(); } - - /// - /// 充电机鉴权 + /// (CMD=9)后台服务器应答桩上传命令请求(预留) /// /// /// - private void BtnChrg01SignIn_Click(object sender, EventArgs e) + private void button18_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.SendCharingSignIn(); + //CmnChargerParam._CHR00TCPCLIENT.Send9(); } + #endregion + + #region 充电桩主动上传数据 /// - /// 监控平台应答充电启动完成帧 + /// (CMD=101)服务器应答心跳包信息 /// /// /// - private void button1_Click(object sender, EventArgs e) + private void button20_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.SendStartChargingFinishedRes(0, 0); + //CmnChargerParam._CHR00TCPCLIENT.Send101(); } /// - /// 监控平台应答充电停止完成帧 + /// /// /// /// - private void button2_Click(object sender, EventArgs e) + private void button21_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.SendStopChargingFinishedRes(0); + //CmnChargerParam._CHR00TCPCLIENT.Send103(); } + /// - /// 监控平台应答充电设备登录签到报文 + /// /// /// /// - private void button3_Click(object sender, EventArgs e) + private void button19_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.SendCharingLoginRes(); + //CmnChargerParam._CHR00TCPCLIENT.Send105(); } + /// - /// 发送功率调节指令 + /// /// /// /// - private void button6_Click(object sender, EventArgs e) + private void button22_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.SendPowerRegulate(30); + CmnChargerParam._CHR00TCPCLIENT.Send107(); } + /// - /// 下发辅源控制指令 + /// /// /// /// - private void button7_Click(object sender, EventArgs e) + private void button23_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.SendAuxiliaryPowerControl(0); + CmnChargerParam._CHR00TCPCLIENT.Send109(); } + /// - /// 下发掉线停止充电 + /// /// /// /// - private void button8_Click(object sender, EventArgs e) + private void button24_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.SendDisconnectStopCharge(1, 0); + //CmnChargerParam._CHR00TCPCLIENT.Send111(); } + /// - /// 下发站外允许充电SOC + /// /// /// /// - private void button9_Click(object sender, EventArgs e) + private void button26_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.SendOutsideAllowChargeSOC(1); + //CmnChargerParam._CHR00TCPCLIENT.Send113(); } + + #endregion + + #region 充电信息数据 /// - /// 监控平台下发版本号查询 + /// 201/221 /// /// /// - private void button5_Click(object sender, EventArgs e) + private void button13_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.SendVersionNumber(); + + //CmnChargerParam._CHR00TCPCLIENT.Send201(); } /// - /// 主动上送充电记录响应 + /// 203 /// /// /// - private void button10_Click(object sender, EventArgs e) + private void button25_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.SendRecordChargResp(0, 0); + //CmnChargerParam._CHR00TCPCLIENT.Send203(); } /// - /// 监控平台心跳应答 + /// 205 /// /// /// private void button11_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.SendCharingHeartRes(); + uint value03 = 0; uint value04 = 0; + + CmnChargerParam._CHR00TCPCLIENT.Send205( value03, value04); } /// - /// 站控查询监控网关尖峰平谷设置 + /// 207 /// /// /// - private void button13_Click(object sender, EventArgs e) + private void button31_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.SendQueryPeakTime(0); + // CmnChargerParam._CHR00TCPCLIENT.Send207(); } /// - /// 站控响应充放电机上报模块状态 + /// 209 /// /// /// - private void button4_Click(object sender, EventArgs e) + private void button32_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.SendUpModelStationResp(0); + CMD210 CMD210=new CMD210(); + string value05 = ";"; + + + CmnChargerParam._CHR00TCPCLIENT.Send209( CMD210, value05); } + #endregion - #region 协议格式 + #region 直流充电桩 BMS 信息数据(预留) /// - /// (CMD=1)后台服务器下发充电桩整形工作参数 + /// 301 /// /// /// - private void button14_Click(object sender, EventArgs e) + private void button33_Click(object sender, EventArgs e) { - //CmnChargerParam._CHR00TCPCLIENT.Send1(); + CmnChargerParam._CHR00TCPCLIENT.Send301(); } /// - /// (CMD=3)后台服务器下发充电桩字符型参数 + /// 303 /// /// /// - private void button15_Click(object sender, EventArgs e) + private void button34_Click(object sender, EventArgs e) { - //CmnChargerParam._CHR00TCPCLIENT.Send3(); + CmnChargerParam._CHR00TCPCLIENT.Send303(); } + #endregion + + #region 历史记录 /// - /// (CMD=5)后台服务器下发充电桩控制命令 + /// 401 /// /// /// - private void button16_Click(object sender, EventArgs e) + private void button36_Click(object sender, EventArgs e) { - //CmnChargerParam._CHR00TCPCLIENT.Send5(); + string chargingSerialNum= ""; uint startIndex = 0; + + CmnChargerParam._CHR00TCPCLIENT.Send401( chargingSerialNum, startIndex); } + #endregion + + #region 升级命令 /// - /// (CMD=7)后台服务器下发充电桩开启充电控制命令 + /// 1001 /// /// /// - private void button17_Click(object sender, EventArgs e) + private void button38_Click(object sender, EventArgs e) { - //CmnChargerParam._CHR00TCPCLIENT.Send7(); + int instruct = 0; + + CmnChargerParam._CHR00TCPCLIENT.Send1001(instruct); } /// - /// (CMD=9)后台服务器应答桩上传命令请求(预留) + /// 1003 /// /// /// - private void button18_Click(object sender, EventArgs e) + private void button39_Click(object sender, EventArgs e) { - //CmnChargerParam._CHR00TCPCLIENT.Send9(); - } - #endregion + string fileName = ""; - #region 充电桩主动上传数据 + + CmnChargerParam._CHR00TCPCLIENT.Send1003(fileName); + } /// - /// (CMD=101)服务器应答心跳包信息 + /// 1005 /// /// /// - private void button20_Click(object sender, EventArgs e) + private void button37_Click(object sender, EventArgs e) { - //CmnChargerParam._CHR00TCPCLIENT.Send101(); + uint fileLen = 0; + + + CmnChargerParam._CHR00TCPCLIENT.Send1005(fileLen); } /// - /// + /// 1007 /// /// /// - private void button21_Click(object sender, EventArgs e) + private void button40_Click(object sender, EventArgs e) { - //CmnChargerParam._CHR00TCPCLIENT.Send103(); - } + string updata = ""; + CmnChargerParam._CHR00TCPCLIENT.Send1007(updata); + } /// - /// + /// 1009 /// /// /// - private void button19_Click(object sender, EventArgs e) + private void button35_Click(object sender, EventArgs e) { - //CmnChargerParam._CHR00TCPCLIENT.Send105(); + CmnChargerParam._CHR00TCPCLIENT.Send1009(); } - /// - /// + /// 1011 /// /// /// - private void button22_Click(object sender, EventArgs e) + private void button41_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.Send107(); + CmnChargerParam._CHR00TCPCLIENT.Send1011(); } - /// - /// + /// 1021 /// /// /// - private void button23_Click(object sender, EventArgs e) + private void button42_Click(object sender, EventArgs e) { - CmnChargerParam._CHR00TCPCLIENT.Send109(); + uint results = 0; string description=""; + + CmnChargerParam._CHR00TCPCLIENT.Send1021( results, description); } + #endregion + #region 与计费策略相关的指令 /// - /// + /// 1101 /// /// /// - private void button24_Click(object sender, EventArgs e) + private void button1_Click(object sender, EventArgs e) { - //CmnChargerParam._CHR00TCPCLIENT.Send111(); + CmnChargerParam._CHR00TCPCLIENT.Send1101(); } - /// - /// + /// 1103 /// /// /// - private void button26_Click(object sender, EventArgs e) + private void button2_Click(object sender, EventArgs e) { - //CmnChargerParam._CHR00TCPCLIENT.Send113(); - } + CMD1103 cMD1103 = new CMD1103(); - #endregion - - #region 充电信息数据 - private void button27_Click(object sender, EventArgs e) - { - //CmnChargerParam._CHR00TCPCLIENT.Send201(); - } - private void button12_Click(object sender, EventArgs e) - { - //CmnChargerParam._CHR00TCPCLIENT.Send203(); + CmnChargerParam._CHR00TCPCLIENT.Send1103(cMD1103); } - - private void button28_Click(object sender, EventArgs e) + /// + /// 1105 + /// + /// + /// + private void button3_Click(object sender, EventArgs e) { - //CmnChargerParam._CHR00TCPCLIENT.Send205(); - } + CMD1105 cMD1105 = new CMD1105(); - private void button29_Click(object sender, EventArgs e) - { - //CmnChargerParam._CHR00TCPCLIENT.Send207(); + CmnChargerParam._CHR00TCPCLIENT.Send1105(cMD1105); } - - private void button30_Click(object sender, EventArgs e) + /// + /// 1107 + /// + /// + /// + private void button4_Click(object sender, EventArgs e) { - //CmnChargerParam._CHR00TCPCLIENT.Send209(); + CmnChargerParam._CHR00TCPCLIENT.Send1107(); } - #endregion - #region 直流充电桩 BMS 信息数据(预留) #endregion - #region 历史记录 + #region 白名单报文 + /// + /// 1301 + /// + /// + /// + private void button5_Click(object sender, EventArgs e) + { + CMD1301 cMD1301 = new CMD1301(); + CmnChargerParam._CHR00TCPCLIENT.Send1301(cMD1301); + } #endregion - #region 升级命令 - - #endregion + #region FTP 远程升级和 FTP 方式日志上传 + /// + /// 1401 + /// + /// + /// + private void button6_Click(object sender, EventArgs e) + { + CMD1401 cMD1401 = new CMD1401(); - #region 与计费策略相关的指令 + CmnChargerParam._CHR00TCPCLIENT.Send1401(cMD1401); + } + /// + /// 1406 + /// + /// + /// + private void button7_Click(object sender, EventArgs e) + { + CMD1406 cMD1406 = new CMD1406(); + CmnChargerParam._CHR00TCPCLIENT.Send1406(cMD1406); + } #endregion - #region 白名单报文 - - #endregion + #region 协议方式日志上传 + /// + /// 1502 + /// + /// + /// + private void button8_Click(object sender, EventArgs e) + { + ushort responseCode = 0; - #region FTP 远程升级和 FTP 方式日志上传 - #endregion + CmnChargerParam._CHR00TCPCLIENT.Send1502(responseCode); + } + /// + /// 1504 + /// + /// + /// + private void button9_Click(object sender, EventArgs e) + { + uint logo = 0; + uint successReservedMessageNum = 0; - #region 协议方式日志上传 + CmnChargerParam._CHR00TCPCLIENT.Send1504(logo, successReservedMessageNum); + } + /// + /// 1506 + /// + /// + /// + private void button10_Click(object sender, EventArgs e) + { + CmnChargerParam._CHR00TCPCLIENT.Send1506(); + } #endregion } diff --git a/Monitor.ChargeTest/Program.cs b/Monitor.ChargeTest/Program.cs index 8032808..0784eb3 100644 --- a/Monitor.ChargeTest/Program.cs +++ b/Monitor.ChargeTest/Program.cs @@ -1,3 +1,4 @@ +using CommonClass; using System; using System.Collections.Generic; using System.Linq; @@ -14,6 +15,8 @@ namespace Monitor.ChargeTest [STAThread] static void Main() { + new PubCommonClass().SetCmd3StartAddress(); + Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FrmChargeResult());