|
|
@@ -34,6 +34,8 @@ namespace UAS_MES_NEW.Make
|
|
|
DataTable dt;
|
|
|
DataHelper dh;
|
|
|
|
|
|
+ string telnetPort;
|
|
|
+
|
|
|
private void Make_WirelessThroughput_Load(object sender, EventArgs e)
|
|
|
{
|
|
|
dh = SystemInf.dh;
|
|
|
@@ -54,16 +56,23 @@ namespace UAS_MES_NEW.Make
|
|
|
{
|
|
|
ShowMsg(0, $"获取iperf服务器地址失败,{ex.Message}");
|
|
|
}
|
|
|
-
|
|
|
if (!IPList.Text.Contains(":"))
|
|
|
{
|
|
|
IPList.Text = IPList.Text + ":5021";
|
|
|
}
|
|
|
|
|
|
- if (!ProductList.Text.Contains(":"))
|
|
|
- {
|
|
|
- ProductList.Text = ProductList.Text + ":23";
|
|
|
- }
|
|
|
+ telnetPort = "23";
|
|
|
+
|
|
|
+ //if (!ProductList.Text.Contains(":"))
|
|
|
+ //{
|
|
|
+ // ProductList.Text = ProductList.Text + ":23";
|
|
|
+ //}
|
|
|
+
|
|
|
+ Locat1.Visible = false;
|
|
|
+ Locat2.Visible = false;
|
|
|
+ Locat3.Visible = false;
|
|
|
+ Radio1.Visible = false;
|
|
|
+ Radio2.Visible = false;
|
|
|
}
|
|
|
|
|
|
private void SN_KeyDown(object sender, KeyEventArgs e)
|
|
|
@@ -73,21 +82,32 @@ namespace UAS_MES_NEW.Make
|
|
|
if (IPList.Text.IndexOf(':') > 0) IPList.Text = IPList.Text.Replace(":", ":");
|
|
|
else IPList.Text = IPList.Text.Trim();
|
|
|
|
|
|
- if (IsCheckSet()) return;
|
|
|
-
|
|
|
SN.Text = SN.Text.Trim().Replace(";", ";");
|
|
|
string sn = SN.Text.Trim();
|
|
|
|
|
|
+
|
|
|
+ SQL.Clear();
|
|
|
+ SQL.Append($"SELECT pr_test_account,pr_test_password FROM makeserial,product WHERE ms_sncode = '{sn}' AND ms_prodcode = pr_code");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(SQL.ToString(), "select");
|
|
|
+ if (dt.Rows.Count == 0)
|
|
|
+ {
|
|
|
+ ShowMsg(0, $"序列号:{sn}未维护吞吐量测试账户密码");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Account.Text = dt.Rows[0]["pr_test_account"].ToString();
|
|
|
+ Password.Text = dt.Rows[0]["pr_test_password"].ToString();
|
|
|
+
|
|
|
+ if (IsCheckSet()) return;
|
|
|
+
|
|
|
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().Split(':')[0],
|
|
|
- cameraPort: cSPort,
|
|
|
+ cameraPort: Convert.ToInt32(telnetPort),
|
|
|
username: Account.Text.Trim(),
|
|
|
password: Password.Text.Trim(),
|
|
|
iperfServerIp: IPList.Text.Trim().Split(':')[0],
|
|
|
@@ -345,41 +365,65 @@ namespace UAS_MES_NEW.Make
|
|
|
try
|
|
|
{
|
|
|
StringBuilder streamTxt = new StringBuilder();
|
|
|
+ string upRate, downRate, cmdLog, upLog, downLog;
|
|
|
|
|
|
- //string[] comList = new string[] {
|
|
|
- // "killall iperf3",
|
|
|
- // $"iperf3 -s -p {iSPort} -i 1&"
|
|
|
- //};
|
|
|
+ if (username.ToUpper() == "ROOT")
|
|
|
+ {
|
|
|
+ WriteStream(_telnetStream, "killall iperf3");
|
|
|
+ streamTxt.Append(ReadStream(_telnetStream));
|
|
|
+ Thread.Sleep(500);
|
|
|
|
|
|
- WriteStream(_telnetStream, "killall iperf3_mstar");
|
|
|
- streamTxt.Append(ReadStream(_telnetStream));
|
|
|
- Thread.Sleep(200);
|
|
|
+ WriteStream(_telnetStream, $"iperf3 -s -p {iperfServerPort} -i 1&");
|
|
|
+ streamTxt.Append(ReadStream(_telnetStream));
|
|
|
+ Thread.Sleep(500);
|
|
|
|
|
|
- WriteStream(_telnetStream, "cp /mnt/tf/usb1_1/iperf3_mstar /var/tmp/ -f");
|
|
|
- streamTxt.Append(ReadStream(_telnetStream));
|
|
|
- Thread.Sleep(200);
|
|
|
+ cmdLog = Path.Combine(logDirectory, $"{SN}_CMD.log");
|
|
|
+ File.WriteAllText(cmdLog, streamTxt.ToString());
|
|
|
|
|
|
- WriteStream(_telnetStream, "chmod a+x /var/tmp/iperf3_mstar");
|
|
|
- streamTxt.Append(ReadStream(_telnetStream));
|
|
|
- Thread.Sleep(200);
|
|
|
+ upLog = Path.Combine(logDirectory, $"{SN}_up.log");
|
|
|
+ downLog = Path.Combine(logDirectory, $"{SN}_down.log");
|
|
|
|
|
|
- WriteStream(_telnetStream, $"/var/tmp/iperf3_mstar -s -p {iperfServerPort} -i 1 &");
|
|
|
- streamTxt.Append(ReadStream(_telnetStream));
|
|
|
+ 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);
|
|
|
|
|
|
- string cmdLog = Path.Combine(logDirectory, $"{SN}_CMD.log");
|
|
|
- File.WriteAllText(cmdLog, streamTxt.ToString());
|
|
|
+ upRate = ParseIperfBitrate(upLog);
|
|
|
+ downRate = ParseIperfBitrate(downLog);
|
|
|
|
|
|
- string upLog = Path.Combine(logDirectory, $"{SN}_up.log");
|
|
|
- string downLog = Path.Combine(logDirectory, $"{SN}_down.log");
|
|
|
+ Close();
|
|
|
+ return $"OK,{upRate}|{downRate}";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ WriteStream(_telnetStream, "killall iperf3_mstar");
|
|
|
+ streamTxt.Append(ReadStream(_telnetStream));
|
|
|
+ Thread.Sleep(500);
|
|
|
|
|
|
- RunIperfClient($"/var/tmp/iperf3 -c {cameraIp} -p {iperfServerPort} -t 6 -w 1M -i 1 -l 1518 -P 8 -R", iperfPath, upLog);
|
|
|
- RunIperfClient($"/var/tmp/iperf3 -c {cameraIp} -p {iperfServerPort} -t 6 -w 1M -i 1 -l 1518 -P 8", iperfPath, downLog);
|
|
|
+ WriteStream(_telnetStream, "cp /mnt/tf/usb1_1/iperf3_mstar /var/tmp/ -f");
|
|
|
+ streamTxt.Append(ReadStream(_telnetStream));
|
|
|
+ Thread.Sleep(500);
|
|
|
|
|
|
- string upRate = ParseIperfBitrate(upLog);
|
|
|
- string downRate = ParseIperfBitrate(downLog);
|
|
|
+ WriteStream(_telnetStream, "chmod a+x /var/tmp/iperf3_mstar");
|
|
|
+ streamTxt.Append(ReadStream(_telnetStream));
|
|
|
+ Thread.Sleep(500);
|
|
|
|
|
|
- Close();
|
|
|
- return $"OK,{upRate}|{downRate}";
|
|
|
+ WriteStream(_telnetStream, $"/var/tmp/iperf3_mstar -s -p {iperfServerPort} -i 1 &");
|
|
|
+ streamTxt.Append(ReadStream(_telnetStream));
|
|
|
+
|
|
|
+ cmdLog = Path.Combine(logDirectory, $"{SN}_CMD.log");
|
|
|
+ File.WriteAllText(cmdLog, streamTxt.ToString());
|
|
|
+
|
|
|
+ upLog = Path.Combine(logDirectory, $"{SN}_up.log");
|
|
|
+ downLog = Path.Combine(logDirectory, $"{SN}_down.log");
|
|
|
+
|
|
|
+ RunIperfClient($"/var/tmp/iperf3 -c {cameraIp} -p {iperfServerPort} -t 6 -w 1M -i 1 -l 1518 -P 8 -R", iperfPath, upLog);
|
|
|
+ RunIperfClient($"/var/tmp/iperf3 -c {cameraIp} -p {iperfServerPort} -t 6 -w 1M -i 1 -l 1518 -P 8", iperfPath, downLog);
|
|
|
+
|
|
|
+ upRate = ParseIperfBitrate(upLog);
|
|
|
+ downRate = ParseIperfBitrate(downLog);
|
|
|
+
|
|
|
+ Close();
|
|
|
+ return $"OK,{upRate}|{downRate}";
|
|
|
+ }
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|