Esempio n. 1
0
 public NetworkStack(Helper iHelper, System.Net.IPAddress aIpAddress)
 {
     iIpAddress             = aIpAddress;
     iEventServerUpnp       = new EventServerUpnp();
     iSsdpListenerMulticast = new SsdpListenerMulticast();
     iBoxes = new Boxes(iHelper, iEventServerUpnp, iSsdpListenerMulticast);
 }
Esempio n. 2
0
        public HelperKinsky(string[] aArgs, IInvoker aInvoker)
            : base(aArgs)
        {
            iInvoker        = aInvoker;
            iEventServer    = new EventServerUpnp();
            iListenerNotify = new SsdpListenerMulticast();

            IModelFactory factory = new ModelFactory();

            iTopologyHouse = new Linn.Topology.House(iListenerNotify, iEventServer, factory);
            iSenders       = new ModelSenders(iListenerNotify, iEventServer);
            iHouse         = new House(iTopologyHouse, iInvoker, iSenders);

            OptionPage optionPage = new OptionPage("Startup Room");

            iOptionStartupRoom = new OptionStartupRoom(iHouse);
            optionPage.Add(iOptionStartupRoom);
            AddOptionPage(optionPage);

            //optionPage = new OptionPage("Cloud Servers");
            iOptionCloudServers = new OptionListUri("cloudservers", "Server locations", "List of locations for cloud media servers", new List <Uri>());
            //optionPage.Add(iOptionCloudServers);
            //AddOptionPage(optionPage);

            iOptionLastSelectedRoom = new OptionString("lastroom", "Last Selected Room", "The last room selected", string.Empty);
            AddOption(iOptionLastSelectedRoom);

            iOptionLastLocation = new OptionBreadcrumbTrail("lastlocation", "Last Location", "The last location visited by the browser", BreadcrumbTrail.Default);
            AddOption(iOptionLastLocation);

            iBookmarkManager = new BookmarkManager(Path.Combine(DataPath.FullName, "Bookmarks.xml"));

            Stack.SetStack(this);
        }
Esempio n. 3
0
        public App(Helper aHelper, Form1 aForm)
        {
            iForm         = aForm;
            iForm.Load   += this.OnLoad;
            iForm.Closed += this.OnClosed;
            iForm.ListViewRoom.SelectedIndexChanged   += this.EventRoomSelectedIndexChanged;
            iForm.ListViewSource.SelectedIndexChanged += this.EventSourceSelectedIndexChanged;
            iForm.MenuItemAbout.Click   += this.MenuItemAboutClick;
            iForm.MenuItemDebug.Click   += this.MenuItemDebugClick;
            iForm.MenuItemOptions.Click += this.MenuItemOptionsClick;

            iHelper = aHelper;
            iHelper.Stack.SetStack(this);
            iHelper.Stack.EventStatusChanged += StackStatusChanged;

            iEventServer    = new EventServerUpnp();
            iListenerNotify = new SsdpListenerMulticast();

            iHouse = new House(iListenerNotify, iEventServer, new ModelFactory());
            iHouse.EventRoomAdded   += RoomAdded;
            iHouse.EventRoomRemoved += RoomRemoved;

            iLibrary = new Library(iListenerNotify);
            iLibrary.EventMediaServerAdded   += LibraryAdded;
            iLibrary.EventMediaServerRemoved += LibraryRemoved;
        }
Esempio n. 4
0
        public Form1(Helper aHelper)
        {
            InitializeComponent();

            iDevices      = new SortedList <string, Device>();
            iDevicesMutex = new Mutex();

            iServiceDiagnosticsMutex = new Mutex();
            iResultMutex             = new Mutex();

            iRefresh      = 0;
            iTimerRefresh = new System.Threading.Timer(RefreshElapsed);
            iRefreshMutex = new Mutex();

            comboBoxRefresh.SelectedIndex = 0;

            iActionsStart = true;

            // create discovery system

            iHelper = aHelper;

            iListener = new SsdpListenerMulticast();

            iDeviceList = new DeviceListUpnp(ServiceDiagnostics.ServiceType(), iListener);
            iDeviceList.EventDeviceAdded   += DeviceAdded;
            iDeviceList.EventDeviceRemoved += DeviceRemoved;

            iHelper.Stack.SetStack(this);
            iHelper.Stack.Start();
        }
