general overhaul & add presets
This commit is contained in:
25
MainForm.Designer.cs
generated
25
MainForm.Designer.cs
generated
@@ -30,6 +30,9 @@
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
lbMain = new ListBox();
|
||||
statusStripMain = new StatusStrip();
|
||||
toolStripStatusLabel = new ToolStripStatusLabel();
|
||||
statusStripMain.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// lbMain
|
||||
@@ -39,25 +42,45 @@
|
||||
lbMain.ItemHeight = 15;
|
||||
lbMain.Location = new Point(12, 23);
|
||||
lbMain.Name = "lbMain";
|
||||
lbMain.Size = new Size(776, 409);
|
||||
lbMain.Size = new Size(776, 394);
|
||||
lbMain.TabIndex = 0;
|
||||
lbMain.MouseDoubleClick += lbMain_MouseDoubleClick;
|
||||
//
|
||||
// statusStripMain
|
||||
//
|
||||
statusStripMain.Items.AddRange(new ToolStripItem[] { toolStripStatusLabel });
|
||||
statusStripMain.Location = new Point(0, 428);
|
||||
statusStripMain.Name = "statusStripMain";
|
||||
statusStripMain.Size = new Size(800, 22);
|
||||
statusStripMain.TabIndex = 1;
|
||||
statusStripMain.Text = "statusStrip1";
|
||||
//
|
||||
// toolStripStatusLabel
|
||||
//
|
||||
toolStripStatusLabel.Name = "toolStripStatusLabel";
|
||||
toolStripStatusLabel.Size = new Size(0, 17);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(statusStripMain);
|
||||
Controls.Add(lbMain);
|
||||
Icon = (Icon)resources.GetObject("$this.Icon");
|
||||
Name = "MainForm";
|
||||
Text = "RoboSpot MotionCamera finder";
|
||||
FormClosing += MainForm_FormClosing;
|
||||
statusStripMain.ResumeLayout(false);
|
||||
statusStripMain.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ListBox lbMain;
|
||||
private StatusStrip statusStripMain;
|
||||
private ToolStripStatusLabel toolStripStatusLabel;
|
||||
}
|
||||
}
|
||||
99
MainForm.cs
99
MainForm.cs
@@ -12,15 +12,22 @@ namespace robospot_camera_finder
|
||||
|
||||
private BindingList<Camera> all_cameras = new();
|
||||
|
||||
class Camera
|
||||
public static string cam_username = "admin";
|
||||
public static string cam_password = "RoboSpot10";
|
||||
|
||||
public class Camera
|
||||
{
|
||||
private IPAddress ip;
|
||||
private string name;
|
||||
private string location;
|
||||
private string serial;
|
||||
|
||||
public Camera(string name, IPAddress ip)
|
||||
public Camera(string name, IPAddress ip, string location, string serial)
|
||||
{
|
||||
this.name = name;
|
||||
this.ip = ip;
|
||||
this.location = location;
|
||||
this.serial = serial;
|
||||
}
|
||||
|
||||
public string camera_name
|
||||
@@ -38,6 +45,21 @@ namespace robospot_camera_finder
|
||||
return ip;
|
||||
}
|
||||
}
|
||||
|
||||
public string camera_location
|
||||
{
|
||||
get
|
||||
{
|
||||
return location;
|
||||
}
|
||||
}
|
||||
public string camera_serial
|
||||
{
|
||||
get
|
||||
{
|
||||
return serial;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MainForm()
|
||||
@@ -79,33 +101,67 @@ namespace robospot_camera_finder
|
||||
|
||||
browser.ServiceAdded += (sender, args) =>
|
||||
{
|
||||
foreach (var cam_addr in args.Announcement.Addresses)
|
||||
{
|
||||
if (cam_addr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||||
{
|
||||
Camera camera = new Camera("Camera " + cam_addr.ToString(), cam_addr);
|
||||
all_cameras.Add(camera);
|
||||
}
|
||||
}
|
||||
ServiceAdded(sender, args);
|
||||
};
|
||||
|
||||
browser.ServiceChanged += (sender, args) =>
|
||||
{
|
||||
ServiceAdded(sender, args);
|
||||
};
|
||||
|
||||
browser.ServiceRemoved += (sender, args) =>
|
||||
{
|
||||
foreach (var cam_ip in args.Announcement.Addresses)
|
||||
ServiceRemoved(sender, args);
|
||||
};
|
||||
}
|
||||
|
||||
private void ServiceAdded(object sender, ServiceAnnouncementEventArgs args)
|
||||
{
|
||||
foreach (var cam_addr in args.Announcement.Addresses)
|
||||
{
|
||||
if (cam_addr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||||
{
|
||||
if (cam_ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://" + cam_addr + "/stw-cgi/system.cgi?msubmenu=deviceinfo&action=view");
|
||||
request.Credentials = new NetworkCredential(MainForm.cam_username, MainForm.cam_password);
|
||||
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
||||
string text;
|
||||
using (var sr = new StreamReader(response.GetResponseStream())) { text = sr.ReadToEnd(); }
|
||||
string[] resp_lines = text.Split('\n');
|
||||
string location_line = Array.Find(resp_lines, line => line.Trim().StartsWith("DeviceLocation="));
|
||||
string serial_line = Array.Find(resp_lines, line => line.Trim().StartsWith("SerialNumber="));
|
||||
string location = "";
|
||||
string serial = "";
|
||||
if (location_line != null)
|
||||
{
|
||||
foreach (var camera in all_cameras)
|
||||
location = location_line.Substring("DeviceLocation=".Length).Trim();
|
||||
}
|
||||
if (serial_line != null)
|
||||
{
|
||||
serial = serial_line.Substring("SerialNumber=".Length).Trim();
|
||||
}
|
||||
|
||||
Camera camera = new Camera("Camera " + cam_addr.ToString() + " - " + location + " - " + serial, cam_addr, location, serial);
|
||||
all_cameras.Add(camera);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ServiceRemoved(object sender, ServiceAnnouncementEventArgs args)
|
||||
{
|
||||
foreach (var cam_ip in args.Announcement.Addresses)
|
||||
{
|
||||
if (cam_ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||||
{
|
||||
foreach (var camera in all_cameras)
|
||||
{
|
||||
if (cam_ip == camera.camera_ip)
|
||||
{
|
||||
if (cam_ip == camera.camera_ip)
|
||||
{
|
||||
all_cameras.Remove(camera);
|
||||
return;
|
||||
}
|
||||
all_cameras.Remove(camera);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
@@ -117,8 +173,11 @@ namespace robospot_camera_finder
|
||||
{
|
||||
if (lbMain.SelectedItem != null)
|
||||
{
|
||||
Form viewer = new StreamViewer(lbMain.GetItemText(lbMain.SelectedItem), lbMain.SelectedValue.ToString());
|
||||
toolStripStatusLabel.Text = "Loading camera...";
|
||||
Camera camera = all_cameras.FirstOrDefault<Camera>(cam => cam.camera_ip.ToString() == lbMain.SelectedValue.ToString());
|
||||
Form viewer = new StreamViewer(lbMain.GetItemText(lbMain.SelectedItem), lbMain.SelectedValue.ToString(), camera, this);
|
||||
viewer.Show();
|
||||
toolStripStatusLabel.Text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,64 @@
|
||||
<root>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
@@ -57,6 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="statusStripMain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<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">
|
||||
<value>
|
||||
|
||||
131
StreamViewer.Designer.cs
generated
131
StreamViewer.Designer.cs
generated
@@ -38,6 +38,13 @@ namespace robospot_camera_finder
|
||||
btnZoomMin = new Button();
|
||||
btnZoomMax = new Button();
|
||||
grpSACN = new GroupBox();
|
||||
gbPresetBtns = new GroupBox();
|
||||
btnPresetClr = new Button();
|
||||
btnPresetRec = new Button();
|
||||
btnPreset4 = new Button();
|
||||
btnPreset3 = new Button();
|
||||
btnPreset2 = new Button();
|
||||
btnPreset1 = new Button();
|
||||
cbEnableSACN = new CheckBox();
|
||||
tbTilt = new TrackBar();
|
||||
cbEnableXboxCtrl = new CheckBox();
|
||||
@@ -48,10 +55,13 @@ namespace robospot_camera_finder
|
||||
numUniv = new NumericUpDown();
|
||||
timerDMX = new System.Windows.Forms.Timer(components);
|
||||
splitContainerMain = new SplitContainer();
|
||||
labelSerial = new Label();
|
||||
tbSerial = new TextBox();
|
||||
btnSidePanel = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)videoView).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)tbZoom).BeginInit();
|
||||
grpSACN.SuspendLayout();
|
||||
gbPresetBtns.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)tbTilt).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)tbPan).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numDMXAddr).BeginInit();
|
||||
@@ -69,7 +79,7 @@ namespace robospot_camera_finder
|
||||
videoView.Location = new Point(12, 12);
|
||||
videoView.MediaPlayer = null;
|
||||
videoView.Name = "videoView";
|
||||
videoView.Size = new Size(730, 490);
|
||||
videoView.Size = new Size(730, 453);
|
||||
videoView.TabIndex = 0;
|
||||
videoView.TabStop = false;
|
||||
videoView.Text = "videoView";
|
||||
@@ -124,6 +134,7 @@ namespace robospot_camera_finder
|
||||
// grpSACN
|
||||
//
|
||||
grpSACN.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
grpSACN.Controls.Add(gbPresetBtns);
|
||||
grpSACN.Controls.Add(cbEnableSACN);
|
||||
grpSACN.Controls.Add(tbTilt);
|
||||
grpSACN.Controls.Add(cbEnableXboxCtrl);
|
||||
@@ -139,6 +150,93 @@ namespace robospot_camera_finder
|
||||
grpSACN.TabStop = false;
|
||||
grpSACN.Text = "sACN Control";
|
||||
//
|
||||
// gbPresetBtns
|
||||
//
|
||||
gbPresetBtns.Controls.Add(btnPresetClr);
|
||||
gbPresetBtns.Controls.Add(btnPresetRec);
|
||||
gbPresetBtns.Controls.Add(btnPreset4);
|
||||
gbPresetBtns.Controls.Add(btnPreset3);
|
||||
gbPresetBtns.Controls.Add(btnPreset2);
|
||||
gbPresetBtns.Controls.Add(btnPreset1);
|
||||
gbPresetBtns.Location = new Point(6, 287);
|
||||
gbPresetBtns.Name = "gbPresetBtns";
|
||||
gbPresetBtns.Size = new Size(224, 94);
|
||||
gbPresetBtns.TabIndex = 7;
|
||||
gbPresetBtns.TabStop = false;
|
||||
gbPresetBtns.Text = "Presets";
|
||||
//
|
||||
// btnPresetClr
|
||||
//
|
||||
btnPresetClr.Enabled = false;
|
||||
btnPresetClr.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
btnPresetClr.Location = new Point(113, 56);
|
||||
btnPresetClr.Name = "btnPresetClr";
|
||||
btnPresetClr.Size = new Size(103, 28);
|
||||
btnPresetClr.TabIndex = 5;
|
||||
btnPresetClr.Text = "Clear";
|
||||
btnPresetClr.UseVisualStyleBackColor = true;
|
||||
btnPresetClr.Click += btnPresetClr_Click;
|
||||
//
|
||||
// btnPresetRec
|
||||
//
|
||||
btnPresetRec.Enabled = false;
|
||||
btnPresetRec.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
btnPresetRec.Location = new Point(5, 56);
|
||||
btnPresetRec.Name = "btnPresetRec";
|
||||
btnPresetRec.Size = new Size(103, 28);
|
||||
btnPresetRec.TabIndex = 4;
|
||||
btnPresetRec.Text = "Record";
|
||||
btnPresetRec.UseVisualStyleBackColor = true;
|
||||
btnPresetRec.Click += btnPresetRec_Click;
|
||||
//
|
||||
// btnPreset4
|
||||
//
|
||||
btnPreset4.Enabled = false;
|
||||
btnPreset4.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
btnPreset4.Location = new Point(167, 22);
|
||||
btnPreset4.Name = "btnPreset4";
|
||||
btnPreset4.Size = new Size(49, 28);
|
||||
btnPreset4.TabIndex = 3;
|
||||
btnPreset4.Text = "4";
|
||||
btnPreset4.UseVisualStyleBackColor = true;
|
||||
btnPreset4.Click += btnPreset4_Click;
|
||||
//
|
||||
// btnPreset3
|
||||
//
|
||||
btnPreset3.Enabled = false;
|
||||
btnPreset3.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
btnPreset3.Location = new Point(113, 22);
|
||||
btnPreset3.Name = "btnPreset3";
|
||||
btnPreset3.Size = new Size(49, 28);
|
||||
btnPreset3.TabIndex = 2;
|
||||
btnPreset3.Text = "3";
|
||||
btnPreset3.UseVisualStyleBackColor = true;
|
||||
btnPreset3.Click += btnPreset3_Click;
|
||||
//
|
||||
// btnPreset2
|
||||
//
|
||||
btnPreset2.Enabled = false;
|
||||
btnPreset2.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
btnPreset2.Location = new Point(59, 22);
|
||||
btnPreset2.Name = "btnPreset2";
|
||||
btnPreset2.Size = new Size(49, 28);
|
||||
btnPreset2.TabIndex = 1;
|
||||
btnPreset2.Text = "2";
|
||||
btnPreset2.UseVisualStyleBackColor = true;
|
||||
btnPreset2.Click += btnPreset2_Click;
|
||||
//
|
||||
// btnPreset1
|
||||
//
|
||||
btnPreset1.Enabled = false;
|
||||
btnPreset1.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
btnPreset1.Location = new Point(5, 22);
|
||||
btnPreset1.Name = "btnPreset1";
|
||||
btnPreset1.Size = new Size(49, 28);
|
||||
btnPreset1.TabIndex = 0;
|
||||
btnPreset1.Text = "1";
|
||||
btnPreset1.UseVisualStyleBackColor = true;
|
||||
btnPreset1.Click += btnPreset1_Click;
|
||||
//
|
||||
// cbEnableSACN
|
||||
//
|
||||
cbEnableSACN.AutoSize = true;
|
||||
@@ -240,6 +338,8 @@ namespace robospot_camera_finder
|
||||
//
|
||||
// splitContainerMain.Panel1
|
||||
//
|
||||
splitContainerMain.Panel1.Controls.Add(labelSerial);
|
||||
splitContainerMain.Panel1.Controls.Add(tbSerial);
|
||||
splitContainerMain.Panel1.Controls.Add(btnSidePanel);
|
||||
splitContainerMain.Panel1.Controls.Add(btnZoomMin);
|
||||
splitContainerMain.Panel1.Controls.Add(tbZoom);
|
||||
@@ -255,6 +355,25 @@ namespace robospot_camera_finder
|
||||
splitContainerMain.TabIndex = 6;
|
||||
splitContainerMain.TabStop = false;
|
||||
//
|
||||
// labelSerial
|
||||
//
|
||||
labelSerial.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
labelSerial.AutoSize = true;
|
||||
labelSerial.Location = new Point(12, 483);
|
||||
labelSerial.Name = "labelSerial";
|
||||
labelSerial.Size = new Size(82, 15);
|
||||
labelSerial.TabIndex = 6;
|
||||
labelSerial.Text = "Serial Number";
|
||||
//
|
||||
// tbSerial
|
||||
//
|
||||
tbSerial.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
tbSerial.Location = new Point(100, 479);
|
||||
tbSerial.Name = "tbSerial";
|
||||
tbSerial.ReadOnly = true;
|
||||
tbSerial.Size = new Size(170, 23);
|
||||
tbSerial.TabIndex = 5;
|
||||
//
|
||||
// btnSidePanel
|
||||
//
|
||||
btnSidePanel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
@@ -283,6 +402,7 @@ namespace robospot_camera_finder
|
||||
((System.ComponentModel.ISupportInitialize)tbZoom).EndInit();
|
||||
grpSACN.ResumeLayout(false);
|
||||
grpSACN.PerformLayout();
|
||||
gbPresetBtns.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)tbTilt).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)tbPan).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numDMXAddr).EndInit();
|
||||
@@ -314,5 +434,14 @@ namespace robospot_camera_finder
|
||||
private SplitContainer splitContainerMain;
|
||||
private CheckBox cbEnableSACN;
|
||||
private Button btnSidePanel;
|
||||
private Label labelSerial;
|
||||
private TextBox tbSerial;
|
||||
private GroupBox gbPresetBtns;
|
||||
private Button btnPreset1;
|
||||
private Button btnPresetClr;
|
||||
private Button btnPresetRec;
|
||||
private Button btnPreset4;
|
||||
private Button btnPreset3;
|
||||
private Button btnPreset2;
|
||||
}
|
||||
}
|
||||
218
StreamViewer.cs
218
StreamViewer.cs
@@ -15,8 +15,6 @@ namespace robospot_camera_finder
|
||||
|
||||
static SACNClient sendClient = new SACNClient(senderId: acnSourceId, senderName: acnSourceName, localAddress: SACNCommon.GetFirstBindAddress().IPAddress);
|
||||
|
||||
string username = "admin";
|
||||
string password = "RoboSpot10";
|
||||
string cam_ip = "";
|
||||
|
||||
int max_zoom_pulse = 9999;
|
||||
@@ -26,7 +24,31 @@ namespace robospot_camera_finder
|
||||
|
||||
Xbox360Controller controller = new Xbox360Controller();
|
||||
|
||||
public StreamViewer(string name, string ip)
|
||||
bool preset_rec_mode = false;
|
||||
bool preset_clear_mode = false;
|
||||
|
||||
bool preset1_exists = false;
|
||||
int preset1_pan;
|
||||
int preset1_tilt;
|
||||
int preset1_zoom;
|
||||
|
||||
bool preset2_exists = false;
|
||||
int preset2_pan;
|
||||
int preset2_tilt;
|
||||
int preset2_zoom;
|
||||
|
||||
bool preset3_exists = false;
|
||||
int preset3_pan;
|
||||
int preset3_tilt;
|
||||
int preset3_zoom;
|
||||
|
||||
|
||||
bool preset4_exists = false;
|
||||
int preset4_pan;
|
||||
int preset4_tilt;
|
||||
int preset4_zoom;
|
||||
|
||||
public StreamViewer(string name, string ip, MainForm.Camera camera, MainForm mainForm)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@@ -40,6 +62,8 @@ namespace robospot_camera_finder
|
||||
|
||||
updateZoomSlider();
|
||||
|
||||
tbSerial.Text = camera.camera_serial;
|
||||
|
||||
videoView.MediaPlayer = _mp;
|
||||
var media = new Media(_libVLC, new Uri("rtsp://" + ip + "/profile2/media.smp"));
|
||||
media.AddOption(":network-caching=25");
|
||||
@@ -50,7 +74,7 @@ namespace robospot_camera_finder
|
||||
private void updateZoomSlider()
|
||||
{
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://" + cam_ip + "/stw-cgi/ptzcontrol.cgi?msubmenu=query&action=view&Query=Zoom");
|
||||
request.Credentials = new NetworkCredential(username, password);
|
||||
request.Credentials = new NetworkCredential(MainForm.cam_username, MainForm.cam_password);
|
||||
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
||||
string text;
|
||||
using (var sr = new StreamReader(response.GetResponseStream())) { text = sr.ReadToEnd(); }
|
||||
@@ -73,7 +97,7 @@ namespace robospot_camera_finder
|
||||
}
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://" + cam_ip + "/stw-cgi/ptzcontrol.cgi?msubmenu=absolute&action=control&ZoomPulse=" + zoom_pulse);
|
||||
request.Credentials = new NetworkCredential(username, password);
|
||||
request.Credentials = new NetworkCredential(MainForm.cam_username, MainForm.cam_password);
|
||||
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
||||
}
|
||||
|
||||
@@ -81,7 +105,7 @@ namespace robospot_camera_finder
|
||||
private void sendZoomValueManual(string zoom_value)
|
||||
{
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://" + cam_ip + "/stw-cgi/ptzcontrol.cgi?msubmenu=continuous&NormalizedSpeed=True&action=control&Channel=0&Zoom=" + zoom_value);
|
||||
request.Credentials = new NetworkCredential(username, password);
|
||||
request.Credentials = new NetworkCredential(MainForm.cam_username, MainForm.cam_password);
|
||||
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
||||
}
|
||||
|
||||
@@ -212,8 +236,8 @@ namespace robospot_camera_finder
|
||||
|
||||
private void numDMXAddr_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
tbPan.Value = 128;
|
||||
tbTilt.Value = 128;
|
||||
tbPan.Value = 32767;
|
||||
tbTilt.Value = 32767;
|
||||
|
||||
for (int i = 0; i < dmx_universe.Length; i++)
|
||||
{
|
||||
@@ -231,6 +255,12 @@ namespace robospot_camera_finder
|
||||
tbTilt.Enabled = true;
|
||||
numDMXAddr.Enabled = true;
|
||||
numUniv.Enabled = true;
|
||||
btnPreset1.Enabled = true;
|
||||
btnPreset2.Enabled = true;
|
||||
btnPreset3.Enabled = true;
|
||||
btnPreset4.Enabled = true;
|
||||
btnPresetClr.Enabled = true;
|
||||
btnPresetRec.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -242,6 +272,13 @@ namespace robospot_camera_finder
|
||||
numUniv.Enabled = false;
|
||||
cbEnableXboxCtrl.Checked = false;
|
||||
cbEnableXboxCtrl.Enabled = false;
|
||||
|
||||
btnPreset1.Enabled = false;
|
||||
btnPreset2.Enabled = false;
|
||||
btnPreset3.Enabled = false;
|
||||
btnPreset4.Enabled = false;
|
||||
btnPresetClr.Enabled = false;
|
||||
btnPresetRec.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,5 +293,170 @@ namespace robospot_camera_finder
|
||||
splitContainerMain.Panel2Collapsed = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnPresetRec_Click(object sender, EventArgs e)
|
||||
{
|
||||
rec_mode_toggle();
|
||||
}
|
||||
|
||||
private void rec_mode_toggle()
|
||||
{
|
||||
if (preset_clear_mode)
|
||||
{
|
||||
preset_clear_mode = false;
|
||||
btnPresetClr.ForeColor = default(Color);
|
||||
}
|
||||
|
||||
if (preset_rec_mode)
|
||||
{
|
||||
preset_rec_mode = false;
|
||||
btnPresetRec.ForeColor = default(Color);
|
||||
}
|
||||
else
|
||||
{
|
||||
preset_rec_mode = true;
|
||||
btnPresetRec.ForeColor = Color.Red;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnPresetClr_Click(object sender, EventArgs e)
|
||||
{
|
||||
clear_mode_toggle();
|
||||
}
|
||||
|
||||
private void clear_mode_toggle()
|
||||
{
|
||||
if (preset_rec_mode)
|
||||
{
|
||||
preset_rec_mode = false;
|
||||
btnPresetRec.ForeColor = default(Color);
|
||||
}
|
||||
|
||||
if (preset_clear_mode)
|
||||
{
|
||||
preset_clear_mode = false;
|
||||
btnPresetClr.ForeColor = default(Color);
|
||||
}
|
||||
else
|
||||
{
|
||||
preset_clear_mode = true;
|
||||
btnPresetClr.ForeColor = Color.Red;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnPreset1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (preset_rec_mode)
|
||||
{
|
||||
preset1_exists = true;
|
||||
preset1_pan = tbPan.Value;
|
||||
preset1_tilt = tbTilt.Value;
|
||||
preset1_zoom = tbZoom.Value;
|
||||
btnPreset1.ForeColor = Color.Blue;
|
||||
rec_mode_toggle();
|
||||
}
|
||||
else if (preset_clear_mode)
|
||||
{
|
||||
preset1_exists = false;
|
||||
preset1_pan = 0;
|
||||
preset1_tilt = 0;
|
||||
preset1_zoom = 0;
|
||||
btnPreset1.ForeColor = default(Color);
|
||||
clear_mode_toggle();
|
||||
}
|
||||
else if (preset1_exists)
|
||||
{
|
||||
tbPan.Value = preset1_pan;
|
||||
tbTilt.Value = preset1_tilt;
|
||||
tbZoom.Value = preset1_zoom;
|
||||
sendZoomValue(tbZoom.Value.ToString());
|
||||
}
|
||||
}
|
||||
private void btnPreset2_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (preset_rec_mode)
|
||||
{
|
||||
preset2_exists = true;
|
||||
preset2_pan = tbPan.Value;
|
||||
preset2_tilt = tbTilt.Value;
|
||||
preset2_zoom = tbZoom.Value;
|
||||
btnPreset2.ForeColor = Color.Blue;
|
||||
rec_mode_toggle();
|
||||
}
|
||||
else if (preset_clear_mode)
|
||||
{
|
||||
preset2_exists = false;
|
||||
preset2_pan = 0;
|
||||
preset2_tilt = 0;
|
||||
preset2_zoom = 0;
|
||||
btnPreset2.ForeColor = default(Color);
|
||||
clear_mode_toggle();
|
||||
}
|
||||
else if (preset2_exists)
|
||||
{
|
||||
tbPan.Value = preset2_pan;
|
||||
tbTilt.Value = preset2_tilt;
|
||||
tbZoom.Value = preset2_zoom;
|
||||
sendZoomValue(tbZoom.Value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void btnPreset3_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (preset_rec_mode)
|
||||
{
|
||||
preset3_exists = true;
|
||||
preset3_pan = tbPan.Value;
|
||||
preset3_tilt = tbTilt.Value;
|
||||
preset3_zoom = tbZoom.Value;
|
||||
btnPreset3.ForeColor = Color.Blue;
|
||||
rec_mode_toggle();
|
||||
}
|
||||
else if (preset_clear_mode)
|
||||
{
|
||||
preset3_exists = false;
|
||||
preset3_pan = 0;
|
||||
preset3_tilt = 0;
|
||||
preset3_zoom = 0;
|
||||
btnPreset3.ForeColor = default(Color);
|
||||
clear_mode_toggle();
|
||||
}
|
||||
else if (preset3_exists)
|
||||
{
|
||||
tbPan.Value = preset3_pan;
|
||||
tbTilt.Value = preset3_tilt;
|
||||
tbZoom.Value = preset3_zoom;
|
||||
sendZoomValue(tbZoom.Value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void btnPreset4_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (preset_rec_mode)
|
||||
{
|
||||
preset4_exists = true;
|
||||
preset4_pan = tbPan.Value;
|
||||
preset4_tilt = tbTilt.Value;
|
||||
preset4_zoom = tbZoom.Value;
|
||||
btnPreset4.ForeColor = Color.Blue;
|
||||
rec_mode_toggle();
|
||||
}
|
||||
else if (preset_clear_mode)
|
||||
{
|
||||
preset4_exists = false;
|
||||
preset4_pan = 0;
|
||||
preset4_tilt = 0;
|
||||
preset4_zoom = 0;
|
||||
btnPreset4.ForeColor = default(Color);
|
||||
clear_mode_toggle();
|
||||
}
|
||||
else if (preset4_exists)
|
||||
{
|
||||
tbPan.Value = preset4_pan;
|
||||
tbTilt.Value = preset4_tilt;
|
||||
tbZoom.Value = preset4_zoom;
|
||||
sendZoomValue(tbZoom.Value.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,64 @@
|
||||
<root>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
|
||||
Reference in New Issue
Block a user