Example #1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var controlPoint = new UpnpSmartControlPoint();

            controlPoint.OnAddedDevice   += controPoint_OnAddedDevice;
            controlPoint.OnRemovedDevice += controPoint_OnRemovedDevice;
            controlPoint.OnDeviceExpired += controPoint_OnDeviceExpired;

            while (true)
            {
                //Thread.Sleep(1000);
                //Console.WriteLine(".");
                var s = Console.ReadLine();
                if (s == "-" && controlPoint != null)
                {
                    StopControlPoint(controlPoint);
                }
                if (s == "+")
                {
                    StartControlPoint(controlPoint);
                }
                if (s == "s")
                {
                    // Simulate WeMo Switch
                    AddWeMoSwitch();
                }
            }
        }
Example #2
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var controlPoint = new UpnpSmartControlPoint();

            controlPoint.OnAddedDevice   += controPoint_OnAddedDevice;
            controlPoint.OnRemovedDevice += controPoint_OnRemovedDevice;
            controlPoint.OnDeviceExpired += controPoint_OnDeviceExpired;

            while (true)
            {
                //Thread.Sleep(1000);
                //Console.WriteLine(".");
                var s = Console.ReadLine();
                if (s == "-" && controlPoint != null)
                {
                    controlPoint.ShutDown();
                    controlPoint.OnAddedDevice   -= controPoint_OnAddedDevice;
                    controlPoint.OnRemovedDevice -= controPoint_OnRemovedDevice;
                    controlPoint.OnDeviceExpired -= controPoint_OnDeviceExpired;
                    controlPoint = null;
                }
                if (s == "+")
                {
                    controlPoint = new UpnpSmartControlPoint();
                    controlPoint.OnAddedDevice   += controPoint_OnAddedDevice;
                    controlPoint.OnRemovedDevice += controPoint_OnRemovedDevice;
                    controlPoint.OnDeviceExpired += controPoint_OnDeviceExpired;
                }
            }
        }
Example #3
0
 private static void StopControlPoint(UpnpSmartControlPoint controlPoint)
 {
     controlPoint.ShutDown();
     controlPoint.OnAddedDevice   -= controPoint_OnAddedDevice;
     controlPoint.OnRemovedDevice -= controPoint_OnRemovedDevice;
     controlPoint.OnDeviceExpired -= controPoint_OnDeviceExpired;
     controlPoint = null;
 }
Example #4
0
 private static void StartControlPoint(UpnpSmartControlPoint controlPoint)
 {
     StopControlPoint(controlPoint);
     controlPoint = new UpnpSmartControlPoint();
     controlPoint.OnAddedDevice   += controPoint_OnAddedDevice;
     controlPoint.OnRemovedDevice += controPoint_OnRemovedDevice;
     controlPoint.OnDeviceExpired += controPoint_OnDeviceExpired;
 }
Example #5
0
 private static void controPoint_OnRemovedDevice(UpnpSmartControlPoint sender, UPnPDevice device)
 {
     Console.WriteLine("Removed " + device.FriendlyName);
 }
Example #6
0
 private static void controPoint_OnDeviceExpired(UpnpSmartControlPoint sender, UPnPDevice device)
 {
     Console.WriteLine("Expired " + device.FriendlyName);
 }
Example #7
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var controlPoint = new UpnpSmartControlPoint();
            controlPoint.OnAddedDevice += controPoint_OnAddedDevice;
            controlPoint.OnRemovedDevice += controPoint_OnRemovedDevice;
            controlPoint.OnDeviceExpired += controPoint_OnDeviceExpired;

            while (true)
            {
                //Thread.Sleep(1000);
                //Console.WriteLine(".");
                var s = Console.ReadLine();
                if (s == "-" && controlPoint != null)
                {
                    controlPoint.ShutDown();
                    controlPoint.OnAddedDevice -= controPoint_OnAddedDevice;
                    controlPoint.OnRemovedDevice -= controPoint_OnRemovedDevice;
                    controlPoint.OnDeviceExpired -= controPoint_OnDeviceExpired;
                    controlPoint = null;
                }
                if (s == "+")
                {
                    controlPoint = new UpnpSmartControlPoint();
                    controlPoint.OnAddedDevice += controPoint_OnAddedDevice;
                    controlPoint.OnRemovedDevice += controPoint_OnRemovedDevice;
                    controlPoint.OnDeviceExpired += controPoint_OnDeviceExpired;
                }

            }
        }
Example #8
0
 private static void controPoint_OnDeviceExpired(UpnpSmartControlPoint sender, UPnPDevice device)
 {
     Console.WriteLine("Expired " + device.FriendlyName);
 }
Example #9
0
 private static void controPoint_OnRemovedDevice(UpnpSmartControlPoint sender, UPnPDevice device)
 {
     Console.WriteLine("Removed " + device.FriendlyName);
 }