• MobileTests.cs
- Pre test now checks firmware and adds the label dynamically to the panel • AiQ_GUI.Designer.cs - Added CbBxCameraModel.SelectedIndexChanged to properly wire UI element. • Microsoft/StatsExcel.cs - Improved workbook loading error handling to distinguish between corruption and file access issues.
This commit is contained in:
13
AiQ Tests/AiQLiteTests.cs
Normal file
13
AiQ Tests/AiQLiteTests.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace AiQ_GUI.AiQ_Tests
|
||||
{
|
||||
internal class AiQLiteTests
|
||||
{
|
||||
|
||||
// Tests to be written here later
|
||||
|
||||
}
|
||||
}
|
||||
@@ -110,13 +110,23 @@ namespace AiQ_GUI.AiQ_Tests
|
||||
bool modelIsRed = !RegexCache.ModelRegex().IsMatch(DiagsAPI.modelNumber);
|
||||
MainForm.Instance.AddLabelToPanel(modelText, modelIsRed);
|
||||
|
||||
string apiModel = DiagsAPI.modelNumber?.Trim();
|
||||
string selectedModel = MainForm.Instance.CamOnTest.Model?.Trim();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(selectedModel) && MainForm.Instance.CbBxCameraModel.SelectedItem != null)
|
||||
selectedModel = MainForm.Instance.CbBxCameraModel.SelectedItem.ToString().Split('-')[0].Trim();
|
||||
|
||||
if (RegexCache.SerialRegex().IsMatch(DiagsAPI.serialNumber) && RegexCache.ModelRegex().IsMatch(DiagsAPI.modelNumber))
|
||||
{
|
||||
if (DiagsAPI.modelNumber != MainForm.Instance.CamOnTest.Model)
|
||||
// If nothing selected yet, do not warn (matches old logic)
|
||||
if (!string.IsNullOrWhiteSpace(selectedModel)
|
||||
&& !string.Equals(apiModel, selectedModel, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
MainForm.Instance.AddToActionsList("Model number in camera doesn't match what has been selected", Level.WARNING);
|
||||
MainForm.Instance.AddToActionsList(
|
||||
"Model number in camera doesn't match what has been selected",
|
||||
Level.WARNING);
|
||||
}
|
||||
else if (!GoogleAPI.CheckWIP(DiagsAPI.serialNumber, CameraAccessInfo.SpreadsheetID)) // Check WIP column in serial number register, if not ticked then RMA
|
||||
else if (!string.IsNullOrWhiteSpace(CameraAccessInfo.SpreadsheetID)&& !GoogleAPI.CheckWIP(DiagsAPI.serialNumber, CameraAccessInfo.SpreadsheetID)) // Check WIP column in serial number register, if not ticked then RMA
|
||||
{
|
||||
MainForm.Instance.CamOnTest.RMANum = GoogleAPI.CheckRMANum(DiagsAPI.serialNumber, DiagsAPI.modelNumber); // Corrected by qualifying with the type name
|
||||
|
||||
@@ -127,7 +137,6 @@ namespace AiQ_GUI.AiQ_Tests
|
||||
if (MainForm.Instance.CamOnTest.RMANum == -1) // Means they chose the 'I don't know' option
|
||||
await MainForm.Instance.TestFailed(MainForm.Instance.BtnStartTest, "Please get RMA number from operations team before continuing");
|
||||
}
|
||||
// Found RMA num and want to verify it with user
|
||||
else if (!await MainForm.Instance.DisplayQuestion($"Is {MainForm.Instance.CamOnTest.RMANum} the RMA Number?")) // '!' because if its not the right RMA number let the user to it manually
|
||||
{
|
||||
MainForm.Instance.CamOnTest.RMANum = Convert.ToInt32(await MainForm.Instance.DisplayInput("What is the RMA number?"));
|
||||
@@ -139,7 +148,9 @@ namespace AiQ_GUI.AiQ_Tests
|
||||
}
|
||||
else
|
||||
{
|
||||
MainForm.Instance.AddToActionsList("Camera has not been given a valid serial and model number, suggest you run through pre test again and check serial number register for any issues.", Level.ERROR);
|
||||
MainForm.Instance.AddToActionsList(
|
||||
"Camera has not been given a valid serial and model number, suggest you run through pre test again and check serial number register for any issues.",
|
||||
Level.ERROR);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -148,45 +159,36 @@ namespace AiQ_GUI.AiQ_Tests
|
||||
}
|
||||
|
||||
// Check licenses
|
||||
List<string> licensesOnCam = []; // Temporary list for licenses on camera
|
||||
List<string> licensesOnCam = new List<string>(); // Temporary list for licenses on camera
|
||||
|
||||
if (DiagsAPI.licenses.saf1)
|
||||
licensesOnCam.Add("SAF1");
|
||||
if (DiagsAPI.licenses.saf2)
|
||||
licensesOnCam.Add("SAF2");
|
||||
if (DiagsAPI.licenses.saf3)
|
||||
licensesOnCam.Add("SAF3");
|
||||
if (DiagsAPI.licenses.saf4)
|
||||
licensesOnCam.Add("SAF4");
|
||||
if (DiagsAPI.licenses.audit)
|
||||
licensesOnCam.Add("Audit");
|
||||
if (DiagsAPI.licenses.stream)
|
||||
licensesOnCam.Add("Stream");
|
||||
if (MainForm.Instance.sshData != null && MainForm.Instance.sshData.tailscale)
|
||||
licensesOnCam.Add("Tailscale");
|
||||
if (DiagsAPI.licenses.saf1) licensesOnCam.Add("SAF1");
|
||||
if (DiagsAPI.licenses.saf2) licensesOnCam.Add("SAF2");
|
||||
if (DiagsAPI.licenses.saf3) licensesOnCam.Add("SAF3");
|
||||
if (DiagsAPI.licenses.saf4) licensesOnCam.Add("SAF4");
|
||||
if (DiagsAPI.licenses.audit) licensesOnCam.Add("Audit");
|
||||
if (DiagsAPI.licenses.stream) licensesOnCam.Add("Stream");
|
||||
if (MainForm.Instance.sshData != null && MainForm.Instance.sshData.tailscale) licensesOnCam.Add("Tailscale");
|
||||
|
||||
string licText = "Licenses = " + (licensesOnCam.Count == 0 ? "None" : string.Join(", ", licensesOnCam));
|
||||
MainForm.Instance.AddLabelToPanel(licText, false);
|
||||
MainForm.Instance.AddLabelToPanel(
|
||||
"Licenses = " + (licensesOnCam.Count == 0 ? "None" : string.Join(", ", licensesOnCam)),
|
||||
false);
|
||||
|
||||
double CPUround = Math.Round(DiagsAPI.CPUusage); // Check CPU usage isn't near max
|
||||
string cpuText = "CPU Usage = " + CPUround + "%";
|
||||
bool cpuIsRed = CPUround <= 50 || CPUround >= 98;
|
||||
MainForm.Instance.AddLabelToPanel(cpuText, cpuIsRed);
|
||||
MainForm.Instance.AddLabelToPanel(
|
||||
"CPU Usage = " + CPUround + "%",
|
||||
CPUround <= 50 || CPUround >= 98);
|
||||
|
||||
// Check Vaxtor if it doesn't need or have license OR has and wants one then pass
|
||||
// Check Vaxtor license
|
||||
bool vaxtorIsRed = false;
|
||||
string vaxtorText = "Vaxtor Key ID = " + DiagsAPI.licenses.raptorKeyID;
|
||||
|
||||
if (CameraAccessInfo.VaxtorLic == false && DiagsAPI.licenses.raptorKeyID == "Not Licensed" || CameraAccessInfo.VaxtorLic == true && DiagsAPI.licenses.raptorKeyID != "Not Licensed")
|
||||
{
|
||||
// OK - passes condition
|
||||
vaxtorIsRed = false;
|
||||
}
|
||||
if (DiagsAPI.licenses.raptorKeyID != "Not Licensed") vaxtorIsRed = false;
|
||||
else if (CameraAccessInfo.VaxtorLic == false) vaxtorIsRed = false;
|
||||
else if (await MainForm.Instance.DisplayQuestion("Was this camera licensed manually?"))
|
||||
{
|
||||
string ProdcutKeyID = await MainForm.Instance.DisplayInput("What is the Key ID?", false);
|
||||
|
||||
if (RegexCache.VaxtorRegex().IsMatch(ProdcutKeyID)) // Valid Key ID
|
||||
if (RegexCache.VaxtorRegex().IsMatch(ProdcutKeyID))
|
||||
{
|
||||
Access.Stats("Please Get A Valid Vaxtor Product Key Before Continuing", MainForm.Instance.CamOnTest.Model);
|
||||
await MainForm.Instance.TestFailed(MainForm.Instance.BtnStartTest, "Please get a valid Vaxtor Product Key before continuing");
|
||||
@@ -196,22 +198,17 @@ namespace AiQ_GUI.AiQ_Tests
|
||||
vaxtorText = "Vaxtor Key ID = " + DiagsAPI.licenses.raptorKeyID;
|
||||
vaxtorIsRed = false;
|
||||
}
|
||||
else // Should have license but doesn't OR shouldn't have but does + any other unforeseen circumstance then fail
|
||||
{
|
||||
vaxtorIsRed = true;
|
||||
}
|
||||
else vaxtorIsRed = true;
|
||||
|
||||
MainForm.Instance.AddLabelToPanel(vaxtorText, vaxtorIsRed);
|
||||
|
||||
// Check trim is within 10% both horizontally and vertically, from auto set done earlier in the test
|
||||
string trimText = "Trim = H: " + DiagsAPI.trim[0] + " V: " + DiagsAPI.trim[1];
|
||||
|
||||
// Offset accounted for in the SetTrim function, so value should be close to 0,0.
|
||||
// Check trim is within 10% both horizontally and vertically
|
||||
const int HMax = 96; // 5% of 1920 each way = ±96
|
||||
const int VMax = 54; // 5% of 1080 each way = ±54
|
||||
|
||||
bool trimIsRed = Math.Abs(DiagsAPI.trim[0]) > HMax || Math.Abs(DiagsAPI.trim[1]) > VMax;
|
||||
MainForm.Instance.AddLabelToPanel(trimText, trimIsRed);
|
||||
MainForm.Instance.AddLabelToPanel(
|
||||
"Trim = H: " + DiagsAPI.trim[0] + " V: " + DiagsAPI.trim[1],
|
||||
Math.Abs(DiagsAPI.trim[0]) > HMax || Math.Abs(DiagsAPI.trim[1]) > VMax);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user