protected ReplayPortClient CreateReplayPortClient()
        {
            string address = GetReplayServiceAddress();

            BeginStep("Connect to Replay service");
            LogStepEvent(string.Format("Replay service address: {0}", address));
            if (string.IsNullOrEmpty(address))
            {
                throw new AssertException("Replay service not supported");
            }
            else
            {
                if (!address.IsValidUrl())
                {
                    throw new AssertException("Replay service address is invalid");
                }
            }
            Binding binding = CreateBinding(false,
                                            new IChannelController[] { new SoapValidator(ReplaySchemasSet.GetInstance()) });
            ReplayPortClient client = new ReplayPortClient(binding, new EndpointAddress(address));

            AttachSecurity(client.Endpoint);
            SetupChannel(client.InnerChannel);

            StepPassed();
            if (_replayClient != null)
            {
                CloseReplayClient();
            }
            return(_replayClient = client);
        }
Example #2
0
        public static string GetReplayUri(Structures set)
        {
            try
            {
                //if (set.GetPTZTokens() == "" || !set.IsActive) return false;

                var messageElement = new TextMessageEncodingBindingElement();
                messageElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None);
                HttpTransportBindingElement httpBinding = new HttpTransportBindingElement();
                httpBinding.AuthenticationScheme = AuthenticationSchemes.Basic;
                CustomBinding    bind         = new CustomBinding(messageElement, httpBinding);
                EndpointAddress  mediaAddress = new EndpointAddress(set.GetONVIF + "/onvif/Replay");
                ReplayPortClient mediaClient  = new ReplayPortClient(bind, mediaAddress);
                mediaClient.ClientCredentials.UserName.UserName = set.Login;
                mediaClient.ClientCredentials.UserName.Password = set.Password;

                var ss = new OREP.StreamSetup
                {
                    Stream    = OREP.StreamType.RTPUnicast,
                    Transport = new OREP.Transport()
                    {
                        Protocol = OREP.TransportProtocol.RTSP,
                    }
                };

                var nodes = mediaClient.GetReplayUri(ss, set.GetMediaTokens()[0]);

                return(nodes);
            }
            catch
            {
                return("");
            }
        }
Example #3
0
        protected ReplayServiceCapabilities GetReplayCapabilities()
        {
            ReplayPortClient          client       = ReplayClient;
            ReplayServiceCapabilities capabilities = null;

            RunStep(() => { capabilities = client.GetServiceCapabilities(); }, "Get Service Capabilities");
            return(capabilities);
        }
Example #4
0
        public void ReplayServiceCapabilitiesTest()
        {
            RunTest(() =>
            {
                // Initialize client
                ReplayPortClient client = ReplayClient;

                Proxies.Onvif.ReplayServiceCapabilities capabilities = GetReplayCapabilities();
            },
                    () =>
            {
                CloseReplayClient();
            });
        }