当前位置: 首页>>代码示例>>C#>>正文


C# UPnPDevice.GetServices方法代码示例

本文整理汇总了C#中OpenSource.UPnP.UPnPDevice.GetServices方法的典型用法代码示例。如果您正苦于以下问题:C# UPnPDevice.GetServices方法的具体用法?C# UPnPDevice.GetServices怎么用?C# UPnPDevice.GetServices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenSource.UPnP.UPnPDevice的用法示例。


在下文中一共展示了UPnPDevice.GetServices方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CpMediaServer

        /// <summary>
        /// Creates a programmer-friendly object for using a device
        /// that happens implement a MediaServer.
        /// </summary>
        /// <param name="device"></param>
        public CpMediaServer(UPnPDevice device)
        {
            UPnPService sCM = device.GetServices(CpConnectionManager.SERVICE_NAME)[0];
            UPnPService sCD = device.GetServices(CpContentDirectory.SERVICE_NAME)[0];

            CpConnectionManager cpCM = new CpConnectionManager(sCM);
            CpContentDirectory cpCD = new CpContentDirectory(sCD);

            UDN = device.UniqueDeviceName;

            if (
                (cpCD.HasAction_GetSearchCapabilities == false) ||
                (cpCD.HasAction_GetSortCapabilities == false) ||
                (cpCD.HasAction_GetSystemUpdateID == false) ||
                (cpCD.HasAction_Browse == false)
                )
            {
                throw new UPnPCustomException(0, "MediaServer does not implement minimum features.");
            }

            this.m_ConnectionManager = cpCM;
            this.m_ContentDirectory = cpCD;

            //create a virtualized root container with the desired settings
            m_Root = new CpRootContainer(this);
            m_Root.UDN = device.UniqueDeviceName;
        }
开发者ID:amadare,项目名称:DeveloperToolsForUPnP,代码行数:32,代码来源:CpMediaServer.cs

示例2: AddSink

        private static void AddSink(DimmableLightDiscovery sender, UPnPDevice d)
        {
            Console.WriteLine("Added Device: " + d.FriendlyName);

            // To interface with a service, instantiate the appropriate wrapper class on the appropriate service
            // Traverse the device heirarchy to the correct device, and invoke 'GetServices', passing in the static field 'SERVICE_NAME'
            // of the appropriate wrapper class. This method returns an array of all services with this service type. For most purposes,
            // there will only be one service, in which case you can use array index 0.
            // Save a reference to this instance of the wrapper class for later use.

            CpDimming Dimming = new CpDimming(d.GetServices(CpDimming.SERVICE_NAME)[0]);

            sw = new CpSwitchPower(d.GetServices(CpSwitchPower.SERVICE_NAME)[0]);

            // To subscribe to Events, call the '_subscribe' method of the wrapper class. The only parameter is
            // the duration of the event. A good value is 300 seconds.
            //Dimming._subscribe(300);

            // The wrapper class exposes all the evented state variables through events in the form 'OnStateVariable_xx', where xx is the variable name.

            // The wrapper class exposes methods in two formats. Asyncronous and Syncronous. The Async method calls are exposed simply
            // by the name of the method. The Syncronous version is the same, except with the word, 'Sync_' prepended to the name.
            // Asyncronous responses to th async method calls are dispatched through the event in the format, 'OnResult_x' where x is the method name.

            // Note: All arguments are automatically type checked. Allowed Values are abstracted through enumerations, that are defined in the wrapper class.
            // To access the list of allowed values or ranges for a given device, refer to the property 'Values_XXX' for a list of the allowed values for a
            // given state variable. Similarly, refer to the properties 'HasMaximum_XXX', 'HasMinimum_XXX', 'Maximum_XXX', and 'Minimum_XXX' where XXX is the variable name, for the Max/Min values.

            // To determine if a given service implements a particular StateVariable or Method, use the properties, 'HasStateVariableXXX' and 'HasActionXXX' where XXX is the method/variable name.
        }
开发者ID:GufCab,项目名称:Semester-Projekt---Test-Kode,代码行数:30,代码来源:Main.cs

