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