Esempio n. 5
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);
            }
        }
Esempio n. 6
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();
        }
Esempio n. 7
0
            private const int kSsdpSearchDelay  = 100; // milliseconds

            public Interface(IPAddress aAddress, ISsdpNotifyHandler aHandler)
            {
                iAddress         = aAddress;
                iListenerUnicast = new SsdpListenerUnicast(aHandler);
                iListenerNotify  = new SsdpListenerMulticast();
                iListenerNotify.Add(aHandler);
            }
Esempio n. 8
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);
        }
Esempio n. 9
0
        public Form1(IHelper aHelper)
        {
            InitializeComponent();

            Closed += Form1_FormClosed;

            iHelper = aHelper;

            iEventServer    = new EventServerUpnp();
            iListenerNotify = new SsdpListenerMulticast();
            iModelLibrary   = new ModelLibrary(iListenerNotify, iEventServer);

            iModelLibrary.EventContainerUpdated += EventContainerUpdated;
        }
Esempio n. 10
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);
 }
Esempio n. 11
0
        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);
        }
Esempio n. 12
0
        public HelperKinsky(string[] aArgs, IInvoker aInvoker)
            : base(aArgs)
        {
            iInvoker        = aInvoker;
            iEventServer    = new EventServerUpnp();
            iListenerNotify = new SsdpListenerMulticast();

            IModelFactory factory = new ModelFactory();

            iTopologyHouse = new Linn.Topology.House(iListenerNotify, iEventServer, factory);
            iSenders       = new ModelSenders(iListenerNotify, iEventServer);
            iHouse         = new House(iTopologyHouse, iInvoker, iSenders);

            OptionPage optionPage = new OptionPage("Startup Room");

            iOptionStartupRoom = new OptionStartupRoom(iHouse);
            optionPage.Add(iOptionStartupRoom);
            AddOptionPage(optionPage);

            //optionPage = new OptionPage("Cloud Servers");
            iOptionCloudServers = new OptionListUri("cloudservers", "Server locations", "List of locations for cloud media servers", new List <Uri>());
            //optionPage.Add(iOptionCloudServers);
            //AddOptionPage(optionPage);

            iOptionInstallId = new OptionString("installid", "InstallId", "Unique installation identifer", Guid.NewGuid().ToString());
            AddOption(iOptionInstallId);

            iOptionLastNotificationVersion = new OptionUint("lastnotificationversion", "LastNotificationVersion", "last version of notification feed viewed", 0);
            AddOption(iOptionLastNotificationVersion);

            iOptionLastAcknowledgedNotificationVersion = new OptionUint("lastacknowledgednotificationversion", "LastAcknowledgedNotificationVersion", "last version of notification feed acknowledged", 0);
            AddOption(iOptionLastAcknowledgedNotificationVersion);

            iOptionLastNotificationDate = new OptionDateTime("lastnotificationdate", "LastNotificationDate", "last date notification feed viewed", DateTime.MinValue);
            AddOption(iOptionLastNotificationDate);

            iOptionLastSelectedRoom = new OptionString("lastroom", "Last Selected Room", "The last room selected", string.Empty);
            AddOption(iOptionLastSelectedRoom);

            iOptionLastLocation = new OptionBreadcrumbTrail("lastlocation", "Last Location", "The last location visited by the browser", BreadcrumbTrail.Default);
            AddOption(iOptionLastLocation);

            iBookmarkManager = new BookmarkManager(Path.Combine(DataPath.FullName, "Bookmarks.xml"));

            Stack.SetStack(this);
        }
Esempio n. 13
0
        public DeviceFinder(string aUglyName)
        {
            iUglyName = aUglyName;

            ServiceType type = ServiceVolkano.ServiceType();

            type.Version = 1;

            iListener = new SsdpListenerMulticast();

            iDeviceList = new DeviceListUpnp(type, iListener);

            iDeviceList.EventDeviceAdded += DeviceAdded;

            iSemaphore = new ManualResetEvent(false);

            iFound = false;
        }