示例3: AddSink

        /// <summary>
        /// Eventfunction that is run when an UPnP sink is detected on the network. Only accepts sinks with the friendly name: "HiPi - Sink". 
        /// If it has the right name then it creates three stacks (AVTransport, ConnectionManager and RenderingControl)
        /// </summary>
        /// <param name="sender">The object that send the event</param>
        /// <param name="d">The discovered sink device</param>
        private void AddSink(MediaRendererDiscovery sender, UPnPDevice d)
        {
            Console.WriteLine("Discovered Sink Device: " + d.FriendlyName);
            if (d.FriendlyName == "HiPi - Sink")
            {
                Console.WriteLine("Added Sink Device: " + d.FriendlyName);

                ISinkFunctions func = new UPnP_SinkFunctions(
                    new SinkStack.CpAVTransport(d.GetServices(SinkStack.CpAVTransport.SERVICE_NAME)[0]),
                    new SinkStack.CpConnectionManager(d.GetServices(SinkStack.CpConnectionManager.SERVICE_NAME)[0]),
                    new SinkStack.CpRenderingControl(d.GetServices(SinkStack.CpRenderingControl.SERVICE_NAME)[0]));

                AddSinkEvent(func, null);
            }
        }
开发者ID:GufCab,项目名称:Semester-Projekt---PC-Program,代码行数:21,代码来源:UPnP_Setup.cs

示例4: AddSink

        private void AddSink(MediaRendererDiscovery sender, UPnPDevice d)
        {
            MessageBox.Show("Sink detected: " + d.FriendlyName);

            try
            {
                _avTransport = new CpAVTransport(d.GetServices(CpAVTransport.SERVICE_NAME)[0]);

                _avTransport.OnStateVariable_LastChange += new CpAVTransport.StateVariableModifiedHandler_LastChange(Eventer);
            }
            catch (Exception m)
            {
                MessageBox.Show("Couldn't initialize AVTransport: " + m.Message);
            }

            try
            {
                _connectionManagerControl = new CpConnectionManager(d.GetServices(CpConnectionManager.SERVICE_NAME)[0]);
            }
            catch (Exception m)
            {
                MessageBox.Show("Couldn't initialize ConnectionManager: " + m.Message);
            }

            try
            {
                _renderingControl = new CpRenderingControl(d.GetServices(CpRenderingControl.SERVICE_NAME)[0]);
            }
            catch (Exception m)
            {
                MessageBox.Show("Couldn't initialize RenderingControl: " + m.Message);
            }

            //MessageBox.Show(d.DeviceURN);

            //RenderingControl._subscribe(300);
        }
开发者ID:GufCab,项目名称:Semester-Projekt---Test-Kode,代码行数:37,代码来源:MainWindow.xaml.cs

示例5: Temporary_AddServer

        /// <summary>
        /// When a MediaServer device is found, we add it to a temp list.
        /// Then we attempt to subscribe to its services.
        /// </summary>
        /// <param name="sender">the smart cp that found the device</param>
        /// <param name="device">the mediaserver device</param>
        private void Temporary_AddServer(UPnPSmartControlPoint sender, UPnPDevice device)
        {
            if (this.OnServerSeen != null)
            {
                this.OnServerSeen(this, device);
            }

            UPnPService sCD = device.GetServices(CpContentDirectory.SERVICE_NAME)[0];
            UPnPService sCM = device.GetServices(CpConnectionManager.SERVICE_NAME)[0];

            CpMediaServer newServer;
            try
            {
                newServer = new CpMediaServer(device);
            }
            catch (UPnPCustomException)
            {
                newServer = null;
            }

            if (newServer != null)
            {
                InitStatus status = new InitStatus();
                status.SubcribeCD = false;
                status.SubcribeCM = false;
                status.EventedCD = false;
                status.EventedCM = false;
                status.Server = newServer;

                lock (LockHashes)
                {
                    UdnToInitStatus[device.UniqueDeviceName] = status;
                }

                newServer.ConnectionManager.OnSubscribe += new CpConnectionManager.SubscribeHandler(this.Sink_OnCmServiceSubscribe);
                newServer.ContentDirectory.OnSubscribe += new CpContentDirectory.SubscribeHandler(this.Sink_OnCdServiceSubscribe);

                newServer.ConnectionManager.OnStateVariable_SourceProtocolInfo += new CpConnectionManager.StateVariableModifiedHandler_SourceProtocolInfo(this.Sink_OnCmEvented);
                newServer.ContentDirectory.OnStateVariable_SystemUpdateID += new CpContentDirectory.StateVariableModifiedHandler_SystemUpdateID(this.Sink_OnCdEvented);

                newServer.ConnectionManager._subscribe(600);
                newServer.ContentDirectory._subscribe(600);
            }
        }
