public virtual void Reset() { CLocalSystem.WriteInfoLog(string.Format("CVideoSource({0}).Reset", Name)); PrepStop(); PrepClose(); this.VideoSourceStatus = VideoSourceState.Norme; if (IsOpen) { if (PrepOpen(Target)) { if (IsPlay) { if (!PrepPlay()) { Stop(); } } } else { Close(); } } }
private void AsyncDoDisconnected(IProcessor processor) { CLocalSystem.WriteInfoLog(string.Format("CRemoteManagerClient.AsyncDoDisconnected: 已经断开服务器 {0}.", processor.Name)); try { if (OnDisconnected != null) { if (CLocalSystem.MainForm != null) { MethodInvoker form_invoker = delegate { OnDisconnected(mSystemContext, processor); }; CLocalSystem.MainForm.Invoke(form_invoker); } else { OnDisconnected(mSystemContext, processor); } } } catch { } }
private void StopMonitor() { IsActive = false; //CLocalSystem.WriteDebugLog(string.Format("CMonitorWatcher({0}).StopMonitor.", Name)); if (CLocalSystem.MainForm != null) { MethodInvoker form_invoker = delegate { IMonitor monitor = mMonitorConfig.SystemContext.MonitorManager.GetMonitor(Name); if (monitor != null) { CLocalSystem.WriteInfoLog(string.Format("CMonitorWatcher({0}).StopMonitor.", Name)); DoMonitorStopBefore(); mMonitorConfig.SystemContext.MonitorManager.FreeMonitor(Name); DoMonitorStopAfter(); } }; CLocalSystem.MainForm.Invoke(form_invoker); } }
private void StartMonitor() { IsActive = true; //CLocalSystem.WriteDebugLog(string.Format("CMonitorWatcher({0}).StartMonitor.", Name)); if (CLocalSystem.MainForm != null) { MethodInvoker form_invoker = delegate { IMonitor monitor = mMonitorConfig.SystemContext.MonitorManager.GetMonitor(Name); if (monitor == null || !monitor.IsActive) { CLocalSystem.WriteInfoLog(string.Format("CMonitorWatcher({0}).StartMonitor.", Name)); DoMonitorStartBefore(); monitor = mMonitorConfig.SystemContext.MonitorManager.CreateMonitor(mMonitorConfig); if (monitor != null) { monitor.Start(); } DoMonitorStartAfter(); } }; CLocalSystem.MainForm.Invoke(form_invoker); } }
private void DoDownProgress(int progress, DownState state) { CLocalSystem.WriteInfoLog(string.Format("\"{0}\"下载进度:{1}% 状态:{2}", LocalFileName, progress, state)); if (OnDownProgress != null) { OnDownProgress(this, mProgress, state); } else if (progress == 100) { MessageBox.Show(string.Format("文件({0})下载结束!", this.LocalFileName)); } }
private void DoDisconnected(IMonitorSystemContext context, IProcessor processor) { CLocalSystem.WriteInfoLog(string.Format("CMonitor({0}).DoDisconnected: 已经与服务器({1})断开.", Name, processor.Name)); if (CheckOrigin(context, processor)) { this.State = MonitorState.Problem; try { ProcessDisconnected(context, processor); } catch (Exception e) { CLocalSystem.WriteErrorLog(string.Format("CMonitor({0}).ProcessDisconnected Exception: {1}", Name, e)); } } }
private void DoConnected(IMonitorSystemContext context, IProcessor processor) { CLocalSystem.WriteInfoLog(string.Format("CMonitor({0}).DoConnected: 已经连接服务器({1}).", Name, processor.Name)); if (CheckOrigin(context, processor)) { processor.Send(string.Format("{0}{1}<Monitor>QueryState<Command>", context.RequestHeadInfo, Name)); try { ProcessConnected(context, processor); } catch (Exception e) { CLocalSystem.WriteErrorLog(string.Format("CMonitor({0}).ProcessConnected Exception: {1}", e)); } } }
protected override void OnMessageCallback(string id, string sender, IntPtr message) { DateTime CurAlarmTime = DateTime.Now; if (message != IntPtr.Zero) { try { if (this.CheckAlarmInterval(CurAlarmTime)) { CVisionEvent msg = (CVisionEvent)Marshal.PtrToStructure(message, typeof(CVisionEvent)); //if (msg.eventType == 0) //{ // System.Console.Out.WriteLine("EventType=" + msg.eventType + ", AlertOpt=" + msg.alertOpt); // return; //} CVisionAlarm alarm = new CVisionAlarm(this); alarm.ID = id; alarm.Sender = sender; alarm.Desc = Config.Desc; alarm.EventType = (TVisionEventType)msg.eventType; alarm.GuardLevel = (TGuardLevel)msg.guardLevel; alarm.AreaIndex = msg.areaIndex; alarm.AreaType = (TAreaType)msg.areaType; alarm.AlertOpt = (TAlertOpt)msg.alertOpt; alarm.AlarmTime = CurAlarmTime; alarm.AlarmImage = ImageUtil.IplImageToBitmap(msg.image); CLocalSystem.WriteInfoLog(string.Format("CBlobTracker.OnMessageCallback AlertOpt:{0}", (TAlertOpt)msg.alertOpt)); this.PostAlarmEvent(alarm); } } catch (Exception e) { CLocalSystem.WriteErrorLog(string.Format("CBlobTracker.OnMessageCallback Exception:{0}", e)); } } }
protected string GetURL() { IVideoSourceConfig config = Config; if (config != null) { //rtsp://192.168.1.231:554/192.168.1.250:8000:HIK-DS8000HC:0:0:admin:12345/av_stream StringBuilder sb = new StringBuilder("rtsp://"); sb.Append(config.StrValue("SMServerIP")); //sb.Append(":"+config.StrValue("SMServerPort")); sb.Append("/" + config.StrValue("DeviceIP")); sb.Append(":" + config.StrValue("DevicePort")); sb.Append(":HIK-DS8000HC:" + config.StrValue("Channel")); sb.Append(":" + config.StrValue("SubChannel") + ":"); sb.Append(config.StrValue("UserName") + ":"); sb.Append(config.StrValue("Password") + "/av_stream"); CLocalSystem.WriteInfoLog(string.Format("StreamMediaURL={0}", sb.ToString())); return(sb.ToString()); } return(""); }