Ejemplo 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);
 }
Ejemplo 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();
        }
Ejemplo n.º 3
0
        public Boxes(Helper aHelper, EventServerUpnp aEventServer, ISsdpNotifyProvider aSsdpNotify, bool aDiscoverProxyDevices)
        {
            iLock           = new object();
            iHelper         = aHelper;
            iEventServer    = aEventServer;
            iListenerNotify = aSsdpNotify;
            iTree           = new Tree(aHelper);

            //listen to the volkano service
            iDeviceListVolkano = new DeviceListUpnp(ServiceVolkano.ServiceType(), iListenerNotify);
            iDeviceListVolkano.EventDeviceAdded   += VolkanoAddedHandler;
            iDeviceListVolkano.EventDeviceRemoved += VolkanoRemovedHandler;

            //listen to the proxy service
            if (aDiscoverProxyDevices)
            {
                iDeviceListProxy = new DeviceListUpnp(ServiceProxy.ServiceType(), iListenerNotify);
                iDeviceListProxy.EventDeviceAdded   += ProxyAddedHandler;
                iDeviceListProxy.EventDeviceRemoved += ProxyRemovedHandler;
            }

            // Configure Service Point Manager
            ServicePointManager.DefaultConnectionLimit = 50;
            ServicePointManager.Expect100Continue      = false;
            ServicePointManager.UseNagleAlgorithm      = false;
        }
Ejemplo n.º 4
0
        internal Item(Helper aHelper, Tree aTree, Device aDevice, EventServerUpnp aEventServer, bool aIsProxy)
        {
            iLock        = new object();
            iHelper      = aHelper;
            iTree        = aTree;
            iEventServer = aEventServer;
            iIsProxy     = aIsProxy;
            iBasicSetup  = new BasicSetup(aDevice, aEventServer);
            iPlayback    = new Playback(aHelper, aDevice, aEventServer);

            if (aIsProxy)
            {
                iServiceProxy = new ServiceProxy(aDevice);
            }
            else
            {
                iServiceVolkano = new ServiceVolkano(aDevice);
            }

            if (Box.IsFallBack(aDevice.Udn) && !aIsProxy)
            {
                iBox = iTree.AddFallbackBox(iBasicSetup, aDevice, aEventServer, iProductId, iBoardId.ToArray(), iBoardType.ToArray(), iBoardDescription.ToArray(), iBoardNumber.ToArray(), iSoftwareVersion);
                GetVersionInfo();
            }
            else
            {
                //wait for service product to collect box data before turning on Box
                iServiceProduct = new ServiceProduct(aDevice, iEventServer);
                iServiceProduct.EventInitial += EventHandlerProductInitial;
            }
        }
