Exemplo n.º 1
0
		public Finder(UPnPDevice device, Gallery presenter)
		{
			Controller = new ContentDirectoryController(this);
			Model = MediaServerModel.GetInstance();
			Device = device;
			Presenter = presenter;
		}
Exemplo n.º 2
0
 public void ForceDisposeDevice(UPnPDevice dev)
 {
     if(dev.ParentDevice!=null)
     {
         ForceDisposeDevice(dev.ParentDevice);
     }
     else
     {
         scp.ForceDisposeDevice(dev);
     }
 }
        public CPCodeGenerationForm(UPnPDevice device, Hashtable serviceNames, Hashtable stackSettings, ArrayList FragResponseActions, ArrayList EscapeActions)
        {
            InitializeComponent();

            platformComboBox.SelectedIndex = 0;
            languageComboBox.SelectedIndex = 0;
            newLineComboBox.SelectedIndex = 0;
            indentComboBox.SelectedIndex = 0;
            callConventionComboBox.SelectedIndex = 0;
            this.device = device;
            this.serviceNames = serviceNames;
            this.stackSettings = stackSettings;
            this.FragResponseActions = FragResponseActions;
            this.EscapeActions = EscapeActions;
        }
 public static SonosPlayer Map(UPnPDevice device)
 {
     return(new SonosPlayer
     {
         UniqueDeviceName = device.UniqueDeviceName,
         BaseUrl = device.BaseURL,
         LocationUrl = device.LocationURL,
         FriendlyName = device.FriendlyName,
         ModelNumber = device.ModelNumber,
         ModelDescription = device.ModelDescription,
         ModelName = device.ModelName,
         Manufacturer = device.Manufacturer,
         RemoteEndPoint = device.RemoteEndPoint,
         StandardDeviceType = device.StandardDeviceType
     });
 }
Exemplo n.º 5
0
        /// <summary>
        /// Returns the upnp devices that were discovered in the last scan
        /// We return as UPnpDevice[] because .net does not let us pass List<UPnPDevice>
        /// </summary>
        public static UPnPDevice[] UpnpGetDevices()
        {
           UPnPDevice[] retList = null;

            lock (lockObject)
            {
                retList = new UPnPDevice[upnpDevices.Count];

                for(int index = 0; index < upnpDevices.Count; index++)
                {
                    retList[index] = upnpDevices[index];
                }
            }

            return retList;
        }
        private TreeNode ProcessEmbeddedDevice(UPnPDevice device)
        {
            TreeNode Parent;
            TreeNode Child;

            Parent     = new TreeNode(device.FriendlyName, 1, 1);
            Parent.Tag = device;

            for (int cid = 0; cid < device.EmbeddedDevices.Length; ++cid)
            {
                Child     = ProcessEmbeddedDevice(device.EmbeddedDevices[cid]);
                Child.Tag = device.EmbeddedDevices[cid];
                Parent.Nodes.Add(Child);
            }

            return(Parent);
        }
 private void UNSubscribeAllServices(UPnPDevice d)
 {
     foreach (UPnPDevice _D in d.EmbeddedDevices)
     {
         UNSubscribeAllServices(_D);
     }
     foreach (UPnPService S in d.Services)
     {
         foreach (UPnPStateVariable V in S.GetStateVariables())
         {
             if (V.SendEvent)
             {
                 V.OnModified -= new UPnPStateVariable.ModifiedHandler(EventSink);
             }
         }
     }
 }
        private HTTPMessage[] MSEARCH(UPnPDevice device)
        {
            ArrayList PacketList = new ArrayList();

            foreach (UPnPDevice d in device.EmbeddedDevices)
            {
                foreach (HTTPMessage m in MSEARCH(d))
                {
                    PacketList.Add(m);
                }
            }

            HTTPMessage rq;

            rq              = new HTTPMessage();
            rq.Directive    = "M-SEARCH";
            rq.DirectiveObj = "*";
            rq.AddTag("MX", "5");
            rq.AddTag("ST", "uuid:" + device.UniqueDeviceName);
            rq.AddTag("Host", "239.255.255.250:1900");
            rq.AddTag("MAN", "\"ssdp:discover\"");
            PacketList.Add(rq);

            rq              = new HTTPMessage();
            rq.Directive    = "M-SEARCH";
            rq.DirectiveObj = "*";
            rq.AddTag("MX", "5");
            rq.AddTag("ST", device.DeviceURN);
            rq.AddTag("Host", "239.255.255.250:1900");
            rq.AddTag("MAN", "\"ssdp:discover\"");
            PacketList.Add(rq);

            foreach (UPnPService s in device.Services)
            {
                rq              = new HTTPMessage();
                rq.Directive    = "M-SEARCH";
                rq.DirectiveObj = "*";
                rq.AddTag("MX", "5");
                rq.AddTag("ST", s.ServiceURN);
                rq.AddTag("Host", "239.255.255.250:1900");
                rq.AddTag("MAN", "\"ssdp:discover\"");
                PacketList.Add(rq);
            }

            return((HTTPMessage[])PacketList.ToArray(typeof(HTTPMessage)));
        }
Exemplo n.º 9
0
        public static string GetInterfaceToHost(this UPnPDevice device)
        {
            while (true)
            {
                if (device.InterfaceToHost != null)
                {
                    return(device.InterfaceToHost);
                }

                if (device.ParentDevice == null)
                {
                    return(null);
                }

                device = device.ParentDevice;
            }
        }
        internal UPnPDevice UnprotectedRemoveMe(string UDN)
        {
            DeviceInfo deviceInfo;
            UPnPDevice removedDevice = null;

            if (deviceTable.ContainsKey(UDN))
            {
                deviceInfo    = (DeviceInfo)deviceTable[UDN];
                removedDevice = deviceInfo.Device;
                deviceTable.Remove(UDN);
                deviceLifeTimeClock.Remove(deviceInfo.UDN);
                deviceUpdateClock.Remove(deviceInfo);
                activeDeviceList.Remove(removedDevice);
            }

            return(removedDevice);
        }
