//#endif
        public void PTZConfigurationConfiguration()
        {
            Profile profile = null;

            RunTest <Profile>(
                new Backup <Profile>(() => { return(null); }),
                () =>
            {
                PTZConfiguration[] configurations = GetPTZConfigurations();
                PTZConfiguration config           = configurations[0];
                profile = CreateProfile("testprofilex", null);

                string reason;
                Assert(IsEmptyProfile(profile, out reason), reason, Resources.StepValidatingNewProfile_Title);

                AddPTZConfiguration(profile.token, config.token);

                RemovePTZConfiguration(profile.token);

                DeleteProfile(profile.token);
                profile = null;
            },
                (param) =>
            {
                if (profile != null)
                {
                    DeleteProfile(profile.token);
                }
            });
        }
        public void PtzSetConfiguration()
        {
            RunTest(() =>
            {
                PTZConfiguration[] configuarions = GetConfigurations();
                Assert((configuarions != null) && (configuarions.Length > 0), Resources.ErrorNoPTZConfig_Text, Resources.StepValidateGetConfigurations_Title);
                PTZConfiguration configuration = configuarions[0];
                string reason = null;
                Assert(ValidatePTZConfiguration(configuration, out reason), reason, Resources.StepValidatePTZConfig_Title);

                //according to Tests interpretation.xls 61
                PTZConfigurationOptions options = GetConfigurationOptions(configuration.token);

                Assert(ValidatePTZConfigurationOptions(options, configuration.NodeToken, out reason), reason, Resources.StepValidatePTZConfigOptions_Title);


                configuration.DefaultPTZTimeout = GetModifiedTimeout(configuration.DefaultPTZTimeout, options);

                SetConfiguration(configuration, false, string.Format("Default timeout = {0}", configuration.DefaultPTZTimeout));

                PTZConfiguration newConfig = GetConfiguration(configuration.token);

                Assert(
                    EqualConfigs(configuration, newConfig, out reason),
                    string.Format(Resources.PTZConfigsNotEqual_Format, reason),
                    Resources.StepValidateNewPTZConfig_Title);
            });
        }
Ejemplo n.º 3
0
        void InitData()
        {
            //InitDefaultPTZSpaces();

            //Nodes.Clear();
            Presets.Clear();
            model.presets.ForEach(x => { Presets.Add(x); });
            valuePresetName.CreateBinding(TextBox.TextProperty, this, x => x.PresetName, (m, v) => { m.PresetName = v; });
            valuePresetsList.ItemsSource = Presets;
            valuePresetsList.CreateBinding(ListBox.SelectedItemProperty, this, x => x.SelectedPreset, (m, v) => m.SelectedPreset = v);

            var node = model.node;

            if (node == null)
            {
                return;
            }
            var supportedPtzSpaces = node.supportedPTZSpaces;

            if (supportedPtzSpaces == null)
            {
                return;
            }
            ptzConfig = model.profile.ptzConfiguration;
            if (ptzConfig == null)
            {
                return;
            }
            ptzSpacesConfig.Setup(ptzConfig, supportedPtzSpaces);
        }
        public void PTZConfigurationConfiguration()
        {
            Profile deletedProfile  = null;
            Profile createdProfile  = null;
            Profile modifiedProfile = null;
            Profile profile         = null;

            RunTest <Profile>(
                new Backup <Profile>(() => { return(null); }),
                () =>
            {
                PTZConfiguration[] configurations = GetPTZConfigurations();
                PTZConfiguration config           = configurations[0];
                profile = CreateProfileByAnnex3("testprofileX", null, out deletedProfile, out createdProfile, out modifiedProfile);
                string reason;
                Assert(IsEmptyProfile(profile, out reason), reason, Resources.StepValidatingNewProfile_Title);

                AddPTZConfiguration(profile.token, config.token);

                RemovePTZConfiguration(profile.token);
            },
                (param) =>
            {
                RestoreProfileByAnnex3(deletedProfile, createdProfile, modifiedProfile);
            });
        }
        void CheckNodeAndConfiguration(PTZConfiguration configuration, PTZNode node)
        {
            bool          ok = true;
            StringBuilder sb = new StringBuilder();

            ok = CheckConfigurationAndSpaces(configuration, node.SupportedPTZSpaces, sb);

            Assert(ok, sb.ToStringTrimNewLine(), "Check that PTZ configuration are correct accordingly to PTZ node settings");
        }
Ejemplo n.º 6
0
        public override void SetConfiguration(PTZConfiguration PTZConfiguration, bool ForcePersistence)
        {
            TestSuitInit();
            int           timeOut;
            SoapException ex;

            StepType stepType = m_PTZServiceTest.SetConfigurationTest(out ex, out timeOut, PTZConfiguration, ForcePersistence);

            StepTypeProcessing(stepType, ex, timeOut);
        }
 public void PtzConfigurationOptions()
 {
     RunTest(() =>
     {
         PTZConfiguration[] configuarions = GetConfigurations();
         Assert((configuarions != null) && (configuarions.Length > 0), Resources.ErrorNoPTZConfig_Text, Resources.StepValidateGetConfigurations_Title);
         PTZConfiguration configuration  = configuarions[0];
         PTZConfigurationOptions options = GetConfigurationOptions(configuration.token);
         string reason = null;
         Assert(ValidatePTZConfigurationOptions(options, configuration.NodeToken, out reason), reason, Resources.StepValidatePTZConfigOptions_Title);
     });
 }
        public void PtzConfigurationConsistencyTest()
        {
            RunTest(() =>
            {
                PTZConfiguration[] configurations = GetConfigurations();
                Assert((configurations != null) && (configurations.Length > 0), Resources.ErrorNoPTZConfig_Text, Resources.StepValidateGetConfigurations_Title);

                foreach (PTZConfiguration configuration in configurations)
                {
                    PTZConfiguration config = GetConfiguration(configuration.token);
                    CompareConfigurations(configuration, config);
                }
            });
        }
