Example #1
0
        /// <summary>
        /// Updates view.
        /// </summary>
        public override void UpdateView()
        {
            DiscoveredDevices devices = ContextController.GetDiscoveredDevices();

            if (devices != null)
            {
                View.DeviceManagementUrl = devices.ServiceAddress;
                View.IP = devices.DeviceAddress != null?devices.DeviceAddress.ToString() : string.Empty;

                if (_client != null && _client.Address != devices.ServiceAddress)
                {
                    View.Clear();
                }
            }
            else
            {
                View.DeviceManagementUrl = string.Empty;
                View.IP = string.Empty;
                View.Clear();
            }
            DeviceEnvironment environment = ContextController.GetDeviceEnvironment();

            if (_client != null)
            {
                _client.Timeout = environment.Timeouts.Message;
            }
        }
Example #2
0
        public void ShowVideo(Media.MediaUri uri, Media.VideoEncoderConfiguration encoder, Media.AudioEncoderConfiguration audio)
        {
            try
            {
                _videoWindow = new VideoContainer();
                DeviceEnvironment environment    = ContextController.GetDeviceEnvironment();
                int messageTimeout               = environment.Timeouts.Message;
                Media.TransportProtocol protocol = GetTransportProtocol();
                VideoUtils.AdjustVideo(
                    _videoWindow,
                    environment.Credentials.UserName,
                    environment.Credentials.Password,
                    messageTimeout,
                    protocol,
                    Media.StreamType.RTPUnicast,
                    uri,
                    encoder);
                _videoWindow.KEEPALIVE = true;
                _videoWindow.DebugPage = true;
                _videoWindow.OpenWindow(audio != null);

                Invoke(new Action(() => { btnGetStreams.Text = "Stop Video"; }));
            }
            catch
            {
                _videoWindow.DebugPage = false;
                _videoWindow           = null;
                throw;
            }
        }
Example #3
0
        /// <summary>
        /// Updates view.
        /// </summary>
        public override void UpdateView()
        {
            DeviceEnvironment environment = ContextController.GetDeviceEnvironment();

            View.TimeBetweenTests = environment.Timeouts.InterTests;
            View.MessageTimeout   = environment.Timeouts.Message;
            View.RebootTimeout    = environment.Timeouts.Reboot;
            View.DnsIpv4          = environment.EnvironmentSettings.DnsIpv4;
            View.DnsIpv6          = environment.EnvironmentSettings.DnsIpv6;
            View.NtpIpv4          = environment.EnvironmentSettings.NtpIpv4;
            View.NtpIpv6          = environment.EnvironmentSettings.NtpIpv6;
            View.GatewayIpv4      = environment.EnvironmentSettings.GatewayIpv4;
            View.GatewayIpv6      = environment.EnvironmentSettings.GatewayIpv6;
            View.PTZNodeToken     = environment.TestSettings.PTZNodeToken;

            View.UseEmbeddedPassword = environment.TestSettings.UseEmbeddedPassword;
            View.Password1           = environment.TestSettings.Password1;
            View.Password2           = environment.TestSettings.Password2;
            View.OperationDelay      = environment.TestSettings.OperationDelay;

            SetupInfo info = ContextController.GetSetupInfo();

            if (!info.Specification20Selected())
            {
                View.DeviceTypes = DeviceType.NVT;
            }
            View.EnableDeviceTypes(info.Specification20Selected());
        }
Example #4
0
        /// <summary>
        /// Updates view.
        /// </summary>
        public override void UpdateView()
        {
            DeviceEnvironment environment = ContextController.GetDeviceEnvironment();

            View.SettingsView.TimeBetweenTests = environment.Timeouts.InterTests;
            View.SettingsView.MessageTimeout   = environment.Timeouts.Message;
            View.SettingsView.RebootTimeout    = environment.Timeouts.Reboot;
            View.SettingsView.DnsIpv4          = environment.EnvironmentSettings.DnsIpv4;
            View.SettingsView.DnsIpv6          = environment.EnvironmentSettings.DnsIpv6;
            View.SettingsView.NtpIpv4          = environment.EnvironmentSettings.NtpIpv4;
            View.SettingsView.NtpIpv6          = environment.EnvironmentSettings.NtpIpv6;
            View.SettingsView.GatewayIpv4      = environment.EnvironmentSettings.GatewayIpv4;
            View.SettingsView.GatewayIpv6      = environment.EnvironmentSettings.GatewayIpv6;
            View.SettingsView.PTZNodeToken     = environment.TestSettings.PTZNodeToken;

            View.SettingsView.UseEmbeddedPassword = environment.TestSettings.UseEmbeddedPassword;
            View.SettingsView.Password1           = environment.TestSettings.Password1;
            View.SettingsView.Password2           = environment.TestSettings.Password2;

            View.SettingsView.OperationDelay = environment.TestSettings.OperationDelay;
            View.SettingsView.RecoveryDelay  = environment.TestSettings.RecoveryDelay;

            View.SettingsView.SubscriptionTimeout = environment.TestSettings.SubscriptionTimeout;
            View.SettingsView.EventTopic          = environment.TestSettings.EventTopic;
            View.SettingsView.TopicNamespaces     = environment.TestSettings.TopicNamespaces;
            View.SettingsView.SecureMethod        = environment.TestSettings.SecureMethod;

            View.SettingsView.RelayOutputDelayTimeMonostable = environment.TestSettings.RelayOutputDelayTimeMonostable;

            DisplayAdvancedSettings(environment.TestSettings.RawAdvancedSettings);
        }