Exemplo n.º 11
0
        public DirectoryServer()
        {
            device = UPnPDevice.CreateRootDevice(1800, 1.0, "\\");

            device.FriendlyName     = "Local Audio Broadcast @ " + System.Environment.MachineName;
            device.Manufacturer     = "Mario Guggenberger / Protyposis";
            device.ManufacturerURL  = "http://protyposis.net";
            device.ModelName        = "LAB";
            device.ModelDescription = "LAB";
            device.ModelNumber      = "1.0";
            device.HasPresentation  = false;
            device.DeviceURN        = "urn:schemas-upnp-org:device:MediaServer:1";


            DvX_MS_MediaReceiverRegistrar X_MS_MediaReceiverRegistrar = new DvX_MS_MediaReceiverRegistrar();

            X_MS_MediaReceiverRegistrar.External_IsAuthorized   = new DvX_MS_MediaReceiverRegistrar.Delegate_IsAuthorized(X_MS_MediaReceiverRegistrar_IsAuthorized);
            X_MS_MediaReceiverRegistrar.External_IsValidated    = new DvX_MS_MediaReceiverRegistrar.Delegate_IsValidated(X_MS_MediaReceiverRegistrar_IsValidated);
            X_MS_MediaReceiverRegistrar.External_RegisterDevice = new DvX_MS_MediaReceiverRegistrar.Delegate_RegisterDevice(X_MS_MediaReceiverRegistrar_RegisterDevice);
            device.AddService(X_MS_MediaReceiverRegistrar);
            DvConnectionManager ConnectionManager = new DvConnectionManager();

            ConnectionManager.External_GetCurrentConnectionIDs  = new DvConnectionManager.Delegate_GetCurrentConnectionIDs(ConnectionManager_GetCurrentConnectionIDs);
            ConnectionManager.External_GetCurrentConnectionInfo = new DvConnectionManager.Delegate_GetCurrentConnectionInfo(ConnectionManager_GetCurrentConnectionInfo);
            ConnectionManager.External_GetProtocolInfo          = new DvConnectionManager.Delegate_GetProtocolInfo(ConnectionManager_GetProtocolInfo);
            device.AddService(ConnectionManager);
            DvContentDirectory ContentDirectory = new DvContentDirectory();

            ContentDirectory.External_Browse = new DvContentDirectory.Delegate_Browse(ContentDirectory_Browse);
            ContentDirectory.External_GetSearchCapabilities = new DvContentDirectory.Delegate_GetSearchCapabilities(ContentDirectory_GetSearchCapabilities);
            ContentDirectory.External_GetSortCapabilities   = new DvContentDirectory.Delegate_GetSortCapabilities(ContentDirectory_GetSortCapabilities);
            ContentDirectory.External_GetSystemUpdateID     = new DvContentDirectory.Delegate_GetSystemUpdateID(ContentDirectory_GetSystemUpdateID);
            ContentDirectory.External_Search = new DvContentDirectory.Delegate_Search(ContentDirectory_Search);
            device.AddService(ContentDirectory);

            // Setting the initial value of evented variables
            X_MS_MediaReceiverRegistrar.Evented_AuthorizationGrantedUpdateID = 0;
            X_MS_MediaReceiverRegistrar.Evented_ValidationRevokedUpdateID    = 0;
            X_MS_MediaReceiverRegistrar.Evented_ValidationSucceededUpdateID  = 0;
            X_MS_MediaReceiverRegistrar.Evented_AuthorizationDeniedUpdateID  = 0;
            ConnectionManager.Evented_SourceProtocolInfo   = "Sample String";
            ConnectionManager.Evented_SinkProtocolInfo     = "Sample String";
            ConnectionManager.Evented_CurrentConnectionIDs = "Sample String";
            ContentDirectory.Evented_ContainerUpdateIDs    = "Sample String";
            ContentDirectory.Evented_SystemUpdateID        = 0;
        }
        public IList <UPnPDevice> LoadSubDevices(IEnumerable <XElement> xml, string location)
        {
            IList <UPnPDevice> devices = new List <UPnPDevice>();

            foreach (XElement element in xml.Where(x => x.Name.LocalName == "deviceList").Elements())
            {
                UPnPDevice device = new UPnPDevice {
                    Location = location
                };

                device = ParseDescription(device, element.Elements());

                devices.Add(device);
            }

            return(devices);
        }
Exemplo n.º 13
0
        private void AddDeviceToNode(TreeNode n, UPnPDevice d)
        {
            foreach (UPnPDevice ed in d.EmbeddedDevices)
            {
                AddDeviceToNode(n, ed);
            }

            TreeNode NewNode = new TreeNode(d.FriendlyName);

            NewNode.Tag = d;
            foreach (UPnPService s in d.Services)
            {
                AddServiceToNode(NewNode, s);
            }

            n.Nodes.Add(NewNode);
        }
Exemplo n.º 14
0
        public void DeviceAdded(int lFindData, UPnPDevice pDevice)
        {
            try
            {
                IUPnPDeviceFinderCallback callback = (IUPnPDeviceFinderCallback)connection.Target;
                if (callback == null)
                {
                    return;
                }

                callback.DeviceAdded(lFindData, pDevice);
            }
            finally
            {
                Marshal.ReleaseComObject(pDevice);
            }
        }
Exemplo n.º 15
0
        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);
        }
        /// <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);
            }
        }
