add zoom test

This commit is contained in:
Vincent BOUQUET
2024-03-27 20:43:12 +01:00
parent 5b78fdf17e
commit 38b7f93ca2
3 changed files with 73 additions and 28 deletions

View File

@@ -41,6 +41,8 @@ namespace robospot_camera_finder
lblRtspLink = new Label(); lblRtspLink = new Label();
labelSerial = new Label(); labelSerial = new Label();
tbSerial = new TextBox(); tbSerial = new TextBox();
cbTestZoom = new CheckBox();
timerZoomTestSeq = new System.Windows.Forms.Timer(components);
((System.ComponentModel.ISupportInitialize)videoView).BeginInit(); ((System.ComponentModel.ISupportInitialize)videoView).BeginInit();
((System.ComponentModel.ISupportInitialize)tbZoom).BeginInit(); ((System.ComponentModel.ISupportInitialize)tbZoom).BeginInit();
SuspendLayout(); SuspendLayout();
@@ -49,11 +51,10 @@ namespace robospot_camera_finder
// //
videoView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; videoView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
videoView.BackColor = Color.Black; videoView.BackColor = Color.Black;
videoView.Location = new Point(13, 14); videoView.Location = new Point(9, 8);
videoView.Margin = new Padding(4, 5, 4, 5);
videoView.MediaPlayer = null; videoView.MediaPlayer = null;
videoView.Name = "videoView"; videoView.Name = "videoView";
videoView.Size = new Size(1035, 796); videoView.Size = new Size(724, 478);
videoView.TabIndex = 0; videoView.TabIndex = 0;
videoView.TabStop = false; videoView.TabStop = false;
videoView.Text = "videoView"; videoView.Text = "videoView";
@@ -62,12 +63,11 @@ namespace robospot_camera_finder
// //
tbZoom.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; tbZoom.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
tbZoom.LargeChange = 20; tbZoom.LargeChange = 20;
tbZoom.Location = new Point(1056, 58); tbZoom.Location = new Point(739, 35);
tbZoom.Margin = new Padding(4, 5, 4, 5);
tbZoom.Maximum = 9999; tbZoom.Maximum = 9999;
tbZoom.Name = "tbZoom"; tbZoom.Name = "tbZoom";
tbZoom.Orientation = Orientation.Vertical; tbZoom.Orientation = Orientation.Vertical;
tbZoom.Size = new Size(69, 710); tbZoom.Size = new Size(45, 426);
tbZoom.SmallChange = 10; tbZoom.SmallChange = 10;
tbZoom.TabIndex = 1; tbZoom.TabIndex = 1;
tbZoom.TickFrequency = 300; tbZoom.TickFrequency = 300;
@@ -86,10 +86,9 @@ namespace robospot_camera_finder
// //
btnZoomMin.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; btnZoomMin.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
btnZoomMin.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); btnZoomMin.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
btnZoomMin.Location = new Point(1056, 778); btnZoomMin.Location = new Point(739, 467);
btnZoomMin.Margin = new Padding(4, 5, 4, 5);
btnZoomMin.Name = "btnZoomMin"; btnZoomMin.Name = "btnZoomMin";
btnZoomMin.Size = new Size(60, 38); btnZoomMin.Size = new Size(42, 23);
btnZoomMin.TabIndex = 2; btnZoomMin.TabIndex = 2;
btnZoomMin.Text = "1x"; btnZoomMin.Text = "1x";
btnZoomMin.UseVisualStyleBackColor = true; btnZoomMin.UseVisualStyleBackColor = true;
@@ -99,10 +98,9 @@ namespace robospot_camera_finder
// //
btnZoomMax.Anchor = AnchorStyles.Top | AnchorStyles.Right; btnZoomMax.Anchor = AnchorStyles.Top | AnchorStyles.Right;
btnZoomMax.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); btnZoomMax.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
btnZoomMax.Location = new Point(1056, 10); btnZoomMax.Location = new Point(739, 6);
btnZoomMax.Margin = new Padding(4, 5, 4, 5);
btnZoomMax.Name = "btnZoomMax"; btnZoomMax.Name = "btnZoomMax";
btnZoomMax.Size = new Size(60, 38); btnZoomMax.Size = new Size(42, 23);
btnZoomMax.TabIndex = 3; btnZoomMax.TabIndex = 3;
btnZoomMax.Text = "32x"; btnZoomMax.Text = "32x";
btnZoomMax.UseVisualStyleBackColor = true; btnZoomMax.UseVisualStyleBackColor = true;
@@ -111,21 +109,19 @@ namespace robospot_camera_finder
// tbRtspLink // tbRtspLink
// //
tbRtspLink.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; tbRtspLink.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
tbRtspLink.Location = new Point(573, 820); tbRtspLink.Location = new Point(312, 492);
tbRtspLink.Margin = new Padding(4, 5, 4, 5);
tbRtspLink.Name = "tbRtspLink"; tbRtspLink.Name = "tbRtspLink";
tbRtspLink.ReadOnly = true; tbRtspLink.ReadOnly = true;
tbRtspLink.Size = new Size(545, 31); tbRtspLink.Size = new Size(215, 23);
tbRtspLink.TabIndex = 8; tbRtspLink.TabIndex = 8;
// //
// lblRtspLink // lblRtspLink
// //
lblRtspLink.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; lblRtspLink.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
lblRtspLink.AutoSize = true; lblRtspLink.AutoSize = true;
lblRtspLink.Location = new Point(478, 823); lblRtspLink.Location = new Point(249, 494);
lblRtspLink.Margin = new Padding(4, 0, 4, 0);
lblRtspLink.Name = "lblRtspLink"; lblRtspLink.Name = "lblRtspLink";
lblRtspLink.Size = new Size(87, 25); lblRtspLink.Size = new Size(57, 15);
lblRtspLink.TabIndex = 7; lblRtspLink.TabIndex = 7;
lblRtspLink.Text = "RTSP Link"; lblRtspLink.Text = "RTSP Link";
// //
@@ -133,28 +129,44 @@ namespace robospot_camera_finder
// //
labelSerial.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; labelSerial.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
labelSerial.AutoSize = true; labelSerial.AutoSize = true;
labelSerial.Location = new Point(13, 823); labelSerial.Location = new Point(9, 494);
labelSerial.Margin = new Padding(4, 0, 4, 0);
labelSerial.Name = "labelSerial"; labelSerial.Name = "labelSerial";
labelSerial.Size = new Size(124, 25); labelSerial.Size = new Size(82, 15);
labelSerial.TabIndex = 6; labelSerial.TabIndex = 6;
labelSerial.Text = "Serial Number"; labelSerial.Text = "Serial Number";
// //
// tbSerial // tbSerial
// //
tbSerial.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; tbSerial.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
tbSerial.Location = new Point(145, 820); tbSerial.Location = new Point(102, 492);
tbSerial.Margin = new Padding(4, 5, 4, 5);
tbSerial.Name = "tbSerial"; tbSerial.Name = "tbSerial";
tbSerial.ReadOnly = true; tbSerial.ReadOnly = true;
tbSerial.Size = new Size(241, 31); tbSerial.Size = new Size(124, 23);
tbSerial.TabIndex = 5; tbSerial.TabIndex = 5;
// //
// cbTestZoom
//
cbTestZoom.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
cbTestZoom.AutoSize = true;
cbTestZoom.Location = new Point(640, 493);
cbTestZoom.Name = "cbTestZoom";
cbTestZoom.Size = new Size(144, 19);
cbTestZoom.TabIndex = 9;
cbTestZoom.Text = "Automated Zoom Test";
cbTestZoom.UseVisualStyleBackColor = true;
cbTestZoom.CheckedChanged += cbTestZoom_CheckedChanged;
//
// timerZoomTestSeq
//
timerZoomTestSeq.Interval = 6000;
timerZoomTestSeq.Tick += timerZoomTestSeq_Tick;
//
// StreamViewer // StreamViewer
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1138, 857); ClientSize = new Size(801, 514);
Controls.Add(cbTestZoom);
Controls.Add(tbRtspLink); Controls.Add(tbRtspLink);
Controls.Add(lblRtspLink); Controls.Add(lblRtspLink);
Controls.Add(videoView); Controls.Add(videoView);
@@ -164,8 +176,8 @@ namespace robospot_camera_finder
Controls.Add(tbZoom); Controls.Add(tbZoom);
Controls.Add(btnZoomMin); Controls.Add(btnZoomMin);
Icon = (Icon)resources.GetObject("$this.Icon"); Icon = (Icon)resources.GetObject("$this.Icon");
Margin = new Padding(6, 5, 6, 5); Margin = new Padding(4, 3, 4, 3);
MinimumSize = new Size(1160, 884); MinimumSize = new Size(817, 546);
Name = "StreamViewer"; Name = "StreamViewer";
Text = "Camera"; Text = "Camera";
FormClosed += StreamViewer_FormClosed; FormClosed += StreamViewer_FormClosed;
@@ -186,5 +198,7 @@ namespace robospot_camera_finder
private TextBox tbSerial; private TextBox tbSerial;
private TextBox tbRtspLink; private TextBox tbRtspLink;
private Label lblRtspLink; private Label lblRtspLink;
private CheckBox cbTestZoom;
private System.Windows.Forms.Timer timerZoomTestSeq;
} }
} }