Example #5
0
        /// <summary>
        /// Updates context data when a user leaves management tab.
        /// </summary>
        public override void UpdateContext()
        {
            DeviceEnvironment environment = ContextController.GetDeviceEnvironment();

            environment.Timeouts            = new Timeouts();
            environment.Timeouts.InterTests = View.TimeBetweenTests;
            environment.Timeouts.Message    = View.MessageTimeout;
            environment.Timeouts.Reboot     = View.RebootTimeout;

            environment.Features = new List <Feature>(View.Features);

            environment.DeviceTypes = View.DeviceTypes;

            environment.Services.Clear();
            environment.Services.AddRange(View.Services);

            environment.EnvironmentSettings             = new EnvironmentSettings();
            environment.EnvironmentSettings.DnsIpv4     = View.DnsIpv4;
            environment.EnvironmentSettings.NtpIpv4     = View.NtpIpv4;
            environment.EnvironmentSettings.DnsIpv6     = View.DnsIpv6;
            environment.EnvironmentSettings.NtpIpv6     = View.NtpIpv6;
            environment.EnvironmentSettings.GatewayIpv4 = View.GatewayIpv4;
            environment.EnvironmentSettings.GatewayIpv6 = View.GatewayIpv6;

            environment.TestSettings = new TestSettings();
            environment.TestSettings.PTZNodeToken = View.PTZNodeToken;

            environment.TestSettings.UseEmbeddedPassword = View.UseEmbeddedPassword;
            environment.TestSettings.Password1           = View.Password1;
            environment.TestSettings.Password2           = View.Password2;
            environment.TestSettings.OperationDelay      = View.OperationDelay;

            ContextController.UpdateDeviceEnvironment(environment);
        }
Example #6
0
        /// <summary>
        /// Collects parameters for launching current test/current test group/all selected tests
        /// </summary>
        /// <returns></returns>
        public TestSuiteParameters GetParameters()
        {
            TestSuiteParameters parameters = new TestSuiteParameters();
            DiscoveredDevices   devices    = ContextController.GetDiscoveredDevices();

            parameters.Address  = devices.ServiceAddress;
            parameters.CameraIP = devices.DeviceAddress;
            parameters.NetworkInterfaceController = devices.NIC;
            if ((devices.Current != null) && (devices.Current.ByDiscovery != null))
            {
                parameters.CameraUUID = devices.Current.ByDiscovery.UUID;
            }

            DeviceEnvironment env = ContextController.GetDeviceEnvironment();

            parameters.UserName        = env.Credentials.UserName;
            parameters.Password        = env.Credentials.Password;
            parameters.UseUTCTimestamp = env.Credentials.UseUTCTimeStamp;

            DeviceEnvironment environment = ContextController.GetDeviceEnvironment();

            parameters.MessageTimeout   = environment.Timeouts.Message;
            parameters.RebootTimeout    = environment.Timeouts.Reboot;
            parameters.TimeBetweenTests = environment.Timeouts.InterTests;
            parameters.PTZNodeToken     = environment.TestSettings.PTZNodeToken;

            parameters.EnvironmentSettings = new Tests.Common.TestEngine.EnvironmentSettings()
            {
                DnsIpv4            = env.EnvironmentSettings.DnsIpv4,
                NtpIpv4            = env.EnvironmentSettings.NtpIpv4,
                DnsIpv6            = env.EnvironmentSettings.DnsIpv6,
                NtpIpv6            = env.EnvironmentSettings.NtpIpv6,
                DefaultGateway     = env.EnvironmentSettings.GatewayIpv4,
                DefaultGatewayIpv6 = env.EnvironmentSettings.GatewayIpv6
            };

            parameters.UseEmbeddedPassword = environment.TestSettings.UseEmbeddedPassword;
            parameters.Password1           = environment.TestSettings.Password1;
            parameters.Password2           = environment.TestSettings.Password2;
            parameters.SecureMethod        = environment.TestSettings.SecureMethod;
            parameters.VideoSourceToken    = environment.TestSettings.VideoSourceToken;

            parameters.OperationDelay = environment.TestSettings.OperationDelay;
            parameters.RecoveryDelay  = environment.TestSettings.RecoveryDelay;

            parameters.EventTopic                     = environment.TestSettings.EventTopic;
            parameters.SubscriptionTimeout            = environment.TestSettings.SubscriptionTimeout;
            parameters.TopicNamespaces                = environment.TestSettings.TopicNamespaces;
            parameters.RelayOutputDelayTimeMonostable = environment.TestSettings.RelayOutputDelayTimeMonostable;

            Dictionary <string, object> advanced = new Dictionary <string, object>();

            foreach (object o in environment.TestSettings.AdvancedSettings)
            {
                advanced.Add(o.GetType().GUID.ToString(), o);
            }
            parameters.AdvancedPrameters = advanced;

            return(parameters);
        }
        /// <summary>
        /// Sends request.
        /// </summary>
        void SendRequestInternal()
        {
            try
            {
                DeviceEnvironment env = ContextController.GetDeviceEnvironment();

                HttpClient client = new HttpClient(_address, env.Timeouts.Message, _semaphore);
                _requestPending = true;
                string response = client.SendSoapMessage(_request);
                if (!_shutdown)
                {
                    View.DisplayResponse(response);
                }
            }
            catch (Exception exc)
            {
                if (!_shutdown)
                {
                    View.DisplayResponse(exc.Message);
                }
            }
            finally
            {
                _requestPending = false;
                if (!_shutdown)
                {
                    ReportOperationCompleted();
                }
            }
        }
