Exemplo n.º 1
0
        private void FormDevices_Load(object sender, EventArgs e)
        {
            try {
                // create discovery system
                iListenerNotify = new SsdpListenerMulticast();

                // create device lists
                iDeviceListJukebox = new DeviceListUpnp(ServiceJukebox.ServiceType(1), iListenerNotify);

                // hook in to discovery events
                iDeviceListJukebox.EventDeviceAdded   += DeviceAlive;
                iDeviceListJukebox.EventDeviceRemoved += DeviceByeBye;

                NetworkInfoModel iface = iHelper.Interface.Interface.Info;
                if (iface != null)
                {
                    // start discovery process
                    iListenerNotify.Start(iface.IPAddress);
                    iDeviceListJukebox.Start(iface.IPAddress);

                    // improve discovery process
                    iDeviceListJukebox.Rescan();
                }
                else
                {
                    DiscoveryFailed("Device discovery failed: no valid network interface card selected");
                }
            }
            catch (Linn.Network.NetworkError ne) {
                DiscoveryFailed("NetworkError on device discovery: " + ne.Message);
            }
            catch (Exception exc) {
                DiscoveryFailed("Error on device discovery: " + exc.Message);
            }
        }
Exemplo n.º 2
0
        public Form1(AppKinskyWinForm aApp)
        {
            InitializeComponent();

            iApp = aApp;

            iEventServer  = new EventServerUpnp();
            iSsdpListener = new SsdpListenerMulticast();
            IMediaProviderSupportV6 support = new MediaProviderSupport(new AppSupport(aApp, iEventServer, iSsdpListener), new ViewSupport(), new PlaylistSupport(), new ArtworkCache(ArtworkCache.ECacheSize.eSmall));

            MediaProviderLibraryFactory factory = new MediaProviderLibraryFactory();

            iLibrary = factory.Create(support);

            SuspendLayout();

            iLibrary.Control.Dock = DockStyle.Fill;
            //iLibrary.Control.Height = Height - button1.Height - button2.Height;

            Controls.Clear();

            Controls.Add(iLibrary.Control);
            Controls.Add(this.button2);
            Controls.Add(this.button1);

            ResumeLayout(false);

            iEventServer.Start(aApp.Interface);
            iSsdpListener.Start(aApp.Interface);
            iLibrary.Start();

            iLibrary.Open();
        }
Exemplo n.º 3
0
        public void Start(IPAddress aIpAddress)
        {
            iEventServer.Start(aIpAddress);
            iListenerNotify.Start(aIpAddress);
            iHouse.Start(aIpAddress);

            iHouse.Rescan();
        }
Exemplo n.º 4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            IPAddress addr = iHelper.Interface.Interface.Info.IPAddress;

            iEventServer.Start(addr);
            iListenerNotify.Start(addr);
            iModelLibrary.Start(addr);
        }
Exemplo n.º 5
0
        void IStack.Start(System.Net.IPAddress aIpAddress)
        {
            iEventServer             = new EventServerUpnp();
            iListenerNotify          = new SsdpListenerMulticast();
            iBoxes                   = new Boxes(iHelper, iEventServer, iListenerNotify);
            iBoxes.EventRoomAdded   += RoomAddedHandler;
            iBoxes.EventRoomRemoved += RoomRemovedHandler;

            iEventServer.Start(aIpAddress);
            iListenerNotify.Start(aIpAddress);
            iBoxes.Start(aIpAddress);
        }
Exemplo n.º 6
0
        private void button2_Click(object sender, EventArgs e)
        {
            iLibrary.Close();

            iLibrary.Stop();
            iSsdpListener.Stop();
            iEventServer.Stop();

            iEventServer.Start(iApp.Interface);
            iSsdpListener.Start(iApp.Interface);
            iLibrary.Start();

            iLibrary.Open();
        }
Exemplo n.º 7
0
 public Finder(IPAddress aInterface, IConsole aConsole, string aUglyName)
 {
     iInterface        = aInterface;
     iConsole          = aConsole;
     iUglyName         = aUglyName;
     iMutex            = new Mutex();
     iIsFound          = new ManualResetEvent(false);
     iIsBootModeSet    = new ManualResetEvent(false);
     iIsRebootAccepted = new ManualResetEvent(false);
     iIsByeByeReceived = new ManualResetEvent(false);
     iIsAliveReceived  = new ManualResetEvent(false);
     iListener         = new SsdpListenerMulticast();
     iListener.Add(this);
     iListener.Start(iInterface);
 }
Exemplo n.º 8
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());
        }
Exemplo n.º 9
0
 void IStack.Start(IPAddress aIpAddress)
 {
     iListenerNotify.Start(aIpAddress);
     iDeviceListProduct.Start(aIpAddress);
 }