示例#1
0
        protected ImagingOptions20 GetImagingOptions(string VideoSourceToken)
        {
            ImagingPortClient client = ImagingClient;

            if (client == null)
            {
                return(null);
            }

            ImagingOptions20 options = null;

            try
            {
                RunStep(() => { options = client.GetOptions(VideoSourceToken); }, "Get Imaging Options");
            }
            catch (Exception exc)
            {
                RethrowIfStop(exc);
                LogStepEvent(string.Format("Imaging GetOptions not supported ({0})", exc.Message));
                StepFailed(exc);
            }

            DoRequestDelay();
            return(options);
        }
示例#2
0
        public static ImagingSettings20 GetImageSetting(Structures set, uint tokenid)
        {
            try
            {
                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/imaging");
                ImagingPortClient client       = new ImagingPortClient(bind, mediaAddress);
                client.ClientCredentials.UserName.UserName = set.Login;
                client.ClientCredentials.UserName.Password = set.Password;

                return(client.GetImagingSettings(set.GetMediaTokens()[tokenid]));
            }
            catch
            {
                return(null);
            }
        }