开发者ID:amadare,项目名称:DeveloperToolsForUPnP,代码行数:50,代码来源:MediaServerDiscovery.cs

示例6: AddSource

        /// <summary>
        /// Eventfunction that is run when an UPnP source is detected on the network. Only accepts sources with the friendly name: "HiPi - Source". 
        /// If it has the right name then it creates one stacks (ContentDirectory)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="d"></param>
        private void AddSource(MediaServerDiscovery sender, UPnPDevice d)
        {
            Console.WriteLine("Added Source Device: " + d.FriendlyName);

            if (d.FriendlyName == "HiPi - Source")
            {
                UPnP_SourceFunctions func = new UPnP_SourceFunctions(null,
                    //new SourceStack.CpConnectionManager(d.GetServices(SourceStack.CpConnectionManager.SERVICE_NAME)[0]),
                    new SourceStack.CpContentDirectory(d.GetServices(SourceStack.CpContentDirectory.SERVICE_NAME)[0]));

                AddSourceEvent(func, null);
            }
        }
开发者ID:GufCab,项目名称:Semester-Projekt---Test-Kode,代码行数:19,代码来源:UPnP_Setup.cs

示例7: ConnectSink

        private void ConnectSink(UPnPDeviceFactory sender, UPnPDevice d, Uri ConnectUri)
        {
            string useIP = d.InterfaceToHost.ToString();
            disconnectMenuItem.Enabled = false;
            CheckIconState();

            if(this.overrideIP!="") {useIP = this.overrideIP;}

            statusBar.Text = "Connected to Peer Relay";
            devicefactory = null;
            home = new CpGateKeeper(d.GetServices(CpGateKeeper.SERVICE_NAME)[0]);
            home.Register(new Uri("http://" + useIP + ":" + this.PortNumber.ToString()),true);
        }
开发者ID:amadare,项目名称:DeveloperToolsForUPnP,代码行数:13,代码来源:MainForm.cs

示例8: ProxySink_NoReverse

        private void ProxySink_NoReverse(UPnPDeviceFactory sender, UPnPDevice d, Uri LocationUri)
        {
            FactoryTable.Remove(sender);
            sender.Shutdown();
            CpGateKeeper CP = new CpGateKeeper(d.GetServices(CpGateKeeper.SERVICE_NAME)[0]);
            lock(RegisteredTable)
            {
                RegisteredTable[CP.GetUPnPService().ParentDevice.UniqueDeviceName] = CP;
                object[] PL = (object[])ProcessLaterList.ToArray(typeof(object));
                foreach(object PL2 in PL)
                {
                    object[] PL3 = (object[])PL2;
                    string SenderUDN = (string)PL3[0];
                    string DeviceUDN = (string)PL3[1];

                    if(RegisteredTable.ContainsKey(SenderUDN))
                    {
                        CpGateKeeper HOME = (CpGateKeeper)RegisteredTable[SenderUDN];
                        HOME.GetDocument(DeviceUDN,"",null,new CpGateKeeper.Delegate_OnResult_GetDocument(CPGetDocumentSink));
                        ProcessLaterList.Remove(PL2);
                    }
                }
            }
            foreach(UPnPDevice t in ShareList)
            {
                CP.AddDevice(Root.UniqueDeviceName,t.UniqueDeviceName);
            }
        }