View File

@@ -13,6 +13,8 @@ namespace robospot_camera_finder
int max_zoom_pulse = 9999; int max_zoom_pulse = 9999;
int min_zoom_pulse = 10; int min_zoom_pulse = 10;
bool zoomTestSeqFlag = false;
public StreamViewer(string name, string ip, MainForm.Camera camera, MainForm mainForm) public StreamViewer(string name, string ip, MainForm.Camera camera, MainForm mainForm)
{ {
InitializeComponent(); InitializeComponent();
@@ -108,5 +110,31 @@ namespace robospot_camera_finder
tbZoom.Value = min_zoom_pulse; tbZoom.Value = min_zoom_pulse;
sendZoomValue(tbZoom.Value.ToString()); sendZoomValue(tbZoom.Value.ToString());
} }
private void cbTestZoom_CheckedChanged(object sender, EventArgs e)
{
if (cbTestZoom.Checked)
{
timerZoomTestSeq.Start();
} else
{
timerZoomTestSeq.Stop();
}
}
private void timerZoomTestSeq_Tick(object sender, EventArgs e)
{
if (zoomTestSeqFlag)
{
tbZoom.Value = min_zoom_pulse;
sendZoomValue(tbZoom.Value.ToString());
zoomTestSeqFlag = false;
} else
{
tbZoom.Value = max_zoom_pulse;
sendZoomValue(tbZoom.Value.ToString());
zoomTestSeqFlag = true;
}
}
} }
} }

View File

@@ -120,6 +120,9 @@
<metadata name="timerUpdateZoom.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="timerUpdateZoom.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="timerZoomTestSeq.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>169, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>