yhluo 4 viikkoa sitten
vanhempi
commit
d48455e176
1 muutettua tiedostoa jossa 26 lisäystä ja 18 poistoa
  1. 26 18
      UAS_MES_HYSX/FunctionCode/Make/Make_WirelessThroughput.cs

+ 26 - 18
UAS_MES_HYSX/FunctionCode/Make/Make_WirelessThroughput.cs

@@ -58,6 +58,11 @@ namespace UAS_MES_NEW.Make
             {
                 IPList.Text = IPList.Text + ":5001";
             }
+
+            if (!ProductList.Text.Contains(":"))
+            {
+                ProductList.Text = ProductList.Text + ":23";
+            }
         }
 
         private void SN_KeyDown(object sender, KeyEventArgs e)
@@ -77,21 +82,19 @@ namespace UAS_MES_NEW.Make
             UpdateSN("L", SN.Text.Trim());
 
             ShowMsg(1, $"开始测试");
+
+            int cSPort = Convert.ToInt32(ProductList.Text.Trim().Split(':')[1]);
             int iSPort = Convert.ToInt32(IPList.Text.Trim().Split(':')[1]);
             var tester = new CameraIperfTester(
                 timeOut: TestTime.Text.Trim(),
-                cameraIp: ProductList.Text.Trim(),
-                cameraPort: 23,
+                cameraIp: ProductList.Text.Trim().Split(':')[0],
+                cameraPort: cSPort,
                 username: Account.Text.Trim(),
                 password: ProductList.Text.Trim(),
                 iperfServerIp: IPList.Text.Trim().Split(':')[0],
                 iperfServerPort: iSPort
             );
 
-            /*string upRate = tester.ParseIperfBitrate("C:\\Users\\MI\\Desktop\\testEquiment\\吞吐量\\251017010;13629_down.log");
-            string downRate = tester.ParseIperfBitrate("C:\\Users\\MI\\Desktop\\testEquiment\\吞吐量\\251017010;13629_down.log");
-            Console.WriteLine();*/
-
             string Msg = tester.TelnetConnect();
             if (Msg.Substring(0, 2) != "OK")
             {
@@ -108,14 +111,16 @@ namespace UAS_MES_NEW.Make
             }
 
             //string[] comList = new string[] {
-            //    "killall iperf3_mstar",
-            //    "cp /mnt/tf/usb1_1/iperf3_mstar/var/tmp/ -f",
-            //    "chmod a+x /var/tmp/iperf3_mstar",
-            //    $"/var/tmp/iperf3_mstar -s -p {iSPort} -i 1 &"
+            //    "killall iperf3",
+            //    $"iperf3 -s -p {iSPort} -i 1&"
             //};
+
             string[] comList = new string[] {
-                $"iperf3 -s -p {iSPort} -i 1&"
-            };
+                "cd /tmp/",
+                "ls iperf3_mstar",
+                "chmod a+x iperf3_mstar",
+                $"iperf3 -s -p {iSPort} -i 1 &"
+        };
 
             Msg = tester.StartIperfTest(SN.Text.Trim(), ExePath.Text.Trim(), logsPath, comList);
             if (Msg.Substring(0, 2) != "OK")
@@ -123,7 +128,7 @@ namespace UAS_MES_NEW.Make
                 ShowMsg(0, $"iperf3启动失败,{Msg}");
                 return;
             }
-            string upRate = Msg.Split('|')[0];
+            string upRate = Msg.Split('|')[0].Split(',')[1];
             string downRate = Msg.Split('|')[1];
             ShowMsg(1, $"OK,上行速率: {upRate},下行速率: {downRate}");
             ResMax.Text = upRate;
@@ -296,8 +301,11 @@ namespace UAS_MES_NEW.Make
                     string upLog = Path.Combine(logDirectory, $"{SN}_up.log");
                     string downLog = Path.Combine(logDirectory, $"{SN}_down.log");
 
-                    RunIperfClient($"-c {cameraIp} -p {iperfServerPort} -t 10 -w 1M -i 1 -P 8 -R", iperfPath, upLog);
-                    RunIperfClient($"-c {cameraIp} -p {iperfServerPort} -t 10 -w 1M -i 1 -P 8", iperfPath, downLog);
+                    //RunIperfClient($"-c {cameraIp} -p {iperfServerPort} -t 10 -w 1M -i 1 -P 8 -R", iperfPath, upLog);
+                    //RunIperfClient($"-c {cameraIp} -p {iperfServerPort} -t 10 -w 1M -i 1 -P 8", iperfPath, downLog);
+
+                    RunIperfClient($"./iperf3_mstar -c {cameraIp} -p {iperfServerPort} -i l -b 100M -t 10 -R", iperfPath, upLog);
+                    RunIperfClient($"./iperf3_mstar -c {cameraIp} -p {iperfServerPort} -i l -b 100M -t 10", iperfPath, downLog);
 
                     string upRate = ParseIperfBitrate(upLog);
                     string downRate = ParseIperfBitrate(downLog);
@@ -408,10 +416,10 @@ namespace UAS_MES_NEW.Make
                         rVal2 = match.Groups[2].Value;
                     }
                 }
-                double num1 = (double.Parse(sVal1.Split(' ')[0]) + double.Parse(rVal1.Split(' ')[0])) / 2;
-                double num2 = (double.Parse(sVal2.Split(' ')[0]) + double.Parse(rVal2.Split(' ')[0])) / 2;
+                //double num1 = (double.Parse(sVal1.Split(' ')[0]) + double.Parse(rVal1.Split(' ')[0])) / 2;
+                //double num2 = (double.Parse(sVal2.Split(' ')[0]) + double.Parse(rVal2.Split(' ')[0])) / 2;
 
-                return num2.ToString() + rVal2.Split(' ')[1];
+                return rVal2;
             }
 
             private void WriteStream(NetworkStream stream, string text)