Пример #1
0
        public Runner()
        {
            Console.Write("TestDvDeviceCs - starting\n");

            DeviceBasic device = new DeviceBasic();

            iDeviceList = new List <CpDevice>();
            CpDeviceList.ChangeHandler  added   = new CpDeviceList.ChangeHandler(DeviceAdded);
            CpDeviceList.ChangeHandler  removed = new CpDeviceList.ChangeHandler(DeviceRemoved);
            CpDeviceListUpnpServiceType list    = new CpDeviceListUpnpServiceType("openhome.org", "TestBasic", 1, added, removed);
            Semaphore sem = new Semaphore(0, 1);

            sem.WaitOne(1000);
            Debug.Assert(iDeviceList.Count == 1);
            TestBasicCp cp = new TestBasicCp(iDeviceList[0]);

            cp.TestActions();
            cp.TestSubscriptions();
            list.Dispose();
            lock (this)
            {
                for (int i = 0; i < iDeviceList.Count; i++)
                {
                    iDeviceList[i].RemoveRef();
                }
            }
            device.Dispose();

            Console.Write("TestDvDeviceCs - completed\n");
        }
Пример #2
0
        public Runner()
        {
            Console.Write("TestDvDeviceCs - starting\n");

            DeviceBasic device = new DeviceBasic();
            iDeviceList = new List<CpDevice>();
            CpDeviceList.ChangeHandler added = new CpDeviceList.ChangeHandler(DeviceAdded);
            CpDeviceList.ChangeHandler removed = new CpDeviceList.ChangeHandler(DeviceRemoved);
            CpDeviceListUpnpServiceType list = new CpDeviceListUpnpServiceType("openhome.org", "TestBasic", 1, added, removed);
            Semaphore sem = new Semaphore(0, 1);
            sem.WaitOne(1000);
            Debug.Assert(iDeviceList.Count == 1);
            TestBasicCp cp = new TestBasicCp(iDeviceList[0]);
            cp.TestActions();
            cp.TestSubscriptions();
            list.Dispose();
            lock (this)
            {
                for (int i = 0; i < iDeviceList.Count; i++)
                {
                    iDeviceList[i].RemoveRef();
                }
            }
            device.Dispose();

            Console.Write("TestDvDeviceCs - completed\n");
        }
Пример #3
0
        public static void Main(string[] args)
        {
            InitParams initParams = new InitParams
            {
                MsearchTimeSecs = 1,
                UseLoopbackNetworkAdapter = true
            };
            using (Library lib = Library.Create(initParams))
            {
                SubnetList subnetList = new SubnetList();
                NetworkAdapter nif = subnetList.SubnetAt(0);
                uint subnet = nif.Subnet();
                subnetList.Dispose();
                lib.StartCombined(subnet);

                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");
            }
        }
Пример #4
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();
        }