Esempio n. 14
0
        public Form1(Helper aHelper, string aFriendlyName, uint aIterations)
        {
            InitializeComponent();

            MinimizeBox = true;
            iHelper     = aHelper;

            iFriendlyName = aFriendlyName;
            iIterations   = aIterations;

            iListenerNotify    = new SsdpListenerMulticast();
            iDeviceListProduct = new DeviceListUpnp(ServiceProduct.ServiceType(), iListenerNotify);

            iDeviceListProduct.EventDeviceAdded   += EventDeviceAdded;
            iDeviceListProduct.EventDeviceRemoved += EventDeviceRemoved;

            iHelper.Stack.SetStack(this);
        }
Esempio n. 15
0
        // This method is invoked when the application has loaded its UI and its ready to run
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            iHelper = new Helper(new string[] {});
            iHelper.ProcessOptionsFileAndCommandLine();
            iHelper.Stack.SetStack(this);
            iHelper.Stack.EventStatusChanged += StackStatusChanged;

            //Trace.Level = Trace.kUpnp | Trace.kTopology;

            iEventServer    = new EventServerUpnp();
            iListenerNotify = new SsdpListenerMulticast();
            iHouse          = new House(iListenerNotify, iEventServer, new ModelFactory());

            splitViewController.Delegate = new SplitViewControllerDelegate();

            UINavigationController navigation = splitViewController.ViewControllers[0] as UINavigationController;

            if (navigation != null)
            {
                RoomTableViewController room = navigation.TopViewController as RoomTableViewController;
                if (room != null)
                {
                    room.SetHouse(iHouse);

                    navigation = splitViewController.ViewControllers[1] as UINavigationController;
                    if (navigation != null)
                    {
                        SourceTableViewController source = navigation.TopViewController as SourceTableViewController;
                        if (source != null)
                        {
                            room.SetSourceTableViewController(source);
                        }
                    }
                }
            }

            window.AddSubview(splitViewController.View);

            window.MakeKeyAndVisible();

            iHelper.Stack.Start();

            return(true);
        }
Esempio n. 16
0
        private void StartStack()
        {
            iUserLogListener = new AndroidUserLogListener();
            UserLog.AddListener(iUserLogListener);
            iTraceListener = new AndroidTraceListener();
            Trace.AddListener(iTraceListener);
            iWifiManager = (WifiManager)GetSystemService(Context.WifiService);
            if (iWifiManager != null)
            {
                iWifiLock = iWifiManager.CreateWifiLock("myWifiLock");
                iWifiLock.Acquire();
                iMulticastLock = iWifiManager.CreateMulticastLock("myMcastlock");
                iMulticastLock.Acquire();
            }

            iHelper = new Helper(new string[0] {
            });
            OptionPageCrashDumper optionCrashDumper = new OptionPageCrashDumper("Crash Logs");

            iHelper.AddOptionPage(optionCrashDumper);
            iWifiListener = new WifiListener(this, iHelper);
            iWifiListener.Refresh(this.ApplicationContext);

            iHelper.ProcessOptionsFileAndCommandLine();
            iHelper.Stack.SetStack(this);
            iCrashLogDumper = new CrashDumper(this.ApplicationContext, Resource.Drawable.Icon, iHelper, optionCrashDumper);
            iHelper.AddCrashLogDumper(iCrashLogDumper);
            iEventServer    = new EventServerUpnp();
            iListenerNotify = new SsdpListenerMulticast();

            iHouse = new House(iListenerNotify, iEventServer, new ModelFactory());
            iHouse.EventRoomAdded   += RoomAdded;
            iHouse.EventRoomRemoved += RoomRemoved;

            iLibrary = new Library(iListenerNotify);
            iLibrary.EventMediaServerAdded   += LibraryAdded;
            iLibrary.EventMediaServerRemoved += LibraryRemoved;

            iRescanTimer          = new System.Timers.Timer(kRescanTimeoutMilliseconds);
            iRescanTimer.Elapsed += (d, e) =>
            {
                if (iHelper.Stack.Status.State == EStackState.eOk)
                {
                    try
                    {
                        if (iHouse != null)
                        {
                            iHouse.Rescan();
                        }

                        if (iLibrary != null)
                        {
                            iLibrary.Rescan();
                        }
                    }
                    catch (Exception ex)
                    {
                        UserLog.WriteLine("Error caught on rescan: " + ex);
                    }
                }
            };

            iHelper.Stack.Start();
        }