/// <summary> /// Retrieves lists of video sources form DUT /// </summary> /// <returns>Array of video sources</returns> protected VideoSource[] GetVideoSources() { VideoSource[] sources = null; MediaClient client = MediaClient; if (client != null) { RunStep(() => { sources = client.GetVideoSources(); }, "Get video sources"); } else { DeviceIOPortClient deviceIOPortClient = DeviceIoClient; if (deviceIOPortClient != null) { RunStep(() => { sources = deviceIOPortClient.GetVideoSources(); }, "Get video sources"); DoRequestDelay(); } else { Assert(false, "Neither media, nor I/O supported.", "Check if media or I/O supported"); } } return(sources); }
protected IOServiceCapabilities GetIoCapabilities() { DeviceIOPortClient client = IoClient; if (client == null) { return(null); } IOServiceCapabilities capabilities = null; try { RunStep(() => { capabilities = client.GetServiceCapabilities(); }, "Get IO capabilities"); } catch (Exception exc) { RethrowIfStop(exc); LogStepEvent(string.Format("GetServiceCapabilities not supported ({0})", exc.Message)); StepFailed(exc); } DoRequestDelay(); return(capabilities); }
protected VideoSource[] GetVideoSourcesFromMediaOrIO() { VideoSource[] sources = null; if (MediaClient != null) { MediaClient client = MediaClient; RunStep(() => { sources = client.GetVideoSources(); }, "Get Video Sources"); DoRequestDelay(); if (sources != null) { LogStepEvent(string.Format("{0} sources found", sources.Length) + Environment.NewLine); } return(sources); } if (IoClient != null) { DeviceIOPortClient client = IoClient; RunStep(() => { sources = client.GetVideoSources(); }, "Get Video Sources"); DoRequestDelay(); if (sources != null) { LogStepEvent(string.Format("{0} sources found", sources.Length) + Environment.NewLine); } return(sources); } return(sources); }
public OnVifDeviceIO(OnVifDevice onVifDevice) : base(onVifDevice) { // m_ErrorMessage = ""; // m_onVifDevice = onVifDevice; // m_initialised = false; m_subscriptionTerminationTime = TimeSpan.FromSeconds(20); m_DeviceIOPortClient = null; }
public override async Task <bool> InitalizeAsync() { if (this.m_onVifDevice.ServicesResponse == null) { bool b = await this.m_onVifDevice.InitalizeDeviceAsync(); if (this.m_onVifDevice.ServicesResponse == null) { return(false); } } try { foreach (var service in this.m_onVifDevice.ServicesResponse.Service) { if (service.Namespace == "http://www.onvif.org/ver10/deviceIO/wsdl") { string serviceAdress = service.XAddr; HttpTransportBindingElement httpBinding = new HttpTransportBindingElement(); httpBinding.AuthenticationScheme = AuthenticationSchemes.Digest; var messageElement = new TextMessageEncodingBindingElement(); messageElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.WSAddressing10); CustomBinding binding = new CustomBinding(messageElement, httpBinding); m_DeviceIOPortClient = new DeviceIOPortClient(binding, new EndpointAddress(serviceAdress)); m_DeviceIOPortClient.Endpoint.EndpointBehaviors.Add(this.m_onVifDevice.GetPasswordDigestBehavior); m_DeviceIOPortClient.Endpoint.EndpointBehaviors.Add(this.m_onVifDevice.GetBasicBasicAuthBehaviour); m_initialised = true; } } } catch (Exception ex) { m_ErrorMessage = ex.Message; throw new OnVifException("OnVifDeviceIO.InitalizeAsync", ex); // return false; } return(m_initialised); }