|
@@ -41,6 +41,13 @@ namespace Bird_tool
|
|
TestSingle
|
|
TestSingle
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 设备类型
|
|
|
|
+ public enum DeviceType
|
|
|
|
+ {
|
|
|
|
+ FANYUE_DEVICE,
|
|
|
|
+ LEWEI_DEVICE
|
|
|
|
+ }
|
|
|
|
+
|
|
public partial class bird_tool : Form
|
|
public partial class bird_tool : Form
|
|
{
|
|
{
|
|
private SerialManager _serialManager = new SerialManager();//定义串口
|
|
private SerialManager _serialManager = new SerialManager();//定义串口
|
|
@@ -52,31 +59,27 @@ namespace Bird_tool
|
|
|
|
|
|
// 是否加载了配置
|
|
// 是否加载了配置
|
|
private AppConfig appConfig = ConfigManager.LoadConfig();
|
|
private AppConfig appConfig = ConfigManager.LoadConfig();
|
|
- private bool flag_load_config = false;
|
|
|
|
- // 是否选择串口
|
|
|
|
- private bool flag_selected_serial = false;
|
|
|
|
|
|
+
|
|
private static LogLevel show_log_level = LogLevel.info;
|
|
private static LogLevel show_log_level = LogLevel.info;
|
|
private static StringBuilder logBuilder = new StringBuilder();
|
|
private static StringBuilder logBuilder = new StringBuilder();
|
|
|
|
|
|
private static ExcelDataManager m_excel_manager;
|
|
private static ExcelDataManager m_excel_manager;
|
|
private string m_config_uuid = "";
|
|
private string m_config_uuid = "";
|
|
-
|
|
|
|
|
|
|
|
|
|
+ private bool SetWifi = false;
|
|
|
|
+ private bool allow_hw_test = false;
|
|
private bool result_success = false;
|
|
private bool result_success = false;
|
|
private string result_msg = "";
|
|
private string result_msg = "";
|
|
private TestMode m_test_mode = TestMode.none;
|
|
private TestMode m_test_mode = TestMode.none;
|
|
|
|
+ private DeviceType m_device_type = DeviceType.LEWEI_DEVICE;
|
|
|
|
|
|
- private string AppConfigPath = "";
|
|
|
|
-
|
|
|
|
- private bool SetWifi = false;
|
|
|
|
|
|
+ private string test_tool_passwd = "szhfy";
|
|
private string wifi_ssid = "";
|
|
private string wifi_ssid = "";
|
|
private string wifi_password = "";
|
|
private string wifi_password = "";
|
|
private string wifi_act = "hfyswj100";
|
|
private string wifi_act = "hfyswj100";
|
|
private string sd_act = "hfyswj188";
|
|
private string sd_act = "hfyswj188";
|
|
private string debug_passwd = "hfyswj100";
|
|
private string debug_passwd = "hfyswj100";
|
|
-
|
|
|
|
- private string excel_path = "test.xlsx";
|
|
|
|
- private string excel_primary_key = "uuid";
|
|
|
|
|
|
+
|
|
|
|
|
|
private string hw_test_csv_path = "TestReport/report.csv";
|
|
private string hw_test_csv_path = "TestReport/report.csv";
|
|
private string config_csv_path = "ConfigReport/report.csv";
|
|
private string config_csv_path = "ConfigReport/report.csv";
|
|
@@ -301,11 +304,46 @@ namespace Bird_tool
|
|
|
|
|
|
_uart_ui_change(false);
|
|
_uart_ui_change(false);
|
|
SerialPort_Load();
|
|
SerialPort_Load();
|
|
-
|
|
|
|
- _imageSharpnessServer = new ImageSharpnessServer("*", appConfig.web_port);
|
|
|
|
- _ip_ui_change();
|
|
|
|
|
|
+
|
|
|
|
+ // 判断是什么厂商的设备配置模式
|
|
|
|
+ if (appConfig.c_dev_key == "fy")
|
|
|
|
+ {
|
|
|
|
+ m_device_type = DeviceType.FANYUE_DEVICE;
|
|
|
|
+ Log($"梵悦观鸟器配置工具启动中");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ m_device_type = DeviceType.LEWEI_DEVICE;
|
|
|
|
+ Log($"观鸟器配置工具启动中");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 判断是否显示硬件测试按钮
|
|
|
|
+ if (appConfig.enable_hw_test)
|
|
|
|
+ {
|
|
|
|
+ if (test_tool_passwd == appConfig.test_tool_passwd)
|
|
|
|
+ {
|
|
|
|
+ allow_hw_test = true;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ Log($"无法启用硬件配置功能! 工具密码错误", LogLevel.error);
|
|
|
|
+ allow_hw_test = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ Log($"不启用硬件配置功能! 可在配置文件中进行调整");
|
|
|
|
+ allow_hw_test = false;
|
|
|
|
+ }
|
|
|
|
+ // 控制ui界面用于是否显示硬件测试按钮
|
|
|
|
+ ui_show_hw(allow_hw_test);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
if (appConfig.enable_local_server)
|
|
if (appConfig.enable_local_server)
|
|
{
|
|
{
|
|
|
|
+ _imageSharpnessServer = new ImageSharpnessServer("*", appConfig.web_port);
|
|
|
|
+ _ip_ui_change();
|
|
if (_imageSharpnessServer.Start())
|
|
if (_imageSharpnessServer.Start())
|
|
{
|
|
{
|
|
Log_show($"网络服务已经启动, localhost:{appConfig.web_port}");
|
|
Log_show($"网络服务已经启动, localhost:{appConfig.web_port}");
|
|
@@ -315,6 +353,11 @@ namespace Bird_tool
|
|
Log_show($"网络服务启动失败, 请用管理员模式启动或者更换端口");
|
|
Log_show($"网络服务启动失败, 请用管理员模式启动或者更换端口");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
//_serialManager.OnLineReceived += _handle_received_line;
|
|
//_serialManager.OnLineReceived += _handle_received_line;
|
|
_serialManager.OnDisconnect += (isError) =>
|
|
_serialManager.OnDisconnect += (isError) =>
|
|
{
|
|
{
|
|
@@ -334,6 +377,8 @@ namespace Bird_tool
|
|
|
|
|
|
if (appConfig.enable_excel_load)
|
|
if (appConfig.enable_excel_load)
|
|
{
|
|
{
|
|
|
|
+ Log($"启用excel文件,尝试加载excel文件中 {appConfig.excel_path}");
|
|
|
|
+
|
|
m_excel_manager = new ExcelDataManager(appConfig);
|
|
m_excel_manager = new ExcelDataManager(appConfig);
|
|
m_excel_manager.OnLog += Log;
|
|
m_excel_manager.OnLog += Log;
|
|
m_excel_manager.OnLogShow += Log_show;
|
|
m_excel_manager.OnLogShow += Log_show;
|
|
@@ -343,24 +388,22 @@ namespace Bird_tool
|
|
Log_show("excel 文件加载失败, 将禁用ecxel相关功能");
|
|
Log_show("excel 文件加载失败, 将禁用ecxel相关功能");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ Log($"不使用excel加载, 仅使用基础检测功能");
|
|
|
|
+ Log($"如果需要使用excel配置功能, 请在配置文件{ConfigManager.getConfigPath()}中进行配置");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
private void load_app_config()
|
|
private void load_app_config()
|
|
{
|
|
{
|
|
- Log($"加载配置文件 {ConfigManager.getConfigPath()}");
|
|
|
|
|
|
+ Log($"观鸟器启动中, 正在加载配置文件 {ConfigManager.getConfigPath()}");
|
|
appConfig = ConfigManager.LoadConfig();
|
|
appConfig = ConfigManager.LoadConfig();
|
|
|
|
+
|
|
wifi_ssid = appConfig.wifi_ssid;
|
|
wifi_ssid = appConfig.wifi_ssid;
|
|
wifi_password = appConfig.wifi_passwd;
|
|
wifi_password = appConfig.wifi_passwd;
|
|
txt_ssid.Text = wifi_ssid;
|
|
txt_ssid.Text = wifi_ssid;
|
|
txt_password.Text = wifi_password;
|
|
txt_password.Text = wifi_password;
|
|
- if (appConfig.enable_excel_load)
|
|
|
|
- {
|
|
|
|
- Log($"启用excel文件,尝试加载excel文件中 {appConfig.excel_path}");
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- Log($"不使用excel加载, 仅使用基础检测功能");
|
|
|
|
- Log($"如果需要使用excel配置功能, 请在配置文件{ConfigManager.getConfigPath()}中进行配置");
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
private void SerialPort_Load()
|
|
private void SerialPort_Load()
|
|
@@ -704,6 +747,10 @@ namespace Bird_tool
|
|
{
|
|
{
|
|
this.el_btn_sd_test.Visible = isShow;
|
|
this.el_btn_sd_test.Visible = isShow;
|
|
}
|
|
}
|
|
|
|
+ private void ui_show_hw(bool isShow)
|
|
|
|
+ {
|
|
|
|
+ this.el_btn_hw_test.Visible = isShow;
|
|
|
|
+ }
|
|
private void ui_hide_start_panpel()
|
|
private void ui_hide_start_panpel()
|
|
{
|
|
{
|
|
tableLayoutPanel.Visible = false;
|
|
tableLayoutPanel.Visible = false;
|
|
@@ -739,7 +786,6 @@ namespace Bird_tool
|
|
// device mac
|
|
// device mac
|
|
private void hw_test()
|
|
private void hw_test()
|
|
{
|
|
{
|
|
-
|
|
|
|
var steps = CreateTestSteps();
|
|
var steps = CreateTestSteps();
|
|
if (!_testExecutor.InitTest(steps))
|
|
if (!_testExecutor.InitTest(steps))
|
|
{
|
|
{
|
|
@@ -791,7 +837,7 @@ namespace Bird_tool
|
|
|
|
|
|
Log($"[{DateTime.Now}] 格式化sd卡");
|
|
Log($"[{DateTime.Now}] 格式化sd卡");
|
|
}
|
|
}
|
|
- private string ask_query_id()
|
|
|
|
|
|
+ private string ask_query_id(string id_text = "uuid")
|
|
{
|
|
{
|
|
string deviceId = "";
|
|
string deviceId = "";
|
|
while (true) // 使用循环代替递归
|
|
while (true) // 使用循环代替递归
|
|
@@ -802,15 +848,18 @@ namespace Bird_tool
|
|
return "";
|
|
return "";
|
|
}
|
|
}
|
|
|
|
|
|
- using (var idDialog = new IdInputDialog("请输入uuid"))
|
|
|
|
|
|
+ using (var idDialog = new IdInputDialog($"请输入{id_text}"))
|
|
{
|
|
{
|
|
if (idDialog.ShowDialog() == DialogResult.OK)
|
|
if (idDialog.ShowDialog() == DialogResult.OK)
|
|
{
|
|
{
|
|
deviceId = idDialog.EnteredId;
|
|
deviceId = idDialog.EnteredId;
|
|
var row = m_excel_manager.GetRowByKey(deviceId);
|
|
var row = m_excel_manager.GetRowByKey(deviceId);
|
|
|
|
+ string error_msg = $"{id_text}异常, 请重新输入或者检查excel文件";
|
|
if (row == null)
|
|
if (row == null)
|
|
{
|
|
{
|
|
- StopTest(false, "uuid异常, 请重新输入或者检查excel文件");
|
|
|
|
|
|
+ StopTest(false, error_msg);
|
|
|
|
+ progressPanel.Message = error_msg;
|
|
|
|
+ progressPanel.ShowTestResult(false, error_msg, LoadCancelledImage());
|
|
return "";
|
|
return "";
|
|
}
|
|
}
|
|
|
|
|
|
@@ -851,9 +900,19 @@ namespace Bird_tool
|
|
//
|
|
//
|
|
if (m_test_mode == TestMode.config)
|
|
if (m_test_mode == TestMode.config)
|
|
{
|
|
{
|
|
- if (!initConfigTest())
|
|
|
|
|
|
+ bool tmp_flag = false;
|
|
|
|
+ // 判断设备模式
|
|
|
|
+ if (m_device_type == DeviceType.FANYUE_DEVICE)
|
|
|
|
+ {
|
|
|
|
+ tmp_flag = initConfigTest_by_fanyue();
|
|
|
|
+ }
|
|
|
|
+ else if(m_device_type == DeviceType.LEWEI_DEVICE)
|
|
{
|
|
{
|
|
- Log("涂鸦uuid输入错误!!", LogLevel.error);
|
|
|
|
|
|
+ tmp_flag = initConfigTest_by_lewei();
|
|
|
|
+ }
|
|
|
|
+ if (!tmp_flag)
|
|
|
|
+ {
|
|
|
|
+ Log("设备id输入错误!!", LogLevel.error);
|
|
//Log_show("无法初始化涂鸦相关命令");
|
|
//Log_show("无法初始化涂鸦相关命令");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -1012,6 +1071,28 @@ namespace Bird_tool
|
|
{
|
|
{
|
|
// 按钮长按功能测试
|
|
// 按钮长按功能测试
|
|
///**
|
|
///**
|
|
|
|
+ new TestStepConfig
|
|
|
|
+ {
|
|
|
|
+ GroupId = "btn_long",
|
|
|
|
+ GroupName = "按钮测试",
|
|
|
|
+ Name = "重置按钮",
|
|
|
|
+ Tips = "请按下重置按钮",
|
|
|
|
+ Command = "",
|
|
|
|
+ SuccessText = "OS start",
|
|
|
|
+ Timeout = 30000,
|
|
|
|
+ MaxRetries = 3,
|
|
|
|
+ },
|
|
|
|
+ new TestStepConfig
|
|
|
|
+ {
|
|
|
|
+ GroupId = "btn_long",
|
|
|
|
+ GroupName = "等待主控启动",
|
|
|
|
+ Name = "重置按钮",
|
|
|
|
+ Tips = "等待主控连接",
|
|
|
|
+ Command = "",
|
|
|
|
+ SuccessText = "<=OK cmd:16",
|
|
|
|
+ Timeout = 30000,
|
|
|
|
+ MaxRetries = 3,
|
|
|
|
+ },
|
|
new TestStepConfig
|
|
new TestStepConfig
|
|
{
|
|
{
|
|
GroupId = "btn_long",
|
|
GroupId = "btn_long",
|
|
@@ -1464,9 +1545,9 @@ namespace Bird_tool
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
- private bool initConfigTest()
|
|
|
|
|
|
+ private bool initConfigTest_by_fanyue()
|
|
{
|
|
{
|
|
- string uuid = ask_query_id();
|
|
|
|
|
|
+ string uuid = ask_query_id("uuid");
|
|
if (string.IsNullOrEmpty(uuid))
|
|
if (string.IsNullOrEmpty(uuid))
|
|
{
|
|
{
|
|
return false;
|
|
return false;
|
|
@@ -1584,6 +1665,74 @@ namespace Bird_tool
|
|
MaxRetries = 2,
|
|
MaxRetries = 2,
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ ret_steps.Add(new TestStepConfig
|
|
|
|
+ {
|
|
|
|
+ GroupId = "device_config",
|
|
|
|
+ Name = "配置上传地址",
|
|
|
|
+ Tips = "配置上传地址水印...",
|
|
|
|
+ Command = "AT+SEND=1, at+campara=6\\,\"http://robinsnote.shop/web/assets/add\"\r\n",
|
|
|
|
+ SuccessPattern = "<=OK cmd:20",
|
|
|
|
+ Timeout = 6000,
|
|
|
|
+ DelayBefore = 500,
|
|
|
|
+ MaxRetries = 2,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ ret_steps.Add(new TestStepConfig
|
|
|
|
+ {
|
|
|
|
+ GroupId = "device_config",
|
|
|
|
+ Name = "配置视频后缀",
|
|
|
|
+ Tips = "配置视频文件后缀...",
|
|
|
|
+ Command = "AT+SEND=1, at+campara=5\\,\"mp4\"\r\n",
|
|
|
|
+ SuccessPattern = "<=OK cmd:20",
|
|
|
|
+ Timeout = 6000,
|
|
|
|
+ DelayBefore = 500,
|
|
|
|
+ MaxRetries = 2,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ ret_steps.Add(new TestStepConfig
|
|
|
|
+ {
|
|
|
|
+ GroupId = "device_config",
|
|
|
|
+ Name = "配置视频编码",
|
|
|
|
+ Tips = "配置视频编码为265...",
|
|
|
|
+ Command = "AT+SEND=1, at+campara=23\\,0\\,0\r\n",
|
|
|
|
+ SuccessPattern = "<=OK cmd:20",
|
|
|
|
+ Timeout = 6000,
|
|
|
|
+ DelayBefore = 500,
|
|
|
|
+ MaxRetries = 2,
|
|
|
|
+ });
|
|
|
|
+ ret_steps.Add(new TestStepConfig
|
|
|
|
+ {
|
|
|
|
+ GroupId = "device_config",
|
|
|
|
+ Name = "配置音频编码",
|
|
|
|
+ Tips = "配置音频编码为pcmu...",
|
|
|
|
+ Command = "AT+SEND=1, at+campara=20\\,2\r\n",
|
|
|
|
+ SuccessPattern = "<=OK cmd:20",
|
|
|
|
+ Timeout = 6000,
|
|
|
|
+ DelayBefore = 500,
|
|
|
|
+ MaxRetries = 2,
|
|
|
|
+ });
|
|
|
|
+ ret_steps.Add(new TestStepConfig
|
|
|
|
+ {
|
|
|
|
+ GroupId = "device_config",
|
|
|
|
+ Name = "保存配置",
|
|
|
|
+ Tips = "保存设备配置中",
|
|
|
|
+ Command = "AT+SEND=1, at+camscont\r\n",
|
|
|
|
+ SuccessPattern = "<=OK cmd:20",
|
|
|
|
+ Timeout = 6000,
|
|
|
|
+ DelayBefore = 500,
|
|
|
|
+ MaxRetries = 2,
|
|
|
|
+ });
|
|
|
|
+ ret_steps.Add(new TestStepConfig
|
|
|
|
+ {
|
|
|
|
+ GroupId = "device_config",
|
|
|
|
+ Name = "配置日志等级",
|
|
|
|
+ Tips = "配置设备日志等级...",
|
|
|
|
+ Command = "AT+SEND=1, AT+FACTORY=2\\,0\r\n",
|
|
|
|
+ SuccessPattern = "<=OK cmd:20",
|
|
|
|
+ Timeout = 6000,
|
|
|
|
+ DelayBefore = 500,
|
|
|
|
+ MaxRetries = 2,
|
|
|
|
+ });
|
|
|
|
|
|
if (!_testExecutor.InitTest(ret_steps))
|
|
if (!_testExecutor.InitTest(ret_steps))
|
|
{
|
|
{
|
|
@@ -1604,6 +1753,21 @@ namespace Bird_tool
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private bool initConfigTest_by_lewei()
|
|
|
|
+ {
|
|
|
|
+ string dev_id = ask_query_id("id");
|
|
|
|
+ if (string.IsNullOrEmpty(dev_id))
|
|
|
|
+ {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ Log($"用户输入id: {dev_id}");
|
|
|
|
+ var (names, values) = m_excel_manager.GetVariableListByKey(dev_id);
|
|
|
|
+ m_config_uuid = dev_id;
|
|
|
|
+ List<TestStepConfig> ret_steps = new List<TestStepConfig>();
|
|
|
|
+ // 配置28项
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
private bool IsValidMac(string mac)
|
|
private bool IsValidMac(string mac)
|
|
{
|
|
{
|
|
// 实现MAC地址验证逻辑
|
|
// 实现MAC地址验证逻辑
|
|
@@ -1870,7 +2034,7 @@ namespace Bird_tool
|
|
var prompt = new Form
|
|
var prompt = new Form
|
|
{
|
|
{
|
|
Width = 450,
|
|
Width = 450,
|
|
- Height = 250,
|
|
|
|
|
|
+ Height = 270,
|
|
FormBorderStyle = FormBorderStyle.FixedDialog,
|
|
FormBorderStyle = FormBorderStyle.FixedDialog,
|
|
Text = "操作确认",
|
|
Text = "操作确认",
|
|
StartPosition = FormStartPosition.CenterParent,
|
|
StartPosition = FormStartPosition.CenterParent,
|
|
@@ -1900,7 +2064,7 @@ namespace Bird_tool
|
|
Text = question,
|
|
Text = question,
|
|
Dock = DockStyle.Fill,
|
|
Dock = DockStyle.Fill,
|
|
TextAlign = ContentAlignment.MiddleCenter,
|
|
TextAlign = ContentAlignment.MiddleCenter,
|
|
- Font = new Font("Microsoft YaHei UI", 20, FontStyle.Regular),
|
|
|
|
|
|
+ Font = new Font("Microsoft YaHei UI", 18, FontStyle.Regular),
|
|
AutoSize = false
|
|
AutoSize = false
|
|
};
|
|
};
|
|
|
|
|