Example #8
0
        /// <summary>
        /// Sends request.
        /// </summary>
        void SendRequestInternal()
        {
            try
            {
                DeviceEnvironment   env = ContextController.GetDeviceEnvironment();
                CredentialsProvider cp  = new CredentialsProvider();
                cp.Security = ContextController.GetDebugInfo().Security;
                cp.Username = env.Credentials.UserName;
                cp.Password = env.Credentials.Password;

                HttpClient client = new HttpClient(_address, env.Timeouts.Message, _semaphore, cp);
                _requestPending = true;
                string response = client.SendSoapMessage(_request);
                if (!_shutdown)
                {
                    View.DisplayResponse(response);
                }
            }
            catch (Exception exc)
            {
                if (!_shutdown)
                {
                    View.DisplayResponse(exc.Message);
                }
            }
            finally
            {
                _requestPending = false;
                if (!_shutdown)
                {
                    ReportOperationCompleted();
                }
            }
        }
Example #9
0
        /// <summary>
        /// Adds "wsse:security" element to a message, or replaces existing element.
        /// </summary>
        /// <param name="request">Request string.</param>
        /// <returns>Request string with added (updated) "wsse:security" element.</returns>
        public string ApplySecurity(string request)
        {
            DeviceEnvironment env  = ContextController.GetDeviceEnvironment();
            DebugInfo         info = ContextController.GetDebugInfo();

            string secureRequest = request;

            if (info.Security == HttpTransport.Interfaces.Security.WS)
            {
                if (!string.IsNullOrEmpty(env.Credentials.UserName))
                {
                    SoapHelper soapHelper = new SoapHelper();
                    secureRequest =
                        soapHelper.ApplySecurity(
                            request,
                            env.Credentials.UserName,
                            env.Credentials.Password,
                            env.Credentials.UseUTCTimeStamp,
                            true);
                }
            }
            else
            {
                SoapHelper soapHelper = new SoapHelper();
                secureRequest = soapHelper.RemoveSecurity(request);
            }
            return(secureRequest);
        }
Example #10
0
 public void ShowVideo(Onvif.MediaUri uri, Onvif.VideoEncoderConfiguration encoder)
 {
     try
     {
         _videoWindow = new VideoContainer();
         DeviceEnvironment environment = ContextController.GetDeviceEnvironment();
         int messageTimeout            = environment.Timeouts.Message;
         VideoUtils.AdjustVideo(
             _videoWindow,
             environment.Credentials.UserName,
             environment.Credentials.Password,
             messageTimeout,
             Onvif.TransportProtocol.UDP,
             Onvif.StreamType.RTPUnicast,
             uri,
             encoder);
         _videoWindow.KEEPALIVE = true;
         _videoWindow.OpenWindow(false);
         Invoke(new Action(() => { btnVideo.Text = "Stop Video"; }));
     }
     catch
     {
         _videoWindow = null;
         throw;
     }
 }
Example #11
0
        /// <summary>
        /// Collects parameters for launching current test/current test group/all selected tests
        /// </summary>
        /// <returns></returns>
        TestSuiteParameters GetParameters()
        {
            TestSuiteParameters parameters = new TestSuiteParameters();
            DiscoveredDevices   devices    = ContextController.GetDiscoveredDevices();

            parameters.Address  = devices.ServiceAddress;
            parameters.CameraIP = devices.DeviceAddress;
            parameters.NetworkInterfaceController = devices.NIC;
            if ((devices.Current != null) && (devices.Current.ByDiscovery != null))
            {
                parameters.CameraUUID = devices.Current.ByDiscovery.UUID;
            }

            DeviceEnvironment environment = ContextController.GetDeviceEnvironment();

            parameters.MessageTimeout   = environment.Timeouts.Message;
            parameters.RebootTimeout    = environment.Timeouts.Reboot;
            parameters.TimeBetweenTests = environment.Timeouts.InterTests;
            parameters.InteractiveFirst = tsbInteractiveFirst.Checked;
            parameters.PTZNodeToken     = environment.TestSettings.PTZNodeToken;

            parameters.UseEmbeddedPassword = environment.TestSettings.UseEmbeddedPassword;
            parameters.Password1           = environment.TestSettings.Password1;
            parameters.Password2           = environment.TestSettings.Password2;
            parameters.OperationDelay      = environment.TestSettings.OperationDelay;

            parameters.Features.AddRange(environment.Features);

            return(parameters);
        }
