protected async Task Handle(ModeSetCommand message) { //Surround support only in main zone if (_zone != 1) { return; } var surroundMode = message.AsString(MessageProperties.SurroundMode); var mode = DenonSurroundModes.MapApiCommand(surroundMode); if (mode?.Length == 0) { throw new ArgumentException($"Surroundmode {mode} was not found on available surround modes"); } var control = new DenonControlQuery { Command = mode, Api = "formiPhoneAppDirect", ReturnNode = "", Zone = "", Address = _hostName }; await MessageBroker.QueryService <DenonControlQuery, string>(control).ConfigureAwait(false); _surround = await UpdateState(SurroundSoundState.StateName, _surround, surroundMode).ConfigureAwait(false); }
public static ModeSetCommand Create(string mode) { var command = new ModeSetCommand { SurroundMode = mode }; return(command); }
protected void HandleState(ModeSetCommand 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("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; }