• New method added: RunFinalTestAsync() - Performs final mobile tests including SSH verification of setup files • Calls SSH.MobiletxtCheck() to verify /home/mav/Mobile-Setup-configuration-marker.txt exists on device • Updates UI with "MobileSetup.sh" pass/fail status • Mobile Tests/Mobile API.cs (New File Created) New Method Added: MobiletxtCheck(string IPAddress) - Boolean method to verify setup marker file • Checks if /home/mav/Mobile-Setup-configuration-marker.txt exists on device via SSH • Returns exit status 0 (true) if file exists, false otherwise • Used in RunFinalTestAsync() for setup verification
84 lines
3.4 KiB
C#
84 lines
3.4 KiB
C#
using LibVLCSharp.WinForms;
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace AiQ_GUI.Mobile_Tests
|
|
{
|
|
public static class MobileTests
|
|
{
|
|
public static async Task RunPreTestAsync()
|
|
{
|
|
|
|
await MobileAPI.CheckFirmwareAsync();// Check firmware version
|
|
|
|
VLC.Play(MainForm.Instance.VidView);// Test Live Video streaming
|
|
await Task.Delay(5000);
|
|
|
|
VLC.TakeSnapshot(MainForm.Instance.VidView);
|
|
|
|
if (!VLC.IsPLaying(MainForm.Instance.VidView))// Check Live Video streaming
|
|
{
|
|
MainForm.Instance.AddToActionsList("Live Video streaming test failed: Video is not playing.", Level.ERROR);
|
|
MainForm.Instance.AddLabelToPanel("Live Video = Not Playing", true);
|
|
}
|
|
else
|
|
{
|
|
MainForm.Instance.AddLabelToPanel("Live Video = Playing", false);
|
|
}
|
|
|
|
await TestDayNightMode();// Test day/night mode cycling
|
|
|
|
double dayLuminance = ImageProcessing.GetMeanLuminance(MainForm.Instance.DayImgPcbx.Image); // Calculates the Luminance
|
|
double nightLuminance = ImageProcessing.GetMeanLuminance(MainForm.Instance.NightImgPcbx.Image);
|
|
|
|
MainForm.Instance.DayImage.Text += $" - Luminance: {dayLuminance}%";
|
|
MainForm.Instance.NightImage.Text += $" - Luminance: {nightLuminance}%";
|
|
|
|
if (dayLuminance > nightLuminance)
|
|
{
|
|
MainForm.Instance.AddLabelToPanel("Day/Night Mode = Passed", false);
|
|
}
|
|
else
|
|
{
|
|
MainForm.Instance.AddToActionsList($"Day/Night mode test failed: Day luminance ({dayLuminance}%) is not greater than night luminance ({nightLuminance}%).", Level.ERROR);
|
|
MainForm.Instance.AddLabelToPanel("Day/Night Mode = Failed", true);
|
|
|
|
}
|
|
}
|
|
public static async Task RunFinalTestAsync()
|
|
{
|
|
// Placeholder for any final tests if needed in the future
|
|
//RunPreTestAsync().Wait();
|
|
//SSH.MobiletxtCheck(MainForm.Instance.CamOnTest.IP);// Verify mobile.txt presence
|
|
if (SSH.MobiletxtCheck(MainForm.Instance.CamOnTest.IP) == true)
|
|
{
|
|
MainForm.Instance.AddLabelToPanel("MobileSetup.sh = True", false);
|
|
}
|
|
else
|
|
{
|
|
MainForm.Instance.AddToActionsList("MobileSetup.sh test failed: mobile.txt not found on device.", Level.ERROR);
|
|
MainForm.Instance.AddLabelToPanel("MobileSetup.sh = False", true);
|
|
}
|
|
}
|
|
|
|
private static async Task TestDayNightMode()
|
|
{
|
|
await MobileAPI.SetDayModeAsync();// Set to Day mode
|
|
|
|
await Task.Delay(5000);
|
|
|
|
VLC.TakeSnapshot(MainForm.Instance.VidView, "Mobile_day_snapshot.png");// Take Day Image Snapshot
|
|
|
|
MainForm.Instance.DayImgPcbx.Image = System.Drawing.Image.FromFile(Path.Combine(LDS.MAVPath, "Mobile_day_snapshot.png"));// Display Day mode snapshot
|
|
|
|
await MobileAPI.SetNightModeAsync();// Set to Night mode
|
|
|
|
await Task.Delay(5000);
|
|
|
|
VLC.TakeSnapshot(MainForm.Instance.VidView, "Mobile_night_snapshot.png");// Take Night Image Snapshot
|
|
MainForm.Instance.NightImgPcbx.Image = System.Drawing.Image.FromFile(Path.Combine(LDS.MAVPath, "Mobile_night_snapshot.png"));// Display Night mode snapshot
|
|
}
|
|
}
|
|
}
|
|
|