开发者ID:amadare,项目名称:DeveloperToolsForUPnP,代码行数:28,代码来源:Gatekeeper.cs

示例9: ProxySink

        private void ProxySink(UPnPDeviceFactory sender, UPnPDevice d, Uri LocationUri)
        {
            FactoryTable.Remove(sender);
            sender.Shutdown();
            CpGateKeeper CP = new CpGateKeeper(d.GetServices(CpGateKeeper.SERVICE_NAME)[0]);
            string useThisIP = d.InterfaceToHost.ToString();

            if(this.PublicIP!="") {useThisIP = PublicIP;}

            lock(RegisteredTable)
            {
                RegisteredTable[CP.GetUPnPService().ParentDevice.UniqueDeviceName] = CP;
                object[] PL = (object[])ProcessLaterList.ToArray(typeof(object));
                foreach(object PL2 in PL)
                {
                    object[] PL3 = (object[])PL2;
                    string SenderUDN = (string)PL3[0];
                    string DeviceUDN = (string)PL3[1];

                    if(RegisteredTable.ContainsKey(SenderUDN))
                    {
                        CpGateKeeper HOME = (CpGateKeeper)RegisteredTable[SenderUDN];
                        HOME.GetDocument(DeviceUDN,"",null,new CpGateKeeper.Delegate_OnResult_GetDocument(CPGetDocumentSink));
                        ProcessLaterList.Remove(PL2);
                    }
                }
            }
            foreach(UPnPDevice t in ShareList)
            {
                CP.AddDevice(Root.UniqueDeviceName,t.UniqueDeviceName);
            }

            CP.Register(new Uri("http://" + useThisIP + ":" + Port.ToString()),false);
        }
开发者ID:amadare,项目名称:DeveloperToolsForUPnP,代码行数:34,代码来源:Gatekeeper.cs

示例10: AVRenderer

		/// <summary>
		/// This constructor is called with the UPnPDevice that contains the services of a MediaRenderer device.
		/// </summary>
		/// <param name="device">The UPnPDevice</param>
		public AVRenderer(UPnPDevice device)
		{
			OpenSource.Utilities.InstanceTracker.Add(this);
			this.ConnectionMonitor.OnExpired += new LifeTimeMonitor.LifeTimeHandler(ConnectionMonitorSink);

			MainDevice = device;
			ConnectionManager = new CpConnectionManager(device.GetServices(CpConnectionManager.SERVICE_NAME)[0]);
			ConnectionManager.OnStateVariable_CurrentConnectionIDs += new CpConnectionManager.StateVariableModifiedHandler_CurrentConnectionIDs(ConnectionIDEventSink);
			ConnectionManager._subscribe(90);
            //TODO: Fails to compile after using generated code from DeviceBuilderV23. Seems like CpConnectionManager.PeriodicRenewFailedHandler is no longer defined?
			//ConnectionManager.OnPeriodicRenewFailed += new CpConnectionManager.PeriodicRenewFailedHandler(PeriodicRenewFailedSink);

			// Grab initial state of the ConnectionManager Service
			if(ConnectionManager.HasAction_GetProtocolInfo)
			{
				ConnectionManager.GetProtocolInfo(null,new CpConnectionManager.Delegate_OnResult_GetProtocolInfo(GetProtocolInfoSink));
			}
			if(ConnectionManager.HasAction_GetCurrentConnectionIDs) 
			{
				ConnectionManager.GetCurrentConnectionIDs(null,new CpConnectionManager.Delegate_OnResult_GetCurrentConnectionIDs(IDSink));
			}
			if(ConnectionManager.HasAction_PrepareForConnection==false)
			{
				lock(InstanceList)
				{
					AVConnection ac = new AVConnection(MainDevice,0,0,0,new AVConnection.OnReadyHandler(ReadySink), null);
					ac._Parent = this;
					DontEverDelete = true;
					if(InstanceList.Count==0) InstanceList.Add(ac);
				}
				/*  Wait for Ready
				if(InstanceList.Count>0)
				{
					if(OnCreateConnection!=null) OnCreateConnection(this,(AVConnection)InstanceList[0],Guid.NewGuid().GetHashCode());
				}
				*/
			}
		}