Example #12
0
        /// <summary>
        /// Updates credentials data saved in context.
        /// </summary>
        void UpdateCredentials()
        {
            DeviceEnvironment env = ContextController.GetDeviceEnvironment();

            env.Credentials.Password = View.Password;
            env.Credentials.UserName = View.UserName;
        }
Example #13
0
        /// <summary>
        /// Selects default tests for certification mode.
        /// All "Must", "Should", "Optional" tests are selected.
        /// All "Must if", "Should if" tests are selected depending on features selected at the "Management" page.
        /// </summary>
        void SelectAllTests()
        {
            DeviceEnvironment environment = ContextController.GetDeviceEnvironment();

            foreach (TestInfo testInfo in _testNodes.Keys)
            {
                switch (testInfo.RequirementLevel)
                {
                case RequirementLevel.Must:
                case RequirementLevel.Should:
                case RequirementLevel.Optional:
                    _testNodes[testInfo].Checked = true;
                    break;

                case RequirementLevel.ConditionalMust:
                case RequirementLevel.ConditionalShould:
                {
                    _testNodes[testInfo].Checked = FeaturesHelper.AllFeaturesSelected(testInfo);
                }
                break;
                }
            }

            SelectTestGroups();
        }
Example #14
0
        ///////////////////////////////////////////////////////////////////////////
        //!  @author        Ivan Vagunin
        ////
        public override void LoadSavedContext(SavedContext context)
        {
            if (context.DeviceEnvironment != null)
            {
                if (context.DeviceEnvironment.Timeouts != null)
                {
                    View.SettingsView.MessageTimeout   = context.DeviceEnvironment.Timeouts.Message;
                    View.SettingsView.RebootTimeout    = context.DeviceEnvironment.Timeouts.Reboot;
                    View.SettingsView.TimeBetweenTests = context.DeviceEnvironment.Timeouts.InterTests;
                }
                if (context.DeviceEnvironment.EnvironmentSettings != null)
                {
                    View.SettingsView.DnsIpv4     = context.DeviceEnvironment.EnvironmentSettings.DnsIpv4;
                    View.SettingsView.DnsIpv6     = context.DeviceEnvironment.EnvironmentSettings.DnsIpv6;
                    View.SettingsView.NtpIpv4     = context.DeviceEnvironment.EnvironmentSettings.NtpIpv4;
                    View.SettingsView.NtpIpv6     = context.DeviceEnvironment.EnvironmentSettings.NtpIpv6;
                    View.SettingsView.GatewayIpv4 = context.DeviceEnvironment.EnvironmentSettings.GatewayIpv4;
                    View.SettingsView.GatewayIpv6 = context.DeviceEnvironment.EnvironmentSettings.GatewayIpv6;
                }
                if (context.DeviceEnvironment.TestSettings != null)
                {
                    View.SettingsView.PTZNodeToken     = context.DeviceEnvironment.TestSettings.PTZNodeToken;
                    View.SettingsView.VideoSourceToken = context.DeviceEnvironment.TestSettings.VideoSourceToken;

                    View.SettingsView.UseEmbeddedPassword = context.DeviceEnvironment.TestSettings.UseEmbeddedPassword;
                    View.SettingsView.Password1           = context.DeviceEnvironment.TestSettings.Password1;
                    View.SettingsView.Password2           = context.DeviceEnvironment.TestSettings.Password2;
                    View.SettingsView.SecureMethod        = context.DeviceEnvironment.TestSettings.SecureMethod;

                    View.SettingsView.OperationDelay = context.DeviceEnvironment.TestSettings.OperationDelay;
                    View.SettingsView.RecoveryDelay  = context.DeviceEnvironment.TestSettings.RecoveryDelay;

                    View.SettingsView.SubscriptionTimeout = context.DeviceEnvironment.TestSettings.SubscriptionTimeout;
                    View.SettingsView.EventTopic          = context.DeviceEnvironment.TestSettings.EventTopic;

                    View.SettingsView.SearchTimeout  = context.DeviceEnvironment.TestSettings.SearchTimeout;
                    View.SettingsView.RecordingToken = context.DeviceEnvironment.TestSettings.RecordingToken;

                    string loadedNs = context.DeviceEnvironment.TestSettings.TopicNamespaces.Replace("\n",
                                                                                                     Environment.NewLine);
                    context.DeviceEnvironment.TestSettings.TopicNamespaces = loadedNs;
                    View.SettingsView.TopicNamespaces = context.DeviceEnvironment.TestSettings.TopicNamespaces;

                    if (context.DeviceEnvironment.TestSettings.RelayOutputDelayTimeMonostable > 0)
                    {
                        View.SettingsView.RelayOutputDelayTimeMonostable =
                            context.DeviceEnvironment.TestSettings.RelayOutputDelayTimeMonostable;
                    }

                    DisplayAdvancedSettings(context.DeviceEnvironment.TestSettings.RawAdvancedSettings);

                    DeviceEnvironment env = ContextController.GetDeviceEnvironment();
                    env.TestSettings.AdvancedSettings =
                        ParseAdvancedSettings(context.DeviceEnvironment.TestSettings.RawAdvancedSettings);
                }
            }
        }
