Compare commits
2 Commits
AddToActio
...
760987fa75
| Author | SHA1 | Date | |
|---|---|---|---|
| 760987fa75 | |||
| 4c624d7e29 |
19
AiQ_GUI.cs
19
AiQ_GUI.cs
@@ -48,7 +48,7 @@ namespace AiQ_GUI
|
|||||||
Task<LocalDataStore> LDSWAIT = Task.Run(() => LDS.GetLDS()); // Get and deserialise LDS.json
|
Task<LocalDataStore> LDSWAIT = Task.Run(() => LDS.GetLDS()); // Get and deserialise LDS.json
|
||||||
Task<string> guiVerTask = Task.Run(() => GUIUpdate.FindGUIVersion()); // Get GUI Version
|
Task<string> guiVerTask = Task.Run(() => GUIUpdate.FindGUIVersion()); // Get GUI Version
|
||||||
|
|
||||||
Network.Initialize("admin", "admin"); // Initialise HTTP client
|
Network.Initialize("admin", "admin"); // Initialise HTTP client with basic auth creds.
|
||||||
|
|
||||||
if (await Network.PingIP("8.8.8.8")) // Ping to check if we're online
|
if (await Network.PingIP("8.8.8.8")) // Ping to check if we're online
|
||||||
{
|
{
|
||||||
@@ -146,10 +146,10 @@ namespace AiQ_GUI
|
|||||||
|
|
||||||
Task VisCheck = Helper.VisualCheck(BtnStartTest);
|
Task VisCheck = Helper.VisualCheck(BtnStartTest);
|
||||||
|
|
||||||
if (!await FlexiAPI.ZoomModules("1F40", CamOnTest.IP)) // Zoom to 8000 (1F40h) at the same time.
|
if (!await CameraModules.ZoomModules("1F40", CamOnTest.IP)) // Zoom to 8000 (1F40h) at the same time.
|
||||||
await TestFailed(BtnStartTest, "Could not zoom modules to 8000");
|
await TestFailed(BtnStartTest, "Could not zoom modules to 8000");
|
||||||
|
|
||||||
if (!await FlexiAPI.SetZoomLockOn(CamOnTest.IP))
|
if (!await CameraModules.SetZoomLockOn(CamOnTest.IP))
|
||||||
Helper.RestartApp();
|
Helper.RestartApp();
|
||||||
|
|
||||||
await Task.Delay(1000); // Without sleep it kept failing the factory reset as camera modules were not ready yet
|
await Task.Delay(1000); // Without sleep it kept failing the factory reset as camera modules were not ready yet
|
||||||
@@ -170,6 +170,9 @@ namespace AiQ_GUI
|
|||||||
// TODO - Force expire sighting.
|
// TODO - Force expire sighting.
|
||||||
Task Wait = Task.Delay(5000); // Wait for 5 seconds to allow the camera to zoom in, set settings and capture some plates before auto trim
|
Task Wait = Task.Delay(5000); // Wait for 5 seconds to allow the camera to zoom in, set settings and capture some plates before auto trim
|
||||||
|
|
||||||
|
if (CameraAccessInfo.HardwareExtras.Contains("GPS")) // Check GPS if the hardware has it
|
||||||
|
await FlexiAPI.GPSFix(CamOnTest.IP);
|
||||||
|
|
||||||
// While waiting do the SSH tasks.
|
// While waiting do the SSH tasks.
|
||||||
sshData = SSH.CollectSSHData(CamOnTest.IP); // SSH into camera to get Vaxtor packages, filesystem size and if tailscale is installed.
|
sshData = SSH.CollectSSHData(CamOnTest.IP); // SSH into camera to get Vaxtor packages, filesystem size and if tailscale is installed.
|
||||||
await SSH.CheckFSSize(CamOnTest.IP, LblFilesystemSize, sshData); // Check Filesystem size is between 100GB & 150GB
|
await SSH.CheckFSSize(CamOnTest.IP, LblFilesystemSize, sshData); // Check Filesystem size is between 100GB & 150GB
|
||||||
@@ -189,7 +192,7 @@ namespace AiQ_GUI
|
|||||||
await Wait; // Finished to 5s wait
|
await Wait; // Finished to 5s wait
|
||||||
await FlexiAPI.SetTrim(CamOnTest.IP, LblTestTubePing.Text); // Auto trims the cameras, some plates should have been captured in the meantime
|
await FlexiAPI.SetTrim(CamOnTest.IP, LblTestTubePing.Text); // Auto trims the cameras, some plates should have been captured in the meantime
|
||||||
|
|
||||||
if (!await FlexiAPI.ZoomModules("0000", CamOnTest.IP)) // Zoom to full wide
|
if (!await CameraModules.ZoomModules("0000", CamOnTest.IP)) // Zoom to full wide
|
||||||
await TestFailed(BtnStartTest, "Could not zoom modules to full wide");
|
await TestFailed(BtnStartTest, "Could not zoom modules to full wide");
|
||||||
|
|
||||||
await Task.Delay(1000); // Wait to be sure cameras are zoomed out.
|
await Task.Delay(1000); // Wait to be sure cameras are zoomed out.
|
||||||
@@ -236,7 +239,7 @@ namespace AiQ_GUI
|
|||||||
BtnPreTest.Enabled = BtnStartTest.Enabled = false; // Disable buttons to stop user rnning multiple tests at the same time.
|
BtnPreTest.Enabled = BtnStartTest.Enabled = false; // Disable buttons to stop user rnning multiple tests at the same time.
|
||||||
Logging.LogMessage("Pre Test Started");
|
Logging.LogMessage("Pre Test Started");
|
||||||
|
|
||||||
if (!await FlexiAPI.SetZoomLockOn(CamOnTest.IP))
|
if (!await CameraModules.SetZoomLockOn(CamOnTest.IP))
|
||||||
Helper.RestartApp();
|
Helper.RestartApp();
|
||||||
|
|
||||||
string LEDreply = await FlexiAPI.APIHTTPLED(CamOnTest.IP, LEDPOWER.MID); // Set LED's to medium (0x30)
|
string LEDreply = await FlexiAPI.APIHTTPLED(CamOnTest.IP, LEDPOWER.MID); // Set LED's to medium (0x30)
|
||||||
@@ -1471,7 +1474,7 @@ namespace AiQ_GUI
|
|||||||
|
|
||||||
private async void BtnZoomWide_Click(object sender, EventArgs e)
|
private async void BtnZoomWide_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (await FlexiAPI.ZoomModules("0000", CamOnTest.IP))
|
if (await CameraModules.ZoomModules("0000", CamOnTest.IP))
|
||||||
BtnZoomWide.BackColor = Color.Green;
|
BtnZoomWide.BackColor = Color.Green;
|
||||||
else
|
else
|
||||||
BtnZoomWide.BackColor = Color.Red;
|
BtnZoomWide.BackColor = Color.Red;
|
||||||
@@ -1481,7 +1484,7 @@ namespace AiQ_GUI
|
|||||||
|
|
||||||
private async void BtnZoom8000_Click(object sender, EventArgs e)
|
private async void BtnZoom8000_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (await FlexiAPI.ZoomModules("1F40", CamOnTest.IP))
|
if (await CameraModules.ZoomModules("1F40", CamOnTest.IP))
|
||||||
BtnZoom8000.BackColor = Color.Green;
|
BtnZoom8000.BackColor = Color.Green;
|
||||||
else
|
else
|
||||||
BtnZoom8000.BackColor = Color.Red;
|
BtnZoom8000.BackColor = Color.Red;
|
||||||
@@ -1585,7 +1588,7 @@ namespace AiQ_GUI
|
|||||||
|
|
||||||
CancellationTokenSource cts = new();
|
CancellationTokenSource cts = new();
|
||||||
soakCtsList.Add(cts);
|
soakCtsList.Add(cts);
|
||||||
soakTasks.Add(SoakTest.StartSoak(SCL, SCL.CheckBox, cts.Token));
|
soakTasks.Add(SoakTest.StartSoak(SCL, cts));
|
||||||
await Task.Delay(10000);
|
await Task.Delay(10000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net9.0-windows10.0.17763.0</TargetFramework>
|
<TargetFramework>net10.0-windows7.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
@@ -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.5.0</Version>
|
<Version>4.6.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>
|
||||||
@@ -55,14 +55,13 @@
|
|||||||
<PackageReference Include="ClosedXML" Version="0.105.0" />
|
<PackageReference Include="ClosedXML" Version="0.105.0" />
|
||||||
<PackageReference Include="Emgu.CV" Version="4.12.0.5764" />
|
<PackageReference Include="Emgu.CV" Version="4.12.0.5764" />
|
||||||
<PackageReference Include="Emgu.CV.runtime.windows" Version="4.12.0.5764" />
|
<PackageReference Include="Emgu.CV.runtime.windows" Version="4.12.0.5764" />
|
||||||
<PackageReference Include="Google.Apis.Auth" Version="1.72.0" />
|
<PackageReference Include="Google.Apis.Auth" Version="1.73.0" />
|
||||||
<PackageReference Include="Google.Apis.Gmail.v1" Version="1.70.0.3833" />
|
<PackageReference Include="Google.Apis.Sheets.v4" Version="1.72.0.3966" />
|
||||||
<PackageReference Include="Google.Apis.Sheets.v4" Version="1.70.0.3819" />
|
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||||
<PackageReference Include="PDFsharp-MigraDoc-gdi" Version="6.2.2" />
|
<PackageReference Include="PDFsharp-MigraDoc-gdi" Version="6.2.3" />
|
||||||
<PackageReference Include="Selenium.Support" Version="4.38.0" />
|
<PackageReference Include="Selenium.Support" Version="4.38.0" />
|
||||||
<PackageReference Include="Selenium.WebDriver" Version="4.38.0" />
|
<PackageReference Include="Selenium.WebDriver" Version="4.38.0" />
|
||||||
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="142.0.7444.6100" />
|
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="142.0.7444.17500" />
|
||||||
<PackageReference Include="SSH.NET" Version="2025.1.0" />
|
<PackageReference Include="SSH.NET" Version="2025.1.0" />
|
||||||
<PackageReference Include="System.Data.OleDb" Version="10.0.0" />
|
<PackageReference Include="System.Data.OleDb" Version="10.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ namespace AiQ_GUI
|
|||||||
MainForm.Instance.AddToActionsList($"{CamMod.firmwareVer} or {UniversalData.WonwooFirmware} could not be converted to a double", Level.ERROR);
|
MainForm.Instance.AddToActionsList($"{CamMod.firmwareVer} or {UniversalData.WonwooFirmware} could not be converted to a double", Level.ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CamOnTest.RMANum > 0 && LessTanOrEqualTo)
|
if (CamOnTest.RMANum > 0 && !LessTanOrEqualTo)
|
||||||
errMssg += $"Firmware: {CamMod.firmwareVer} should be less than or equal to {UniversalData.WonwooFirmware} for RMA {CamOnTest.RMANum}";
|
errMssg += $"Firmware: {CamMod.firmwareVer} should be less than or equal to {UniversalData.WonwooFirmware} for RMA {CamOnTest.RMANum}";
|
||||||
|
|
||||||
else if ((CamOnTest.RMANum == 0 || CamOnTest.RMANum == -1) && CamMod.firmwareVer != UniversalData.WonwooFirmware)
|
else if (CamOnTest.RMANum < 1 && CamMod.firmwareVer != UniversalData.WonwooFirmware)
|
||||||
errMssg += $"Firmware: {CamMod.firmwareVer} should be {UniversalData.WonwooFirmware} ";
|
errMssg += $"Firmware: {CamMod.firmwareVer} should be {UniversalData.WonwooFirmware} ";
|
||||||
|
|
||||||
if (CamMod.expMode != 0) // Auto 0=0x00
|
if (CamMod.expMode != 0) // Auto 0=0x00
|
||||||
@@ -107,5 +107,33 @@ namespace AiQ_GUI
|
|||||||
// Build the final VISCA command string using the input characters split as p and q
|
// Build the final VISCA command string using the input characters split as p and q
|
||||||
return $"8101044{command}00000{hex[0]}0{hex[1]}FF";
|
return $"8101044{command}00000{hex[0]}0{hex[1]}FF";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async Task<bool> SetZoomLockOn(string IP)
|
||||||
|
{
|
||||||
|
// Set Zoomlock on and if it fails ask user to set it manually
|
||||||
|
if (!(await FlexiAPI.APIHTTPRequest("/api/zoomLock?enable=true", IP)).Contains("Zoom lock enabled.")
|
||||||
|
&& !await MainForm.Instance.DisplayQuestion("Could not set zoomlock on" + Environment.NewLine + "Set Zoomlock to on then click YES. Click NO to restart."))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<bool> ZoomModules(string VISCAInput, string IPAddress)
|
||||||
|
{
|
||||||
|
// Populate the VISCA command with the four zoom characters
|
||||||
|
string VISCA = $"810104470{VISCAInput[0]}0{VISCAInput[1]}0{VISCAInput[2]}0{VISCAInput[3]}FF";
|
||||||
|
|
||||||
|
Task<string> TS1 = FlexiAPI.APIHTTPVISCA(IPAddress, VISCA, true);
|
||||||
|
Task<string> TS2 = FlexiAPI.APIHTTPVISCA(IPAddress, VISCA, false);
|
||||||
|
await Task.WhenAll(TS1, TS2);
|
||||||
|
|
||||||
|
const string ExpReply = "9041FF9051FF";
|
||||||
|
if (TS1.Result == ExpReply && TS1.Result == ExpReply)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -193,32 +193,16 @@ namespace AiQ_GUI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<bool> SetZoomLockOn(string IP)
|
public static async Task GPSFix(string IPAddress)
|
||||||
{
|
{
|
||||||
// Set Zoomlock on and if it fails ask user to set it manually
|
string sysstatus = await APIHTTPRequest("/sysstatus", IPAddress, 5);
|
||||||
if (!(await APIHTTPRequest("/api/zoomLock?enable=true", IP)).Contains("Zoom lock enabled.")
|
SysStatus status = JsonConvert.DeserializeObject<SysStatus>(sysstatus);
|
||||||
&& !await MainForm.Instance.DisplayQuestion($"Could not set zoomlock on{Level.WARNING}" + Environment.NewLine + $"Set Zoomlock to on then click YES. Click NO to restart. {Level.WARNING}"))
|
|
||||||
|
if (status.gpsState == 0 || status.gpsPresent == "Not Fitted")
|
||||||
{
|
{
|
||||||
return false;
|
MainForm.Instance.AddToActionsList($"GPS not present in camera. State: {status.gpsState} & Status: {status.gpsPresent}");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async Task<bool> ZoomModules(string VISCAInput, string IPAddress)
|
|
||||||
{
|
|
||||||
// Populate the VISCA command with the four zoom characters
|
|
||||||
string VISCA = $"810104470{VISCAInput[0]}0{VISCAInput[1]}0{VISCAInput[2]}0{VISCAInput[3]}FF";
|
|
||||||
|
|
||||||
Task<string> TS1 = APIHTTPVISCA(IPAddress, VISCA, true);
|
|
||||||
Task<string> TS2 = APIHTTPVISCA(IPAddress, VISCA, false);
|
|
||||||
await Task.WhenAll(TS1, TS2);
|
|
||||||
|
|
||||||
const string ExpReply = "9041FF9051FF";
|
|
||||||
if (TS1.Result == ExpReply && TS1.Result == ExpReply)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task SetTrim(string IPAddress, string LblTxt, int RetryCount = 0) // Sets trim by getting plate postion as metric
|
public static async Task SetTrim(string IPAddress, string LblTxt, int RetryCount = 0) // Sets trim by getting plate postion as metric
|
||||||
@@ -558,6 +542,12 @@ namespace AiQ_GUI
|
|||||||
public int colourY { get; set; }
|
public int colourY { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SysStatus
|
||||||
|
{
|
||||||
|
public int gpsState { get; set; } = 0;
|
||||||
|
public string gpsPresent { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
public class NetworkConfig
|
public class NetworkConfig
|
||||||
{
|
{
|
||||||
public Property propDHCP { get; set; } = new Property();
|
public Property propDHCP { get; set; } = new Property();
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace AiQ_GUI
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MainForm.Instance.AddToActionsList($"Error logging message: {ex.Message}{Level.ERROR}");
|
MessageBox.Show($"Error logging message: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,8 +106,6 @@ namespace AiQ_GUI
|
|||||||
// Initialises and opens a ChromeDriver with specific options
|
// Initialises and opens a ChromeDriver with specific options
|
||||||
public static ChromeDriver OpenDriver()
|
public static ChromeDriver OpenDriver()
|
||||||
{
|
{
|
||||||
string tempProfile = null;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ChromeOptions options = new();
|
ChromeOptions options = new();
|
||||||
@@ -121,7 +119,7 @@ namespace AiQ_GUI
|
|||||||
"--disable-features=BrowserAddPersonFeature,InterestFeedContentSuggestions");
|
"--disable-features=BrowserAddPersonFeature,InterestFeedContentSuggestions");
|
||||||
|
|
||||||
// Use a unique temporary profile to avoid conflicts
|
// Use a unique temporary profile to avoid conflicts
|
||||||
tempProfile = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
|
string tempProfile = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
|
||||||
options.AddArguments($"--user-data-dir={tempProfile}");
|
options.AddArguments($"--user-data-dir={tempProfile}");
|
||||||
|
|
||||||
// manual driver path
|
// manual driver path
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ namespace AiQ_GUI
|
|||||||
internal class SoakTest
|
internal class SoakTest
|
||||||
{
|
{
|
||||||
// Main soak test loop: Randomise dropdowns, run luminance test every hour, power cycle at 7am
|
// Main soak test loop: Randomise dropdowns, run luminance test every hour, power cycle at 7am
|
||||||
public static async Task StartSoak(Camera CamInfo, CheckBox CkBx, CancellationToken token)
|
public static async Task StartSoak(Camera CamInfo, CancellationTokenSource CTS)
|
||||||
{
|
{
|
||||||
|
CancellationToken token = CTS.Token;
|
||||||
if (CamInfo.Serial == "N/A")
|
if (CamInfo.Serial == "N/A")
|
||||||
CamInfo.Serial = "UNKNOWN"; // If serial is not set, set it to UNKNOWN. Cannot have N/A in file names.
|
CamInfo.Serial = "UNKNOWN"; // If serial is not set, set it to UNKNOWN. Cannot have N/A in file names.
|
||||||
|
|
||||||
@@ -18,6 +19,7 @@ namespace AiQ_GUI
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
driver = Selenium.OpenDriver();
|
driver = Selenium.OpenDriver();
|
||||||
|
Logging.LogMessage("----- Soak test started -----", SoakLogFile);
|
||||||
await Task.Delay(1000); // Small delay to ensure driver is ready
|
await Task.Delay(1000); // Small delay to ensure driver is ready
|
||||||
|
|
||||||
// Keep retrying until connected or cancelled
|
// Keep retrying until connected or cancelled
|
||||||
@@ -58,6 +60,16 @@ namespace AiQ_GUI
|
|||||||
|
|
||||||
while (!token.IsCancellationRequested)
|
while (!token.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string TheString = "Selenium string: " + driver.Manage().Window.Size; // Fails out if Window doesn't exist.
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
CTS.Cancel();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
int currentHour = DateTime.Now.Hour;
|
int currentHour = DateTime.Now.Hour;
|
||||||
|
|
||||||
// At 7am, power cycle the camera
|
// At 7am, power cycle the camera
|
||||||
|
|||||||
Reference in New Issue
Block a user