bool _uploadFirmwareBasic(string camera_ip, string file_fw, int time_out) { bool ret = false; int count = 0; //get logsytem var prop_logsystem = testingInfo.GetType().GetProperty("logSystem"); string log_value = (string)prop_logsystem.GetValue(testingInfo); //set uboot ip log_value += string.Format("\n-------------------------------\n"); log_value += string.Format("{0}, set uboot ip\n", DateTime.Now); prop_logsystem.SetValue(testingInfo, log_value); count = 0; RE_IP: count++; ret = camera.setIPUboot(camera_ip, "192.168.1.1", "255.255.255.0"); if (!ret) { if (count < 3) { goto RE_IP; } } if (!ret) { return(false); } log_value += string.Format("...kết quả {0}\n", ret ? "Passed" : "Failed"); prop_logsystem.SetValue(testingInfo, log_value); //request camera upload firmware log_value += string.Format("\n-------------------------------\n"); log_value += string.Format("{0}, request camera upload firmware\n", DateTime.Now); prop_logsystem.SetValue(testingInfo, log_value); count = 0; RE_REQUEST: count++; ret = camera.uploadFirmwareBasic(); if (!ret) { if (count < 3) { goto RE_REQUEST; } } if (!ret) { return(false); } log_value += string.Format("...kết quả {0}\n", ret ? "Passed" : "Failed"); prop_logsystem.SetValue(testingInfo, log_value); //request transfer firmware file from pc to camera log_value += string.Format("\n-------------------------------\n"); log_value += string.Format("{0}, transfer file firmware from pc to camera\n", DateTime.Now); prop_logsystem.SetValue(testingInfo, log_value); count = 0; RE_TRANSFER: count++; // Connect request failed string data = CommandPrompt.Query(string.Format("tftp -i {0} put {1}", camera_ip, file_fw)); log_value += data; prop_logsystem.SetValue(testingInfo, log_value); ret = data.Contains("successful"); if (!ret) { if (count < 3) { goto RE_TRANSFER; } } if (!ret) { return(false); } log_value += string.Format("...kết quả {0}\n", ret ? "Passed" : "Failed"); prop_logsystem.SetValue(testingInfo, log_value); //wait camera upload firmware complete log_value += string.Format("\n-------------------------------\n"); log_value += string.Format("{0}, wait camera upload firmware complete\n", DateTime.Now); prop_logsystem.SetValue(testingInfo, log_value); count = 0; RE_WAIT: count++; ret = camera.captureLog().Contains("update done"); if (!ret) { if (count < time_out) { Thread.Sleep(1000); goto RE_WAIT; } } //return result return(ret); }