internal StepType GetNodesTest(out PTZNode[] target, out System.Web.Services.Protocols.SoapException ex, out int Timeout) { StepType res = StepType.None; Timeout = 0; ex = null; target = null; bool passed = true; string logMessage = ""; string tmpCommandName = "GetNodes"; int tmpCommandNumber = GetNodes; //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]]; //Generate response object targetObj; res = m_TestCommon.GenerateResponseStepTypeNotVoid(test, out targetObj, out ex, out Timeout, typeof(PTZNode[])); target = (PTZNode[])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); }
internal StepType SMSRenewTest(out RenewResponse target, out SoapException ex, out int timeOut, Renew Renew1) { StepType res = StepType.None; target = new RenewResponse(); timeOut = 0; ex = null; bool passed = true; string logMessage = ""; //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand("SMSRenew"); if (m_testList != null) { //Get current step XmlNode test = m_testList[m_commandCount[SMSRenew]]; #region Analyze request //TerminationTime if (test.SelectNodes("RequestParameters/TerminationTime[@type=\"now+diff\"]").Count == 0) { CommonCompare.StringCompare("RequestParameters/TerminationTime", "TerminationTime", Renew1.TerminationTime, ref logMessage, ref passed, test); } else { CommonCompare.CompareRealTime("RequestParameters/TerminationTime", "TerminationTime", Renew1.TerminationTime, ref logMessage, ref passed, test); } #endregion //Analyze request //Generate response object targetObj; res = m_TestCommon.GenerateResponseStepTypeNotVoid(test, out targetObj, out ex, out timeOut, typeof(RenewResponse)); target = (RenewResponse)targetObj; #region Serialization Temp //Events.EndpointReferenceType dsr = new Events.EndpointReferenceType(); //dsr.Address = new Events.AttributedURIType(); //dsr.Address.Value = "http://192.168.10.203/onvif/event"; //dsr.Metadata = new Events.MetadataType(); //dsr.ReferenceParameters = new Events.ReferenceParametersType(); //XmlSerializer serializer1 = new XmlSerializer(typeof(Events.EndpointReferenceType)); //TextWriter textWriter = new StreamWriter("c:\\2.txt"); //serializer1.Serialize(textWriter, dsr); #endregion //Serialization Temp if (res == StepType.Normal) { //CurrentTime string CurrentTimeType = test.SelectSingleNode("ResponseParametersAdditional/CurrentTime/@type").InnerText; switch (CurrentTimeType) { case "now": { target.CurrentTime = System.DateTime.UtcNow; break; } case "value": { target.CurrentTime = Convert.ToDateTime(test.SelectSingleNode("ResponseParametersAdditional/CurrentTime").InnerText); break; } case "nowDiff": { int timeDiff = Convert.ToInt32(test.SelectSingleNode("ResponseParametersAdditional/CurrentTime").InnerText); target.CurrentTime = System.DateTime.UtcNow.AddSeconds(timeDiff); break; } case "none": { target.CurrentTimeSpecified = false; break; } } //TerminationTime if (test.SelectNodes("ResponseParametersAdditional/TerminationTime[@type=\"fromrequest\"]").Count != 0) { target.TerminationTime = Convert.ToDateTime(Renew1.TerminationTime); } else { if (test.SelectNodes("ResponseParametersAdditional/TerminationTime[@differance=\"true\"]").Count != 0) { int timeDiff = Convert.ToInt32(test.SelectSingleNode("ResponseParametersAdditional/TerminationTime").InnerText); target.TerminationTime = target.CurrentTime.AddSeconds(timeDiff); } else { target.TerminationTime = Convert.ToDateTime(test.SelectSingleNode("ResponseParametersAdditional/TerminationTime").InnerText); } } } m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, SMSRenew); } else { timeOut = 0; target = null; ex = null; res = StepType.None; } return(res); }