예제 #1
0
 public OhNetLibraryWrapper()
 {
     OpenHome.Net.Core.InitParams initialisationParams = new OpenHome.Net.Core.InitParams
     {
         // Nothing to set, yet!
     };
     iLibrary = new OpenHome.Net.Core.Library();
     iLibrary.Initialise(initialisationParams);
     iLibrary.StartCp();
 }
예제 #2
0
        public OhNetLibraryWrapper()
        {
            OpenHome.Net.Core.InitParams initialisationParams = new OpenHome.Net.Core.InitParams
            {
                // Nothing to set, yet!
            };
            iLibrary = new OpenHome.Net.Core.Library();
            iLibrary.Initialise(initialisationParams);
            IntPtr subnetList = iLibrary.SubnetListCreate();
            IntPtr nif        = iLibrary.SubnetAt(subnetList, 0);
            uint   subnet     = iLibrary.NetworkAdapterSubnet(nif);

            iLibrary.SubnetListDestroy(subnetList);
            iLibrary.StartCp(subnet);
        }
예제 #3
0
        /// <summary>
        /// Starts a new DeviceController for controlling UPnP-Media-Renderer in your network.
        /// </summary>
        /// <param name="networkAdapterIndex"></param>
        public Controller(uint networkAdapterIndex = 0)
        {
            deviceList = new Dictionary<string, UPnPDevice>();

            OpenHome.Net.Core.InitParams initParams = new OpenHome.Net.Core.InitParams();
            lib = OpenHome.Net.Core.Library.Create(initParams);
            OpenHome.Net.Core.SubnetList subnetList = new OpenHome.Net.Core.SubnetList();
            if (networkAdapterIndex >= subnetList.Size())
                networkAdapterIndex = 0;
            OpenHome.Net.Core.NetworkAdapter nif = subnetList.SubnetAt(networkAdapterIndex);
            uint subnet = nif.Subnet();
            Utils.Logger.Log(Utils.Logger.Level.Info, "Using adapter: " + nif.Name());
            subnetList.Dispose();
            lib.StartCp(subnet);

            startListening();
        }