Ejemplo n.º 9
0
        internal StepType GetConfigurationTest(out PTZConfiguration target, out SoapException ex, out int Timeout, string PTZConfigurationToken)
        {
            StepType res = StepType.None;

            Timeout = 0;
            ex      = null;
            target  = null;
            bool   passed     = true;
            string logMessage = "";

            string tmpCommandName   = "GetConfiguration";
            int    tmpCommandNumber = GetConfiguration;

            //Get step list for command
            XmlNodeList m_testList = m_TestCommon.GetStepsForCommand(ServiceName + "." + tmpCommandName);

            //TEMP: for backward compatibility
            if (m_testList.Count == 0)
            {
                m_testList = m_TestCommon.GetStepsForCommand(tmpCommandName);
            }

            if (m_testList.Count != 0)
            {
                //Get current step
                XmlNode test = m_testList[m_commandCount[tmpCommandNumber]];

                #region Analyze request

                //PTZConfigurationToken
                CommonCompare.StringCompare("RequestParameters/PTZConfigurationToken", "PTZConfigurationToken", PTZConfigurationToken, ref logMessage, ref passed, test);

                #endregion //Analyze request

                //Generate response
                object targetObj;
                res    = m_TestCommon.GenerateResponseStepTypeNotVoid(test, out targetObj, out ex, out Timeout, typeof(PTZConfiguration));
                target = (PTZConfiguration)targetObj;

                //Log message
                m_TestCommon.writeToLog(test, logMessage, passed);

                Increment(m_testList.Count, tmpCommandNumber);
            }
            else
            {
                throw new SoapException("NO " + ServiceName + "." + tmpCommandName + " COMMAND IN SCRIPT", SoapException.ServerFaultCode);
            }
            return(res);
        }
        void CheckOptionsAndConfiguration(PTZConfiguration configuration, PTZConfigurationOptions options)
        {
            bool          ok      = true;
            bool          warning = false;
            StringBuilder sb      = new StringBuilder();

            ok = CheckConfigurationAndSpaces(configuration, options.Spaces, sb);

            if (options.PTZTimeout != null && !string.IsNullOrEmpty(configuration.DefaultPTZTimeout))
            {
                double minTimeout = options.PTZTimeout.Min.DurationToSeconds();
                double maxTimeout = options.PTZTimeout.Max.DurationToSeconds();
                double timeout    = configuration.DefaultPTZTimeout.DurationToSeconds();

                if (double.IsNaN(minTimeout) || double.IsNaN(maxTimeout) || double.IsNaN(timeout))
                {
                    warning = true;
                    sb.AppendLine("WARNING: some of timeout values contain date part. Comparison will be omitted.");
                }
                else
                {
                    if (!(minTimeout <= timeout && maxTimeout >= timeout))
                    {
                        ok = false;
                        sb.AppendLine(string.Format("DefaultPTZTimeout ({0}) is out of range ([{1}, {2}])",
                                                    configuration.DefaultPTZTimeout, options.PTZTimeout.Min, options.PTZTimeout.Max));
                    }
                }
            }

            BeginStep("Check that PTZ configuration and configuration options are consistent");
            if (!ok)
            {
                throw new AssertException(sb.ToStringTrimNewLine());
            }
            else
            {
                if (warning)
                {
                    LogStepEvent(sb.ToStringTrimNewLine());
                }
            }
            StepPassed();
        }