Example #15
0
        /// <summary>
        /// Creates client for PTZ service
        /// </summary>
        /// <param name="address">PTZ service address</param>
        void IntializePtzClient(string address)
        {
            DeviceEnvironment env = ContextController.GetDeviceEnvironment();

            _ptzClient = new PTZServiceProvider(address, env.Timeouts.Message);
            _ptzClient.ExceptionThrown             += new Action <string, Exception>(OnExceptionThrown);
            _ptzClient.OperationCompleted          += new Action(OnOperationCompleted);
            _ptzClient.OperationStarted            += new Action(OnOperationStarted);
            _ptzClient.Timeout                      = env.Timeouts.Message;
            _ptzClient.ResponseReceived            += OnResponseReceived;
            _ptzClient.OnPTZConfigurationsReceived += OnPTZConfigurationsReceived;
        }
        /// <summary>
        /// Selects feature-dependent tests.
        /// </summary>
        public void ApplyFeatures()
        {
            List <Feature>    features    = View.Features;
            DeviceEnvironment environment = ContextController.GetDeviceEnvironment();

            environment.Features = new List <Feature>(features);

            if (FeaturesApplied != null)
            {
                FeaturesApplied(features);
            }
        }
Example #17
0
        /// <summary>
        /// Creates client for device management service
        /// </summary>
        /// <param name="address">Management service address</param>
        void InitializeDeviceClient(string address)
        {
            DeviceEnvironment env = ContextController.GetDeviceEnvironment();

            _deviceClient = new ManagementServiceProvider(address, env.Timeouts.Message);
            _deviceClient.ExceptionThrown        += new Action <string, Exception>(OnExceptionThrown);
            _deviceClient.OperationCompleted     += new Action(OnOperationCompleted);
            _deviceClient.OperationStarted       += new Action(OnOperationStarted);
            _deviceClient.OnCapabilitiesReceived += OnCapabilitiesReceived;
            _deviceClient.Timeout           = env.Timeouts.Message;
            _deviceClient.ResponseReceived += OnResponseReceived;
        }
Example #18
0
        /// <summary>
        /// Initializes device management service client
        /// </summary>
        /// <param name="address">Address of device management service</param>
        void InitializeClient(string address)
        {
            DeviceEnvironment env = ContextController.GetDeviceEnvironment();

            _client = new ManagementServiceProvider(address, env.Timeouts.Message);
            _client.ExceptionThrown             += new Action <string, Exception>(OnExceptionThrown);
            _client.FaultThrown                 += new Action <string, FaultException>(OnFaultThrown);
            _client.OnDeviceInformationReceived += DeviceInformationReceived;
            _client.OperationCompleted          += new Action(ReportOperationCompleted);
            _client.OperationStarted            += new Action(ReportOperationStarted);
            _client.Timeout = env.Timeouts.Message;
        }
Example #19
0
        /// <summary>
        /// Creates client for device management service
        /// </summary>
        /// <param name="address">Management service address</param>
        void InitializeDeviceClient(string address)
        {
            DeviceEnvironment env = ContextController.GetDeviceEnvironment();

            _deviceClient = new ManagementServiceProvider(address, env.Timeouts.Message);
            _deviceClient.ExceptionThrown        += OnExceptionThrown;
            _deviceClient.OperationCompleted     += OnOperationCompleted;
            _deviceClient.OperationStarted       += OnOperationStarted;
            _deviceClient.Timeout                 = env.Timeouts.Message;
            _deviceClient.ResponseReceived       += OnResponseReceived;
            _deviceClient.OnServicesInfoReceived += OnServicesInfoReceived;
            _deviceClient.Security                = ContextController.GetDebugInfo().Security;
        }
        bool ValidateTestSettings()
        {
            DeviceEnvironment environment = ContextController.GetDeviceEnvironment();

            bool topicEmpty = string.IsNullOrEmpty(environment.TestSettings.EventTopic) ||
                              string.IsNullOrEmpty(environment.TestSettings.TopicNamespaces);

            if (topicEmpty)
            {
                ShowPrompt("Topic (with namespace) for Events tests not defined at the Management page", "Necessary settings missing");
            }

            return(!topicEmpty);
        }
Example #21
0
        /// <summary>
        /// Creates client for media service
        /// </summary>
        /// <param name="address">Media service address</param>
        void InitializeMediaClient(string address)
        {
            DeviceEnvironment env = ContextController.GetDeviceEnvironment();

            _mediaClient = new MediaServiceProvider(address, env.Timeouts.Message);
            _mediaClient.ExceptionThrown         += OnExceptionThrown;
            _mediaClient.OperationCompleted      += OnOperationCompleted;
            _mediaClient.OperationStarted        += OnOperationStarted;
            _mediaClient.OnMediaUriReceived      += OnMediaUriReceived;
            _mediaClient.Timeout                  = env.Timeouts.Message;
            _mediaClient.ResponseReceived        += OnResponseReceived;
            _mediaClient.OnProfilesReceived      += OnProfilesReceived;
            _mediaClient.OnPTZConfigurationAdded += OnPTZConfigurationAdded;

            _mediaClient.Security = ContextController.GetDebugInfo().Security;
        }
