private void connect(int i) { IpCameraHandler cam = new IpCameraHandler(); cam.CameraStateChanged += ModelCameraStateChanged; cam.CameraErrorOccured += ModelCameraErrorOccured; cam.ConnectOnvifCamera("192.168.226.10" + i + ":80;Username=admin;Password=123456;Transport=UDP;"); kamerak[i] = cam; }
private void button1_Click(object sender, EventArgs e) { int i = int.Parse(textBox1.Text); IpCameraHandler cam = new IpCameraHandler(); cam.CameraStateChanged += ModelCameraStateChanged; cam.CameraErrorOccured += ModelCameraErrorOccured; cam.ConnectOnvifCamera("192.168.226.10" + i + ":80;Username=admin;Password=123456;Transport=UDP;"); kamerak[i] = cam; }
private void ModelCameraErrorOccured(object sender, CameraErrorEventArgs e) { InvokeGuiThread(() => { IpCameraHandler curr = (IpCameraHandler)sender; Log.Write("Camera error: " + (e.Details ?? e.Error.ToString())); if (e.Error.Equals(IPCameraError.NoEndPoint)) { string str = curr.Camera.CameraAddress.ToString().Split(':')[0].Substring(curr.Camera.CameraAddress.ToString().Split(':')[0].Length - 2); kamerak[(int.Parse(str))] = null; } }); }
private void ModelCameraStateChanged(object sender, CameraStateEventArgs e) { InvokeGuiThread(() => { IpCameraHandler curr = (IpCameraHandler)sender; Log.Write(curr.Camera.CameraAddress.ToString() + " : " + e.State); string str = curr.Camera.CameraAddress.ToString().Split(':')[0].Substring(curr.Camera.CameraAddress.ToString().Split(':')[0].Length - 2); if (connectall && (e.State.Equals(CameraState.Connected) || e.State.Equals(CameraState.Disconnected))) { try { if (kamerak[(int.Parse(str)) + 1] == null) { connect((int.Parse(str)) + 1); } } catch (Exception ex) { } } }); }
private void SetSpeed(IpCameraHandler cam, int sp) { cam.Camera.CameraMovement.TiltSpeed = (float)sp / 8; cam.Camera.CameraMovement.PanSpeed = (float)sp / 8; }
private void GetCameraStreams(IpCameraHandler _model) { }