private const int kSsdpSearchDelay = 100; // milliseconds public Interface(IPAddress aAddress, ISsdpNotifyHandler aHandler) { iAddress = aAddress; iListenerUnicast = new SsdpListenerUnicast(aHandler); iListenerNotify = new SsdpListenerMulticast(); iListenerNotify.Add(aHandler); }
public DeviceListUpnp(ServiceType aType) { iType = aType; iListenerUnicast = new SsdpListenerUnicast(this); iLock = new object(); iRescanning = false; iRescanStart = DateTime.Now; iMsearchCount = 0; iTimerRescan = new Timer(); iTimerRescan.Elapsed += RescanTimerExpired; iTimerRescan.AutoReset = false; iTimerRescan.Interval = (kSsdpSearchTime * 1000) + 100; }
public Form1(Helper aHelper) { InitializeComponent(); iDevices = new Dictionary <string, Device>(); iMutex = new Mutex(); iListenerMulticast = new SsdpListenerMulticast(); iListenerMulticast.Add(new MySsdpNotifyHandler(this, true)); iListenerUnicast = new SsdpListenerUnicast(new MySsdpNotifyHandler(this, false)); iHelper = aHelper; iHelper.Stack.SetStack(this); }
private List <Device> SearchForDevices() { SsdpHandler ssdpHandler = new SsdpHandler(); SsdpListenerUnicast ssdp = new SsdpListenerUnicast(ssdpHandler); System.Net.IPAddress ip = System.Net.IPAddress.Parse(iInterface); iLog.Subtest("Searching for UPnP devices for " + iMsearchTime.ToString() + "s"); try { ssdp.Start(ip); ssdp.SsdpMsearchRoot(iMsearchTime); System.Threading.Thread.Sleep(iMsearchTime * 1000 + 2000); ssdp.Stop(); ssdpHandler.DeviceList.Sort(CompareDevs); iLog.Pass("Found " + ssdpHandler.DeviceList.Count + " devices"); } catch (Exception e) { iLog.Fail(e.ToString()); ssdp.Stop(); } return(ssdpHandler.DeviceList); }
public DeviceListUpnp(ServiceType aType) { iType = aType; iListenerUnicast = new SsdpListenerUnicast(this); iTimers = new List <Timer>(); }