Example #22
0
        /// <summary>
        /// Updates context data when a user leaves management tab.
        /// </summary>
        public override void UpdateContext()
        {
            DeviceEnvironment environment = ContextController.GetDeviceEnvironment();

            environment.Timeouts            = new Timeouts();
            environment.Timeouts.InterTests = View.SettingsView.TimeBetweenTests;
            environment.Timeouts.Message    = View.SettingsView.MessageTimeout;
            environment.Timeouts.Reboot     = View.SettingsView.RebootTimeout;

            environment.EnvironmentSettings             = new EnvironmentSettings();
            environment.EnvironmentSettings.DnsIpv4     = View.SettingsView.DnsIpv4;
            environment.EnvironmentSettings.NtpIpv4     = View.SettingsView.NtpIpv4;
            environment.EnvironmentSettings.DnsIpv6     = View.SettingsView.DnsIpv6;
            environment.EnvironmentSettings.NtpIpv6     = View.SettingsView.NtpIpv6;
            environment.EnvironmentSettings.GatewayIpv4 = View.SettingsView.GatewayIpv4;
            environment.EnvironmentSettings.GatewayIpv6 = View.SettingsView.GatewayIpv6;

            environment.TestSettings = new TestSettings();
            environment.TestSettings.PTZNodeToken = View.SettingsView.PTZNodeToken;

            environment.TestSettings.UseEmbeddedPassword = View.SettingsView.UseEmbeddedPassword;
            environment.TestSettings.Password1           = View.SettingsView.Password1;
            environment.TestSettings.Password2           = View.SettingsView.Password2;
            environment.TestSettings.OperationDelay      = View.SettingsView.OperationDelay;
            environment.TestSettings.RecoveryDelay       = View.SettingsView.RecoveryDelay;
            environment.TestSettings.VideoSourceToken    = View.SettingsView.VideoSourceToken;

            environment.TestSettings.SecureMethod        = View.SettingsView.SecureMethod;
            environment.TestSettings.SubscriptionTimeout = View.SettingsView.SubscriptionTimeout;
            environment.TestSettings.EventTopic          = View.SettingsView.EventTopic;
            environment.TestSettings.TopicNamespaces     = View.SettingsView.TopicNamespaces;

            environment.TestSettings.RelayOutputDelayTimeMonostable = View.SettingsView.RelayOutputDelayTimeMonostable;

            environment.TestSettings.RecordingToken = View.SettingsView.RecordingToken;
            environment.TestSettings.SearchTimeout  = View.SettingsView.SearchTimeout;
            environment.TestSettings.MetadataFilter = View.SettingsView.MetadataFilter;

            environment.TestSettings.RetentionTime = View.SettingsView.RetentionTime;

            environment.TestSettings.RawAdvancedSettings = GetAdvancedSettings();

            List <object> advanced = View.SettingsView.AdvancedSettings;

            environment.TestSettings.AdvancedSettings = advanced;
        }
Example #23
0
        /// <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();
        }
Example #24
0
        void UpdateDeviceContext(TestSuiteParameters parameters)
        {
            DeviceEnvironment environment = ContextController.GetDeviceEnvironment();

            environment.Timeouts            = new Timeouts();
            environment.Timeouts.InterTests = parameters.TimeBetweenTests;
            environment.Timeouts.Message    = parameters.MessageTimeout;
            environment.Timeouts.Reboot     = parameters.RebootTimeout;

            environment.EnvironmentSettings             = new EnvironmentSettings();
            environment.EnvironmentSettings.DnsIpv4     = parameters.EnvironmentSettings.DnsIpv4;
            environment.EnvironmentSettings.NtpIpv4     = parameters.EnvironmentSettings.NtpIpv4;
            environment.EnvironmentSettings.DnsIpv6     = parameters.EnvironmentSettings.DnsIpv6;
            environment.EnvironmentSettings.NtpIpv6     = parameters.EnvironmentSettings.NtpIpv6;
            environment.EnvironmentSettings.GatewayIpv4 = parameters.EnvironmentSettings.DefaultGateway;
            environment.EnvironmentSettings.GatewayIpv6 = parameters.EnvironmentSettings.DefaultGatewayIpv6;

            environment.TestSettings = new TestSettings();
            environment.TestSettings.PTZNodeToken = parameters.PTZNodeToken;

            environment.TestSettings.UseEmbeddedPassword             = parameters.UseEmbeddedPassword;
            environment.TestSettings.Password1                       = parameters.Password1;
            environment.TestSettings.Password2                       = parameters.Password2;
            environment.TestSettings.OperationDelay                  = parameters.OperationDelay;
            environment.TestSettings.RecoveryDelay                   = parameters.RecoveryDelay;
            environment.TestSettings.VideoSourceToken                = parameters.VideoSourceToken;
            environment.TestSettings.FirmwareFilePath                = parameters.FirmwareFilePath;
            environment.TestSettings.CredentialIdentifierValueFirst  = parameters.CredentialIdentifierValueFirst;
            environment.TestSettings.CredentialIdentifierValueSecond = parameters.CredentialIdentifierValueSecond;
            environment.TestSettings.CredentialIdentifierValueThird  = parameters.CredentialIdentifierValueThird;

            environment.TestSettings.SecureMethod        = parameters.SecureMethod;
            environment.TestSettings.SubscriptionTimeout = parameters.SubscriptionTimeout;
            environment.TestSettings.EventTopic          = parameters.EventTopic;
            environment.TestSettings.TopicNamespaces     = parameters.TopicNamespaces;

            environment.TestSettings.RelayOutputDelayTimeMonostable = parameters.RelayOutputDelayTimeMonostable;

            environment.TestSettings.RecordingToken = parameters.RecordingToken;
            environment.TestSettings.SearchTimeout  = parameters.SearchTimeout;
            environment.TestSettings.MetadataFilter = parameters.MetadataFilter;

            environment.TestSettings.RetentionTime = parameters.RetentionTime;
        }
