|
|
@@ -53,6 +53,11 @@ namespace UAS_MES_NEW.Make
|
|
|
{
|
|
|
ShowMsg(0, $"获取iperf服务器地址失败,{ex.Message}");
|
|
|
}
|
|
|
+
|
|
|
+ if (!IPList.Text.Contains(":"))
|
|
|
+ {
|
|
|
+ IPList.Text = IPList.Text + ":5001";
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void SN_KeyDown(object sender, KeyEventArgs e)
|
|
|
@@ -70,7 +75,7 @@ namespace UAS_MES_NEW.Make
|
|
|
else SN.Text = sn;
|
|
|
|
|
|
UpdateSN("L", SN.Text.Trim());
|
|
|
-
|
|
|
+
|
|
|
ShowMsg(1, $"开始测试");
|
|
|
int iSPort = Convert.ToInt32(IPList.Text.Trim().Split(':')[1]);
|
|
|
var tester = new CameraIperfTester(
|
|
|
@@ -83,6 +88,10 @@ namespace UAS_MES_NEW.Make
|
|
|
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")
|
|
|
{
|
|
|
@@ -119,9 +128,10 @@ namespace UAS_MES_NEW.Make
|
|
|
ShowMsg(1, $"OK,上行速率: {upRate},下行速率: {downRate}");
|
|
|
ResMax.Text = upRate;
|
|
|
ResMin.Text = downRate;
|
|
|
- CheckPassStation(SN.Text, upRate, downRate, "PASS");
|
|
|
+ string tDetail = $"upRate/{upRate};downRate/{downRate}";
|
|
|
+ CheckPassStation(SN.Text, upRate, downRate, "PASS", tDetail);
|
|
|
}
|
|
|
- private void CheckPassStation(string sn, string upRate, string downRate, string testRes)
|
|
|
+ private void CheckPassStation(string sn, string upRate, string downRate, string testRes,string testDetail)
|
|
|
{
|
|
|
string oWO, oWOId, oErrMsg = "";
|
|
|
if (LogicHandler.CheckStepSNAndMacode(workOrder.Text, User.UserSourceCode, sn, User.UserCode, out oWO, out oWOId, out oErrMsg))
|
|
|
@@ -137,7 +147,7 @@ namespace UAS_MES_NEW.Make
|
|
|
param.Add("");
|
|
|
param.Add("");
|
|
|
param.Add("WirelessThroughput");
|
|
|
- param.Add("");
|
|
|
+ param.Add(testDetail);
|
|
|
param.Add(outMsg);
|
|
|
string[] paramList = param.ToArray();
|
|
|
dh.CallProcedure("cs_insert_testrejects", ref paramList);
|
|
|
@@ -255,6 +265,9 @@ namespace UAS_MES_NEW.Make
|
|
|
|
|
|
private TcpClient _telnetClient;
|
|
|
private NetworkStream _telnetStream;
|
|
|
+
|
|
|
+ string sVal1, sVal2, rVal1, rVal2;
|
|
|
+
|
|
|
public CameraIperfTester(string timeOut, string cameraIp, int cameraPort, string username, string password, string iperfServerIp, int iperfServerPort)
|
|
|
{
|
|
|
this.timeOut = Convert.ToInt32(timeOut) * 1000;
|
|
|
@@ -363,7 +376,7 @@ namespace UAS_MES_NEW.Make
|
|
|
File.WriteAllText(logPath, output + Environment.NewLine + error);
|
|
|
}
|
|
|
}
|
|
|
- private string ParseIperfBitrate(string logPath)
|
|
|
+ public string ParseIperfBitrate(string logPath)
|
|
|
{
|
|
|
if (!File.Exists(logPath)) return "0.0";
|
|
|
|
|
|
@@ -376,17 +389,29 @@ namespace UAS_MES_NEW.Make
|
|
|
logItem.Add(line);
|
|
|
}
|
|
|
}
|
|
|
- if(logItem.Count > 0 && logItem[logItem.Count].Contains("receiver"))
|
|
|
+
|
|
|
+ if (logItem.Count > 0 && logItem[logItem.Count - 2].Contains("sender"))
|
|
|
{
|
|
|
- var matches = Regex.Matches(logItem[logItem.Count], @"(\d+\.?\d*)\s+(?:MBytes|Mbits/sec)");
|
|
|
- if (matches.Count >= 2)
|
|
|
+ var match = Regex.Match(logItem[logItem.Count - 2], @"(\d+\.\d+\s+MBytes).*?(\d+\.\d+\s+Mbits/sec)");
|
|
|
+ if (match.Success)
|
|
|
{
|
|
|
- double value1 = double.Parse(matches[0].Groups[1].Value);
|
|
|
- double value2 = double.Parse(matches[1].Groups[1].Value);
|
|
|
- return value2.ToString();
|
|
|
+ sVal1 = match.Groups[1].Value;
|
|
|
+ sVal2 = match.Groups[2].Value;
|
|
|
}
|
|
|
}
|
|
|
- return "0.0";
|
|
|
+ if (logItem.Count > 0 && logItem[logItem.Count -1].Contains("receiver"))
|
|
|
+ {
|
|
|
+ var match = Regex.Match(logItem[logItem.Count - 1], @"(\d+\.\d+\s+MBytes).*?(\d+\.\d+\s+Mbits/sec)");
|
|
|
+ if (match.Success)
|
|
|
+ {
|
|
|
+ rVal1 = match.Groups[1].Value;
|
|
|
+ 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;
|
|
|
+
|
|
|
+ return num2.ToString() + rVal2.Split(' ')[1];
|
|
|
}
|
|
|
|
|
|
private void WriteStream(NetworkStream stream, string text)
|