Ejemplo n.º 11
0
            public void Setup(PTZConfiguration config, PTZSpaces spaces)
            {
                absPanTiltPosition = GetDefaultSpace(
                    spaces.absolutePanTiltPositionSpace, s => s.uri,
                    config.defaultAbsolutePantTiltPositionSpace
                    );

                absZoomPosition = GetDefaultSpace(
                    spaces.absoluteZoomPositionSpace, s => s.uri,
                    config.defaultAbsoluteZoomPositionSpace
                    );

                relPanTiltTranslation = GetDefaultSpace(
                    spaces.relativePanTiltTranslationSpace, s => s.uri,
                    config.defaultRelativePanTiltTranslationSpace
                    );

                relZoomTranslation = GetDefaultSpace(
                    spaces.relativeZoomTranslationSpace, s => s.uri,
                    config.defaultRelativeZoomTranslationSpace
                    );

                contPanTiltVelocity = GetDefaultSpace(
                    spaces.continuousPanTiltVelocitySpace, s => s.uri,
                    config.defaultContinuousPanTiltVelocitySpace
                    );

                contZoomVelocity = GetDefaultSpace(
                    spaces.continuousZoomVelocitySpace, s => s.uri,
                    config.defaultContinuousZoomVelocitySpace
                    );

                absRelPanTiltSpeed = GetDefaultSpace(
                    spaces.panTiltSpeedSpace, s => s.uri,
                    config.IfNotNull(c => c.defaultPTZSpeed.IfNotNull(s => s.panTilt.IfNotNull(v => v.space)))
                    );

                absRelZoomSpeed = GetDefaultSpace(
                    spaces.zoomSpeedSpace, s => s.uri,
                    config.IfNotNull(c => c.defaultPTZSpeed.IfNotNull(s => s.zoom.IfNotNull(v => v.space)))
                    );
            }
            public static Model Create(
                VideoEncoderConfiguration videoEncCfg,
                AudioEncoderConfiguration audioEncCfg,
                VideoAnalyticsConfiguration analyticsCfg,
                PTZConfiguration ptzCfg,
                MetadataConfiguration metaCfg,
                bool isVideoEncCfgEnabled,
                bool isAudioEncCfgEnabled,
                bool isAnalyticsCfgEnabled,
                bool isPtzCfgEnabled,
                bool isMetaCfgEnabled,
                VideoEncoderConfiguration[] videoEncCfgs,
                AudioEncoderConfiguration[] audioEncCfgs,
                PTZConfiguration[] ptzCfgs,
                VideoAnalyticsConfiguration[] analyticsCfgs,
                MetadataConfiguration[] metaCfgs
                )
            {
                var _this = new Model();

                _this.videoEncCfgs                 = videoEncCfgs;
                _this.audioEncCfgs                 = audioEncCfgs;
                _this.ptzCfgs                      = ptzCfgs;
                _this.analyticsCfgs                = analyticsCfgs;
                _this.metaCfgs                     = metaCfgs;
                _this.origin.videoEncCfg           = videoEncCfg;
                _this.origin.audioEncCfg           = audioEncCfg;
                _this.origin.analyticsCfg          = analyticsCfg;
                _this.origin.ptzCfg                = ptzCfg;
                _this.origin.metaCfg               = metaCfg;
                _this.origin.isVideoEncCfgEnabled  = isVideoEncCfgEnabled;
                _this.origin.isAudioEncCfgEnabled  = isAudioEncCfgEnabled;
                _this.origin.isAnalyticsCfgEnabled = isAnalyticsCfgEnabled;
                _this.origin.isPtzCfgEnabled       = isPtzCfgEnabled;
                _this.origin.isMetaCfgEnabled      = isMetaCfgEnabled;
                _this.RevertChanges();

                return(_this);
            }
        public void PtzConfiguration()
        {
            RunTest(() =>
            {
                PTZConfiguration[] configuarions = GetConfigurations();
                Assert((configuarions != null) && (configuarions.Length > 0), Resources.ErrorNoPTZConfig_Text, Resources.StepValidateGetConfigurations_Title);

                string token = configuarions[0].token;
                if (!string.IsNullOrEmpty(_ptzNodeToken))
                {
                    PTZConfiguration config = configuarions.FirstOrDefault((c) => c.NodeToken == _ptzNodeToken);
                    Assert(config != null, string.Format("No PTZ configuration for node [token={0}]", _ptzNodeToken));
                    token = config.token;
                }
                PTZConfiguration configuration = GetConfiguration(token);
                string reason = null;

                Assert(
                    (configuration.token == token) && ValidatePTZConfiguration(configuration, out reason),
                    configuration.token != token ? string.Format("PTZ configuration has invalid token. Expected: {0} - actual: {1}", token, configuration.token) : reason,
                    Resources.StepValidatePTZConfig_Title);
            });
        }