Example #25
0
        /// <summary>
        /// Creates client for media service
        /// </summary>
        /// <param name="address">Media service address</param>
        void InitializeMediaClient(string address)
        {
            DeviceEnvironment env = ContextController.GetDeviceEnvironment();

            _mediaClient = new MediaServiceProvider(address, env.Timeouts.Message);
            _mediaClient.ExceptionThrown    += new Action <string, Exception>(OnExceptionThrown);
            _mediaClient.OperationCompleted += new Action(OnOperationCompleted);
            _mediaClient.OperationStarted   += new Action(OnOperationStarted);
            _mediaClient.OnProfilesReceived += OnProfilesReceived;
            _mediaClient.OnVideoSourceConfigurationsReceived += OnSourceConfigsReceived;
            _mediaClient.OnVideoEncoderConfigurationReceived += OnVideoEncoderConfigsReceived;
            _mediaClient.OnVideoEncoderConfigOptionsReceived += OnVideoEncoderConfigOptionsReceived;
            _mediaClient.OnAudioSourceConfigurationsReceived += OnAudioSourceConfigsReceived;
            _mediaClient.OnAudioEncoderConfigurationReceived += OnAudioEncoderConfigsReceived;
            _mediaClient.OnAudioEncoderConfigOptionsReceived += OnAudioEncoderConfigOptionsReceived;
            _mediaClient.OnMediaUriReceived += OnMediaUriReceived;
            _mediaClient.Timeout             = env.Timeouts.Message;
            _mediaClient.ResponseReceived   += OnResponseReceived;
        }
Example #26
0
        public static Data.Log.ManagementSettings GetManagementSettings()
        {
            Data.Log.ManagementSettings settings = new TestTool.GUI.Data.Log.ManagementSettings();

            DeviceEnvironment environment  = GetDeviceEnvironment();
            TestSettings      testSettings = environment.TestSettings;

            TestTool.GUI.Data.Log.Timeouts timeouts = new TestTool.GUI.Data.Log.Timeouts();
            timeouts.MessageTimeout      = environment.Timeouts.Message;
            timeouts.OperationDelay      = testSettings.OperationDelay;
            timeouts.RebootTimeout       = environment.Timeouts.Reboot;
            timeouts.TimeBetweenRequests = testSettings.RecoveryDelay;
            timeouts.TimeBetweenTests    = environment.Timeouts.InterTests;

            settings.Timeouts = timeouts;

            Data.Log.Miscellaneous misc = new TestTool.GUI.Data.Log.Miscellaneous();
            misc.DefaultGatewayIpv4 = environment.EnvironmentSettings.GatewayIpv4;
            misc.DefaultGatewayIpv6 = environment.EnvironmentSettings.GatewayIpv6;
            misc.DnsIpv4            = environment.EnvironmentSettings.DnsIpv4;
            misc.DnsIpv6            = environment.EnvironmentSettings.DnsIpv6;
            misc.NtpIpv4            = environment.EnvironmentSettings.NtpIpv4;
            misc.NtpIpv6            = environment.EnvironmentSettings.NtpIpv6;

            misc.EventTopic           = testSettings.EventTopic;
            misc.MetadataFilter       = testSettings.MetadataFilter;
            misc.Password1            = testSettings.Password1;
            misc.Password2            = testSettings.Password2;
            misc.PTZNodeToken         = testSettings.PTZNodeToken;
            misc.RecordingToken       = testSettings.RecordingToken;
            misc.RelayOutputDelayTime = testSettings.RelayOutputDelayTimeMonostable;
            misc.SearchTimeout        = testSettings.SearchTimeout;
            misc.SecureMethod         = testSettings.SecureMethod;
            misc.SubscriptionTimeout  = testSettings.SubscriptionTimeout;
            misc.TopicNamespaces      = testSettings.TopicNamespaces;
            misc.UseEmbeddedPassword  = testSettings.UseEmbeddedPassword;
            misc.RetentionTime        = testSettings.RetentionTime;

            settings.Miscellaneous = misc;

            return(settings);
        }
