Exemple #1
0
        public Result Next()
        {
            var result = _playerService.Next();

            PushNotification(result.Message);
            return(result);
        }
Exemple #2
0
        public async Task <Result> Next()
        {
            var sb          = new StringBuilder();
            var powerStatus = await _yamahaService.PowerStatus();

            if (powerStatus == PowerStatusEnum.On)
            {
                var mpdState        = _mpdService.GetStatus().State;
                var smartHouseState = await _smartHouseService.GetCurrentState();

                if (smartHouseState == SmartHouseState.Music && (mpdState == MpdState.Play || mpdState == MpdState.Pause))
                {
                    _mpdService.Next();
                    sb.AppendLine("MPD Next song");
                }
                else if (smartHouseState == SmartHouseState.Pandora)
                {
                    _playerService.Next();
                    sb.AppendLine("Pandora next song");
                }
                else if (smartHouseState == SmartHouseState.TV)
                {
                    await _tvService.Forward();

                    sb.AppendLine("TV forward");
                }
            }
            else
            {
                sb.AppendLine("Yamaha is turned off. Operation canceled");
                PushNotification("Yamaha is turned off. Operation canceled");
            }

            return(new Result()
            {
                ErrorCode = 0,
                Message = sb.ToString(),
                Ok = true
            });
        }