if(!LEDreply.Contains("Power levels set successfully"))
MainForm.Instance.AddToActionsList($"LED level could not be set: {LEDreply}",Level.ERROR);
awaitCameraModules.FactoryResetModules(MainForm.Instance.CamOnTest.IP);// Reset both modules and double check
MainForm.Instance.sshData=SSH.CollectSSHData(MainForm.Instance.CamOnTest.IP);// SSH into camera to get Vaxtor packages, filesystem size and if tailscale is installed.
awaitSSH.CheckFSSize(MainForm.Instance.CamOnTest.IP,MainForm.Instance.LblFilesystemSize,MainForm.Instance.sshData);// Check Filesystem size is between 100GB & 150GB
Helper.DCPowerCheck(MainForm.Instance.LblDC);// If the camera is DC powered check it is within limits
// Requests, deserialises and checks the diagnostics API is correct
awaitTestingFunctions.CheckDiagsAPIPt1();
// Check module has gone to default config
CameraModules.CheckCamModule(TestingFunctions.DiagsAPI.IRmodule,MainForm.Instance.LblIRModule,MainForm.Instance.CamOnTest);// IR
CameraModules.CheckCamModule(TestingFunctions.DiagsAPI.OVmodule,MainForm.Instance.LblOVModule,MainForm.Instance.CamOnTest);// OV
// Check voltage and current are OK.
LED.CheckLEDs(TestingFunctions.DiagsAPI.LedVoltage,MainForm.Instance.LblLEDV,"V",CameraAccessInfo.LED_V);// Voltage
LED.CheckLEDs(TestingFunctions.DiagsAPI.LedCurrent,MainForm.Instance.LblLEDI,"mA",CameraAccessInfo.LED_I);// Current
MainForm.Instance.Refresh();// Make sure all labels are updated before checking them
// If there are any actions identified then fail the test.
// If any labels are red then fail. Only labels in panel so can foreach on labels not controls
if(awaitMainForm.Instance.DisplayQuestion($"Would you like to allocate a serial number to this camera?"))
awaitMainForm.Instance.AllocateSerial();
elseif(GoogleAPI.UpdateSpreadSheetRePreTest(CameraAccessInfo.SpreadsheetID,MainForm.Instance.Vers)!="OK")// If rerun might be different values so update SS
MainForm.Instance.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");
if(MainForm.Instance.LblTestTubePing.Text=="❌")// No test tube so test like an IQ
{
stringLEDreply=awaitFlexiAPI.APIHTTPLED(MainForm.Instance.CamOnTest.IP,LEDPOWER.SAFE);// Set LED's to safe (0x0E) to help with eye safety and trim check.
if(!LEDreply.Contains("Power levels set successfully"))
MainForm.Instance.AddToActionsList($"LED level could not be set: {LEDreply}",Level.ERROR);
awaitTask.Delay(1000);// Without sleep it kept failing the factory reset as camera modules were not ready yet
awaitCameraModules.FactoryResetModules(MainForm.Instance.CamOnTest.IP);// Reset both modules and double check
stringVISCAReply=awaitFlexiAPI.APIHTTPVISCA(MainForm.Instance.CamOnTest.IP,"8101043903FF",true);// Manual mode to be able to manipulate the SIG settings.
if(VISCAReply!="9041FF9051FF")
MainForm.Instance.AddToActionsList("Couldn't set to manual mode",Level.ERROR);
awaitCameraModules.SetSIG(MainForm.Instance.CbBxShutter,MainForm.Instance.CbBxIris,MainForm.Instance.CbBxGain,MainForm.Instance.CamOnTest.IP);// Set SIG according to the drop downs in settings for a good picture ready for image check
awaitImageProcessing.ImageCheck(MainForm.Instance.PicBxOV,MainForm.Instance.PicBxIRF2,MainForm.Instance.PicBxIRF16,MainForm.Instance.LblIRImageF2,MainForm.Instance.LblIRImageF16,MainForm.Instance.CamOnTest);// Populates the picture boxes and checks iris changes
awaitVisCheck;// Before changing UI elements wait for user to finish Visual check
MainForm.Instance.TabImagesandSettings.SelectedIndex=2;// Swaps to the images tab
MainForm.Instance.Refresh();// Show user things are happening by displaying images taken
// TODO - Force expire sighting.
TaskWait=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
MainForm.Instance.sshData=SSH.CollectSSHData(MainForm.Instance.CamOnTest.IP);// SSH into camera to get Vaxtor packages, filesystem size and if tailscale is installed.
awaitSSH.CheckFSSize(MainForm.Instance.CamOnTest.IP,MainForm.Instance.LblFilesystemSize,MainForm.Instance.sshData);// Check Filesystem size is between 100GB & 150GB
Helper.DCPowerCheck(MainForm.Instance.LblDC);// If the camera is DC powered check it is within limits
if(CameraAccessInfo.HardwareExtras.Contains("4G"))// If it is a router camera then test the router.
{
MainForm.Instance.LblRouter.Visible=true;
if(Router.CheckRouter(Router.GetRouterInfo()))
MainForm.Instance.LblRouter.Text+="OK";
else
MainForm.Instance.LblRouter.Text+="Error with router";
}
awaitWait;// Finished to 5s wait
awaitFlexiAPI.SetTrim(MainForm.Instance.CamOnTest.IP,MainForm.Instance.LblTestTubePing.Text);// Auto trims the cameras, some plates should have been captured in the meantime
if(!awaitCameraModules.ZoomModules("0000",MainForm.Instance.CamOnTest.IP))// Zoom to full wide
awaitMainForm.Instance.TestFailed(MainForm.Instance.BtnStartTest,"Could not zoom modules to full wide");
awaitTask.Delay(1000);// Wait to be sure cameras are zoomed out.
awaitCameraModules.FactoryResetModules(MainForm.Instance.CamOnTest.IP);// Reset both modules and double check
if(MainForm.Instance.LblTestTubePing.Text=="❌")// Set LED's to MID in prep for diagnostics API
{
stringLEDreply=awaitFlexiAPI.APIHTTPLED(MainForm.Instance.CamOnTest.IP,LEDPOWER.MID);// Set LED's to medium (0x30)
if(!LEDreply.Contains("Power levels set successfully"))
MainForm.Instance.AddToActionsList($"LED level could not be set: {LEDreply}",Level.ERROR);
awaitMainForm.Instance.TestFailed(MainForm.Instance.BtnStartTest,"Diagnostic Failure");// If approved then pass otherwise GUI would have restarted before getting to TestPassed.