public bool CancelMonitor(Monitor monitor, System.Windows.Controls.TextBox txtMessage) { string xml = string.Format(@"<hytera> <product_name>PUC</product_name> <version>10</version> <cmd_name>mon_monitor</cmd_name> <cmd_guid>{0}</cmd_guid> <puc_id>{1}</puc_id> <system_id>{2}</system_id> <user_id>{3}</user_id> <monitor_level>{4}</monitor_level> <target> <number>{5}</number> <number_type>{6}</number_type> </target> </hytera>", Guid.NewGuid(), monitor.Puc_id, monitor.SystemID, monitor.pseudo_trunking_id, (GlobalCommandName.PUCMonitorLevelCancelAll).ToString(), monitor.Number, monitor.NumberType); txtMessage.Text += "\n发起取消监听 send xml:\n"; txtMessage.Text += FormatXml(xml); txtMessage.ScrollToEnd(); IntPtr xmlPtr = Marshal.StringToHGlobalUni(xml); PUCApiAdapter.PUCAPI_ProcessRequest(xmlPtr); return(true); }
public bool SetMonitor(Monitor monitor, System.Windows.Controls.TextBox txtMessage) { string monitorLevel = string.Empty; if (string.IsNullOrEmpty(monitor.MonitorLevel)) { monitorLevel = (GlobalCommandName.PUCMonitorLevelEvent | GlobalCommandName.PUCMonitorLevelMedia | GlobalCommandName.PUCMonitorLevelOnline | GlobalCommandName.PUCMonitorLevelSDSStatus | GlobalCommandName.PUCMonitorLevelSDSText ).ToString(); } else { monitorLevel = monitor.MonitorLevel; } string xml = string.Format(@"<hytera> <product_name>PUC</product_name> <version>10</version> <cmd_name>mon_monitor</cmd_name> <cmd_guid>{0}</cmd_guid> <puc_id>{1}</puc_id> <system_id>{2}</system_id> <user_id>{3}</user_id> <monitor_level>{4}</monitor_level> <target> <number>{5}</number> <number_type>{6}</number_type> </target> </hytera>", Guid.NewGuid(), monitor.Puc_id, monitor.SystemID, monitor.pseudo_trunking_id, monitorLevel, monitor.Number, monitor.NumberType); txtMessage.Text += "\n发起监听 send xml:\n"; txtMessage.Text += FormatXml(xml); txtMessage.ScrollToEnd(); IntPtr xmlPtr = Marshal.StringToHGlobalUni(xml); PUCApiAdapter.PUCAPI_ProcessRequest(xmlPtr); return(true); }