/// <summary> /// Handles capabilities received event /// </summary> /// <param name="capabilities">Received capabilities</param> void OnCapabilitiesReceived(Device.Capabilities capabilities) { if (capabilities.Media != null) { View.MediaAddress = capabilities.Media.XAddr; } }
/// <summary> /// Handles capabilities received event /// </summary> /// <param name="capabilities">Received capabilities</param> void OnCapabilitiesReceived(Device.Capabilities capabilities) { View.PTZAddress = string.Empty; View.MediaAddress = string.Empty; if (capabilities.PTZ != null) { View.PTZAddress = capabilities.PTZ.XAddr; } if (capabilities.Media != null) { View.MediaAddress = capabilities.Media.XAddr; } }
/// <summary> /// Queries PTZ nodes /// </summary> public void GetPTZNodes() { DiscoveredDevices devices = ContextController.GetDiscoveredDevices(); string address = devices != null ? devices.ServiceAddress : string.Empty; DeviceEnvironment env = ContextController.GetDeviceEnvironment(); ManagementServiceProvider deviceClient = new ManagementServiceProvider(address, env.Timeouts.Message); ReportOperationStarted(); Thread thread = new Thread(new ThreadStart(new Action(() => { try { Device.Capabilities capabilities = deviceClient.GetCapabilitiesSync(new Device.CapabilityCategory[] { Device.CapabilityCategory.PTZ }); if (capabilities.PTZ != null) { string ptzAddress = capabilities.PTZ.XAddr; PTZServiceProvider ptzClient = new PTZServiceProvider(ptzAddress, env.Timeouts.Message); PTZ.PTZNode[] nodes = ptzClient.GetNodes(); if ((nodes != null) && (nodes.Length > 0)) { View.SetPTZNodes(nodes); } else { throw new Exception("No PTZ nodes returned by device"); } } else { throw new Exception("Device does not support PTZ service"); } } catch (System.Exception ex) { View.ShowError(ex); } finally { ReportOperationCompleted(); } }))); thread.CurrentUICulture = System.Globalization.CultureInfo.InvariantCulture; thread.Start(); }