Ejemplo n.º 14
0
 public OnvifPtzSetConfiguration(string uri, string userName, string password, PTZConfiguration config, bool forcePersistance)
     : base(uri, userName, password)
 {
     Config           = config;
     ForcePersistance = forcePersistance;
 }
        void CompareConfigurations(PTZConfiguration configuration1, PTZConfiguration configuration2)
        {
            bool          ok = true;
            bool          currentOk;
            StringBuilder sb = new StringBuilder();

            //Name
            if (configuration1.Name != configuration2.Name)
            {
                ok = false;
                sb.AppendLine("'Name' properties are different");
            }

            //Name
            if (configuration1.token != configuration2.token)
            {
                ok = false;
                sb.AppendLine("'token' properties are different");
            }

            //UseCount
            if (configuration1.UseCount != configuration2.UseCount)
            {
                ok = false;
                sb.AppendLine("'UseCount' properties are different");
            }

            //DefaultAbsolutePantTiltPositionSpace
            currentOk = StringsAreEqual(configuration1.DefaultAbsolutePantTiltPositionSpace,
                                        configuration2.DefaultAbsolutePantTiltPositionSpace,
                                        "DefaultAbsolutePantTiltPositionSpace", sb);
            ok = ok && currentOk;

            //DefaultAbsoluteZoomPositionSpace
            currentOk = StringsAreEqual(configuration1.DefaultAbsoluteZoomPositionSpace,
                                        configuration2.DefaultAbsoluteZoomPositionSpace,
                                        "DefaultAbsoluteZoomPositionSpace", sb);
            ok = ok && currentOk;

            //DefaultContinuousPanTiltVelocitySpace
            currentOk = StringsAreEqual(configuration1.DefaultContinuousPanTiltVelocitySpace,
                                        configuration2.DefaultContinuousPanTiltVelocitySpace,
                                        "DefaultContinuousPanTiltVelocitySpace", sb);
            ok = ok && currentOk;


            //DefaultContinuousZoomVelocitySpace
            currentOk = StringsAreEqual(configuration1.DefaultContinuousZoomVelocitySpace,
                                        configuration2.DefaultContinuousZoomVelocitySpace,
                                        "DefaultContinuousZoomVelocitySpace", sb);
            ok = ok && currentOk;


            //DefaultPTZSpeed
            if (configuration1.DefaultPTZSpeed != null && configuration2.DefaultPTZSpeed != null)
            {
                PTZSpeed speed1 = configuration1.DefaultPTZSpeed;
                PTZSpeed speed2 = configuration2.DefaultPTZSpeed;

                if (speed1.PanTilt != null && speed2.PanTilt != null)
                {
                    if (!(speed1.PanTilt.space == speed2.PanTilt.space && speed1.PanTilt.x == speed2.PanTilt.x && speed1.PanTilt.y == speed2.PanTilt.y))
                    {
                        ok = false;
                        sb.AppendLine("PanTilt settings in DefaultPTZSpeed are different");
                    }
                }
                else if (!(speed1.PanTilt == null && speed2.PanTilt == null))
                {
                    ok = false;
                    sb.AppendLine("PanTilt settings in DefaultPTZSpeed are defined for only one configuration");
                }

                if (speed1.Zoom != null && speed2.Zoom != null)
                {
                    if (!(speed1.Zoom.space == speed2.Zoom.space && speed1.Zoom.x == speed2.Zoom.x))
                    {
                        ok = false;
                        sb.AppendLine("Zoom settings in DefaultPTZSpeed are different");
                    }
                }
                else if (!(speed1.Zoom == null && speed2.Zoom == null))
                {
                    ok = false;
                    sb.AppendLine("Zoom settings in DefaultPTZSpeed are defined for only one configuration");
                }
            }
            else
            {
                if (!(configuration1.DefaultPTZSpeed == null && configuration2.DefaultPTZSpeed == null))
                {
                    ok = false;
                    sb.AppendLine("DefaultPTZSpeed are defined for only one configuration");
                }
            }


            //DefaultPTZTimeout
            //currentOk = StringsAreEqual(configuration1.DefaultPTZTimeout,
            //     configuration2.DefaultPTZTimeout,
            //     "DefaultPTZTimeout", sb);
            //ok = ok && currentOk;

            //DefaultRelativePanTiltTranslationSpace
            currentOk = StringsAreEqual(configuration1.DefaultRelativePanTiltTranslationSpace,
                                        configuration2.DefaultRelativePanTiltTranslationSpace,
                                        "DefaultRelativePanTiltTranslationSpace", sb);
            ok = ok && currentOk;

            //DefaultRelativeZoomTranslationSpace
            currentOk = StringsAreEqual(configuration1.DefaultRelativeZoomTranslationSpace,
                                        configuration2.DefaultRelativeZoomTranslationSpace,
                                        "DefaultRelativeZoomTranslationSpace", sb);
            ok = ok && currentOk;

            //NodeToken
            if (configuration1.NodeToken != configuration2.NodeToken)
            {
                ok = false;
                sb.AppendLine("'NodeToken' properties are different");
            }

            //PanTiltLimits
            if (configuration1.PanTiltLimits != null && configuration2.PanTiltLimits != null)
            {
                Space2DDescription range1 = configuration1.PanTiltLimits.Range;
                Space2DDescription range2 = configuration2.PanTiltLimits.Range;

                if (range1 != null && range2 != null)
                {
                    if (range1.URI != range2.URI)
                    {
                        ok = false;
                        sb.AppendLine("URI in 'PanTiltLimits' ranges are different");
                    }

                    FloatRange r1 = range1.XRange;
                    FloatRange r2 = range2.XRange;

                    if (r1 != null && r2 != null)
                    {
                        if (r1.Max != r2.Max || r1.Min != r2.Min)
                        {
                            ok = false;
                            sb.AppendLine("XRange in PanTiltLimits range are different");
                        }
                    }
                    else
                    {
                        if (!(r1 == null && r2 == null))
                        {
                            ok = false;
                            sb.AppendLine("XRange in PanTiltLimits range is defined for only one configuration");
                        }
                    }

                    r1 = range1.YRange;
                    r2 = range2.YRange;

                    if (r1 != null && r2 != null)
                    {
                        if (r1.Max != r2.Max || r1.Min != r2.Min)
                        {
                            ok = false;
                            sb.AppendLine("YRange in PanTiltLimits range are different");
                        }
                    }
                    else
                    {
                        if (!(r1 == null && r2 == null))
                        {
                            ok = false;
                            sb.AppendLine("YRange in PanTiltLimits range is defined for only one configuration");
                        }
                    }
                }
                else
                {
                    ok = false;
                    sb.AppendLine("'PanTiltLimits' range is defined for only one configuration");
                }
            }
            else
            {
                if (!(configuration1.PanTiltLimits == null && configuration2.PanTiltLimits == null))
                {
                    ok = false;
                    sb.AppendLine("PanTiltLimits are defined for only one configuration");
                }
            }


            //ZoomLimits
            if (configuration1.ZoomLimits != null && configuration2.ZoomLimits != null)
            {
                Space1DDescription range1 = configuration1.ZoomLimits.Range;
                Space1DDescription range2 = configuration2.ZoomLimits.Range;

                if (range1 != null && range2 != null)
                {
                    if (range1.URI != range2.URI)
                    {
                        ok = false;
                        sb.AppendLine("URI in ZoomLimits ranges are different");
                    }

                    FloatRange r1 = range1.XRange;
                    FloatRange r2 = range2.XRange;

                    if (r1 != null && r2 != null)
                    {
                        if (r1.Max != r2.Max || r1.Min != r2.Min)
                        {
                            ok = false;
                            sb.AppendLine("XRange in ZoomLimits range are different");
                        }
                    }
                    else
                    {
                        if (!(r1 == null && r2 == null))
                        {
                            ok = false;
                            sb.AppendLine("XRange in ZoomLimits range is defined for only one configuration");
                        }
                    }
                }
                else
                {
                    ok = false;
                    sb.AppendLine("'ZoomLimits' range is defined for only one configuration");
                }
            }
            else
            {
                if (!(configuration1.ZoomLimits == null && configuration2.ZoomLimits == null))
                {
                    ok = false;
                    sb.AppendLine("ZoomLimits are defined for only one configuration");
                }
            }

            Assert(ok, sb.ToStringTrimNewLine(), "Check that configurations are the same");
        }
