Beispiel #1
0
 public static PTZConfiguration[] GetPtzConfigurations(BaseOnvifTest test, PTZClient client)
 {
     PTZConfiguration[] result = null;
     RunStep(test, () => { result = client.GetConfigurations(); }, "Get PTZ configurations");
     DoRequestDelay(test);
     return(result);
 }
Beispiel #2
0
 public static Profile[] GetProfiles(BaseOnvifTest test, MediaClient client)
 {
     Profile[] profiles = null;
     RunStep(test, () => { profiles = client.GetProfiles(); }, "Get Media profiles");
     DoRequestDelay(test);
     return(profiles);
 }
Beispiel #3
0
 public static Receiver[] GetReceivers(BaseOnvifTest test, ReceiverPortClient client)
 {
     Receiver[] items = null;
     RunStep(test, () => { items = client.GetReceivers(); }, "Get Receivers");
     DoRequestDelay(test);
     return(items);
 }
Beispiel #4
0
        public static void RollbackMediaConfiguration(BaseOnvifTest test, MediaClient client, MediaConfigurationChangeLog changeLog)
        {
            foreach (Profile p in changeLog.CreatedProfiles)
            {
                DeleteProfile(test, client, p.token);
            }
            foreach (Profile p in changeLog.DeletedProfiles)
            {
                RestoreDeletedProfile(test, client, p);
            }
            foreach (Profile p in changeLog.ModifiedProfiles)
            {
                ResetProfile(test, client, p);
            }

            foreach (VideoEncoderConfiguration config in changeLog.ModifiedVideoEncoderConfigurations)
            {
                SetVideoEncoderConfiguration(test, client, config, true);
            }
            foreach (AudioEncoderConfiguration config in changeLog.ModifiedAudioEncoderConfigurations)
            {
                SetAudioEncoderConfiguration(test, client, config, false);
            }
            foreach (MetadataConfiguration config in changeLog.ModifiedMetadataConfigurations)
            {
                SetMetadataConfiguration(test, client, config, false);
            }
        }
Beispiel #5
0
        protected static void RestoreDeletedProfile(BaseOnvifTest test, MediaClient client, Profile profile)
        {
            LogTestEvent(test, string.Format("Restore profile '{0}' deleted during the test{1}", profile.token, Environment.NewLine));

            Profile actual = CreateProfile(test, client, profile.Name, profile.token);

            if (profile.VideoSourceConfiguration != null)
            {
                AddVideoSourceConfiguration(test, client, profile.token, profile.VideoSourceConfiguration.token);
            }
            if (profile.AudioSourceConfiguration != null)
            {
                AddAudioSourceConfiguration(test, client, profile.token, profile.AudioSourceConfiguration.token);
            }
            if (profile.VideoEncoderConfiguration != null)
            {
                AddVideoEncoderConfiguration(test, client, profile.token, profile.VideoEncoderConfiguration.token);
            }
            if (profile.AudioEncoderConfiguration != null)
            {
                AddAudioEncoderConfiguration(test, client, profile.token, profile.AudioEncoderConfiguration.token);
            }
            if (profile.MetadataConfiguration != null)
            {
                AddMetadataConfiguration(test, client, profile.token, profile.MetadataConfiguration.token);
            }
            if (profile.PTZConfiguration != null)
            {
                AddPTZConfiguration(test, client, profile.token, profile.PTZConfiguration.token);
            }
            if (profile.VideoAnalyticsConfiguration != null)
            {
                AddVideoAnalyticsConfiguration(test, client, profile.token, profile.VideoAnalyticsConfiguration.token);
            }
        }
Beispiel #6
0
 public static Service[] GetServices(BaseOnvifTest test, DeviceClient client, bool includeCapabilities)
 {
     Service[] services = null;
     RunStep(test, () => { services = client.GetServices(includeCapabilities); }, "Get Services");
     DoRequestDelay(test);
     return(services);
 }
