Beispiel #1
0
        /// <summary>
        /// Constructor. Performs initialization.
        /// </summary>
        /// <param name="param"></param>
        protected BaseTest(TestLaunchParam param)
        {
            _cameraAddress        = param.ServiceAddress;
            _cameraIp             = param.CameraIp;
            _cameraId             = param.CameraUUID;
            _nic                  = param.NIC;
            _username             = param.UserName;
            _password             = param.Password;
            _useUTCTimestamp      = param.UseUTCTimestamp;
            _operator             = param.Operator;
            _videoForm            = param.VideoForm;
            _environmentSettings  = param.EnvironmentSettings;
            _ptzNodeToken         = param.PTZNodeToken;
            _useEmbeddedPassword  = param.UseEmbeddedPassword;
            _password1            = param.Password1;
            _password2            = param.Password2;
            _operationDelay       = param.OperationDelay;
            _recoveryDelay        = param.RecoveryDelay;
            _relayOutputDelayTime = param.RelayOutputDelayTime;

            _rebootTimeout = param.RebootTimeout;

            _semaphore = new TestSemaphore();

            _trafficListener                   = new TrafficListener();
            _trafficListener.RequestSent      += LogRequest;
            _trafficListener.ResponseReceived += LogResponse;

            _endpointController = new EndpointController(new EndpointAddress(_cameraAddress));

            _credentialsProvider          = new CredentialsProvider();
            _credentialsProvider.Username = param.UserName;
            _credentialsProvider.Password = param.Password;
        }
        protected BaseOnvifTest(TestLaunchParam param)
            : base(param)
        {
            _features = param.Features;

            _cameraAddress       = param.ServiceAddress;
            _cameraIp            = param.CameraIp;
            _cameraId            = param.CameraUUID;
            _nic                 = param.NIC;
            _username            = param.UserName;
            _password            = param.Password;
            _useUTCTimestamp     = param.UseUTCTimestamp;
            _operator            = param.Operator;
            _videoForm           = param.VideoForm;
            _environmentSettings = param.EnvironmentSettings;

            _messageTimeout = param.MessageTimeout;

            _operationDelay = param.OperationDelay;
            _recoveryDelay  = param.RecoveryDelay;

            _rebootTimeout = param.RebootTimeout;

            _trafficListener                   = new TrafficListener();
            _trafficListener.RequestSent      += LogRequest;
            _trafficListener.ResponseReceived += LogResponse;

            _endpointController = new EndpointController(new EndpointAddress(_cameraAddress));

            _credentialsProvider          = new CredentialsProvider();
            _credentialsProvider.Username = param.UserName;
            _credentialsProvider.Password = param.Password;
            _credentialsProvider.Security = param.Security;
        }
        protected BaseOnvifTest(TestLaunchParam param) : base(param)
        {
            _features.Mode = param.FeatureDefinitionMode;
            if (param.FeatureDefinitionMode == FeatureDefinitionMode.Default)
            {
                _features.AddRange(param.Features);
            }

            _cameraAddress   = param.ServiceAddress;
            _cameraIp        = param.CameraIp;
            _cameraId        = param.CameraUUID;
            _nic             = param.NIC;
            _username        = param.UserName;
            _password        = param.Password;
            _useUTCTimestamp = param.UseUTCTimestamp;
            Operator         = param.Operator;

            if (param.VideoForm != null)
            {
                _videoForm = param.VideoForm;
                // reinitialize video window
                _videoForm.Reset();
                _videoForm.NICIndex  = param.NIC.Index;
                _videoForm.StopEvent = _semaphore.StopEvent;
            }

            _declaredScopes.AddRange(param.DeclaredScopes);

            _environmentSettings = param.EnvironmentSettings;

            _messageTimeout = param.MessageTimeout;

            _operationDelay = param.OperationDelay;
            _recoveryDelay  = param.RecoveryDelay;

            _rebootTimeout = param.RebootTimeout;

            // should be done in BaseTest.Initialize();
            //_trafficListener = new TrafficListener();
            //_trafficListener.RequestSent += LogRequest;
            //_trafficListener.ResponseReceived += LogResponse;

            _endpointController = new EndpointController(new EndpointAddress(_cameraAddress));

            _credentialsProvider          = new CredentialsProvider();
            _credentialsProvider.Username = param.UserName;
            _credentialsProvider.Password = param.Password;
            _credentialsProvider.Security = param.Security;
        }