Ejemplo n.º 5
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;
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
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;
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
0
        internal BasicSetup(Device aDevice, EventServerUpnp aEventServer)
        {
            iLock = new object();
            if (aDevice.HasService(ServiceConfiguration.ServiceType(1)) > 0)
            {
                iServiceConfiguration = new ServiceConfiguration(aDevice, aEventServer);
                iServiceConfiguration.EventInitial += EventHandlerConfigurationInitial;
                iActionSetParameter             = iServiceConfiguration.CreateAsyncActionSetParameter();
                iActionSetParameter.EventError += SetParameterError;
            }

            if (aDevice.HasService(ServiceVolkano.ServiceType(1)) > 0)
            {
                iServiceVolkano = new ServiceVolkano(aDevice);
                iActionReboot   = iServiceVolkano.CreateAsyncActionReboot();
            }
            iDeviceIpAddress = aDevice.IpAddress;
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
0
        internal Box AddFallbackBox(BasicSetup aBasicSetup, Device aDevice, EventServerUpnp aEventServer, string aProductId, string[] aBoardId, string[] aBoardType, string[] aBoardDescription, string[] aBoardNumber, string aSoftwareVersion)
        {
            string model = aDevice.Model;

            if (model != null && model != "")
            {
                // Originally fallback model was 'Reprogram-Device', pull the device from this
                if (model.Contains("Reprogram-"))
                {
                    string[] list = model.Split('-');
                    if (list.Length > 1)
                    {
                        model = list[1];
                    }
                }
            }
            if (model == null || model == "")
            {
                model = "Unknown";
            }
            return(AddBox(aBasicSetup, model, "Unknown", "Reprogram", aDevice, aEventServer, Box.EState.eFallback, aProductId, aBoardId, aBoardType, aBoardDescription, aBoardNumber, aSoftwareVersion));
        }
Ejemplo n.º 13
0
 internal Box(Helper aHelper, UpdateCheck aUpdateCheck, BasicSetup aBasicSetup, Playback aPlayback, string aModel, Room aRoom, string aName, Device aDevice, EventServerUpnp aEventServer, EState aState, string aProductId, string[] aBoardId, string[] aBoardType, string[] aBoardDescription, string[] aBoardNumber, string aImageUri, string aSoftwareVersion, bool aIsProxy)
 {
     iHelper          = aHelper;
     iModel           = aModel;
     iRoom            = aRoom;
     iName            = aName;
     iDevice          = aDevice;
     iEventServer     = aEventServer;
     iState           = aState;
     iImageUri        = aImageUri;
     iSoftwareVersion = aSoftwareVersion;
     iUpdateCheck     = aUpdateCheck;
     iBasicSetup      = aBasicSetup;
     iUpdateFirmware  = new UpdateFirmware(aHelper);
     iPlayback        = aPlayback;
     iUpdateCheck.GetInfo(aModel, aIsProxy, aSoftwareVersion, aBoardNumber, out iSoftwareUpdateAvailable, out iSoftwareUpdateVersion, out iSoftwareUpdateUrl, out iSoftwareUpdateVariant, out iReleaseNotesHtml);
     iUpdateCheck.EventUpdateCheckComplete += UpdateCheckComplete;
     iUpdateCheck.EventUpdateCheckError    += UpdateCheckError;
     iSysLogPretty = new SysLogPretty(aHelper.ExePath.FullName);
     iProductId    = aProductId;
     iIsProxy      = aIsProxy;
     if (aBoardId != null)
     {
         iBoardId = aBoardId;
     }
     if (aBoardType != null)
     {
         iBoardType = aBoardType;
     }
     if (aBoardDescription != null)
     {
         iBoardDescription = aBoardDescription;
     }
     if (aBoardNumber != null)
     {
         iBoardNumber = aBoardNumber;
     }
 }
Ejemplo n.º 14
0
        public Playback(Helper aHelper, Device aDevice, EventServerUpnp aEventServer)
        {
            iLock        = new object();
            iHelper      = aHelper;
            iDevice      = aDevice;
            iEventServer = aEventServer;

            if (iDevice.HasService(ServicePlaylist.ServiceType(1)) > 0)
            {
                iServicePlaylist = new ServicePlaylist(iDevice, iEventServer);
                iServicePlaylist.EventInitial += EventHandlerPlaylistInitial;
                iActionInsert    = iServicePlaylist.CreateAsyncActionInsert();
                iActionPlay      = iServicePlaylist.CreateAsyncActionPlay();
                iActionSetRepeat = iServicePlaylist.CreateAsyncActionSetRepeat();
                iActionDeleteAll = iServicePlaylist.CreateAsyncActionDeleteAll();
            }

            if (iDevice.HasService(ServiceProduct.ServiceType(1)) > 0)
            {
                iServiceProduct = new ServiceProduct(iDevice, iEventServer);
                iServiceProduct.EventInitial += EventHandlerProductInitial;
                iActionStandby              = iServiceProduct.CreateAsyncActionStandby();
                iActionSetStandby           = iServiceProduct.CreateAsyncActionSetStandby();
                iActionSetSourceIndex       = iServiceProduct.CreateAsyncActionSetSourceIndex();
                iActionSourceIndex          = iServiceProduct.CreateAsyncActionSourceIndex();
                iActionSetSourceIndexByName = iServiceProduct.CreateAsyncActionSetSourceIndexByName();
            }

            if (iDevice.HasService(ServiceVolume.ServiceType(1)) > 0)
            {
                iServiceVolume = new ServiceVolume(iDevice, iEventServer);
                iServiceVolume.EventInitial += EventHandlerVolumeInitial;
                iActionVolumeInc             = iServiceVolume.CreateAsyncActionVolumeInc();
                iActionVolumeDec             = iServiceVolume.CreateAsyncActionVolumeDec();
            }
        }
Ejemplo n.º 15
0
        private Box AddBox(BasicSetup aBasicSetup, Playback aPlayback, string aModel, string aRoom, string aName, Device aDevice, EventServerUpnp aEventServer, Box.EState aState, string aProductId, string[] aBoardId, string[] aBoardType, string[] aBoardDescription, string[] aBoardNumber, string aImageUri, string aSoftwareVersion, bool aIsProxy)
        {
            Room room;
            Box  box;

            Lock();

            if (iRoomList.TryGetValue(aRoom, out room))
            {
                Unlock();
                box = new Box(iHelper, iUpdateCheck, aBasicSetup, aPlayback, aModel, room, aName, aDevice, aEventServer, aState, aProductId, aBoardId, aBoardType, aBoardDescription, aBoardNumber, aImageUri, aSoftwareVersion, aIsProxy);
            }
            else
            {
                room             = new Room(aRoom);
                iRoomList[aRoom] = room;
                Unlock();

                if (EventRoomAdded != null)
                {
                    EventRoomAdded(this, new EventArgsRoom(room));
                }

                box = new Box(iHelper, iUpdateCheck, aBasicSetup, aPlayback, aModel, room, aName, aDevice, aEventServer, aState, aProductId, aBoardId, aBoardType, aBoardDescription, aBoardNumber, aImageUri, aSoftwareVersion, aIsProxy);
            }

            room.AddBox(box);

            return(box);
        }
Ejemplo n.º 16
0
 private Box AddBox(string aModel, string aRoom, string aName, Device aDevice, EventServerUpnp aEventServer, Box.EState aState, string[] aBoardType, string[] aBoardDescription, string[] aBoardNumber, string aImageUri, string aSoftwareVersion)
 {
     // proxy device
     return(AddBox(null, null, aModel, aRoom, aName, aDevice, aEventServer, aState, null, null, aBoardType, aBoardDescription, aBoardNumber, aImageUri, aSoftwareVersion, true));
 }
Ejemplo n.º 17
0
 public Boxes(Helper aHelper, EventServerUpnp aEventServer, ISsdpNotifyProvider aSsdpNotify)
     : this(aHelper, aEventServer, aSsdpNotify, true)
 {
 }
Ejemplo n.º 18
0
 internal Box AddMainBox(BasicSetup aBasicSetup, Playback aPlayback, ServiceProduct aServiceProduct, EventServerUpnp aEventServer, string aProductId, string[] aBoardId, string[] aBoardType, string[] aBoardDescription, string[] aBoardNumber, string aSoftwareVersion)
 {
     return(AddBox(aBasicSetup, aPlayback, aServiceProduct.ModelName, aServiceProduct.ProductRoom, aServiceProduct.ProductName, aServiceProduct.Device, aEventServer, Box.EState.eOn, aProductId, aBoardId, aBoardType, aBoardDescription, aBoardNumber, aServiceProduct.ProductImageUri, aSoftwareVersion, false));
 }
Ejemplo n.º 19
0
 internal Item(Helper aHelper, Tree aTree, Device aDevice, EventServerUpnp aEventServer)
     : this(aHelper, aTree, aDevice, aEventServer, false)
 {
 }
Ejemplo n.º 20
0
 internal Box AddProxyBox(ServiceProduct aServiceProduct, EventServerUpnp aEventServer, string[] aBoardType, string[] aBoardDescription, string[] aBoardNumber, string aSoftwareVersion)
 {
     return(AddBox(aServiceProduct.ModelName, aServiceProduct.ProductRoom, aServiceProduct.ProductName, aServiceProduct.Device, aEventServer, Box.EState.eOn, aBoardType, aBoardDescription, aBoardNumber, aServiceProduct.ProductImageUri, aSoftwareVersion));
 }
Ejemplo n.º 21
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();
        }
Ejemplo n.º 22
0
 private Box AddBox(BasicSetup aBasicSetup, string aModel, string aRoom, string aName, Device aDevice, EventServerUpnp aEventServer, Box.EState aState, string aProductId, string[] aBoardId, string[] aBoardType, string[] aBoardDescription, string[] aBoardNumber, string aSoftwareVersion)
 {
     // fallback device
     return(AddBox(aBasicSetup, null, aModel, aRoom, aName, aDevice, aEventServer, aState, aProductId, aBoardId, aBoardType, aBoardDescription, aBoardNumber, null, aSoftwareVersion, false));
 }