V4.3 release

This commit is contained in:
2025-11-04 14:29:38 +00:00
parent 3d71ab7e9b
commit 42a4778555
5 changed files with 82 additions and 122 deletions

View File

@@ -18,8 +18,8 @@ namespace AiQ_GUI
private List<Camera> soakCameraList = [];
private List<CancellationTokenSource> soakCtsList = [];
private List<Task> soakTasks = [];
const string GoogleDrivePath = @"G:\Shared drives\MAV Production GUI's\AiQ\GUI's\";
public const string GoogleDrivePath = @"G:\Shared drives\MAV Production GUI's\AiQ\GUI's\";
// Colours
public static readonly Color BtnColour = Color.FromArgb(70, 65, 80);
@@ -1489,6 +1489,16 @@ namespace AiQ_GUI
Process.Start(psi);
}
private async void UploadWonwooSetOV_Click(object sender, EventArgs e)
{
await FlexiAPI.UploadWonwooSet(CbBxFoundCams.Text, false); // false = Colour
}
private async void UploadWonwooSetIR_Click(object sender, EventArgs e)
{
await FlexiAPI.UploadWonwooSet(CbBxFoundCams.Text, true); // true = Infrared
}
private void TxBxSerialPrint_Click(object sender, EventArgs e)
{
if (TxBxSerialPrint.Text == "K ") // If at default then remove the dashes ready for user to put in number
@@ -1601,7 +1611,7 @@ namespace AiQ_GUI
}
}
}
}
}
private void CkBxTickAll_CheckedChanged(object sender, EventArgs e)
{
@@ -1722,29 +1732,8 @@ namespace AiQ_GUI
{
Stopwatch stopWatchTest = Stopwatch.StartNew();
//StatsExcel excelExporter = new();
//excelExporter.ExportDatabaseToExcel();
FakeCamera fakeCamera = new FakeCamera(80); // Create an instance of FakeCamera
//CamOnTest.IP = CbBxFoundCams.Text;
_ = fakeCamera.StartAsync(CAMTYPE.GOOD).ContinueWith(task =>
{
//Network.Initialize("developer", "Pass123");
if (task.IsFaulted)
{
AddToActionsList("Error starting FakeCamera: " + task.Exception?.Message);
}
else
{
AddToActionsList($"FakeCamera started successfully. IP: {fakeCamera}", false);
}
});
await Task.Delay(3000); // Wait for server to start
CbBxFoundCams.Text = "localhost"; // Should force update in creds an network reinit
CmBoFoundCams_TextChanged(sender, e);
CbBxCameraType.SelectedIndex = CbBxCameraType.Items.Count - 1; // Selects AB12CD as model number
await Task.Delay(3000); // Wait for server to start
BtnStartTest_Click(sender, e);
StatsExcel excelExporter = new();
excelExporter.ExportDatabaseToExcel();
// /api/config-ids - For getting all available config IDs
@@ -1752,94 +1741,5 @@ namespace AiQ_GUI
AddToActionsList("RunTime " + stopWatchTest.Elapsed.ToString(@"hh\:mm\:ss\.ff"));
}
private async Task UploadWonwooSet(string ipAddress, bool isIR)
{
string fileToUpload = null;
using OpenFileDialog openFileDialog1 = new()
{
InitialDirectory = GoogleDrivePath,
Filter = "CSV files (*.csv)|*.csv",
FilterIndex = 0
};
if (openFileDialog1.ShowDialog() == DialogResult.OK)
fileToUpload = openFileDialog1.FileName;
else
{
AddToActionsList("File selection cancelled.", false);
return;
}
//Filename validation
string filename = Path.GetFileName(fileToUpload).ToUpper();
if (isIR)
{
if (!filename.Contains("IR") || filename.Contains("OV"))
{
AddToActionsList("Incorrect file selected. Expected IR file.", false);
return;
}
}
else // OV
{
if (!filename.Contains("OV") || filename.Contains("IR"))
{
AddToActionsList("Incorrect file selected. Expected OV file.", false);
return;
}
}
var lines = File.ReadAllLines(fileToUpload);
for (int i = 1; i < lines.Length; i++)
{
var parts = lines[i].Split(',')
.Select(p => p.Trim())
.ToArray();
if (parts.Length < 3)
{
AddToActionsList($"Invalid row format at line {i + 1}", false);
continue;
}
string name = parts[0];
string command = parts[1];
string expectedResponse = parts[2];
// VISCA format check
if (!RegexCache.VISCAAPIRegex().IsMatch(command))
{
AddToActionsList($"{name}: Invalid VISCA command ({command})", false);
continue; // do not send it if bad
}
string result = await FlexiAPI.APIHTTPVISCA(ipAddress, command, isIR);
if (result.Contains(expectedResponse))
AddToActionsList($"{name}: Success ({(isIR ? "IR" : "Colour")})", true);
else
AddToActionsList($"{name}: Unexpected response ({result})", false);
await Task.Delay(150);
}
AddToActionsList($"Upload complete ({(isIR ? "IR" : "Colour")}).", true);
}
private async void UploadWonwooSetOV_Click(object sender, EventArgs e)
{
await UploadWonwooSet(CbBxFoundCams.Text, false); // false = Colour
}
private async void UploadWonwooSetIR_Click(object sender, EventArgs e)
{
await UploadWonwooSet(CbBxFoundCams.Text, true); // true = Infrared
}
}
}