Mobile API Refactoring

• Introduced new Mobile API.cs module
• Encapsulates firmware checks, day/night mode switching, and snapshot operations
• Methods: CheckFirmwareAsync(), SetDayModeAsync(), SetNightModeAsync()
• Improves code maintainability and separates API logic from test execution

UI Components
• DayImgPcbx PictureBox: Displays day snapshot
• NightImgPcbx PictureBox: Displays night snapshot
• DayImage Label: Shows day luminance percentage
• NightImage Label: Shows night luminance percentage

Features Implemented
• Luminance-based validation: Uses ImageProcessing.GetMeanLuminance() to quantitatively analyze day and night snapshots
• Validation logic: Day luminance must exceed night luminance to pass the test
• Real-time luminance display: Appends calculated luminance percentages (0-100%) to day and night image labels
• Enhanced error reporting: Logs detailed luminance values when test fails for debugging purposes

• Captures day mode snapshot → Analyzes luminance
• Captures night mode snapshot → Analyzes luminance
• Compares values and updates UI labels with percentages
• Result: "Day/Night Mode = Passed" (green) or "Day/Night Mode = Failed" (red) with error details
This commit is contained in:
2026-01-13 15:31:50 +00:00
parent 4a2e874b9d
commit d1d90f17fc
7 changed files with 308 additions and 162 deletions

View File

@@ -1,7 +1,9 @@
using AiQ_GUI;
using Emgu.CV.Dai;
using LibVLCSharp.Shared;
using LibVLCSharp.WinForms;
using System.IO;
using System.Security.Policy;
internal class VLC
{
@@ -14,12 +16,12 @@ internal class VLC
libVLC = new LibVLC();
}
public static string RtspUrl = $"rtsp://ADMIN:1234@192.168.0.85:554/live/main";
public static string SnapshotPath = Path.Combine(LDS.MAVPath, "Mobile_ov_snapshot.png");
public static void Play(VideoView VLCVV)
{
var media = new Media(libVLC, RtspUrl, FromType.FromLocation);
var media = new Media(libVLC, $"rtsp://ADMIN:1234@{MainForm.Instance.CamOnTest.IP}:554/live/main", FromType.FromLocation);
VLCVV.MediaPlayer.Play(media);
}
@@ -28,10 +30,10 @@ internal class VLC
return VLCVV.MediaPlayer.IsPlaying;
}
public static void TakeSnapshot(VideoView VLCVV)
public static void TakeSnapshot(VideoView VLCVV, string filename = "Mobile_ov_snapshot.png")
{
VLCVV.MediaPlayer.TakeSnapshot(0, SnapshotPath, 1280, 720);
string path = Path.Combine(LDS.MAVPath, filename);
VLCVV.MediaPlayer.TakeSnapshot(0, path, 1280, 720);
}
public static void Stop(VideoView VLCVV)
@@ -41,7 +43,7 @@ internal class VLC
public static void Capture(VideoView VLCVV)
{
var media = new Media(libVLC, RtspUrl, FromType.FromLocation);
var media = new Media(libVLC, $"rtsp://ADMIN:1234@{MainForm.Instance.CamOnTest.IP}:554/live/main", FromType.FromLocation);
media.AddOption(":rtsp-tcp");
VLCVV.MediaPlayer.Play(media);
}