Ejemplo n.º 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> {
                },
            });
        }
Ejemplo n.º 2
0
 public void Undo()
 {
     if (_previousState == true)
     {
         _target.Off();
     }
     else
     {
         _target.On();
     }
 }
Ejemplo n.º 3
0
 static void ISwitchMethod(ISwitchable dev, int x)
 {
     if (x == 0)
     {
         dev.Off();
         dev.ViewState();
     }
     else
     {
         dev.On();
         dev.ViewState();
     }
 }
Ejemplo n.º 4
0
 public DisposableAdapter(ISwitchable switchableItem)
 {
     this.switchableItem = switchableItem;
     switchableItem.On();
 }
Ejemplo n.º 5
0
 public void OnButton()
 {
     _switchable.On();
 }
Ejemplo n.º 6
0
 public void Execute()
 {
     _previousState = _target.GetState();
     _target.On();
 }
		public DisposableAdapter(ISwitchable switchableItem)
		{
			this.switchableItem = switchableItem;
			switchableItem.On();
		}