Beispiel #7
0
        public static void RemoveAllConfigurations(BaseOnvifTest test, MediaClient client, Profile profile)
        {
            if (profile.VideoEncoderConfiguration != null)
            {
                RemoveVideoEncoderConfiguration(test, client, profile.token);
            }
            if (profile.VideoSourceConfiguration != null)
            {
                RemoveVideoSourceConfiguration(test, client, profile.token);
            }
            if (profile.AudioEncoderConfiguration != null)
            {
                RemoveAudioEncoderConfiguration(test, client, profile.token);
            }
            if (profile.VideoSourceConfiguration != null)
            {
                RemoveAudioSourceConfiguration(test, client, profile.token);
            }

            if (profile.MetadataConfiguration != null)
            {
                RemoveMetadataConfiguration(test, client, profile.token);
            }
            if (profile.PTZConfiguration != null)
            {
                RemovePTZConfiguration(test, client, profile.token);
            }
            if (profile.VideoAnalyticsConfiguration != null)
            {
                RemoveVideoAnalyticsConfiguration(test, client, profile.token);
            }
        }
Beispiel #8
0
        public static ReceiverServiceCapabilities GetReceiverServiceCapabilities(BaseOnvifTest test, ReceiverPortClient client)
        {
            ReceiverServiceCapabilities capabilities = null;

            RunStep(test, () => { capabilities = client.GetServiceCapabilities(); }, "Get Receiver Service Capabilities");
            DoRequestDelay(test);
            return(capabilities);
        }
Beispiel #9
0
        public static Capabilities GetCapabilities(BaseOnvifTest test, DeviceClient client, CapabilityCategory[] categories)
        {
            Capabilities capabilities = null;

            RunStep(test, () => { capabilities = client.GetCapabilities(categories); }, "Get capabilities");
            DoRequestDelay(test);
            return(capabilities);
        }
Beispiel #10
0
        public static Receiver CreateReceiver(BaseOnvifTest test, ReceiverPortClient client, ReceiverConfiguration config)
        {
            Receiver receiver = null;

            RunStep(test, () => { receiver = client.CreateReceiver(config); }, "Create Receiver");
            DoRequestDelay(test);
            return(receiver);
        }
Beispiel #11
0
        public static Profile GetProfile(BaseOnvifTest test, MediaClient client, string token, string stepName)
        {
            Profile profile = null;

            RunStep(test, () => { profile = client.GetProfile(token); }, stepName);
            DoRequestDelay(test);
            return(profile);
        }
Beispiel #12
0
        public static ReceiverStateInformation GetReceiverState(BaseOnvifTest test, ReceiverPortClient client, string receiverToken)
        {
            ReceiverStateInformation receiverSI = null;

            RunStep(test, () => { receiverSI = client.GetReceiverState(receiverToken); },
                    string.Format("Get Receiver {0} State", receiverToken));
            DoRequestDelay(test);
            return(receiverSI);
        }
Beispiel #13
0
        public static Profile CreateProfile(BaseOnvifTest test, MediaClient client, string name, string token)
        {
            Profile profile = null;

            RunStep(test, () => { profile = client.CreateProfile(name, token); },
                    string.Format(Resources.StepCreateMediaProfile_Format, name));
            DoRequestDelay(test);
            return(profile);
        }
Beispiel #14
0
        public static Receiver GetReceiver(BaseOnvifTest test, ReceiverPortClient client, string receiverToken)
        {
            Receiver receiver = null;

            RunStep(test, () => { receiver = client.GetReceiver(receiverToken); },
                    string.Format("Get Receiver {0}", receiverToken));
            DoRequestDelay(test);
            return(receiver);
        }
Beispiel #15
0
 public static GetRecordingsResponseItem[] GetRecordings(BaseOnvifTest test, RecordingPortClient client)
 {
     GetRecordingsResponseItem[] recordingsResponseItems = null;
     RunStep(test,
             () => { recordingsResponseItems = client.GetRecordings(); },
             "Get recordings");
     DoRequestDelay(test);
     return(recordingsResponseItems);
 }
Beispiel #16
0
 public static VideoSourceConfiguration[] GetCompatibleVideoSourceConfigurations(
     BaseOnvifTest test, MediaClient client, string profile)
 {
     VideoSourceConfiguration[] configs = null;
     RunStep(test, () => { configs = client.GetCompatibleVideoSourceConfigurations(profile); },
             string.Format(Resources.StepGetCompatibleVideoSourceConfigs_Format, profile));
     DoRequestDelay(test);
     return(configs);
 }
