public bool ConfigMonitor(IMonitorConfig config) { StringBuilder sb = new StringBuilder(config.SystemContext.RequestHeadInfo); sb.Append(config.Name + "<Monitor>"); sb.Append("Config<Command>"); sb.Append(config.ToXml() + "<Config>"); IRemoteSystem rs = config.SystemContext.MonitorSystem as IRemoteSystem; if (rs != null) { return(WaitReliableSend(rs.Config.IP, rs.Config.Port, sb.ToString())); } else { return(WaitReliableSend(config.Host, config.Port, sb.ToString())); } }
public bool InitMonitor(IMonitorConfig config) { IVisionMonitorConfig vmConfig = config as IVisionMonitorConfig; if (vmConfig != null) { IVideoSourceConfig vsConfig = config.SystemContext.GetVideoSourceConfig(vmConfig.Watcher.ActiveVisionParamConfig.VSName); if (vsConfig != null) { IVideoSourceType vsType = config.SystemContext.GetVideoSourceType(vsConfig.Type); StringBuilder sb = new StringBuilder(config.SystemContext.RequestHeadInfo); sb.Append(vsConfig.Name + "<VideoSource>"); sb.Append("Open;Play;InitKernel<Command>"); sb.Append(vsType.ToXml() + "<Type>"); sb.Append(vsConfig.ToXml() + "<Config><CommandSegment>"); IActionConfig ac; IActionParam[] apList; if (!config.Watcher.ActiveActionParamConfig.LocalAlarmAction) { apList = config.Watcher.ActiveActionParamConfig.GetAlarmActionList(); if (apList != null) { foreach (IActionParam pc in apList) { ac = config.SystemContext.ActionConfigManager.GetConfig(pc.Name); if (ac != null) { IActionType at = config.SystemContext.ActionTypeManager.GetConfig(ac.Type); if (at != null) { sb.Append(ac.Name + "<Action>"); sb.Append("Init;Start<Command>"); sb.Append(at.ToXml() + "<Type>"); sb.Append(ac.ToXml() + "<Config><CommandSegment>"); } } } } } if (!config.Watcher.ActiveActionParamConfig.LocalTransactAction) { apList = config.Watcher.ActiveActionParamConfig.GetTransactActionList(); if (apList != null) { foreach (IActionParam pc in apList) { ac = config.SystemContext.ActionConfigManager.GetConfig(pc.Name); if (ac != null) { IActionType at = config.SystemContext.ActionTypeManager.GetConfig(ac.Type); if (at != null) { sb.Append(ac.Name + "<Action>"); sb.Append("Init;Start<Command>"); sb.Append(at.ToXml() + "<Type>"); sb.Append(ac.ToXml() + "<Config><CommandSegment>"); } } } } } IMonitorType vuType = config.SystemContext.GetMonitorType(config.Type); sb.Append(config.Name + "<Monitor>"); sb.Append("Init<Command>"); sb.Append(vuType.ToXml() + "<Type>"); sb.Append(config.ToXml() + "<Config>"); IRemoteSystem rs = config.SystemContext.MonitorSystem as IRemoteSystem; if (rs != null) { return(WaitReliableSend(rs.Config.IP, rs.Config.Port, sb.ToString())); } else { return(WaitReliableSend(config.Host, config.Port, sb.ToString())); } } } else { IMonitorType vuType = config.SystemContext.GetMonitorType(config.Type); StringBuilder sb = new StringBuilder(config.SystemContext.RequestHeadInfo); sb.Append(config.Name + "<Monitor>"); sb.Append("Init<Command>"); sb.Append(vuType.ToXml() + "<Type>"); sb.Append(config.ToXml() + "<Config>"); IRemoteSystem rs = config.SystemContext.MonitorSystem as IRemoteSystem; if (rs != null) { return(WaitReliableSend(rs.Config.IP, rs.Config.Port, sb.ToString())); } else { return(WaitReliableSend(config.Host, config.Port, sb.ToString())); } } return(false); }