开发者ID:Scannow,项目名称:SWYH,代码行数:42,代码来源:AVRenderer.cs

示例11: AVConnection

		/// <summary>
		/// This construct is only called by the AVRenderer object.
		/// </summary>
		/// <param name="device"></param>
		/// <param name="AVTransportID"></param>
		/// <param name="RenderingControlID"></param>
		/// <param name="ConnectionID"></param>
		/// <param name="ReadyCallback"></param>
		/// <param name="StateObject"></param>
		internal AVConnection(UPnPDevice device, int AVTransportID, int RenderingControlID, Int32 ConnectionID, AVConnection.OnReadyHandler ReadyCallback, object StateObject)
		{
			OpenSource.Utilities.InstanceTracker.Add(this);
			this.Tag = StateObject;
			this.OnReady += ReadyCallback;

			FriendlyName = device.FriendlyName;
			Identifier = device.UniqueDeviceName + ":" + ConnectionID.ToString();
			AVTid = AVTransportID;
			RCid = RenderingControlID;
			CMid = ConnectionID;

			AVTransport = new CpAVTransport(device.GetServices(CpAVTransport.SERVICE_NAME)[0]);
			RenderingControl = new CpRenderingControl(device.GetServices(CpRenderingControl.SERVICE_NAME)[0]);
			ConnectionManager = new CpConnectionManager(device.GetServices(CpConnectionManager.SERVICE_NAME)[0]);

			if(RenderingControl.HasStateVariable_Volume)
			{
				// If the renderer has defined ranges, use those
				if(RenderingControl.HasMaximum_Volume)
				{
					MaxVolume = (UInt16)RenderingControl.Maximum_Volume;
				}
				else
				{
					MaxVolume = UInt16.MaxValue;
				}

				if(RenderingControl.HasMinimum_Volume)
				{
					MinVolume = (UInt16)RenderingControl.Minimum_Volume;
				}
				else
				{
					MinVolume = UInt16.MinValue;
				}
			}
			
			lock(this)
			{
				if(AVTransport.HasStateVariable_LastChange)
				{
					// Hook up to the LastChange event of AVTransport
					++this.StateCounter;
					AV_LastChange = new AVTransportLastChange(AVTransport,device.UniqueDeviceName, AVTid, new AVTransportLastChange.ReadyHandler(AVTLC));
					AV_LastChange.OnCurrentPositionChanged += new AVTransportLastChange.VariableChangeHandler(PositionSink);
					AV_LastChange.OnPlayStateChanged += new AVTransportLastChange.VariableChangeHandler(PlayStateSink);
					AV_LastChange.OnAVTransportURIChanged += new AVTransportLastChange.VariableChangeHandler(AVTransportURISink);
					AV_LastChange.OnCurrentTrackChanged += new AVTransportLastChange.VariableChangeHandler(TrackChangedSink);
					AV_LastChange.OnNumberOfTracksChanged += new AVTransportLastChange.VariableChangeHandler(NumberOfTracksChangedSink);
					AV_LastChange.OnTrackURIChanged += new AVTransportLastChange.VariableChangeHandler(TrackURIChangedSink);
					AV_LastChange.OnCurrentURIMetaDataChanged += new AVTransportLastChange.VariableChangeHandler(URIMetaDataChangedSink);
					AV_LastChange.OnCurrentPlayModeChanged += new AVTransportLastChange.VariableChangeHandler(CurrentPlayModeChangedSink);
					AV_LastChange.OnTransportStatusChanged += new AVTransportLastChange.VariableChangeHandler(TransportStatusChangedSink);
				}

				if(RenderingControl.HasStateVariable_LastChange)
				{
					// Hook up to the LastChange event of RenderingControl
					++this.StateCounter;
					RC_LastChange = new RenderingControlLastChange(RenderingControl,device.UniqueDeviceName, RCid, new RenderingControlLastChange.OnReadyHandler(RCLC));
					RC_LastChange.OnMuteChanged += new RenderingControlLastChange.VariableChangeHandler(MuteSink);
					RC_LastChange.OnVolumeChanged += new RenderingControlLastChange.VariableChangeHandler(VolumeSink);
				}

				/* Get ProtocolInfo Value of current connection */
				++this.StateCounter;
				ConnectionManager.GetCurrentConnectionInfo(ConnectionID,this.GetHashCode(),new CpConnectionManager.Delegate_OnResult_GetCurrentConnectionInfo(InitialState_GetCurrentConnectionInfoSink));
			}
			RenderingControl._subscribe(500);
			AVTransport._subscribe(500);
		}
