V4.3 release
This commit is contained in:
130
AiQ_GUI.cs
130
AiQ_GUI.cs
@@ -18,8 +18,8 @@ namespace AiQ_GUI
|
|||||||
private List<Camera> soakCameraList = [];
|
private List<Camera> soakCameraList = [];
|
||||||
private List<CancellationTokenSource> soakCtsList = [];
|
private List<CancellationTokenSource> soakCtsList = [];
|
||||||
private List<Task> soakTasks = [];
|
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
|
// Colours
|
||||||
public static readonly Color BtnColour = Color.FromArgb(70, 65, 80);
|
public static readonly Color BtnColour = Color.FromArgb(70, 65, 80);
|
||||||
@@ -1489,6 +1489,16 @@ namespace AiQ_GUI
|
|||||||
Process.Start(psi);
|
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)
|
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
|
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)
|
private void CkBxTickAll_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@@ -1722,29 +1732,8 @@ namespace AiQ_GUI
|
|||||||
{
|
{
|
||||||
Stopwatch stopWatchTest = Stopwatch.StartNew();
|
Stopwatch stopWatchTest = Stopwatch.StartNew();
|
||||||
|
|
||||||
//StatsExcel excelExporter = new();
|
StatsExcel excelExporter = new();
|
||||||
//excelExporter.ExportDatabaseToExcel();
|
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);
|
|
||||||
|
|
||||||
// /api/config-ids - For getting all available config IDs
|
// /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"));
|
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<Product>AiQ GUI</Product>
|
<Product>AiQ GUI</Product>
|
||||||
<Authors>MAV Systems Ltd</Authors>
|
<Authors>MAV Systems Ltd</Authors>
|
||||||
<PackageId>AiQ GUI</PackageId>
|
<PackageId>AiQ GUI</PackageId>
|
||||||
<Version>4.2.0</Version>
|
<Version>4.3.0</Version>
|
||||||
<Description>A GUI to control and test the AiQ</Description>
|
<Description>A GUI to control and test the AiQ</Description>
|
||||||
<Copyright>MAV Systems Ltd 2025</Copyright>
|
<Copyright>MAV Systems Ltd 2025</Copyright>
|
||||||
<PackageIcon>MAV - Plain - Blue.png</PackageIcon>
|
<PackageIcon>MAV - Plain - Blue.png</PackageIcon>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Net.NetworkInformation;
|
|
||||||
|
|
||||||
namespace AiQ_GUI
|
namespace AiQ_GUI
|
||||||
{
|
{
|
||||||
@@ -358,10 +357,10 @@ namespace AiQ_GUI
|
|||||||
public async static Task<bool> ChangeNetworkToDHCP(string IPAddress)
|
public async static Task<bool> ChangeNetworkToDHCP(string IPAddress)
|
||||||
{
|
{
|
||||||
string[,] TEST_JSON = { { "propDHCP", "true" } };
|
string[,] TEST_JSON = { { "propDHCP", "true" } };
|
||||||
string result = await HTTP_Update("GLOBAL--NetworkConfig", IPAddress, TEST_JSON);
|
await HTTP_Update("GLOBAL--NetworkConfig", IPAddress, TEST_JSON); // Don't care about response because it will fail as it has changed IP.
|
||||||
|
|
||||||
await Task.Delay(5000); // Wait for 5 seconds to allow the camera to restart
|
await Task.Delay(5000); // Wait for 5 seconds to allow the camera to restart
|
||||||
IList<string> FoundCams = await Network.SearchForCams();
|
IList<string> FoundCams = await Network.SearchForCams();
|
||||||
|
|
||||||
if (FoundCams.Contains("192.168.1.211"))
|
if (FoundCams.Contains("192.168.1.211"))
|
||||||
{
|
{
|
||||||
@@ -373,6 +372,69 @@ namespace AiQ_GUI
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async Task UploadWonwooSet(string ipAddress, bool isIR)
|
||||||
|
{
|
||||||
|
string fileToUpload = null;
|
||||||
|
|
||||||
|
using OpenFileDialog openFileDialog1 = new()
|
||||||
|
{
|
||||||
|
InitialDirectory = MainForm.GoogleDrivePath,
|
||||||
|
Filter = "CSV files (*.csv)|*.csv",
|
||||||
|
FilterIndex = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
||||||
|
fileToUpload = openFileDialog1.FileName;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainForm.Instance.AddToActionsList("File selection cancelled.", false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Filename validation
|
||||||
|
string filename = Path.GetFileName(fileToUpload).ToUpper();
|
||||||
|
|
||||||
|
if ((isIR && filename.Contains("IR")) || (!isIR && filename.Contains("OV")))
|
||||||
|
{
|
||||||
|
MainForm.Instance.AddToActionsList($"Incorrect file selected. Expected {(isIR ? "IR" : "OV")} file", false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] lines = File.ReadAllLines(fileToUpload);
|
||||||
|
|
||||||
|
for (int i = 1; i < lines.Length; i++)
|
||||||
|
{
|
||||||
|
string[] parts = lines[i].Split(',').Select(p => p.Trim()).ToArray();
|
||||||
|
|
||||||
|
if (parts.Length < 3)
|
||||||
|
{
|
||||||
|
MainForm.Instance.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))
|
||||||
|
{
|
||||||
|
MainForm.Instance.AddToActionsList($"{name}: Invalid VISCA command ({command})", false);
|
||||||
|
continue; // do not send it if bad
|
||||||
|
}
|
||||||
|
|
||||||
|
string result = await APIHTTPVISCA(ipAddress, command, isIR);
|
||||||
|
|
||||||
|
if (result.Contains(expectedResponse))
|
||||||
|
MainForm.Instance.AddToActionsList($"{name}: Success ({(isIR ? "IR" : "Colour")})", true);
|
||||||
|
else
|
||||||
|
MainForm.Instance.AddToActionsList($"{name}: Unexpected response ({result})", false);
|
||||||
|
|
||||||
|
await Task.Delay(150);
|
||||||
|
}
|
||||||
|
|
||||||
|
MainForm.Instance.AddToActionsList($"Upload complete ({(isIR ? "IR" : "Colour")}).", true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Items recieved in Versions API
|
//Items recieved in Versions API
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
using System.Diagnostics;
|
using System.Net;
|
||||||
using System.Net;
|
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace AiQ_GUI
|
namespace AiQ_GUI
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user