Ejemplo n.º 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();
                }
            }
        }
Ejemplo n.º 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;
                }
            }
        }
Ejemplo n.º 3
0
 private static void StopControlPoint(UpnpSmartControlPoint controlPoint)
 {
     controlPoint.ShutDown();
     controlPoint.OnAddedDevice   -= controPoint_OnAddedDevice;
     controlPoint.OnRemovedDevice -= controPoint_OnRemovedDevice;
     controlPoint.OnDeviceExpired -= controPoint_OnDeviceExpired;
     controlPoint = null;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 5
0
 private static void controPoint_OnRemovedDevice(UpnpSmartControlPoint sender, UPnPDevice device)
 {
     Console.WriteLine("Removed " + device.FriendlyName);
 }
Ejemplo n.º 6
0
 private static void controPoint_OnDeviceExpired(UpnpSmartControlPoint sender, UPnPDevice device)
 {
     Console.WriteLine("Expired " + device.FriendlyName);
 }
Ejemplo n.º 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;
                }

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