Exemplo n.º 17
0
 private void InitializeThis(string PresentationURL, string LocationURL)
 {
     device = UPnPDevice.CreateRootDevice(1800,1.0,"\\");
     device.FriendlyName = System.Environment.MachineName;
     device.Manufacturer = "Carver Lab Corporation";
     device.ManufacturerURL = "http://www.carverlab.com";
     device.ModelName = "Oyster Mini";
     device.ModelDescription = "Video Capture and Playback Device";
     device.ModelNumber = "CLC_OM_10";
     device.HasPresentation = true;
     device.PresentationURL = PresentationURL;
     device.LocationURL = LocationURL;
     device.SerialNumber = "OD_517200501";
     device.DeviceURN = "urn:schemas-upnp-org:device:OysterDevice:1";
     CarverLab.OysterDevice.OysterConnection OysterConnection = new CarverLab.OysterDevice.OysterConnection();
     OysterConnection.External_GetConnectionVariables = new CarverLab.OysterDevice.OysterConnection.Delegate_GetConnectionVariables(OysterConnection_GetConnectionVariables);
     device.AddService(OysterConnection);
 }
Exemplo n.º 18
0
        public void  DeviceAdded( UPnPDevice device )
        {
            TreeNode newnode = treeDevices.Nodes[0].Nodes.Add(device.UniqueDeviceName, device.FriendlyName);
            newnode.ToolTipText = device.Description;
            
            if (device.HasChildren)
            {
                UPnPDevices childdevices = device.Children;

                foreach (UPnPDevice child in childdevices)
                {
                    newnode.Nodes.Add(child.UniqueDeviceName, child.FriendlyName).ToolTipText = child.Description;
                }
            }

            if (treeDevices.Nodes[0].IsExpanded != true)
                treeDevices.Nodes[0].Expand();
        }
Exemplo n.º 19
0
        internal UPnPDevice UnprotectedRemoveMe(string UDN)
        {
            UPnPDevice device = null;

            try
            {
                DeviceInfo info = (DeviceInfo)deviceTable[UDN];
                device = info.Device;
                deviceTable.Remove(UDN);
                deviceLifeTimeClock.Remove(info.UDN);
                deviceUpdateClock.Remove(info);
                activeDeviceList.Remove(device);
            }
            catch
            {
            }
            return(device);
        }
Exemplo n.º 20
0
        private void ControlPoint_OnAddedDevice(UPnPSmartControlPoint sender, UPnPDevice device)
        {
            Console.WriteLine("OnAddedDevice(" + device.FriendlyName + ", " + device.RemoteEndPoint + ", " + device.UniqueDeviceName + ")");

            foreach (UPnPService service in device.Services)
            {
                Console.WriteLine(device.FriendlyName + " service: " + service.ServiceURN);
            }

            // only add device if necessary services are available
            if (device.GetServices(UPNP_SERVICE_CONTROL).Length > 0 && device.GetServices(UPNP_SERVICE_AVTRANSPORT).Length > 0)
            {
                if (OnAddedDevice != null)
                {
                    OnAddedDevice(sender, device);
                }
            }
        }
        private UPnPService FetchAService(UPnPDevice d)
        {
            UPnPService RetVal = null;

            if (d.Services.Length != 0)
            {
                return(d.Services[0]);
            }
            foreach (UPnPDevice ed in d.EmbeddedDevices)
            {
                RetVal = FetchAService(ed);
                if (RetVal != null)
                {
                    return(RetVal);
                }
            }
            return(null);
        }
Exemplo n.º 22
0
		public UPnPProxyDevice(UPnPDevice device)
		{
			ProxyDevice = UPnPDevice.CreateRootDevice(2000,1,"");
			ProxyDevice.UniqueDeviceName = Guid.NewGuid().ToString();
			int id = ProxyDevice.UniqueDeviceName.GetHashCode();

			ProxyDevice.HasPresentation = false;
			ProxyDevice.FriendlyName = "Intel UPnP Proxy Device (" + id.ToString() + ")";
			ProxyDevice.Manufacturer = "Intel's Connected and Extended PC Lab";
			ProxyDevice.ManufacturerURL = "http://www.intel.com/labs";
			ProxyDevice.ModelName = "UPnP Proxy";
			ProxyDevice.StandardDeviceType = "UPnP_ProxyDevice";

			UPnPDevice d;

			d = UPnPDevice.CreateEmbeddedDevice(double.Parse(device.Version),device.UniqueDeviceName);
			d.FriendlyName = device.FriendlyName;
			d.Manufacturer = device.Manufacturer;
			d.ManufacturerURL = device.ManufacturerURL;
			d.ModelDescription = device.ModelDescription;
			d.ModelURL = device.ModelURL;
			d.DeviceURN = device.DeviceURN;

			foreach(UPnPService S in device.Services)
			{
				UPnPService S2 = (UPnPService)S.Clone();
				foreach(UPnPAction A in S2.Actions)
				{
					A.ParentService = S2;
					A.SpecialCase += new UPnPAction.SpecialInvokeCase(InvokeSink);
				}

				S2.SCPDURL = "_" + S2.ServiceID + "_scpd.xml";
				S2.ControlURL = "_" + S2.ServiceID + "_control";
				S2.EventURL = "_" + S2.ServiceID + "_event";

				ServiceTable[S2] = S;
				RealServiceTable[S] = S2;
				S.Subscribe(1000,new UPnPService.UPnPEventHandler(EventSink));
				d.AddService(S2);
			}
			ProxyDevice.AddDevice(d);
			ProxyDevice.StartDevice();
		}
        public UPnPProxyDevice(UPnPDevice device)
        {
            ProxyDevice = UPnPDevice.CreateRootDevice(2000, 1, "");
            ProxyDevice.UniqueDeviceName = Guid.NewGuid().ToString();
            int id = ProxyDevice.UniqueDeviceName.GetHashCode();

            ProxyDevice.HasPresentation    = false;
            ProxyDevice.FriendlyName       = "Intel UPnP Proxy Device (" + id.ToString() + ")";
            ProxyDevice.Manufacturer       = "Intel's Connected and Extended PC Lab";
            ProxyDevice.ManufacturerURL    = "http://www.intel.com/labs";
            ProxyDevice.ModelName          = "UPnP Proxy";
            ProxyDevice.StandardDeviceType = "UPnP_ProxyDevice";

            UPnPDevice d;

            d = UPnPDevice.CreateEmbeddedDevice(double.Parse(device.Version), device.UniqueDeviceName);
            d.FriendlyName     = device.FriendlyName;
            d.Manufacturer     = device.Manufacturer;
            d.ManufacturerURL  = device.ManufacturerURL;
            d.ModelDescription = device.ModelDescription;
            d.ModelURL         = device.ModelURL;
            d.DeviceURN        = device.DeviceURN;

            foreach (UPnPService S in device.Services)
            {
                UPnPService S2 = (UPnPService)S.Clone();
                foreach (UPnPAction A in S2.Actions)
                {
                    A.ParentService = S2;
                    A.SpecialCase  += new UPnPAction.SpecialInvokeCase(InvokeSink);
                }

                S2.SCPDURL    = "_" + S2.ServiceID + "_scpd.xml";
                S2.ControlURL = "_" + S2.ServiceID + "_control";
                S2.EventURL   = "_" + S2.ServiceID + "_event";

                ServiceTable[S2]    = S;
                RealServiceTable[S] = S2;
                S.Subscribe(1000, new UPnPService.UPnPEventHandler(EventSink));
                d.AddService(S2);
            }
            ProxyDevice.AddDevice(d);
            ProxyDevice.StartDevice();
        }
