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

119
AiQ_GUI.Designer.cs generated
View File

@@ -132,10 +132,10 @@ namespace AiQ_GUI
TabImages = new TabPage();
Video = new TabPage();
VLCVideo = new Label();
pictureBox2 = new PictureBox();
label7 = new Label();
OVImage = new Label();
pictureBox1 = new PictureBox();
NightImgPcbx = new PictureBox();
NightImage = new Label();
DayImage = new Label();
DayImgPcbx = new PictureBox();
TabSoak = new TabPage();
BtnFactoryDefault = new Button();
SetGodModeAll = new Button();
@@ -170,8 +170,8 @@ namespace AiQ_GUI
TabSettings.SuspendLayout();
TabImages.SuspendLayout();
Video.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBox2).BeginInit();
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
((System.ComponentModel.ISupportInitialize)NightImgPcbx).BeginInit();
((System.ComponentModel.ISupportInitialize)DayImgPcbx).BeginInit();
TabSoak.SuspendLayout();
Mobile.SuspendLayout();
SuspendLayout();
@@ -1664,10 +1664,10 @@ namespace AiQ_GUI
Video.BackColor = Color.FromArgb(39, 37, 55);
Video.Controls.Add(VidView);
Video.Controls.Add(VLCVideo);
Video.Controls.Add(pictureBox2);
Video.Controls.Add(label7);
Video.Controls.Add(OVImage);
Video.Controls.Add(pictureBox1);
Video.Controls.Add(NightImgPcbx);
Video.Controls.Add(NightImage);
Video.Controls.Add(DayImage);
Video.Controls.Add(DayImgPcbx);
Video.Location = new Point(4, 24);
Video.Name = "Video";
Video.Padding = new Padding(3);
@@ -1688,55 +1688,55 @@ namespace AiQ_GUI
VLCVideo.TabIndex = 238;
VLCVideo.Text = "Live Video";
//
// pictureBox2
// NightImgPcbx
//
pictureBox2.BackColor = Color.Transparent;
pictureBox2.BorderStyle = BorderStyle.FixedSingle;
pictureBox2.Location = new Point(7, 303);
pictureBox2.Margin = new Padding(4, 3, 4, 3);
pictureBox2.Name = "pictureBox2";
pictureBox2.Size = new Size(392, 221);
pictureBox2.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox2.TabIndex = 237;
pictureBox2.TabStop = false;
NightImgPcbx.BackColor = Color.Transparent;
NightImgPcbx.BorderStyle = BorderStyle.FixedSingle;
NightImgPcbx.Location = new Point(7, 303);
NightImgPcbx.Margin = new Padding(4, 3, 4, 3);
NightImgPcbx.Name = "NightImgPcbx";
NightImgPcbx.Size = new Size(392, 221);
NightImgPcbx.SizeMode = PictureBoxSizeMode.StretchImage;
NightImgPcbx.TabIndex = 237;
NightImgPcbx.TabStop = false;
//
// label7
// NightImage
//
label7.AutoSize = true;
label7.BackColor = Color.Transparent;
label7.Font = new Font("Segoe UI Semibold", 12F, FontStyle.Bold);
label7.ForeColor = SystemColors.Control;
label7.Location = new Point(12, 279);
label7.Margin = new Padding(4, 0, 4, 0);
label7.Name = "label7";
label7.Size = new Size(101, 21);
label7.TabIndex = 236;
label7.Text = "Night Image";
NightImage.AutoSize = true;
NightImage.BackColor = Color.Transparent;
NightImage.Font = new Font("Segoe UI Semibold", 12F, FontStyle.Bold);
NightImage.ForeColor = SystemColors.Control;
NightImage.Location = new Point(12, 279);
NightImage.Margin = new Padding(4, 0, 4, 0);
NightImage.Name = "NightImage";
NightImage.Size = new Size(101, 21);
NightImage.TabIndex = 236;
NightImage.Text = "Night Image";
//
// OVImage
// DayImage
//
OVImage.AutoSize = true;
OVImage.BackColor = Color.Transparent;
OVImage.Font = new Font("Segoe UI Semibold", 12F, FontStyle.Bold);
OVImage.ForeColor = SystemColors.Control;
OVImage.Location = new Point(12, 14);
OVImage.Margin = new Padding(4, 0, 4, 0);
OVImage.Name = "OVImage";
OVImage.Size = new Size(87, 21);
OVImage.TabIndex = 235;
OVImage.Text = "Day Image";
DayImage.AutoSize = true;
DayImage.BackColor = Color.Transparent;
DayImage.Font = new Font("Segoe UI Semibold", 12F, FontStyle.Bold);
DayImage.ForeColor = SystemColors.Control;
DayImage.Location = new Point(12, 14);
DayImage.Margin = new Padding(4, 0, 4, 0);
DayImage.Name = "DayImage";
DayImage.Size = new Size(87, 21);
DayImage.TabIndex = 235;
DayImage.Text = "Day Image";
//
// pictureBox1
// DayImgPcbx
//
pictureBox1.BackColor = Color.Transparent;
pictureBox1.BorderStyle = BorderStyle.FixedSingle;
pictureBox1.Location = new Point(7, 46);
pictureBox1.Margin = new Padding(4, 3, 4, 3);
pictureBox1.Name = "pictureBox1";
pictureBox1.Size = new Size(392, 221);
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox1.TabIndex = 234;
pictureBox1.TabStop = false;
DayImgPcbx.BackColor = Color.Transparent;
DayImgPcbx.BorderStyle = BorderStyle.FixedSingle;
DayImgPcbx.Location = new Point(7, 46);
DayImgPcbx.Margin = new Padding(4, 3, 4, 3);
DayImgPcbx.Name = "DayImgPcbx";
DayImgPcbx.Size = new Size(392, 221);
DayImgPcbx.SizeMode = PictureBoxSizeMode.StretchImage;
DayImgPcbx.TabIndex = 234;
DayImgPcbx.TabStop = false;
//
// TabSoak
//
@@ -1979,8 +1979,8 @@ namespace AiQ_GUI
TabImages.PerformLayout();
Video.ResumeLayout(false);
Video.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureBox2).EndInit();
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
((System.ComponentModel.ISupportInitialize)NightImgPcbx).EndInit();
((System.ComponentModel.ISupportInitialize)DayImgPcbx).EndInit();
TabSoak.ResumeLayout(false);
TabSoak.PerformLayout();
Mobile.ResumeLayout(false);
@@ -1992,7 +1992,7 @@ namespace AiQ_GUI
#endregion
public System.Windows.Forms.Button BtnStartTest;
private System.Windows.Forms.Button BtnFindCams;
private System.Windows.Forms.ComboBox CbBxFoundCams;
public System.Windows.Forms.ComboBox CbBxFoundCams;
private System.Windows.Forms.Button BtnRestart;
private System.Windows.Forms.Button BtnMin;
private System.Windows.Forms.Button BtnClose;
@@ -2121,12 +2121,13 @@ namespace AiQ_GUI
public ComboBox CbBxCamType;
public TabPage Mobile;
private Button BtnUpFirm;
private LibVLCSharp.WinForms.VideoView VidView;
public LibVLCSharp.WinForms.VideoView VidView;
private TabPage Video;
public Label label7;
public Label OVImage;
public Label NightImage;
public Label DayImage;
public PictureBox pictureBox1;
public Label VLCVideo;
public PictureBox pictureBox2;
public PictureBox NightImgPcbx;
public PictureBox DayImgPcbx;
}
}