|
|
|
|
@@ -8,29 +8,30 @@ namespace robospot_camera_finder
|
|
|
|
|
public LibVLC _libVLC;
|
|
|
|
|
public MediaPlayer _mp;
|
|
|
|
|
|
|
|
|
|
string cam_ip = "";
|
|
|
|
|
MainForm.Camera camera;
|
|
|
|
|
|
|
|
|
|
int max_zoom_pulse = 9999;
|
|
|
|
|
int min_zoom_pulse = 10;
|
|
|
|
|
const int MAX_ZOOM_PULSE = 9999;
|
|
|
|
|
const int MIN_ZOOM_PULSE = 10;
|
|
|
|
|
|
|
|
|
|
bool zoomTestSeqFlag = false;
|
|
|
|
|
|
|
|
|
|
public StreamViewer(string name, string ip, MainForm.Camera camera, MainForm mainForm)
|
|
|
|
|
public StreamViewer(MainForm.Camera cam, MainForm mainForm)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
_libVLC = new LibVLC();
|
|
|
|
|
_mp = new MediaPlayer(_libVLC);
|
|
|
|
|
|
|
|
|
|
cam_ip = ip;
|
|
|
|
|
this.Text = name;
|
|
|
|
|
camera = cam;
|
|
|
|
|
|
|
|
|
|
if (!cam_ip.StartsWith("10."))
|
|
|
|
|
this.Text = camera.camera_name;
|
|
|
|
|
|
|
|
|
|
if (!cam.camera_ip.StartsWith("10."))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Camera is not on the 10.0.0.0/8 network, the RoboSpot might not find it.", "Wrong IP", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string rtsp_link = "rtsp://" + ip + "/profile2/media.smp";
|
|
|
|
|
string rtsp_link = "rtsp://" + camera.camera_ip + "/profile2/media.smp";
|
|
|
|
|
|
|
|
|
|
updateZoomSlider();
|
|
|
|
|
|
|
|
|
|
@@ -45,7 +46,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");
|
|
|
|
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://" + camera.camera_ip + "/stw-cgi/ptzcontrol.cgi?msubmenu=query&action=view&Query=Zoom");
|
|
|
|
|
request.Credentials = new NetworkCredential(MainForm.cam_username, MainForm.cam_password);
|
|
|
|
|
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
|
|
|
|
string text;
|
|
|
|
|
@@ -59,16 +60,16 @@ namespace robospot_camera_finder
|
|
|
|
|
private void sendZoomValue(string zoom_pulse)
|
|
|
|
|
{
|
|
|
|
|
// clamp values to allowed range
|
|
|
|
|
if (int.Parse(zoom_pulse) < min_zoom_pulse)
|
|
|
|
|
if (int.Parse(zoom_pulse) < MIN_ZOOM_PULSE)
|
|
|
|
|
{
|
|
|
|
|
zoom_pulse = min_zoom_pulse.ToString();
|
|
|
|
|
zoom_pulse = MIN_ZOOM_PULSE.ToString();
|
|
|
|
|
}
|
|
|
|
|
if (int.Parse(zoom_pulse) > max_zoom_pulse)
|
|
|
|
|
if (int.Parse(zoom_pulse) > MAX_ZOOM_PULSE)
|
|
|
|
|
{
|
|
|
|
|
zoom_pulse = max_zoom_pulse.ToString();
|
|
|
|
|
zoom_pulse = MAX_ZOOM_PULSE.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://" + cam_ip + "/stw-cgi/ptzcontrol.cgi?msubmenu=absolute&action=control&ZoomPulse=" + zoom_pulse);
|
|
|
|
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://" + camera.camera_ip + "/stw-cgi/ptzcontrol.cgi?msubmenu=absolute&action=control&ZoomPulse=" + zoom_pulse);
|
|
|
|
|
request.Credentials = new NetworkCredential(MainForm.cam_username, MainForm.cam_password);
|
|
|
|
|
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
|
|
|
|
}
|
|
|
|
|
@@ -76,7 +77,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);
|
|
|
|
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://" + camera.camera_ip + "/stw-cgi/ptzcontrol.cgi?msubmenu=continuous&NormalizedSpeed=True&action=control&Channel=0&Zoom=" + zoom_value);
|
|
|
|
|
request.Credentials = new NetworkCredential(MainForm.cam_username, MainForm.cam_password);
|
|
|
|
|
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
|
|
|
|
}
|
|
|
|
|
@@ -105,13 +106,13 @@ namespace robospot_camera_finder
|
|
|
|
|
|
|
|
|
|
private void btnZoomMax_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
tbZoom.Value = max_zoom_pulse;
|
|
|
|
|
tbZoom.Value = MAX_ZOOM_PULSE;
|
|
|
|
|
sendZoomValue(tbZoom.Value.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnZoomMin_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
tbZoom.Value = min_zoom_pulse;
|
|
|
|
|
tbZoom.Value = MIN_ZOOM_PULSE;
|
|
|
|
|
sendZoomValue(tbZoom.Value.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -130,12 +131,12 @@ namespace robospot_camera_finder
|
|
|
|
|
{
|
|
|
|
|
if (zoomTestSeqFlag)
|
|
|
|
|
{
|
|
|
|
|
tbZoom.Value = min_zoom_pulse;
|
|
|
|
|
tbZoom.Value = MIN_ZOOM_PULSE;
|
|
|
|
|
sendZoomValue(tbZoom.Value.ToString());
|
|
|
|
|
zoomTestSeqFlag = false;
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
tbZoom.Value = max_zoom_pulse;
|
|
|
|
|
tbZoom.Value = MAX_ZOOM_PULSE;
|
|
|
|
|
sendZoomValue(tbZoom.Value.ToString());
|
|
|
|
|
zoomTestSeqFlag = true;
|
|
|
|
|
}
|
|
|
|
|
|