Beispiel #17
0
        public static VideoEncoderConfigurationOptions GetVideoEncoderConfigurationOptions(
            BaseOnvifTest test, MediaClient client, string configuration, string profile)
        {
            VideoEncoderConfigurationOptions options = null;

            RunStep(test, () => { options = client.GetVideoEncoderConfigurationOptions(configuration, profile); },
                    Resources.StepGetVideoEncoderConfigOptions_Title);
            DoRequestDelay(test);
            return(options);
        }
Beispiel #18
0
        public OnvifServiceClient(BaseOnvifTest test_,
                                  string serviceName_,
                                  ServiceAddressRetrievalMethod serviceAddressRetrievalAction_,
                                  SetupSecurity setupSecurityAction_,
                                  SetupChannel setupChannelAction_,
                                  CreateClient <ServicePortClient> createClientAction_)
        {
            Test        = test_;
            ServiceName = serviceName_;
            ServiceAddressRetrievalAction = serviceAddressRetrievalAction_;
            SetupSecurityAction           = setupSecurityAction_;
            SetupChannelAction            = setupChannelAction_;
            CreateClientAction            = createClientAction_;

            Test.SecurityChangedEvent        += e => this.Close();
            Test.NetworkSettingsChangedEvent += address => this.Close();
        }
Beispiel #19
0
 /// <summary>
 /// Adds video encoder configuration to profile
 /// </summary>
 /// <param name="profile">Token of profile</param>
 /// <param name="configuration">Token of configuration</param>
 public static void AddVideoEncoderConfiguration(BaseOnvifTest test, MediaClient client, string profile, string configuration)
 {
     RunStep(test, () => { client.AddVideoEncoderConfiguration(profile, configuration); },
             string.Format(Resources.StepAddVideoEncoderConfig_Format, configuration, profile));
     DoRequestDelay(test);
 }
Beispiel #20
0
 public static void SetMetadataConfiguration(BaseOnvifTest test, MediaClient client, MetadataConfiguration configuration, bool persistency)
 {
     RunStep(test, () => { client.SetMetadataConfiguration(configuration, persistency); },
             Resources.StepSetMetadataConfig_Title);
     DoRequestDelay(test);
 }
Beispiel #21
0
 public static void AddVideoAnalyticsConfiguration(BaseOnvifTest test, MediaClient client, string profile, string configuration)
 {
     RunStep(test, () => { client.AddVideoAnalyticsConfiguration(profile, configuration); },
             string.Format("Add Video Analytics Configuration {0} to profile {1}", configuration, profile));
     DoRequestDelay(test);
 }
Beispiel #22
0
        public static Profile GetProfile(BaseOnvifTest test, MediaClient client, string token)
        {
            string stepName = string.Format("Get Media profile '{0}'", token);

            return(GetProfile(test, client, token, stepName));
        }
Beispiel #23
0
 public static void RemovePTZConfiguration(BaseOnvifTest test, MediaClient client, string profile)
 {
     RunStep(test, () => { client.RemovePTZConfiguration(profile); },
             string.Format(Resources.StepRemovePTZConfig_Format, profile));
     DoRequestDelay(test);
 }
Beispiel #24
0
 public static void ConfigureReceiver(BaseOnvifTest test, ReceiverPortClient client, string receiverToken, ReceiverConfiguration config)
 {
     RunStep(test, () => client.ConfigureReceiver(receiverToken, config),
             string.Format("Configure Receiver (token = '{0}')", receiverToken));
     DoRequestDelay(test);
 }
Beispiel #25
0
 public static void RemoveVideoAnalyticsConfiguration(BaseOnvifTest test, MediaClient client, string profile)
 {
     RunStep(test, () => { client.RemoveVideoAnalyticsConfiguration(profile); },
             string.Format("Remove Video Analytics Configuration from profile {0}", profile));
     DoRequestDelay(test);
 }
Beispiel #26
0
 public static void DeleteProfile(BaseOnvifTest test, MediaClient client, string profile)
 {
     RunStep(test, () => { client.DeleteProfile(profile); },
             string.Format(Resources.StepDeleteMediaProfile_Format, profile));
     DoRequestDelay(test);
 }
