/// <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; }
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. }
/// <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); } }
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); }
/// <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); } }
/// <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); } }
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); }
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); } }
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); }
/// <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()); } */ } }
/// <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); }
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 >>"); // Cancel R = new HTTPMessage(); R.Directive = "UNSUBSCRIBE"; R.DirectiveObj = HTTPMessage.UnEscapeString(EventUri.PathAndQuery); R.AddTag("Host",dest.ToString()); R.AddTag("SID",SID); StartCountDown(30); SID = ""; MRE.Reset(); rq = new HTTPRequest(); rq.OnResponse += new HTTPRequest.RequestHandler(CancelSink); AddHTTPMessage(R); rq.PipelineRequest(dest,R,s); MRE.WaitOne(30000,false); AbortCountDown(); if (SID=="") { AddEvent(LogImportance.Critical,"Subscribe","UNSUBSCRIBE: " + s.ServiceURN + " << FAILED >>"); AddEvent(LogImportance.Remark,"Subscribe","Aborting tests"); result = "Subscription test failed."; state = UPnPTestStates.Failed; return; } else { AddEvent(LogImportance.Remark,"Subscribe","UNSUBSCRIBE: " + s.ServiceURN + " << OK >>"); } /* Test for duplicate SID * as well as initial events */ EventTable.Clear(); NumEvents = 0; foreach(UPnPStateVariable V in s.GetStateVariables()) { if(V.SendEvent) { ++ NumEvents; EventTable[V.Name] = false; V.OnModified -= new UPnPStateVariable.ModifiedHandler(StateVarModifiedSink); V.OnModified += new UPnPStateVariable.ModifiedHandler(StateVarModifiedSink); } } if(EventTable.Count>0) { MRE.Reset(); s.OnSubscribe -= new UPnPService.UPnPEventSubscribeHandler(OnSubscribeSink); s.OnSubscribe += new UPnPService.UPnPEventSubscribeHandler(OnSubscribeSink); s.UnSubscribe(null); foreach(UPnPStateVariable V in s.GetStateVariables()) { V.Clear(); } s.Subscribe(120,null); MRE.WaitOne(30000,false); if(SID=="") { // Subscribe Failed AddEvent(LogImportance.Critical,"Subscribe","SUBSCRIBE(2): " + s.ServiceURN + " << FAILED >>"); AddEvent(LogImportance.Remark,"Subscribe","Aborting tests"); result = "Subscription test failed."; state = UPnPTestStates.Failed; return; } else { if(SID==null) { // Duplicate SID // Subscribe Failed AddEvent(LogImportance.Critical,"Subscribe","SUBSCRIBE(2): " + s.ServiceURN + " << FAILED, duplicate SID >>"); AddEvent(LogImportance.Remark,"Subscribe","Aborting tests"); result = "Subscription test failed."; state = UPnPTestStates.Failed; return; } else { // Check Hashtable IDictionaryEnumerator de = EventTable.GetEnumerator(); bool OK = true; while(de.MoveNext()) { if((bool)de.Value==false) { // No Event Received OK = false; AddEvent(LogImportance.Critical,"Subscribe"," StateVariable: " + (string)de.Key + " >> Event NOT received"); } else { // OK AddEvent(LogImportance.Remark,"Subscribe"," StateVariable: " + (string)de.Key + " >> Event OK"); } } if(OK==false) { AddEvent(LogImportance.Critical,"Subscribe","SUBSCRIBE(2): " + s.ServiceURN + " << FAILED, Did not receive all events >>"); AddEvent(LogImportance.Remark,"Subscribe","Aborting tests"); result = "Subscription test failed."; state = UPnPTestStates.Failed; return; } } } } } } } } result = "Subscribe Tests OK"; state = UPnPTestStates.Pass; }
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); } else { Results.Add("Invocations: Range - Passed"); SetState("Range",UPnPTestStates.Pass); } } WARN_MASTER = WARN_VALID||WARN_ALLOWED||WARN_RANGE; FAIL_MASTER = FAIL_VALID||FAIL_ALLOWED||FAIL_RANGE; if(WARN_MASTER && !FAIL_MASTER) { state = UPnPTestStates.Warn; } else { if(FAIL_MASTER) { state = UPnPTestStates.Failed; } else { state = UPnPTestStates.Pass; } } SetProgress(100); }