/// <summary> /// Constructs a new Control Point, and waits for your commands and receives events /// </summary> public UPnPControlPoint() { CreateTable = Hashtable.Synchronized(new Hashtable()); NetInfo = new NetworkInfo(new NetworkInfo.InterfaceHandler(NewInterface)); SyncData = ArrayList.Synchronized(new ArrayList()); SSDPSessions = Hashtable.Synchronized(new Hashtable()); Lifetime = new LifeTimeMonitor(); Lifetime.OnExpired += new LifeTimeMonitor.LifeTimeHandler(HandleExpired); SSDPServer = new SSDP(65535); SSDPServer.OnNotify += new SSDP.NotifyHandler(HandleNotify); }
public UPnPControlPoint(NetworkInfo ni) { CreateTable = Hashtable.Synchronized(new Hashtable()); NetInfo = ni; SyncData = ArrayList.Synchronized(new ArrayList()); SSDPSessions = Hashtable.Synchronized(new Hashtable()); Lifetime = new LifeTimeMonitor(); Lifetime.OnExpired += new LifeTimeMonitor.LifeTimeHandler(HandleExpired); SSDPServer = new SSDP(65535); SSDPServer.OnNotify += new SSDP.NotifyHandler(HandleNotify); }
public UPnPControlPoint(NetworkInfo ni) { CreateTable = Hashtable.Synchronized(new Hashtable()); NetInfo = (null != ni) ? ni : new NetworkInfo(new NetworkInfo.InterfaceHandler(NewInterface)); SyncData = ArrayList.Synchronized(new ArrayList()); SSDPSessions = Hashtable.Synchronized(new Hashtable()); Lifetime = new LifeTimeMonitor(); Lifetime.OnExpired += new LifeTimeMonitor.LifeTimeHandler(HandleExpired); SSDPServer = new SSDP(65535); SSDPServer.OnNotify += new SSDP.NotifyHandler(HandleNotify); SSDPServer.OnSniffPacket += new SSDP.SnifferHandler(HandleSniffer); }
/// <summary> /// Constructs a new Control Point, and waits for your commands and receives events /// </summary> public UPnPControlPoint() { CreateTable = Hashtable.Synchronized(new Hashtable()); NetInfo = new NetworkInfo(new NetworkInfo.InterfaceHandler(NewInterface)); SyncData = ArrayList.Synchronized(new ArrayList()); SSDPSessions = Hashtable.Synchronized(new Hashtable()); Lifetime = new LifeTimeMonitor(); Lifetime.OnExpired += new LifeTimeMonitor.LifeTimeHandler(HandleExpired); SSDPServer = new SSDP(65535); SSDPServer.OnNotify += new SSDP.NotifyHandler(HandleNotify); OpenSource.Utilities.EventLogger.Log(this, System.Diagnostics.EventLogEntryType.Information,"UPnP Object Created"); }
internal UPnPDevice(int DeviceExpiration, double version, String RootDir) { //OpenSource.Utilities.InstanceTracker.Add(this); // Full Device IsRoot = true; parent = null; HasPresentation = true; ControlPointOnly = false; RootPath = RootDir; ExpirationTimeout = DeviceExpiration; WebServerTable = Hashtable.Synchronized(new Hashtable()); VirtualDir_Table = new Hashtable(); VirtualDir_Header_Table = new Hashtable(); if (version == 0) { Major = 1; Minor = 0; } else { DText TempNum = new DText(); TempNum.ATTRMARK = "."; TempNum[0] = version.ToString(); Major = int.Parse(TempNum[1]); if (TempNum.DCOUNT() == 2) { Minor = int.Parse(TempNum[2]); } else { Minor = 0; } } Services = new UPnPService[0]; UniqueDeviceName = Guid.NewGuid().ToString(); SSDPServer = new SSDP(ExpirationTimeout); SSDPServer.OnRefresh += SendNotify; SSDPServer.OnSearch += HandleSearch; }
/// <summary> /// Constructs a UPnPDevice for use as a control point /// </summary> internal UPnPDevice() { //OpenSource.Utilities.InstanceTracker.Add(this); // Control Point Only parent = null; ControlPointOnly = true; Services = new UPnPService[0]; HasPresentation = false; VirtualDir_Table = new Hashtable(); VirtualDir_Header_Table = new Hashtable(); lock (typeof(UPnPDevice)) { if (DeviceCount == 0) { CPWebServerTable = new Hashtable(); CPNetworkInfo = new NetworkInfo(new NetworkInfo.InterfaceHandler(NewCPInterface)); } else { IPAddress[] alist = CPNetworkInfo.GetLocalAddresses(); for (int i = 0; i < alist.Length; ++i) { CP_RegisteredInterfaces[alist[i].ToString()] = true; ((MiniWebServer)CPWebServerTable[alist[i].ToString()]).OnReceive += new MiniWebServer.HTTPReceiveHandler(HandleWebRequest); ((MiniWebServer)CPWebServerTable[alist[i].ToString()]).OnHeader += new MiniWebServer.HTTPReceiveHandler(HandleHeaderRequest); } CPNetworkInfo.OnNewInterface += new NetworkInfo.InterfaceHandler(NewCPInterface); } ++DeviceCount; } SSDPServer = new SSDP(ExpirationTimeout); SSDPServer.OnRefresh += SendNotify; SSDPServer.OnSearch += HandleSearch; }
/* /// <summary> /// Reference to the icon for this device /// </summary> public System.Drawing.Image Icon { get { return _icon; } set { if (this.ControlPointOnly == false) _icon = value; } } public System.Drawing.Image Icon2 { get { return _icon2; } set { if (this.ControlPointOnly == false) _icon2 = value; } } // Favicon. Will not be read from remote device public System.Drawing.Icon favicon { get { return _favicon; } set { if (this.ControlPointOnly == false) _favicon = value; } } */ public void Removed() { // Clean up internal references, to aid Garbage Collector IPAddress[] alist = CPNetworkInfo.GetLocalAddresses(); for (int i = 0; i < alist.Length; ++i) { CP_RegisteredInterfaces[alist[i].ToString()] = true; ((MiniWebServer)CPWebServerTable[alist[i].ToString()]).OnReceive -= new MiniWebServer.HTTPReceiveHandler(HandleWebRequest); ((MiniWebServer)CPWebServerTable[alist[i].ToString()]).OnHeader -= new MiniWebServer.HTTPReceiveHandler(HandleHeaderRequest); } if (SSDPServer != null) { SSDPServer.OnRefresh -= SendNotify; SSDPServer.OnSearch -= HandleSearch; SSDPServer.Dispose(); SSDPServer = null; } if (OnRemoved != null) OnRemoved(this); }
internal UPnPDevice(double version, String UDN) { // Full Device IsRoot = false; VirtualDir_Table = new Hashtable(); VirtualDir_Header_Table = new Hashtable(); parent = null; HasPresentation = true; ControlPointOnly = false; RootPath = ""; if (version == 0) { Major = 1; Minor = 0; } else { DText TempNum = new DText(); TempNum.ATTRMARK = "."; TempNum[0] = version.ToString(); Major = int.Parse(TempNum[1]); if (TempNum.DCOUNT() == 2) { Minor = int.Parse(TempNum[2]); } else { Minor = 0; } } Services = new UPnPService[0]; if (UDN == "") { UniqueDeviceName = Guid.NewGuid().ToString(); } else { UniqueDeviceName = UDN; } SSDPServer = new SSDP(ExpirationTimeout); SSDPServer.OnRefresh += new SSDP.RefreshHandler(SendNotify); SSDPServer.OnSearch += new SSDP.SearchHandler(HandleSearch); }