Exemplo n.º 24
0
        private void GKActionSinkEx(UPnPDevice DeviceSender, UPnPService ServiceSender, string ActionName)
        {
            ListViewItem lvi = (ListViewItem)OutboundListViewTable[DeviceSender];

            if (OutboundActionTable.ContainsKey(DeviceSender) == false)
            {
                OutboundActionTable[DeviceSender] = (long)0;
            }
            long Counter = (long)OutboundActionTable[DeviceSender];

            ++Counter;
            OutboundActionTable[DeviceSender] = Counter;
            lvi.SubItems[1].Text = Counter.ToString();

            if (Trace)
            {
                TraceList.Add(DeviceSender.FriendlyName + ": " + ServiceSender.ServiceURN + " [" + ServiceSender.ServiceID + "] Action: " + ActionName);
            }
        }
Exemplo n.º 25
0
 private void FetchServiceDocuments(UPnPDevice device)
 {
     for (int i = 0; i < device.Services.Length; i++)
     {
         HTTPMessage message  = new HTTPMessage();
         Uri         resource = new Uri(device.Services[i].SCPDURL);
         message.Directive    = "GET";
         message.DirectiveObj = HTTPMessage.UnEscapeString(resource.PathAndQuery);
         message.AddTag("Host", resource.Host + ":" + resource.Port.ToString());
         this.r.PipelineRequest(resource, device.Services[i]);
     }
     if (device.EmbeddedDevices.Length > 0)
     {
         for (int j = 0; j < device.EmbeddedDevices.Length; j++)
         {
             this.FetchServiceDocuments(device.EmbeddedDevices[j]);
         }
     }
 }
Exemplo n.º 26
0
        private void HandleResponse(byte[] buffer, IList <UPnPDevice> foundDevices, Action <UPnPDevice> addAction)
        {
            IDictionary <string, string> response = ParseResponse(Encoder.GetString(buffer));

            if (!response.ContainsKey("LOCATION"))
            {
                return;
            }

            UPnPDevice device = foundDevices.FirstOrDefault(x => x.Location == response["LOCATION"]);

            if (device == null)
            {
                device = CreateDeviceFromResponse(response);
                addAction(device);
            }

            device.Targets.Add(response["ST"]);
        }
Exemplo n.º 27
0
        private void RemovedSink(UPnPDevice d)
        {
            return;

            /*
             *          devicelist.Remove(d);
             *          lock(outboundListView)
             *          {
             *                  for(int i=0;i<outboundListView.Items.Count;++i)
             *                  {
             *                          if(((UPnPDevice)outboundListView.Items[i].Tag)==d)
             *                          {
             *                                  outboundListView.Items.RemoveAt(i);
             *                                  break;
             *                          }
             *                  }
             *          }
             */
        }
        public override void Start(UPnPDevice device)
        {
            UPnPDevice d = device;

            UPnPService[] services = d.GetServices(CpContentDirectory.SERVICE_NAME);
            if (services == null || services.Length == 0)
            {
                enabled = false;
                return;
            }


            CdsSubTestArgument arg = new CdsSubTestArgument();

            arg._Device         = device;
            arg._TestGroupState = new CdsTestGroupState();
            arg._TestGroup      = this;
            this.RunTests(null, arg);
        }
