Пример #1
0
        public Device Find(IPAddress aInterface, int aTimeout) // in milliseconds
        {
            Trace.WriteLine(Trace.kTopology, "DeviceFinder Find: " + iUglyName);

            iListener.Start(aInterface);
            iDeviceList.Start(aInterface);

            iSemaphore.WaitOne(aTimeout, false);

            Trace.WriteLine(Trace.kTopology, "DeviceFinder Found: " + iUglyName);

            iDeviceList.Stop();
            iListener.Stop();

            if (iFound)
            {
                return(iDevice);
            }

            throw (new DeviceFinderException());
        }
Пример #2
0
        public bool FindDevice()
        {
            iIsFound.Reset();

            iDeviceList = new DeviceListUpnp(ServiceVolkano.ServiceType(), iListener);

            iDeviceList.EventDeviceAdded += DeviceAdded;

            iDeviceList.Start(iInterface);

            bool result = false;

            uint i = kMaxFindRetries;

            while (i-- > 0)
            {
                iConsole.Write("Finding " + iUglyName + " ................ ");

                if (WaitFor(iIsFound, kMaxFindSeconds))
                {
                    result = true;
                    break;
                }

                if (i > 0)
                {
                    iConsole.Write("Retry");
                    iConsole.Newline();
                    iDeviceList.Rescan();
                }
            }

            iDeviceList.EventDeviceAdded -= DeviceAdded;
            iDeviceList.Stop();

            return(result);
        }
Пример #3
0
 void IStack.Stop()
 {
     iDeviceListProduct.Stop();
     iListenerNotify.Stop();
 }