Exemple #1
0
        internal void Connect(string login, string password)
        {
            PasswordDigestBehavior passwordDigestBehavior = new PasswordDigestBehavior(login, password);

            HttpTransportBindingElement httpBinding = new HttpTransportBindingElement()
            {
                AuthenticationScheme = AuthenticationSchemes.Digest
            };

            //stringUri = System.Configuration.ConfigurationManager.AppSettings["Uri"];

            EndpointAddress endpointAddress = new EndpointAddress(MediaDevice.MediaDeviceUri);

            TextMessageEncodingBindingElement messageElement = new TextMessageEncodingBindingElement()
            {
                MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None)
            };

            CustomBinding binding = new CustomBinding(messageElement, httpBinding);

            deviceioClient = new deviceio.DeviceClient(binding, endpointAddress);


            if (deviceioClient.Endpoint.Behaviors.FirstOrDefault(b => (b as PasswordDigestBehavior) != null) == null)
            {
                deviceioClient.Endpoint.Behaviors.Add(passwordDigestBehavior);
            }

            ptzClient = new ptz.PTZClient(binding, endpointAddress);

            ptzClient20 = new ptz20.PTZClient(binding, endpointAddress);

            mediaClient = new deviceio.MediaClient(binding, endpointAddress);

            if (mediaClient.Endpoint.Behaviors.FirstOrDefault(b => (b as PasswordDigestBehavior) != null) == null)
            {
                mediaClient.Endpoint.Behaviors.Add(passwordDigestBehavior);
            }

            deviceInformation = new DeviceInformation();

            mediaProfiles = mediaClient.GetProfiles();

            // currentMediaProfile = mediaProfiles[mediaProfileIndex];
        }
Exemple #2
0
        internal void Connect(string login, string password)
        {
            PasswordDigestBehavior passwordDigestBehavior = new PasswordDigestBehavior(login, password);

            HttpTransportBindingElement httpBinding = new HttpTransportBindingElement()
            {
                AuthenticationScheme = AuthenticationSchemes.Digest
            };

            //stringUri = System.Configuration.ConfigurationManager.AppSettings["Uri"];

            EndpointAddress endpointAddress = new EndpointAddress(MediaDevice.MediaDeviceUri);

            TextMessageEncodingBindingElement messageElement = new TextMessageEncodingBindingElement()
            {
                MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None)
            };

            CustomBinding binding = new CustomBinding(messageElement, httpBinding);
            deviceioClient = new deviceio.DeviceClient(binding, endpointAddress);

            if (deviceioClient.Endpoint.Behaviors.FirstOrDefault(b => (b as PasswordDigestBehavior) != null) == null)
                deviceioClient.Endpoint.Behaviors.Add(passwordDigestBehavior);

            ptzClient = new ptz.PTZClient(binding, endpointAddress);

            ptzClient20 = new ptz20.PTZClient(binding, endpointAddress);

            mediaClient = new deviceio.MediaClient(binding, endpointAddress);

            if (mediaClient.Endpoint.Behaviors.FirstOrDefault(b => (b as PasswordDigestBehavior) != null) == null)
                mediaClient.Endpoint.Behaviors.Add(passwordDigestBehavior);

            deviceInformation = new DeviceInformation();

            mediaProfiles = mediaClient.GetProfiles();

            // currentMediaProfile = mediaProfiles[mediaProfileIndex];
        }