Ejemplo n.º 16
0
 public OnvifLoadPtzNode(string uri, string userName, string password, PTZConfiguration config)
     : base(uri, userName, password)
 {
     Config = config;
 }
        bool CheckConfigurationAndSpaces(PTZConfiguration configuration, PTZSpaces spaces, StringBuilder sb)
        {
            bool ok = true;

            if (!string.IsNullOrEmpty(configuration.DefaultAbsolutePantTiltPositionSpace))
            {
                bool supported = true;
                if (spaces.AbsolutePanTiltPositionSpace == null)
                {
                    supported = false;
                }
                else
                {
                    //DefaultAbsolutePanTiltPositionSpace from PTZConfiguration is not included in one of SupportedPTZSpaces.AbsolutePanTiltPositionSpace from GetNodesResponse.
                    if (spaces.AbsolutePanTiltPositionSpace.Where(
                            S => S.URI == configuration.DefaultAbsolutePantTiltPositionSpace).FirstOrDefault() == null)
                    {
                        supported = false;
                    }
                }

                if (!supported)
                {
                    ok = false;
                    sb.AppendLine(
                        string.Format("PanTiltPositionSpace with URI = '{0}' not found in SupportedPTZSpaces",
                                      configuration.DefaultAbsolutePantTiltPositionSpace));
                }
            }

            //	DefaultAbsoluteZoomPositionSpace from PTZConfiguration is not included in one of SupportedPTZSpaces.AbsoluteZoomPositionSpace from GetNodesResponse.
            if (!string.IsNullOrEmpty(configuration.DefaultAbsoluteZoomPositionSpace))
            {
                bool supported = true;
                if (spaces.AbsoluteZoomPositionSpace == null)
                {
                    supported = false;
                }
                else
                {
                    if (spaces.AbsoluteZoomPositionSpace.Where(
                            S => S.URI == configuration.DefaultAbsoluteZoomPositionSpace).FirstOrDefault() == null)
                    {
                        supported = false;
                    }
                }

                if (!supported)
                {
                    ok = false;
                    sb.AppendLine(
                        string.Format("AbsoluteZoomPositionSpace with URI = '{0}' not found in SupportedPTZSpaces",
                                      configuration.DefaultAbsoluteZoomPositionSpace));
                }
            }

            //	DefaultRelativePanTiltTranslationSpace from PTZConfiguration is not included in one of SupportedPTZSpaces.RelativePanTiltTranslationSpace from GetNodesResponse.
            if (!string.IsNullOrEmpty(configuration.DefaultRelativePanTiltTranslationSpace))
            {
                bool supported = true;
                if (spaces.RelativePanTiltTranslationSpace == null)
                {
                    supported = false;
                }
                else
                {
                    if (spaces.RelativePanTiltTranslationSpace.Where(
                            S => S.URI == configuration.DefaultRelativePanTiltTranslationSpace).FirstOrDefault() == null)
                    {
                        supported = false;
                    }
                }

                if (!supported)
                {
                    ok = false;
                    sb.AppendLine(
                        string.Format("RelativePanTiltTranslationSpace with URI = '{0}' not found in SupportedPTZSpaces",
                                      configuration.DefaultRelativePanTiltTranslationSpace));
                }
            }

            //	DefaultRelativeZoomTranslationSpace from PTZConfiguration is not included in one of SupportedPTZSpaces.RelativeZoomTranslationSpace from GetNodesResponse.
            if (!string.IsNullOrEmpty(configuration.DefaultRelativeZoomTranslationSpace))
            {
                bool supported = true;
                if (spaces.RelativeZoomTranslationSpace == null)
                {
                    supported = false;
                }
                else
                {
                    if (spaces.RelativeZoomTranslationSpace.Where(
                            S => S.URI == configuration.DefaultRelativeZoomTranslationSpace).FirstOrDefault() == null)
                    {
                        supported = false;
                    }
                }

                if (!supported)
                {
                    ok = false;
                    sb.AppendLine(
                        string.Format("RelativeZoomTranslationSpace with URI = '{0}' not found in SupportedPTZSpaces",
                                      configuration.DefaultRelativeZoomTranslationSpace));
                }
            }

            //	DefaultContinuousPanTiltVelocitySpace from PTZConfiguration is not included in one of SupportedPTZSpaces.ContinuousPanTiltVelocitySpacefrom GetNodesResponse.
            if (!string.IsNullOrEmpty(configuration.DefaultContinuousPanTiltVelocitySpace))
            {
                bool supported = true;
                if (spaces.ContinuousPanTiltVelocitySpace == null)
                {
                    supported = false;
                }
                else
                {
                    if (spaces.ContinuousPanTiltVelocitySpace.Where(
                            S => S.URI == configuration.DefaultContinuousPanTiltVelocitySpace).FirstOrDefault() == null)
                    {
                        supported = false;
                    }
                }

                if (!supported)
                {
                    ok = false;
                    sb.AppendLine(
                        string.Format("ContinuousPanTiltVelocitySpace with URI = '{0}' not found in SupportedPTZSpaces",
                                      configuration.DefaultContinuousPanTiltVelocitySpace));
                }
            }

            //	DefaultContinuousZoomVelocitySpace from PTZConfiguration is not included in one of SupportedPTZSpaces.ContinuousZoomVelocitySpace from GetNodesResponse.
            if (!string.IsNullOrEmpty(configuration.DefaultContinuousZoomVelocitySpace))
            {
                bool supported = true;
                if (spaces.ContinuousZoomVelocitySpace == null)
                {
                    supported = false;
                }
                else
                {
                    if (spaces.ContinuousZoomVelocitySpace.Where(
                            S => S.URI == configuration.DefaultContinuousZoomVelocitySpace).FirstOrDefault() == null)
                    {
                        supported = false;
                    }
                }

                if (!supported)
                {
                    ok = false;
                    sb.AppendLine(
                        string.Format("ContinuousZoomVelocitySpace with URI = '{0}' not found in SupportedPTZSpaces",
                                      configuration.DefaultContinuousZoomVelocitySpace));
                }
            }

            if (configuration.DefaultPTZSpeed != null)
            {
                if (configuration.DefaultPTZSpeed.PanTilt != null)
                {
                    bool supported = true;

                    //	DefaultPTZSpeed.PanTilt.space from PTZConfiguration is not included in one of PanTiltSpeedSpace.URI section from GetNodesResponse
                    Space1DDescription space = null;
                    if (spaces.PanTiltSpeedSpace == null)
                    {
                        supported = false;
                    }
                    else
                    {
                        space = spaces.PanTiltSpeedSpace.Where(
                            S => S.URI == configuration.DefaultPTZSpeed.PanTilt.space).FirstOrDefault();
                        if (space == null)
                        {
                            supported = false;
                        }
                    }
                    if (!supported)
                    {
                        ok = false;
                        sb.AppendLine(
                            string.Format(
                                "PanTiltSpeedSpace with URI = '{0}' not found in SupportedPTZSpaces",
                                configuration.DefaultPTZSpeed.PanTilt.space));
                    }

                    //	DefaultPTZSpeed.PanTilt.x is not between SupportedPTZSpaces.PanTiltSpeedSpace.XRange.Min and SupportedPTZSpaces.PanTiltSpeedSpace.XRange.Max for appropriate PanTiltSpeedSpace.URI from GetNodesResponse.
                    //	DefaultPTZSpeed.PanTilt.y is not between SupportedPTZSpaces.PanTiltSpeedSpace.YRange.Min and SupportedPTZSpaces.PanTiltSpeedSpace.YRange.Max for appropriate PanTiltSpeedSpace.URI from GetNodesResponse. (see Questions)
                    // see questions = PanTile.y not defined =(
                    if (space != null && space.XRange != null)
                    {
                        if (configuration.DefaultPTZSpeed.PanTilt.x < space.XRange.Min ||
                            configuration.DefaultPTZSpeed.PanTilt.x > space.XRange.Max)
                        {
                            ok = false;
                            sb.AppendLine(string.Format("DefaultPTZSpeed.PanTilt.x ({0}) is out of range ([{1},{2}])",
                                                        configuration.DefaultPTZSpeed.PanTilt.x, space.XRange.Min, space.XRange.Max));
                        }

                        if (configuration.DefaultPTZSpeed.PanTilt.y < space.XRange.Min ||
                            configuration.DefaultPTZSpeed.PanTilt.y > space.XRange.Max)
                        {
                            ok = false;
                            sb.AppendLine(string.Format("DefaultPTZSpeed.PanTilt.y ({0}) is out of range ([{1},{2}])",
                                                        configuration.DefaultPTZSpeed.PanTilt.y, space.XRange.Min, space.XRange.Max));
                        }
                    }
                }

                if (configuration.DefaultPTZSpeed.Zoom != null)
                {
                    bool supported = true;

                    //	DefaultPTZSpeed.Zoom.Space is not included in one of ZoomSpeedSpace.URI section of GetNodesResponse
                    Space1DDescription space = null;
                    if (spaces.ZoomSpeedSpace == null)
                    {
                        supported = false;
                    }
                    else
                    {
                        space = spaces.ZoomSpeedSpace.Where(
                            S => S.URI == configuration.DefaultPTZSpeed.Zoom.space).FirstOrDefault();
                        if (space == null)
                        {
                            supported = false;
                        }
                    }
                    if (!supported)
                    {
                        ok = false;
                        sb.AppendLine(
                            string.Format(
                                "PanTiltZoomSpace with URI = '{0}' not found in SupportedPTZSpaces",
                                configuration.DefaultPTZSpeed.Zoom.space));
                    }

                    //	DefaultPTZSpeed.Zoom.x is not between SupportedPTZSpaces.ZoomSpeedSpace.XRange.Min and SupportedPTZSpaces.ZoomSpeedSpace.XRange.Max for appropriate ZoomSpeedSpace.URI from GetNodesResponse.
                    if (space != null && space.XRange != null)
                    {
                        if (configuration.DefaultPTZSpeed.Zoom.x < space.XRange.Min ||
                            configuration.DefaultPTZSpeed.Zoom.x > space.XRange.Max)
                        {
                            ok = false;
                            sb.AppendLine(string.Format("DefaultPTZSpeed.Zoom.x ({0}) is out of range ([{1}, {2}])",
                                                        configuration.DefaultPTZSpeed.Zoom.x, space.XRange.Min, space.XRange.Max));
                        }
                    }
                }
            }

            return(ok);
        }