Exemplo n.º 29
0
        public void DeviceAdded(UPnPDevice device)
        {
            Logger.Info("Device with UUID :{0} found,and will added to the Devices Tree", device.UniqueDeviceName);
            var newnode = treeView1.Nodes[0].Nodes.Add(device.UniqueDeviceName, device.FriendlyName);

            newnode.ToolTipText = device.Description;
            if (device.HasChildren)
            {
                var childdevices = device.Children;
                foreach (UPnPDevice child in childdevices)
                {
                    newnode.Nodes.Add(child.UniqueDeviceName, child.FriendlyName).ToolTipText = child.Description;
                }
            }
            if (treeView1.Nodes[0].IsExpanded != true)
            {
                treeView1.Nodes[0].Expand();
            }
        }
        public override void Start(UPnPDevice device)
        {
            UPnPDevice d = device;

            while (d.ParentDevice != null)
            {
                d = d.ParentDevice;
            }
            TestDevice = d;

            ASocket = new AsyncSocket(4096);
            ASocket.Attach(new IPEndPoint(TestDevice.InterfaceToHost, 0), System.Net.Sockets.ProtocolType.Udp);
            ASocket.SetTTL(4);
            ASocket.AddMembership((IPEndPoint)ASocket.LocalEndPoint, IPAddress.Parse("239.255.255.250"));
            ASocket.OnReceive += new AsyncSocket.OnReceiveHandler(ReceiveSink);
            ASocket.Begin();

            ASocket2 = new AsyncSocket(4096);
            ASocket2.Attach(new IPEndPoint(TestDevice.InterfaceToHost, 1900), System.Net.Sockets.ProtocolType.Udp);
            ASocket2.SetTTL(2);
            ASocket2.AddMembership((IPEndPoint)ASocket.LocalEndPoint, IPAddress.Parse("239.255.255.250"));
            ASocket2.OnReceive += new AsyncSocket.OnReceiveHandler(ReceiveSink2);

            Validate_MSEARCH_RESPONSETIME();
            Validate_NOTIFY();
            Validate_DISCOVERY();

            UPnPTestStates RetState = UPnPTestStates.Pass;

            if (NOTIFY == UPnPTestStates.Failed || DISCOVERY == UPnPTestStates.Failed)
            {
                RetState = UPnPTestStates.Failed;
            }
            else
            {
                if (NOTIFY == UPnPTestStates.Warn || DISCOVERY == UPnPTestStates.Warn || MX == UPnPTestStates.Warn)
                {
                    RetState = UPnPTestStates.Warn;
                }
            }

            state = RetState;
        }
        private void HandleRemovedDevice(UPnPSmartControlPoint sender, UPnPDevice device)
        {
            ArrayList   TempList = new ArrayList();
            TreeNode    tn;
            IEnumerator en = UPnpRoot.Nodes.GetEnumerator();

            while (en.MoveNext())
            {
                tn = (TreeNode)en.Current;
                if (((UPnPDevice)tn.Tag).UniqueDeviceName == device.UniqueDeviceName)
                {
                    TempList.Add(tn);
                }
            }
            for (int x = 0; x < TempList.Count; ++x)
            {
                UPnpRoot.Nodes.Remove((TreeNode)TempList[x]);
            }
        }
        public ProxyDeviceFactory(CpGateKeeper home, UPnPDevice D, OnDeviceHandler Callback)
        {
            OpenSource.Utilities.InstanceTracker.Add(this);
            HOME      = home;
            OnDevice += Callback;
            _D        = D;

            foreach (UPnPDevice ed in D.EmbeddedDevices)
            {
                ProcessEmbeddedDevice(ed, false);
            }
            ProcessServices(D, false);

            foreach (UPnPDevice ed in D.EmbeddedDevices)
            {
                ProcessEmbeddedDevice(ed, true);
            }
            ProcessServices(D, true);
        }
        /// <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());
                 * }
                 */
            }
        }