Beispiel #4
0
        private void ObtainNetworkInterfaces()
        {
            var anyInterface  = new NetworkInterfaceDescription("Any");
            var list          = new BindingList <object>();
            var allInterfaces = NetworkInterface.GetAllNetworkInterfaces();

            foreach (var nic in allInterfaces.Where(i => (i.NetworkInterfaceType == NetworkInterfaceType.Ethernet) ||
                                                    (i.NetworkInterfaceType == NetworkInterfaceType.Wireless80211)))
            {
                list.Add(nic);
            }
            list.Add(anyInterface);
            cbInterfaces.ItemsSource       = list;
            cbInterfaces.DisplayMemberPath = "Description";
            cbInterfaces.SelectedItem      = anyInterface;
        }
Beispiel #5
0
 // should use this NIC to attach to
 public NotifyCollectingServer(NetworkInterfaceDescription Nic)
     : base(Nic)
 {
 }
Beispiel #6
0
 // should use this NIC to attach to
 public NotifyServer(NetworkInterfaceDescription Nic)
 {
     _Nic = Nic;
 }
Beispiel #7
0
        protected BaseOnvifTest(TestLaunchParam param) : base(param)
        {
            _features.Mode = param.FeatureDefinitionMode;
            if (param.FeatureDefinitionMode == FeatureDefinitionMode.Default)
            {
                _features.AddRange(param.Features);
            }

            //_cameraAddress = param.ServiceAddress;
            FirmwareFilePath = param.FirmwareFilePath;

            CredentialIdentifierValueFirst  = param.CredentialIdentifierValueFirst;
            CredentialIdentifierValueSecond = param.CredentialIdentifierValueSecond;
            CredentialIdentifierValueThird  = param.CredentialIdentifierValueThird;

            _cameraIp = param.CameraIp;
            _cameraId = param.CameraUUID;
            _nic      = param.NIC;
            TestTool.HttpTransport.RequestNetworkStream.EndpointFrom = new IPEndPoint(_nic.IP, 0);
            _username        = param.UserName;
            _password        = param.Password;
            _useUTCTimestamp = param.UseUTCTimestamp;
            Operator         = param.Operator;

            if (param.VideoForm != null)
            {
                _videoForm = param.VideoForm;
                // reinitialize video window
                _videoForm.Reset();
                _videoForm.NICIndex  = param.NIC.Index;
                _videoForm.StopEvent = _semaphore.StopEvent;
            }

            _declaredScopes.AddRange(param.DeclaredScopes);

            _environmentSettings = param.EnvironmentSettings;

            _messageTimeout = param.MessageTimeout;

            _operationDelay = param.OperationDelay;
            _recoveryDelay  = param.RecoveryDelay;

            _rebootTimeout = param.RebootTimeout;

            // should be done in BaseTest.Initialize();
            //_trafficListener = new TrafficListener();
            //_trafficListener.RequestSent += LogRequest;
            //_trafficListener.ResponseReceived += LogResponse;

            _endpointController = new EndpointController(new EndpointAddress(param.ServiceAddress));

            _credentialsProvider = new CredentialsProvider
            {
                Username = param.UserName,
                Password = param.Password,
                Security = param.Security
            };

            NetworkSettingsChangedEvent += address =>
            {
                var uri = new EndpointAddress(address);

                var       addresses = Dns.GetHostAddresses(uri.Uri.Host);
                IPAddress newAddr   = null;
                switch (uri.Uri.HostNameType)
                {
                case UriHostNameType.IPv4:
                    newAddr = addresses.FirstOrDefault(u => u.AddressFamily == AddressFamily.InterNetwork);
                    break;

                case UriHostNameType.IPv6:
                    newAddr = addresses.FirstOrDefault(u => u.AddressFamily == AddressFamily.InterNetworkV6);
                    break;

                case UriHostNameType.Dns:
                    newAddr = addresses.FirstOrDefault(u => u.AddressFamily == AddressFamily.InterNetwork);
                    if (null == _cameraIp)
                    {
                        newAddr = addresses.FirstOrDefault(u => u.AddressFamily == AddressFamily.InterNetworkV6);
                    }
                    break;
                }

                if (null != newAddr)
                {
                    _endpointController.UpdateAddress(uri);
                    _cameraIp = newAddr;
                }
            };
        }
Beispiel #8
0
 public NotifyAsyncServer(NetworkInterfaceDescription Nic)
     : base(Nic)
 {
 }
Beispiel #9
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="Nic"></param>
 public BaseNotifyServer(NetworkInterfaceDescription Nic)
 {
     _Nic = Nic;
     ChoosePort();
 }