Example #27
0
        /// <summary>
        /// Initializes service client, if it's possibly.
        /// </summary>
        /// <returns>True if client has been initialized successfully.</returns>
        bool InitializeClient()
        {
            string            serviceAddress = string.Empty;
            DiscoveredDevices devices        = ContextController.GetDiscoveredDevices();

            if (devices.Current != null)
            {
                serviceAddress = devices.ServiceAddress;
            }

            try
            {
                new Uri(serviceAddress);
            }
            catch (Exception)
            {
                View.ShowError("Device service address is invalid!");
                return(false);
            }

            try
            {
                DeviceEnvironment env = ContextController.GetDeviceEnvironment();

                _client = new ManagementServiceProvider(serviceAddress, env.Timeouts.Message);
                _client.ExceptionThrown             += _client_ExceptionThrown;
                _client.OnDeviceInformationReceived += _client_OnDeviceInformationReceived;
                _client.OperationCompleted          += _client_OperationCompleted;
                _client.OperationStarted            += _client_OperationStarted;
                _client.ResponseReceived            += _client_ResponseReceived;

                _client.Security = ContextController.GetDebugInfo().Security;

                return(true);
            }
            catch (Exception exc)
            {
                View.ShowError(string.Format("Error occurred: {0}", exc.Message));
                return(false);
            }
        }
        /// <summary>
        /// Updates view.
        /// </summary>
        public override void UpdateView()
        {
            DeviceEnvironment environment = ContextController.GetDeviceEnvironment();

            View.TimeBetweenTests = environment.Timeouts.InterTests;
            View.MessageTimeout   = environment.Timeouts.Message;
            View.RebootTimeout    = environment.Timeouts.Reboot;
            View.DnsIpv4          = environment.EnvironmentSettings.DnsIpv4;
            View.DnsIpv6          = environment.EnvironmentSettings.DnsIpv6;
            View.NtpIpv4          = environment.EnvironmentSettings.NtpIpv4;
            View.NtpIpv6          = environment.EnvironmentSettings.NtpIpv6;
            View.GatewayIpv4      = environment.EnvironmentSettings.GatewayIpv4;
            View.GatewayIpv6      = environment.EnvironmentSettings.GatewayIpv6;
            View.PTZNodeToken     = environment.TestSettings.PTZNodeToken;

            View.UseEmbeddedPassword = environment.TestSettings.UseEmbeddedPassword;
            View.Password1           = environment.TestSettings.Password1;
            View.Password2           = environment.TestSettings.Password2;
            View.OperationDelay      = environment.TestSettings.OperationDelay;
            View.RecoveryDelay       = environment.TestSettings.RecoveryDelay;
        }
Example #29
0
        /// <summary>
        /// Launches tests.
        /// </summary>
        /// <param name="parameters">Parameters passed from the View.</param>
        /// <param name="single">True if "Run current" button is in use. If "Run current" button has
        /// been clicked, results collected by this moment will not be cleared.</param>
        void InternalRun(TestSuiteParameters parameters, bool single)
        {
            _running       = true;
            _runningSingle = single;
            _testsCount    = parameters.TestCases.Count;

            DeviceEnvironment env = ContextController.GetDeviceEnvironment();

            parameters.UserName        = env.Credentials.UserName;
            parameters.Password        = env.Credentials.Password;
            parameters.UseUTCTimestamp = env.Credentials.UseUTCTimeStamp;
            parameters.Operator        = new Utils.Operator(View.Window);
            parameters.VideoForm       = View.GetVideoForm();

            parameters.EnvironmentSettings = new Tests.Common.TestEngine.EnvironmentSettings()
            {
                DnsIpv4            = env.EnvironmentSettings.DnsIpv4,
                NtpIpv4            = env.EnvironmentSettings.NtpIpv4,
                DnsIpv6            = env.EnvironmentSettings.DnsIpv6,
                NtpIpv6            = env.EnvironmentSettings.NtpIpv6,
                DefaultGateway     = env.EnvironmentSettings.GatewayIpv4,
                DefaultGatewayIpv6 = env.EnvironmentSettings.GatewayIpv6
            };

            if (!single)
            {
                _testResults.Clear();
                _testExecutionTime = DateTime.Now;
            }

            if (TestSuiteStarted != null)
            {
                TestSuiteStarted(parameters);
            }

            _td.Run(parameters);
        }
Example #30
0
        /// <summary>
        /// Selects tests depending on features selected.
        /// </summary>
        /// <param name="features">Features</param>
        public void SelectFeatureDependentTests(IEnumerable <Feature> features)
        {
            // "Must" and "Should" tests are selected when corresponding services are selected.
            // "Optional" tests don't change their state.
            // "Conditional Must", "Conditional Should" become checked or unchecked
            // accordingly to features selection.
            //

            List <TestInfo> tests = new List <TestInfo>();

            DeviceEnvironment environment = ContextController.GetDeviceEnvironment();

            foreach (TestInfo testInfo in _testInfos)
            {
                bool add = true;

                switch (testInfo.RequirementLevel)
                {
                case RequirementLevel.ConditionalMust:
                case RequirementLevel.ConditionalShould:
                {
                    add = Utils.FeaturesHelper.AllFeaturesSelected(testInfo);
                }
                break;

                case RequirementLevel.Optional:
                    add = false;
                    break;
                }
                if (add)
                {
                    tests.Add(testInfo);
                }
            }

            View.SelectFeatureDependentTests(tests);
        }