protected async Task Handle(VolumeDownCommand command) { var volume = _volume - command.AsDouble(MessageProperties.ChangeFactor); var cmd = GetKodiCommand("Application.SetVolume", new { volume = (int)volume }); var result = await MessageBroker.QueryService <KodiCommand, JsonRpcResponse>(cmd).ConfigureAwait(false); _volume = await UpdateState(VolumeState.StateName, _volume, volume).ConfigureAwait(false); }
protected async Task Handle(VolumeDownCommand command) { var volume = _volume - command.AsDouble(MessageProperties.ChangeFactor); var cmd = GetJsonCommand("audio", "setAudioVolume", new SonyAudioVolumeRequest("speaker", ((int)volume).ToString())); await MessageBroker.QueryJsonService <SonyJsonQuery, SonyAudioResult>(cmd); _volume = await UpdateState(VolumeState.StateName, _volume, volume); }
protected async Task Handle(VolumeDownCommand command) { var volume = _volume - command.AsDouble(MessageProperties.ChangeFactor); var cmd = new ComputerCommand { Address = _hostname, Service = "Volume", Message = new VolumePost { Volume = volume } }; await MessageBroker.SendToService(cmd).ConfigureAwait(false); _volume = await UpdateState(VolumeState.StateName, _volume, volume).ConfigureAwait(false); }
protected async Task Handle(VolumeDownCommand command) { if (_volume.HasValue) { var changeFactor = command.AsDouble(MessageProperties.ChangeFactor, DEFAULT_VOLUME_CHANGE_FACTOR); var volume = _volume - changeFactor; var normalized = NormalizeVolume(volume.Value); var control = new DenonControlQuery { Command = normalized, Api = "formiPhoneAppVolume", ReturnNode = "MasterVolume", Address = _hostName, Zone = _zone.ToString() }; // Results are unpredictable so we ignore them await MessageBroker.QueryService <DenonControlQuery, string>(control).ConfigureAwait(false); _volume = await UpdateState(VolumeState.StateName, _volume, volume).ConfigureAwait(false); } }