protected async Task Handle(VolumeSetCommand command) { var volume = command.AsDouble(MessageProperties.Value); 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(VolumeSetCommand command) { var volume = command.AsDouble(MessageProperties.Value); var cmd = GetKodiCommand("Application.SetVolume", new { volume }); var result = await MessageBroker.QueryService <KodiCommand, JsonRpcResponse>(cmd).ConfigureAwait(false); _volume = await UpdateState(VolumeState.StateName, _volume, volume).ConfigureAwait(false); }
public static VolumeSetCommand Create(double volume) { var command = new VolumeSetCommand { Value = volume }; return(command); }
public override async Task RunTask(int taskId) { switch (taskId) { case 0: MessageBroker.Send(VolumeUpCommand.Default, Uid); break; case 1: MessageBroker.Send(VolumeDownCommand.Default, Uid); break; case 2: MessageBroker.Send(TurnOnCommand.Default, Uid); break; case 3: MessageBroker.Send(TurnOffCommand.Default, Uid); break; case 4: MessageBroker.Send(VolumeSetCommand.Create(40), Uid); break; case 5: MessageBroker.Send(MuteCommand.Default, Uid); break; case 6: MessageBroker.Send(UnmuteCommand.Default, Uid); break; case 7: MessageBroker.Send(InputSetCommand.Create("HDMI1"), Uid); break; case 8: var command = new SonyRegisterQuery(); var result = await MessageBroker.Request <SonyRegisterQuery, string>(command, "Sony"); ConsoleEx.WriteTitleLine("Enter PIN from TV:"); var pin = Console.ReadLine(); command.PIN = pin; result = await MessageBroker.Request <SonyRegisterQuery, string>(command, "Sony"); Console.WriteLine($"Device was registered successfully. Application hash: {result}"); break; } }
protected async Task Handle(VolumeSetCommand command) { var volume = command.AsDouble(MessageProperties.Value); 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(VolumeSetCommand command) { var volume = command.AsDouble(MessageProperties.Value); var normalized = NormalizeVolume(volume); var control = new DenonControlQuery { Command = normalized, Api = "formiPhoneAppVolume", ReturnNode = "MasterVolume", Address = _hostName, Zone = _zone.ToString() }; await MessageBroker.QueryService <DenonControlQuery, string>(control).ConfigureAwait(false); _volume = await UpdateState(VolumeState.StateName, _volume, volume).ConfigureAwait(false); }
public override Task RunTask(int taskId) { switch (taskId) { case 0: MessageBroker.Send(VolumeUpCommand.Default, Uid); break; case 1: MessageBroker.Send(VolumeDownCommand.Default, Uid); break; case 2: MessageBroker.Send(TurnOnCommand.Default, Uid); break; case 3: MessageBroker.Send(TurnOffCommand.Default, Uid); break; case 4: MessageBroker.Send(VolumeSetCommand.Create(40), Uid); break; case 5: MessageBroker.Send(MuteCommand.Default, Uid); break; case 6: MessageBroker.Send(UnmuteCommand.Default, Uid); break; case 7: MessageBroker.Send(PlayCommand.Default, Uid); break; case 8: MessageBroker.Send(StopCommand.Default, Uid); break; } return(Task.CompletedTask); }
public override async Task RunTask(int taskId) { switch (taskId) { case 0: MessageBroker.Send(VolumeUpCommand.Default, Uid); break; case 1: MessageBroker.Send(VolumeDownCommand.Default, Uid); break; case 2: MessageBroker.Send(TurnOnCommand.Default, Uid); break; case 3: MessageBroker.Send(TurnOffCommand.Default, Uid); break; case 4: MessageBroker.Send(VolumeSetCommand.Create(40), Uid); break; case 5: MessageBroker.Send(MuteCommand.Default, Uid); break; case 6: MessageBroker.Send(UnmuteCommand.Default, Uid); break; case 7: MessageBroker.Send(InputSetCommand.Create("DVD"), Uid); break; case 8: MessageBroker.Send(ModeSetCommand.Create("Movie"), Uid); break; case 9: var capabilities = await MessageBroker.Request <CapabilitiesQuery, IReadOnlyCollection <string> >(CapabilitiesQuery.Default, Uid); ConsoleEx.WriteTitleLine($"Capabilities of '{Uid}': {string.Join(", ", capabilities)}"); break; case 10: var supportedStates = await MessageBroker.Request <SupportedStatesQuery, IReadOnlyCollection <string> >(SupportedStatesQuery.Default, Uid); ConsoleEx.WriteTitleLine($"Supported states of '{Uid}': {string.Join(", ", supportedStates)}"); break; case 11: var states = await MessageBroker.Request <StateQuery, IReadOnlyDictionary <string, string> >(StateQuery.Default, Uid); ConsoleEx.WriteTitleLine($"State of '{Uid}': {string.Join(", ", states.ToFormatedString())}"); break; } return; }
protected void Handle(VolumeSetCommand command) { //TODO }