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

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

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