This commit is contained in:
2025-12-09 09:00:16 +00:00
parent 760987fa75
commit 03dfb3414b
10 changed files with 142 additions and 57 deletions

View File

@@ -74,7 +74,6 @@ namespace AiQ_GUI
// Load local data store
localDataStore = await LDSWAIT;
Logging.LogMessage("Opening GUI"); // Done after LDS to make sure directory exists.
if (localDataStore == null)
{
@@ -82,6 +81,9 @@ namespace AiQ_GUI
return;
}
Logging.LogMessage("Opening GUI"); // Done after LDS to make sure directory exists.
this.Location = new Point(localDataStore.GUIPosX, localDataStore.GUIPosY);
Task CheckHWOnline = PingCheck(); // Async check all hardware is online
PopulateUIWithLDS(localDataStore); // Update fields that depend on LDS
CbBxCameraType.Text = localDataStore.LastModel; // Set last model that was tested into combobox
@@ -158,7 +160,7 @@ namespace AiQ_GUI
string VISCAReply = await FlexiAPI.APIHTTPVISCA(CamOnTest.IP, "8101043903FF", true); // Manual mode to be able to manipulate the SIG settings.
if (VISCAReply != "9041FF9051FF")
AddToActionsList("Couldn't set to manual mode",Level.ERROR);
AddToActionsList("Couldn't set to manual mode", Level.ERROR);
await CameraModules.SetSIG(CbBxShutter, CbBxIris, CbBxGain, CamOnTest.IP); // Set SIG according to the drop downs in settings for a good picture ready for image check
await ImageProcessing.ImageCheck(PicBxOV, PicBxIRF2, PicBxIRF16, LblIRImageF2, LblIRImageF16, CamOnTest); // Populates the picture boxes and checks iris changes
@@ -170,9 +172,6 @@ namespace AiQ_GUI
// 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
if (CameraAccessInfo.HardwareExtras.Contains("GPS")) // Check GPS if the hardware has it
await FlexiAPI.GPSFix(CamOnTest.IP);
// 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.
await SSH.CheckFSSize(CamOnTest.IP, LblFilesystemSize, sshData); // Check Filesystem size is between 100GB & 150GB
@@ -277,7 +276,7 @@ namespace AiQ_GUI
if (await DisplayQuestion($"Would you like to allocate a serial number to this camera?"))
await AllocateSerial();
else if (GoogleAPI.UpdateSpreadSheetRePreTest(CameraAccessInfo.SpreadsheetID, Vers) != "OK") // If rerun might be different values so update SS
AddToActionsList("Failed to write to spreadsheet, please check manually",Level.WARNING);
AddToActionsList("Failed to write to spreadsheet, please check manually", Level.WARNING);
// else if (Excel.UpdateSpreadSheetPreTest(CameraAccessInfo.SpreadsheetID, Vers, CamOnTest.GetCamDesc(), CamOnTest.Model) != "OK")
// AddToActionsList("Failed to write to spreadsheet, please check manually");
}
@@ -712,7 +711,7 @@ namespace AiQ_GUI
if (!JSONResponse.Contains(NewSerial) || !JSONResponse.Contains(CamOnTest.Model))
{
AddToActionsList("Could not set model or serial numbers into camera.",Level.ERROR);
AddToActionsList("Could not set model or serial numbers into camera.", Level.ERROR);
await PreTestFailed("Failed To Set Model Or Serial Number");
}
@@ -733,6 +732,8 @@ namespace AiQ_GUI
// Save user settings in LDS for next time if values are valid
if (CbBxUserName.Text.Length > 2 && CbBxCameraType.Text.Length > 6)
{
localDataStore.GUIPosX = this.Location.X;
localDataStore.GUIPosY = this.Location.Y;
localDataStore.User = CbBxUserName.Text;
localDataStore.LastModel = CbBxCameraType.Text;
LDS.SetLDS(localDataStore);
@@ -957,7 +958,7 @@ namespace AiQ_GUI
RhTxBxActions.SelectionColor = Color.LightGreen;
}
RhTxBxActions.AppendText(Mssg + Environment.NewLine);
RhTxBxActions.AppendText(Mssg + Environment.NewLine);
RhTxBxActions.SelectionStart = RhTxBxActions.Text.Length;
RhTxBxActions.SelectionColor = SystemColors.Control;
RhTxBxActions.ScrollToCaret();
@@ -1127,6 +1128,26 @@ namespace AiQ_GUI
Windows.StartAsAdmin(ExeLoc);
}
private void BtnBaudModules_Click(object sender, EventArgs e)
{
SSH.SetTo115200(CamOnTest.IP);
}
private void BtnOpenMoba_Click(object sender, EventArgs e)
{
const string mobaPath = @"C:\Program Files (x86)\Mobatek\MobaXterm\MobaXterm.exe";
string sshCommand = $"ssh -o StrictHostKeyChecking=no -p 22 mav@{CamOnTest.IP}"; // optional: skip host check
var psi = new ProcessStartInfo
{
FileName = mobaPath,
Arguments = $"-newtab \"{sshCommand}\"",
UseShellExecute = false,
};
Process.Start(psi);
}
// Flips between setting camera to 211 and DHCP
private async void BtnSet211_Click(object sender, EventArgs e)
{
@@ -1285,6 +1306,8 @@ namespace AiQ_GUI
CbBxType.SelectedIndex = 1;
else if (type == "A") // Audit
CbBxType.SelectedIndex = 2;
else if (type == "X") // XML Server
CbBxType.SelectedIndex = 3;
BtnGenerate.Enabled = true;
}
@@ -1712,7 +1735,7 @@ namespace AiQ_GUI
}
// ***** Test & Debug *****
private void BtnTest_Click(object sender, EventArgs e)
private async void BtnTest_Click(object sender, EventArgs e)
{
Stopwatch stopWatchTest = Stopwatch.StartNew();