Ejemplo n.º 18
0
 public Task SetConfigurationAsync(PTZConfiguration PTZConfiguration,
                                   bool ForcePersistence)
 {
     return(base.Channel.SetConfigurationAsync(PTZConfiguration, ForcePersistence));
 }
Ejemplo n.º 19
0
        internal StepType SetConfigurationTest(out SoapException ex, out int Timeout, PTZConfiguration PTZConfiguration, bool ForcePersistence)
        {
            StepType res = StepType.None;

            Timeout = 0;
            ex      = null;
            bool   passed     = true;
            string logMessage = "";

            string tmpCommandName   = "SetConfiguration";
            int    tmpCommandNumber = SetConfiguration;

            //Get step list for command
            XmlNodeList m_testList = m_TestCommon.GetStepsForCommand(ServiceName + "." + tmpCommandName);

            //TEMP: for backward compatibility
            if (m_testList.Count == 0)
            {
                m_testList = m_TestCommon.GetStepsForCommand(tmpCommandName);
            }

            if (m_testList.Count != 0)
            {
                //Get current step
                XmlNode test = m_testList[m_commandCount[tmpCommandNumber]];

                #region Analyze request

                //ForcePersistence
                CommonCompare.StringCompare("RequestParameters/ForcePersistence", "ForcePersistence", ForcePersistence.ToString(), ref logMessage, ref passed, test);

                //PTZConfiguration
                if (PTZConfiguration != null)
                {
                    //token
                    CommonCompare.StringCompare("RequestParameters/PTZConfiguration/@token", "token", PTZConfiguration.token, ref logMessage, ref passed, test);
                    //Name
                    CommonCompare.StringCompare("RequestParameters/PTZConfiguration/Name", "Name", PTZConfiguration.Name, ref logMessage, ref passed, test);
                    //NodeToken
                    CommonCompare.StringCompare("RequestParameters/PTZConfiguration/NodeToken", "NodeToken", PTZConfiguration.NodeToken, ref logMessage, ref passed, test);
                    //DefaultAbsolutePantTiltPositionSpace
                    CommonCompare.StringCompare("RequestParameters/PTZConfiguration/DefaultAbsolutePantTiltPositionSpace", "DefaultAbsolutePantTiltPositionSpace", PTZConfiguration.DefaultAbsolutePantTiltPositionSpace, ref logMessage, ref passed, test);
                    //DefaultAbsoluteZoomPositionSpace
                    CommonCompare.StringCompare("RequestParameters/PTZConfiguration/DefaultAbsoluteZoomPositionSpace", "DefaultAbsoluteZoomPositionSpace", PTZConfiguration.DefaultAbsoluteZoomPositionSpace, ref logMessage, ref passed, test);
                    //DefaultRelativePanTiltTranslationSpace
                    CommonCompare.StringCompare("RequestParameters/PTZConfiguration/DefaultRelativePanTiltTranslationSpace", "DefaultRelativePanTiltTranslationSpace", PTZConfiguration.DefaultRelativePanTiltTranslationSpace, ref logMessage, ref passed, test);
                    //DefaultRelativeZoomTranslationSpace
                    CommonCompare.StringCompare("RequestParameters/PTZConfiguration/DefaultRelativeZoomTranslationSpace", "DefaultRelativeZoomTranslationSpace", PTZConfiguration.DefaultRelativeZoomTranslationSpace, ref logMessage, ref passed, test);
                    //DefaultContinuousPanTiltVelocitySpace
                    CommonCompare.StringCompare("RequestParameters/PTZConfiguration/DefaultContinuousPanTiltVelocitySpace", "DefaultContinuousPanTiltVelocitySpace", PTZConfiguration.DefaultContinuousPanTiltVelocitySpace, ref logMessage, ref passed, test);
                    //DefaultContinuousZoomVelocitySpace
                    CommonCompare.StringCompare("RequestParameters/PTZConfiguration/DefaultContinuousZoomVelocitySpace", "DefaultContinuousZoomVelocitySpace", PTZConfiguration.DefaultContinuousZoomVelocitySpace, ref logMessage, ref passed, test);
                    //DefaultPTZTimeout
                    CommonCompare.StringCompare("RequestParameters/PTZConfiguration/DefaultPTZTimeout", "DefaultPTZTimeout", PTZConfiguration.DefaultPTZTimeout, ref logMessage, ref passed, test);
                    //PanTiltLimits
                    if (CommonCompare.Exist("RequestParameters/PTZConfiguration/PanTiltLimits", "PanTiltLimits", (object)(PTZConfiguration.PanTiltLimits), ref logMessage, ref passed, test))
                    {
                        //PTZConfiguration.PanTiltLimits.Range
                        if (CommonCompare.Exist("RequestParameters/PTZConfiguration/PanTiltLimits/Range", "PanTiltLimits.Range", (object)(PTZConfiguration.PanTiltLimits.Range), ref logMessage, ref passed, test))
                        {
                            //PTZConfiguration.PanTiltLimits.Range.URI
                            CommonCompare.StringCompare("RequestParameters/PTZConfiguration/PanTiltLimits/Range/URI", "PanTiltLimits.Range.URI", PTZConfiguration.PanTiltLimits.Range.URI, ref logMessage, ref passed, test);

                            //PTZConfiguration.PanTiltLimits.Range.XRange
                            if (CommonCompare.Exist("RequestParameters/PTZConfiguration/PanTiltLimits/Range/XRange", "PanTiltLimits.Range.XRange", (object)(PTZConfiguration.PanTiltLimits.Range.XRange), ref logMessage, ref passed, test))
                            {
                                //PTZConfiguration.PanTiltLimits.Range.XRange.Min
                                CommonCompare.FloatCompare("RequestParameters/PTZConfiguration/PanTiltLimits/Range/XRange/Min", "PanTiltLimits.Range.XRange.Min", PTZConfiguration.PanTiltLimits.Range.XRange.Min, ref logMessage, ref passed, test);

                                //PTZConfiguration.PanTiltLimits.Range.XRange.Max
                                CommonCompare.FloatCompare("RequestParameters/PTZConfiguration/PanTiltLimits/Range/XRange/Max", "PanTiltLimits.Range.XRange.Max", PTZConfiguration.PanTiltLimits.Range.XRange.Max, ref logMessage, ref passed, test);
                            }

                            //PTZConfiguration.PanTiltLimits.Range.YRange
                            if (CommonCompare.Exist("RequestParameters/PTZConfiguration/PanTiltLimits/Range/YRange", "PanTiltLimits.Range.YRange", (object)(PTZConfiguration.PanTiltLimits.Range.YRange), ref logMessage, ref passed, test))
                            {
                                //PTZConfiguration.PanTiltLimits.Range.YRange.Min
                                CommonCompare.FloatCompare("RequestParameters/PTZConfiguration/PanTiltLimits/Range/YRange/Min", "PanTiltLimits.Range.YRange.Min", PTZConfiguration.PanTiltLimits.Range.YRange.Min, ref logMessage, ref passed, test);

                                //PTZConfiguration.PanTiltLimits.Range.YRange.Max
                                CommonCompare.FloatCompare("RequestParameters/PTZConfiguration/PanTiltLimits/Range/YRange/Max", "PanTiltLimits.Range.YRange.Max", PTZConfiguration.PanTiltLimits.Range.YRange.Max, ref logMessage, ref passed, test);
                            }
                        }
                    }

                    //ZoomLimits
                    if (CommonCompare.Exist("RequestParameters/PTZConfiguration/ZoomLimits", "ZoomLimits", (object)(PTZConfiguration.ZoomLimits), ref logMessage, ref passed, test))
                    {
                        //PTZConfiguration.ZoomLimits.Range.URI
                        CommonCompare.StringCompare("RequestParameters/PTZConfiguration/ZoomLimits/Range/URI", "ZoomLimits.Range.URI", PTZConfiguration.ZoomLimits.Range.URI, ref logMessage, ref passed, test);

                        //PTZConfiguration.ZoomLimits.Range.XRange
                        if (CommonCompare.Exist("RequestParameters/PTZConfiguration/ZoomLimits/Range/XRange", "ZoomLimits.Range.XRange", (object)(PTZConfiguration.ZoomLimits.Range.XRange), ref logMessage, ref passed, test))
                        {
                            //PTZConfiguration.ZoomLimits.Range.XRange.Min
                            CommonCompare.FloatCompare("RequestParameters/PTZConfiguration/ZoomLimits/Range/XRange/Min", "ZoomLimits.Range.XRange.Min", PTZConfiguration.ZoomLimits.Range.XRange.Min, ref logMessage, ref passed, test);

                            //PTZConfiguration.ZoomLimits.Range.XRange.Max
                            CommonCompare.FloatCompare("RequestParameters/PTZConfiguration/ZoomLimits/Range/XRange/Max", "ZoomLimits.Range.XRange.Max", PTZConfiguration.ZoomLimits.Range.XRange.Max, ref logMessage, ref passed, test);
                        }
                    }

                    //DefaultPTZSpeed
                    if (CommonCompare.Exist("RequestParameters/PTZConfiguration/DefaultPTZSpeed", "DefaultPTZSpeed", (object)(PTZConfiguration.DefaultPTZSpeed), ref logMessage, ref passed, test))
                    {
                        //DefaultPTZSpeed.PanTilt
                        if (CommonCompare.Exist("RequestParameters/PTZConfiguration/DefaultPTZSpeed/PanTilt", "DefaultPTZSpeed.PanTilt", (object)(PTZConfiguration.DefaultPTZSpeed.PanTilt), ref logMessage, ref passed, test))
                        {
                            //DefaultPTZSpeed.PanTilt.space
                            CommonCompare.StringCompare("RequestParameters/PTZConfiguration/DefaultPTZSpeed/PanTilt/space", "DefaultPTZSpeed.PanTilt.space", PTZConfiguration.DefaultPTZSpeed.PanTilt.space, ref logMessage, ref passed, test);
                            //DefaultPTZSpeed.PanTilt.x
                            CommonCompare.FloatCompare("RequestParameters/PTZConfiguration/DefaultPTZSpeed/PanTilt/x", "DefaultPTZSpeed.PanTilt.x", PTZConfiguration.DefaultPTZSpeed.PanTilt.x, ref logMessage, ref passed, test);
                            //DefaultPTZSpeed.PanTilt.y
                            CommonCompare.FloatCompare("RequestParameters/PTZConfiguration/DefaultPTZSpeed/PanTilt/y", "DefaultPTZSpeed.PanTilt.y", PTZConfiguration.DefaultPTZSpeed.PanTilt.y, ref logMessage, ref passed, test);
                        }

                        //DefaultPTZSpeed.Zoom
                        if (CommonCompare.Exist("RequestParameters/PTZConfiguration/DefaultPTZSpeed/Zoom", "DefaultPTZSpeed.PanTilt", (object)(PTZConfiguration.DefaultPTZSpeed.PanTilt), ref logMessage, ref passed, test))
                        {
                            //DefaultPTZSpeed.Zoom.space
                            CommonCompare.StringCompare("RequestParameters/PTZConfiguration/DefaultPTZSpeed/Zoom/space", "DefaultPTZSpeed.Zoom.space", PTZConfiguration.DefaultPTZSpeed.Zoom.space, ref logMessage, ref passed, test);
                            //DefaultPTZSpeed.Zoom.x
                            CommonCompare.FloatCompare("RequestParameters/PTZConfiguration/DefaultPTZSpeed/Zoom/x", "DefaultPTZSpeed.Zoom.x", PTZConfiguration.DefaultPTZSpeed.Zoom.x, ref logMessage, ref passed, test);
                        }
                    }
                }
                else
                {
                    passed     = false;
                    logMessage = logMessage + "No  PTZConfiguration. ";
                }

                #endregion //Analyze request

                //Generate response
                res = m_TestCommon.GenerateResponseStepTypeVoid(test, out ex, out Timeout);

                //Log message
                m_TestCommon.writeToLog(test, logMessage, passed);

                Increment(m_testList.Count, tmpCommandNumber);
            }
            else
            {
                throw new SoapException("NO " + ServiceName + "." + tmpCommandName + " COMMAND IN SCRIPT", SoapException.ServerFaultCode);
            }
            return(res);
        }
Ejemplo n.º 20
0
 public System.Threading.Tasks.Task SetConfigurationAsync(PTZConfiguration PTZConfiguration, bool ForcePersistence)
 {
     return(base.Channel.SetConfigurationAsync(PTZConfiguration, ForcePersistence));
 }
Ejemplo n.º 21
0
 public Task SetConfigurationAsync(PTZConfiguration PTZConfiguration, bool ForcePersistence)
 {
     throw new NotImplementedException();
 }