开发者ID:Scannow,项目名称:SWYH,代码行数:81,代码来源:AVConnection.cs

示例12: Start

        public override void Start(UPnPDevice device)
        {
            if(!Enabled) return;

            UPnPDevice dv = device;
            while(dv.ParentDevice!=null)
            {
                dv = dv.ParentDevice;
            }

            state = UPnPTestStates.Running;
            UPnPService[] _S = device.GetServices("urn:");

            foreach(UPnPService s in _S)
            {
                bool ok = false;
                foreach(UPnPStateVariable v in s.GetStateVariables())
                {
                    if(v.SendEvent)
                    {
                        ok = true;
                        break;
                    }
                }
                if(ok)
                {

                    UPnPDebugObject d = new UPnPDebugObject(s);
                    Uri EventUri = new Uri((string)d.GetField("__eventurl"));

                    IPEndPoint dest = new IPEndPoint(IPAddress.Parse(EventUri.Host),EventUri.Port);
                    HTTPMessage R = new HTTPMessage();
                    R.Directive = "SUBSCRIBE";
                    R.DirectiveObj = HTTPMessage.UnEscapeString(EventUri.PathAndQuery);
                    R.AddTag("Host",dest.ToString());
                    R.AddTag("Callback","<http://" + dv.InterfaceToHost.ToString()+ ":" + NetworkInfo.GetFreePort(10000,50000,dv.InterfaceToHost).ToString() + ">");
                    //R.AddTag("Callback","<http://127.0.0.1:55555>");
                    R.AddTag("NT","upnp:event");
                    R.AddTag("Timeout","Second-15");

                    System.Console.WriteLine(R.GetTag("Callback"));

                    MRE.Reset();
                    SID = "";
                    StartCountDown(30);
                    HTTPRequest rq = new HTTPRequest();
                    rq.OnResponse += new HTTPRequest.RequestHandler(SubscribeSink);

                    AddHTTPMessage(R);

                    rq.PipelineRequest(dest,R,s);
                    MRE.WaitOne(30000,false);
                    AbortCountDown();

                    if (SID=="")
                    {
                        AddEvent(LogImportance.Critical,"Subscribe","SUBSCRIBE: " + s.ServiceURN + " << FAILED >>");
                        AddEvent(LogImportance.Remark,"Subscribe","Aborting tests");

                        result = "Subscription test failed."; // TODO
                        state = UPnPTestStates.Failed;
                        return;
                    }
                    else
                    {
                        AddEvent(LogImportance.Remark,"Subscribe","SUBSCRIBE: " + s.ServiceURN + " << OK >>");

                        // Renew Test
                        R = new HTTPMessage();
                        R.Directive = "SUBSCRIBE";
                        R.DirectiveObj = HTTPMessage.UnEscapeString(EventUri.PathAndQuery);
                        R.AddTag("Host",dest.ToString());
                        R.AddTag("SID",SID);
                        R.AddTag("Timeout","Second-15");
                        StartCountDown(30);
                        SID = "";
                        MRE.Reset();

                        AddHTTPMessage(R);

                        rq = new HTTPRequest();
                        rq.OnResponse += new HTTPRequest.RequestHandler(SubscribeSink);
                        rq.PipelineRequest(dest,R,s);

                        MRE.WaitOne(30000,false);
                        AbortCountDown();

                        if (SID=="")
                        {
                            AddEvent(LogImportance.Critical,"Subscribe","SUBSCRIBE (Renew): " + s.ServiceURN + " << FAILED >>");
                            AddEvent(LogImportance.Remark,"Subscribe","Aborting tests");

                            result = "Subscription test failed."; // TODO
                            state = UPnPTestStates.Failed;
                            return;
                        }
                        else
                        {
                            AddEvent(LogImportance.Remark,"Subscribe","SUBSCRIBE (Renew): " + s.ServiceURN + " << OK >>");

//.........这里部分代码省略.........
开发者ID:amadare,项目名称:DeveloperToolsForUPnP,代码行数:101,代码来源:UPnPTestSubscribe.cs

示例13: Start

        public override void Start(UPnPDevice device)
        {
            Reset();

            UPnPService[] _S = device.GetServices("urn:");

            TotalTime = 0;
            int CurrentTime = 0;
            foreach(UPnPService s in _S)
            {
                TotalTime += s.Actions.Count*30;
            }
            foreach(UPnPService s in _S)
            {
                UPnPServiceWatcher W = new UPnPServiceWatcher(s,null,new UPnPServiceWatcher.SniffPacketHandler(SniffPacketSink));

                foreach(UPnPAction A in s.Actions)
                {
                    StartCountDown(CurrentTime,TotalTime);
                    BasicControlTest_ACTION(s,A);
                    AbortCountDown();
                    CurrentTime += 30;
                }
            }

            if(WARN_VALID && !FAIL_VALID)
            {
                Results.Add("Invocations: Valid Values  -  Had undesirable behavior");
                SetState("Valid Values", UPnPTestStates.Warn);
            }
            else
            {
                if(FAIL_VALID)
                {
                    Results.Add("Invocations: Valid Values  -  Failed");
                    SetState("Valid Values",UPnPTestStates.Failed);
                }
                else
                {
                    Results.Add("Invocations: Valid Values  -  Passed");
                    SetState("Valid Values",UPnPTestStates.Pass);
                }
            }

            CurrentTime = 0;
            foreach(UPnPService s in _S)
            {
                UPnPServiceWatcher W = new UPnPServiceWatcher(s,null,new UPnPServiceWatcher.SniffPacketHandler(SniffPacketSink));

                foreach(UPnPAction A in s.Actions)
                {
                    StartCountDown(CurrentTime,TotalTime);
                    BasicControlTest_ACTION_BadAllowedValues(s,A);
                    AbortCountDown();
                    CurrentTime += 30;
                }
            }
            if(WARN_ALLOWED && !FAIL_ALLOWED)
            {
                Results.Add("Invocations: Allowed Values  -  Had undesirable behavior");
                SetState("Allowed Values",UPnPTestStates.Warn);
            }
            else
            {
                if(FAIL_ALLOWED)
                {
                    Results.Add("Invocations: Allowed Values  -  Failed");
                    SetState("Allowed Values",UPnPTestStates.Failed);
                }
                else
                {
                    Results.Add("Invocations: Allowed Values  -  Passed");
                    SetState("Allowed Values",UPnPTestStates.Pass);
                }
            }

            CurrentTime = 0;
            foreach(UPnPService s in _S)
            {
                UPnPServiceWatcher W = new UPnPServiceWatcher(s,null,new UPnPServiceWatcher.SniffPacketHandler(SniffPacketSink));

                foreach(UPnPAction A in s.Actions)
                {
                    StartCountDown(CurrentTime,TotalTime);
                    BasicControlTest_ACTION_BadRange(s,A);
                    AbortCountDown();
                    CurrentTime += 30;
                }
            }
            if(WARN_RANGE && !FAIL_RANGE)
            {
                Results.Add("Invocations: Range  -  Had undesirable behavior");
                SetState("Range",UPnPTestStates.Warn);
            }
            else
            {
                if(FAIL_RANGE)
                {
                    Results.Add("Invocations: Range  -  Failed");
                    SetState("Range",UPnPTestStates.Failed);
//.........这里部分代码省略.........
开发者ID:rvodden,项目名称:upnp-developertools-old,代码行数:101,代码来源:UPnPTestInvokeValid.cs


注:本文中的OpenSource.UPnP.UPnPDevice.GetServices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。