Initialisation and finalisation of this library, plus utility functions
Наследование: IDisposable
Пример #1
0
 public static void Main(string[] args)
 {
     Core.InitParams initParams = new Core.InitParams();
     Core.Library lib = new Core.Library();
     lib.Initialise(initParams);
     lib.StartCp();
     new Runner((int)initParams.MsearchTimeSecs);
     lib.Close();
 }
Пример #2
0
 public static void Main(string[] args)
 {
     InitParams initParams = new InitParams
     {
         MsearchTimeSecs = 1,
         UseLoopbackNetworkInterface = true
     };
     Library lib = new Library();
     lib.Initialise(initParams);
     lib.StartCombined();
     new Runner();
     lib.Close();
 }
Пример #3
0
 public static void Main(string[] args)
 {
     Core.InitParams initParams = new Core.InitParams();
     using (Core.Library lib = Core.Library.Create(initParams))
     {
         Core.SubnetList     subnetList = new Core.SubnetList();
         Core.NetworkAdapter nif        = subnetList.SubnetAt(0);
         uint subnet = nif.Subnet();
         Console.WriteLine("Using adapter: {0}", nif.Name());
         subnetList.Dispose();
         lib.StartCp(subnet);
         new Runner((int)initParams.MsearchTimeSecs);
     }
 }
Пример #4
0
 public static void Main(string[] args)
 {
     // !!!! add OptionParser class rather than relying on the user guessing that the first arg
     // is an int 1..3 and the second is the path of a folder that'll serve a test UI
     Core.InitParams initParams = new Core.InitParams();
     using (Core.Library lib = Core.Library.Create(initParams))
     {
         lib.StartDv();
         Console.Write("TestDvLights - starting\n");
         DeviceLights device  = new DeviceLights(Convert.ToInt32(args[0]), args[1]);
         Semaphore    blocker = new Semaphore(0, 1);
         blocker.WaitOne(60 * 60 * 1000); // make the device available for 1 hour then assume we've been forgotten about and exit
         device.Dispose();
         Console.Write("TestDvLights - exiting\n");
     }
 }
Пример #5
0
 public Runner()
 {
     iInitParams = new InitParams();
     iInitParams.DvUpnpWebServerPort = 0;
     iInitParams.LogOutput = new MessageListener(Log);
     iInitParams.SubnetListChangedListener = new ChangedListener(SubnetListChanged);
     iInitParams.SubnetAddedListener = new NetworkAdapterListener(SubnetAdded);
     iInitParams.SubnetRemovedListener = new NetworkAdapterListener(SubnetRemoved);
     iInitParams.NetworkAdapterChangedListener = new NetworkAdapterListener(NetworkAdapterChanged);
     iLibrary = Library.Create(iInitParams);
     Library.SetDebugLevel(Library.DebugLevel.Trace);
     SubnetList subnetList = new SubnetList();
     NetworkAdapter nif = subnetList.SubnetAt(0);
     uint subnet = nif.Subnet();
     subnetList.Dispose();
     iLibrary.StartCombined(subnet);
 }
Пример #6
0
        public static void Main(string[] args)
        {
            InitParams initParams = new InitParams
            {
                MsearchTimeSecs = 1,
                UseLoopbackNetworkInterface = true
            };
            Library lib = new Library();
            lib.Initialise(initParams);
            lib.StartCombined();

            Console.Write("TestCpDeviceDvCs - starting\n");
            DeviceBasic device = new DeviceBasic();
            CpDeviceDv cpDevice = new CpDeviceDv(device.Device());
            TestBasicCp cp = new TestBasicCp(cpDevice);
            cp.TestActions();
            cp.TestSubscriptions();
            cpDevice.RemoveRef();
            device.Dispose();
            Console.Write("TestCpDeviceDvCs - completed\n");

            lib.Close();
        }
Пример #7
0
 /// <summary>
 /// Create the library instance.
 /// </summary>
 /// <remarks>Only one instance per process is allowed.
 /// This must be called before any other library function.</remarks>
 public static Library Create(InitParams aParams)
 {
     Library instance = new Library();
     instance.Initialise(aParams);
     return instance;
 }
Пример #8
0
        public override void init()
        {
            mh = new InitParams.MessageHandler(mhCb);
                ml = new MessageListener(mh);

                OpenHome.Net.Core.InitParams initParams = new OpenHome.Net.Core.InitParams();
                OpenHome.Net.Core.Library.SetDebugLevel(Library.DebugLevel.Error);
                initParams.LogOutput = ml;
                lib = OpenHome.Net.Core.Library.Create(initParams);
                OpenHome.Net.Core.SubnetList subnetList = new OpenHome.Net.Core.SubnetList();
                OpenHome.Net.Core.NetworkAdapter nif = subnetList.SubnetAt((uint)networkConnectInfo.subNetIndex);
                this.delegateStartingNetwork(nif.FullName());
                uint subnet = nif.Subnet();
                subnetList.Dispose();
                lib.StartCp(subnet);
        }
Пример #9
0
 public static void Main(string[] args)
 {
     // !!!! add OptionParser class rather than relying on the user guessing that the first arg
     // is an int 1..3 and the second is the path of a folder that'll serve a test UI
     Core.InitParams initParams = new Core.InitParams();
     Core.Library lib = new Core.Library();
     lib.Initialise(initParams);
     lib.StartDv();
     Console.Write("TestDvLights - starting\n");
     DeviceLights device = new DeviceLights(Convert.ToInt32(args[0]), args[1]);
     Semaphore blocker = new Semaphore(0, 1);
     blocker.WaitOne(60 * 60 * 1000); // make the device available for 1 hour then assume we've been forgotten about and exit
     device.Dispose();
     Console.Write("TestDvLights - exiting\n");
     lib.Close();
 }