Exemplo n.º 34
0
        static void Main(string[] args)
        {
            // Wait for network UP
            while (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
            {
                Thread.Sleep(1000);
            }

            string ip = GetLocalIPAddress();

            // localhost, docker
            while (ip == "127.0.0.1" || ip.StartsWith("172."))
            {
                Thread.Sleep(1000);
                ip = GetLocalIPAddress();
            }

            Console.WriteLine("Starting with IP " + ip);

            upnpDevice = UPnPDevice.CreateRootDevice(1600, 1.0, ".\\");
            upnpDevice.FriendlyName       = "OpenHAB (OH URL in Model URL)";
            upnpDevice.Manufacturer       = "";
            upnpDevice.ManufacturerURL    = "";
            upnpDevice.ModelName          = "OpenHAB";
            upnpDevice.ModelDescription   = "OpenHAB";
            upnpDevice.ModelNumber        = "OpenHAB";
            upnpDevice.ModelURL           = new Uri("http://" + ip + ":8080");
            upnpDevice.BaseURL            = new Uri("http://" + ip + ":8080");
            upnpDevice.StandardDeviceType = "OpenHAB";
            upnpDevice.UniqueDeviceName   = "35fcccdc-b100-450b-bd4e-99e80fbcf6fb";

            upnpDevice.StartDevice();

            /*Console.WriteLine("Press enter to close...");
             * Console.ReadLine();*/
            while (true)
            {
                Thread.Sleep(10000);
            }

            upnpDevice.StopDevice();
        }
        private void HandleRemovedDevice(UPnPSmartControlPoint sender, UPnPDevice device)
        {
            ArrayList   TempList = new ArrayList();
            TreeNode    tn;
            IEnumerator en = UPnpRoot.Nodes.GetEnumerator();

            while (en.MoveNext())
            {
                tn = (TreeNode)en.Current;
                if (((UPnPDevice)tn.Tag).UniqueDeviceName == device.UniqueDeviceName)
                {
                    TempList.Add(tn);
                }
            }

            Object[] args = new Object[1];
            args[0] = TempList;

            this.Invoke(new UpdateTreeRemoveDelegate(HandleTreeUpdate_Remove), args);
        }
Exemplo n.º 36
0
        public void CreateLocalDevice(string deviceguid, string devicetype, string presentationurl, string rootdir, string modelname, string modeldescription, string modelurl, string modelnumber, string manufacturer, string manufacturerurl)
        {
            if (_localdevice != null)
            {
                _localdevice.StopDevice();
                _localdevice = null;
            }
            //
            IPHostEntry host;
            string      localIP = "";

            host = Dns.GetHostEntry(Dns.GetHostName());
            foreach (IPAddress ip in host.AddressList)
            {
                if (ip.AddressFamily == AddressFamily.InterNetwork)
                {
                    localIP = ip.ToString();
                    break;
                }
            }
            _localdevice = UPnPDevice.CreateRootDevice(900, 1, rootdir);
            //hgdevice.Icon = null;
            if (presentationurl != "")
            {
                _localdevice.HasPresentation = true;
                _localdevice.PresentationURL = presentationurl;
            }
            _localdevice.FriendlyName     = modelname + ": " + Environment.MachineName;
            _localdevice.Manufacturer     = manufacturer;
            _localdevice.ManufacturerURL  = manufacturerurl;
            _localdevice.ModelName        = modelname;
            _localdevice.ModelDescription = modeldescription;
            if (Uri.IsWellFormedUriString(manufacturerurl, UriKind.Absolute))
            {
                _localdevice.ModelURL = new Uri(manufacturerurl);
            }
            _localdevice.ModelNumber        = modelnumber;
            _localdevice.StandardDeviceType = devicetype;
            _localdevice.UniqueDeviceName   = deviceguid;
            _localdevice.StartDevice();
        }
        private void CPGetDocumentSink(CpGateKeeper sender, System.String DeviceUDN, System.String ServiceID, System.Byte[] Document, UPnPInvokeException e, object _Tag)
        {
            if (e != null)
            {
                return;
            }
            UTF8Encoding U = new UTF8Encoding();

            string    XML       = U.GetString(Document);
            Uri       SourceUri = new Uri("http://127.0.0.1");
            IPAddress Intfce    = null;

            UPnPDevice d = (UPnPDevice)(new UPnPDebugObject(typeof(OpenSource.UPnP.UPnPDevice))).InvokeStaticMethod("Parse", new object[3]
            {
                XML, SourceUri, Intfce
            });

            ProxyDeviceFactory df = new ProxyDeviceFactory(sender, d, new ProxyDeviceFactory.OnDeviceHandler(NewDeviceSink));

            ProxyFactoryTable[df] = df;
        }
Exemplo n.º 38
0
        public SampleDevice()
        {
            device = UPnPDevice.CreateRootDevice(1800,1.0,"\\");
            device.FriendlyName = "ProjectorDevice";
            device.Manufacturer = "WNMS Group 4";
            device.ManufacturerURL = "http://www.vt.edu";
            device.ModelName = "Projector Controller";
            device.ModelDescription = "Powerpoint Projector Controller";
            device.ModelNumber = "G4";
            device.HasPresentation = false;
            device.DeviceURN = "urn:schemas-upnp-org:device:projector:1";
            Wnms04.UpnpStack.P5_04 P5_04 = new Wnms04.UpnpStack.P5_04();

            P5_04.OnLogEvent += new P5_04.OnLog(this.BubbleLog);
            device.AddService(P5_04);

            // Setting the initial value of evented variables
            P5_04.Evented_PageMax = 0;
            P5_04.Evented_Power = false;
            P5_04.Evented_File = "Sample String";
            P5_04.Evented_PageNumber = 0;
            P5_04.Evented_Files = "Sample String";
        }
Exemplo n.º 39
0
 private void OnDoubleClick(object sender, System.EventArgs e)
 {
     object Selected = DeviceTree.SelectedNode;
     if(((TreeNode)Selected).Tag.GetType().FullName=="Intel.UPNP.UPnPDevice")
     {
         SelectedDevice = (UPnPDevice)((TreeNode)Selected).Tag;
         this.DialogResult=DialogResult.OK;
     }
 }
Exemplo n.º 40
0
 private void AddSink(UPnPSmartControlPoint sender, UPnPDevice d)
 {
     HandleCreate(d,d.BaseURL);
 }
Exemplo n.º 41
0
 private static string GetUniqueName(UPnPDevice device)
 {
     return "huebridge:" + device.SerialNumber;
 }
Exemplo n.º 42
0
 private bool IsAxisDevice(UPnPDevice device)
 {
     return (device.ModelURL != null && device.ModelURL.Length > 0 && device.ModelURL.ToLower() == "http://www.axis.com/");
 }
Exemplo n.º 43
0
		private void NewDeviceFound(object sender, NewDeviceFoundEventArgs args)
		{
			try
			{
				Logger.TraceInfo(MethodBase.GetCurrentMethod(), "New device found: {0}", args.Device);
				_device = args.Device;
				_parentPath = Path.DirectorySeparatorChar + _device.FriendlyName;
				// H show names
				// C:\Users\curtis.CARVERLAB\Documents\onCoreMockData\bc971279-8c5e-4709-a0fe-e532d58fde82+hulu-b90acd07-a55f-4593-937d-fd7fb3679114.xml
				ParseIn("hulu-b90acd07-a55f-4593-937d-fd7fb3679114");

				var collection = AVItemCollections.FirstOrDefault(
					itemCollection => itemCollection.Title.Contains("Human Target"));

				if (collection == null)
					throw new InvalidOperationException("No collection found for Human Target");
				_parentPath = collection.Path;
				// Human Target episodes
				// C:\Users\curtis.CARVERLAB\Documents\onCoreMockData\bc971279-8c5e-4709-a0fe-e532d58fde82+hulu-b18846aa-c36f-45b9-b06c-d50f95ec64eb.xml
				ParseIn("hulu-b18846aa-c36f-45b9-b06c-d50f95ec64eb");

				// a single Human Target episode
				DetailItem.Add(AVItems[0]);

				_allDoneEvent.Set();
			}
			catch (Exception exception)
			{
				Logger.TraceErr(MethodBase.GetCurrentMethod(), exception);
			}
		}
		/// <summary>
		/// Callback method invoked when a new UPnP device has been discovered.
		/// </summary>
		/// <param name="lFindData">The handle of the search-operation for which
		/// the method is being invoked.</param>
		/// <param name="pDevice">The UPnP-device that has been discovered.</param>
		public void DeviceAdded(int lFindData, UPnPDevice pDevice) {
			devices.Add(pDevice);
		}
        /// <summary>
        /// when device is found add to tree view
        /// </summary>
        /// <param name="lFindData"></param>
        /// <param name="pDevice"></param>
        public void DeviceAdded(int lFindData, UPnPDevice pDevice)
        {
            var enumerate = pDevice.Services.GetEnumerator();
            TreeNode parent = new TreeNode();
            parent.Text = pDevice.FriendlyName;
            UPnPServerBrowserDialog.tvwServerList.Nodes.Add(parent);

            try
            {
                while (enumerate.MoveNext())
                {
                    try
                    {
                        UPnPService current = enumerate.Current as UPnPService;
                        XDocument content = UPnPData.Browser(current, "0");
                        object[,] structure = UPnPData.buildStructure(current, content);
                        UPnPData.buildTreeView(structure, parent);
                    }
                    catch
                    {
                        //Do nothing
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
            UPnPServerBrowserDialog.lblSearching.Text = "Finished: " + pDevice.FriendlyName;
        }
Exemplo n.º 46
0
 private void AddSink(OysterDeviceDiscovery sender, UPnPDevice d)
 {
     Intel.UPNP.UPnPService S = d.GetService("ConnectionService");
     string sFriendlyName = cboOysterDevice.Text;
     string sSerialNumber = (string)cboOysterDevice.SelectedValue;
     int BCount = cboOysterDevice.Items.Count;
     cboOysterDevice.Items.Add(d);
     int ACount = cboOysterDevice.Items.Count;
 }
Exemplo n.º 47
0
 private void RemoveSink(OysterDeviceDiscovery sender, UPnPDevice d)
 {
     Intel.UPNP.UPnPDevice DD = d;
     try
     {
         string sText = cboOysterDevice.Text;
         string sItem = (string)cboOysterDevice.SelectedValue;
         if(cboOysterDevice.SelectedItem == DD)
         {
             cboOysterDevice.SelectedItem = NoDevice;
         }
         cboOysterDevice.Items.Remove(DD);
     }
     catch(Exception Err)
     {
         MessageBox.Show(Err.Message,"Error during Remove device");
     }
 }
Exemplo n.º 48
0
        protected void HandleCreate(UPnPDevice device, Uri URL)
        {
            TreeNode Parent;
            TreeNode Child;
            SortedList TempList = new SortedList();

            Parent = new TreeNode(device.FriendlyName,1,1);
            Parent.Tag = device;
            for(int cid=0;cid<device.Services.Length;++cid)
            {
                Child = new TreeNode(device.Services[cid].ServiceURN,2,2);
                Child.Tag = device.Services[cid];

                TreeNode stateVarNode = new TreeNode("State variables",6,6);
                Child.Nodes.Add(stateVarNode);

                UPnPStateVariable[] varList = device.Services[cid].GetStateVariables();
                TempList.Clear();
                foreach (UPnPStateVariable var in varList)
                {
                    TreeNode varNode = new TreeNode(var.Name,5,5);
                    varNode.Tag = var;
                    TempList.Add(var.Name,varNode);
                    //stateVarNode.Nodes.Add(varNode);
                }
                IDictionaryEnumerator sve = TempList.GetEnumerator();
                while(sve.MoveNext())
                {
                    stateVarNode.Nodes.Add((TreeNode)sve.Value);
                }

                TempList.Clear();
                foreach (UPnPAction action in device.Services[cid].GetActions())
                {
                    string argsstr = "";
                    foreach (UPnPArgument arg in action.ArgumentList)
                    {
                        if(arg.IsReturnValue==false)
                        {
                            if (argsstr != "") argsstr += ", ";
                            argsstr += arg.RelatedStateVar.ValueType + " " + arg.Name;
                        }
                    }

                    TreeNode methodNode = new TreeNode(action.Name+"(" + argsstr + ")",4,4);
                    methodNode.Tag = action;
                    //Child.Nodes.Add(methodNode);
                    TempList.Add(action.Name,methodNode);
                }

                IDictionaryEnumerator ide = TempList.GetEnumerator();
                while(ide.MoveNext())
                {
                    Child.Nodes.Add((TreeNode)ide.Value);
                }
                Parent.Nodes.Add(Child);
            }

            for(int cid=0;cid<device.EmbeddedDevices.Length;++cid)
            {
                Child = ProcessEmbeddedDevice(device.EmbeddedDevices[cid]);
                Child.Tag = device.EmbeddedDevices[cid];
                Parent.Nodes.Add(Child);
            }

            Object[] args = new Object[1];
            args[0] = Parent;
            if(this.IsHandleCreated==true)
            {
                this.Invoke(new UpdateTreeDelegate(HandleTreeUpdate),args);
            }
            else
            {
                HandleTreeUpdate(Parent);
            }
        }
Exemplo n.º 49
0
 /// <summary>
 /// Called when a new device is discovered.
 /// </summary>
 /// <param name="findData">The search for which the UPnP framework is returning results.</param>
 /// <param name="device">The new device which was added.</param>
 /// <param name="guidInterface">The network interface Guid from which the device came.</param>
 void IUPnPDeviceFinderAddCallbackWithInterface.DeviceAddedWithInterface(
     int findData, UPnPDevice device, ref Guid guidInterface)
 {
     if(Discovery != null)
         Discovery.OnDeviceAdded(new DeviceAddedEventArgs(device, guidInterface));
 }
Exemplo n.º 50
0
        private static Device CreateDevice(UPnPDevice upnpDevice)
        {
 
            string ipAddress = ExtractIpAddress(upnpDevice.PresentationURL);

            var device = new Device(upnpDevice.FriendlyName, GetUniqueName(upnpDevice.FriendlyName), ipAddress, DateTime.Now, "HomeOS.Hub.Drivers.AxisCamera");

            //intialize the parameters for this device
            device.Details.DriverParams = new List<string>() { device.UniqueName, "root", "" };

            return device;
        }
 public MediaServer(UPnPDevice mediaServerDevice, string deviceTitle)
 {
     device = mediaServerDevice;
     title = deviceTitle;
 }
Exemplo n.º 52
0
		private static string Browse(UPnPDevice device, string objectId)
		{
			try
			{
				string result;
				if (!Directory.Exists(MediaServerModel.MockPath))
					throw new InvalidOperationException("MockPath '" + MediaServerModel.MockPath + "' does not exist.");
				string inFile = string.Format("{0}+{1}.xml", device.FriendlyName, objectId);
				string inPath = Path.Combine(MediaServerModel.MockPath, inFile);
				if (File.Exists(inPath))
					result = File.ReadAllText(inPath);
				else
				{
					// return a default mock
					inPath = Path.Combine(MediaServerModel.MockPath, string.Format("{0}+default.xml", device.FriendlyName));
					result = File.ReadAllText(inPath);
				}
				return result;
			}
			catch (Exception exception)
			{
				Logger.TraceErr(MethodBase.GetCurrentMethod(), exception);
				return string.Empty;
			}
		}
Exemplo n.º 53
0
 private void AddSink(OysterDeviceDiscovery sender, UPnPDevice d)
 {
     Intel.UPNP.UPnPDevice DD = d;
     Intel.UPNP.UPnPService S = d.GetService("ConnectionService");
     string sFriendlyName = cboOysterDevice.Text;
     string sSerialNumber = (string)cboOysterDevice.SelectedValue;
     int BCount = cboOysterDevice.Items.Count;
     cboOysterDevice.Items.Add(DD);
     int ACount = cboOysterDevice.Items.Count;
     if(cboOysterDevice.SelectedItem == null)
     {
         if(DD.SerialNumber == m_HardCopyOptions.DefaultOysterDeviceID)
         {
             cboOysterDevice.SelectedItem = DD;
             cboOysterDevice.Text = DD.FriendlyName;
         }
     }
 }
Exemplo n.º 54
0
 private void OnRemoveSink(UPnPSmartControlPoint sender, UPnPDevice d)
 {
     RemoveEvent.Fire(this,d);
 }
Exemplo n.º 55
0
 private bool IsHueBridge(UPnPDevice device)
 {
     return (device.ModelURL != null && device.ModelURL.Length > 0 && device.ModelURL.ToLower() == "http://www.meethue.com/");
 }
Exemplo n.º 56
0
 private void OnAddSink(UPnPSmartControlPoint sender, UPnPDevice d)
 {
     AddEvent.Fire(this,d);
 }
Exemplo n.º 57
0
        protected TreeNode ProcessEmbeddedDevice(UPnPDevice device)
        {
            SortedList TempList =new SortedList();
            TreeNode Parent;
            TreeNode Child;

            Parent = new TreeNode(device.FriendlyName,1,1);
            Parent.Tag = device;

            /*
            for(int x=0;x<device.Services.Length;++x)
            {
                device.Services[x].OnInvokeError += new UPnPService.UPnPServiceInvokeErrorHandler(HandleInvokeError);
                device.Services[x].OnInvokeResponse += new UPnPService.UPnPServiceInvokeHandler(HandleInvoke);
            }
            */

            for(int cid=0;cid<device.Services.Length;++cid)
            {
                Child = new TreeNode(device.Services[cid].ServiceURN,2,2);
                Child.Tag = device.Services[cid];

                TreeNode stateVarNode = new TreeNode("State variables",6,6);
                Child.Nodes.Add(stateVarNode);

                UPnPStateVariable[] varList = device.Services[cid].GetStateVariables();
                TempList.Clear();
                foreach (UPnPStateVariable var in varList)
                {
                    TreeNode varNode = new TreeNode(var.Name,5,5);
                    varNode.Tag = var;
                    TempList.Add(var.Name,varNode);
                    //stateVarNode.Nodes.Add(varNode);
                }
                IDictionaryEnumerator sve = TempList.GetEnumerator();
                while(sve.MoveNext())
                {
                    stateVarNode.Nodes.Add((TreeNode)sve.Value);
                }

                TempList.Clear();
                foreach (UPnPAction action in device.Services[cid].GetActions())
                {
                    string argsstr = "";
                    foreach (UPnPArgument arg in action.ArgumentList)
                    {
                        if(arg.IsReturnValue==false)
                        {
                            if (argsstr != "") argsstr += ", ";
                            argsstr += arg.RelatedStateVar.ValueType + " " + arg.Name;
                        }
                    }

                    TreeNode methodNode = new TreeNode(action.Name+"(" + argsstr + ")",4,4);
                    methodNode.Tag = action;
                    //Child.Nodes.Add(methodNode);
                    TempList.Add(action.Name,methodNode);
                }

                IDictionaryEnumerator ide = TempList.GetEnumerator();
                while(ide.MoveNext())
                {
                    Child.Nodes.Add((TreeNode)ide.Value);
                }
                Parent.Nodes.Add(Child);
            }

            for(int cid=0;cid<device.EmbeddedDevices.Length;++cid)
            {
                Child = ProcessEmbeddedDevice(device.EmbeddedDevices[cid]);
                Child.Tag = device.EmbeddedDevices[cid];
                Parent.Nodes.Add(Child);
            }

            return(Parent);
        }
Exemplo n.º 58
0
 /// <summary>
 /// Called when a new device is discovered.
 /// </summary>
 /// <param name="findData">The search for which the UPnP framework is returning results.</param>
 /// <param name="device">The new device which was added.</param>
 void IUPnPDeviceFinderCallback.DeviceAdded(int findData, UPnPDevice device)
 {
     if (Discovery != null)
         Discovery.OnDeviceAdded(new DeviceAddedEventArgs(device));
 }
Exemplo n.º 59
0
 private void RemoveSink(UPnPSmartControlPoint sender, UPnPDevice device)
 {
     ArrayList TempList = new ArrayList();
     TreeNode tn;
     IEnumerator en = UPnpRoot.Nodes.GetEnumerator();
     while(en.MoveNext())
     {
         tn = (TreeNode)en.Current;
         if(((UPnPDevice)tn.Tag).UniqueDeviceName==device.UniqueDeviceName)
         {
             TempList.Add(tn);
         }
     }
     for(int x=0;x<TempList.Count;++x)
     {
         UPnpRoot.Nodes.Remove((TreeNode)TempList[x]);
     }
 }