Beispiel #27
0
        protected static void ResetProfile(BaseOnvifTest test, MediaClient client, Profile profile)
        {
            LogTestEvent(test, string.Format("Restore profile '{0}' used for test{1}", profile.token, Environment.NewLine));

            Profile actual = GetProfile(test, client, profile.token, "Get actual profile");

            if (profile.VideoEncoderConfiguration == null)
            {
                if (actual.VideoEncoderConfiguration != null)
                {
                    RemoveVideoEncoderConfiguration(test, client, profile.token);
                }
            }

            if (profile.AudioEncoderConfiguration == null)
            {
                if (actual.AudioEncoderConfiguration != null)
                {
                    RemoveAudioEncoderConfiguration(test, client, profile.token);
                }
            }

            if (profile.VideoSourceConfiguration != null)
            {
                if (actual.VideoSourceConfiguration == null ||
                    actual.VideoSourceConfiguration.token != profile.VideoSourceConfiguration.token)
                {
                    AddVideoSourceConfiguration(test, client, profile.token, profile.VideoSourceConfiguration.token);
                }
            }
            else
            {
                if (actual.VideoSourceConfiguration != null)
                {
                    RemoveVideoSourceConfiguration(test, client, profile.token);
                }
            }

            if (profile.AudioSourceConfiguration != null)
            {
                if (actual.AudioSourceConfiguration == null ||
                    actual.AudioSourceConfiguration.token != profile.AudioSourceConfiguration.token)
                {
                    AddAudioSourceConfiguration(test, client, profile.token, profile.AudioSourceConfiguration.token);
                }
            }
            else
            {
                if (actual.AudioSourceConfiguration != null)
                {
                    RemoveAudioSourceConfiguration(test, client, profile.token);
                }
            }

            if (profile.VideoEncoderConfiguration != null)
            {
                if (actual.VideoEncoderConfiguration == null ||
                    actual.VideoEncoderConfiguration.token != profile.VideoEncoderConfiguration.token)
                {
                    AddVideoEncoderConfiguration(test, client, profile.token, profile.VideoEncoderConfiguration.token);
                }
            }

            if (profile.AudioEncoderConfiguration != null)
            {
                if (actual.AudioEncoderConfiguration == null ||
                    actual.AudioEncoderConfiguration.token != profile.AudioEncoderConfiguration.token)
                {
                    AddAudioEncoderConfiguration(test, client, profile.token, profile.AudioEncoderConfiguration.token);
                }
            }
        }
Beispiel #28
0
 public static void DeleteReceiver(BaseOnvifTest test, ReceiverPortClient client, string receiverToken)
 {
     RunStep(test, () => client.DeleteReceiver(receiverToken),
             string.Format("Delete Receiver (token = '{0}')", receiverToken));
     DoRequestDelay(test);
 }
Beispiel #29
0
 public static void SetReceiverMode(BaseOnvifTest test, ReceiverPortClient client, string receiverToken, ReceiverMode mode)
 {
     RunStep(test, () => { client.SetReceiverMode(receiverToken, mode); },
             string.Format("Set Receiver Mode (receiverToken = '{0}') to '{1}'", receiverToken, mode));
     DoRequestDelay(test);
 }
Beispiel #30
0
        public static void InitServiceClient <ServicePortClient, ServicePort>(this ServiceHolder <ServicePortClient, ServicePort> s, IEnumerable <IChannelController> controllers, BaseOnvifTest test, bool includeAddressController = false)
            where ServicePort : class
            where ServicePortClient : ClientBase <ServicePort>, ServicePort
        {
            bool found = false;

            if (!s.HasAddress)
            {
                s.Retrieve(test.Features);
                test.RunStep(() =>
                {
                    if (!s.HasAddress)
                    {
                        throw new AssertException(string.Format("{0} service not found", s.ServiceName));
                    }
                    else
                    {
                        found = true;
                        test.LogStepEvent(s.Address);
                    }
                },
                             string.Format("Get {0} service address", s.ServiceName), OnvifFaults.NoSuchService, true, true);
                test.DoRequestDelay();
            }

            test.Assert(found,
                        string.Format("{0} service address not found", s.ServiceName),
                        string.Format("Check that the DUT returned {0} service address", s.ServiceName));

            if (found)
            {
                var controller = new EndpointController(new EndpointAddress(s.Address));

                var ctrls = new List <IChannelController>();
                ctrls.Add(controller);
                ctrls.AddRange(controllers);

                Binding binding = test.CreateBinding(includeAddressController, ctrls);

                s.CreateClient(binding, test.AttachSecurity, test.SetupChannel);
            }
        }