예제 #1
0
        private Object HandleTurnOnRequest(JObject request)
        {
            string DeviceID = (string)request["payload"]["appliance"]["applianceId"];

            ErrorLog.Notice("Turning on device {0}\n", DeviceID);
            Appliance   device           = DeviceList.GetDevice(DeviceID);
            ISwitchable switchableDevice = device as ISwitchable;

            if (switchableDevice != null)
            {
                switchableDevice.On();
            }
            // TODO: return an error if not switchable
            return(new Response()
            {
                Header = new Header()
                {
                    Namespace = "Alexa.ConnectedHome.Control",
                    Name = DirectiveName.TurnOnConfirmation,
                    PayloadVersion = "2",
                    MessageID = Guid.NewGuid(),
                },
                Payload = new Dictionary <string, string> {
                },
            });
        }
예제 #2
0
 public void Undo()
 {
     if (_previousState == true)
     {
         _target.Off();
     }
     else
     {
         _target.On();
     }
 }
예제 #3
0
 static void ISwitchMethod(ISwitchable dev, int x)
 {
     if (x == 0)
     {
         dev.Off();
         dev.ViewState();
     }
     else
     {
         dev.On();
         dev.ViewState();
     }
 }
예제 #4
0
 public DisposableAdapter(ISwitchable switchableItem)
 {
     this.switchableItem = switchableItem;
     switchableItem.On();
 }
예제 #5
0
 public void OnButton()
 {
     _switchable.On();
 }
예제 #6
0
 public void Execute()
 {
     _previousState = _target.GetState();
     _target.On();
 }
		public DisposableAdapter(ISwitchable switchableItem)
		{
			this.switchableItem = switchableItem;
			switchableItem.On();
		}