async public override Task <SkillResponse> HandleIntentRequest(IntentRequest request) { var log = curContext.Logger; slots = request.Intent.Slots; Slot lightStateSlot = null; if (slots.ContainsKey(LIGHTCONTROl)) { lightStateSlot = slots[LIGHTCONTROl]; } // Need to seperate it out. Wash_Lights washLtsMsg = new Wash_Lights { DeviceType = "200", Instance = 1, LightState = lightStateSlot.Value }; LightsAlexaMsg msg = new LightsAlexaMsg { ID = 2000, IntentName = request.Intent.Name, Slot = washLtsMsg }; await DynamoDB.PutAlexaMsg(msg); outSpeech = new PlainTextOutputSpeech(); //(outSpeech as PlainTextOutputSpeech).Text = "Alright!. I have sent a message to venue system to push " + monVidSrcSlot.Value + " on " + monLocSlot.Value + " Monitor."; (outSpeech as PlainTextOutputSpeech).Text = "Cabin system accepted your request. Enjoy your flight!. "; skillResponse.Response.OutputSpeech = outSpeech; skillResponse.Response.ShouldEndSession = true; return(skillResponse); }
async public override Task <SkillResponse> HandleIntentRequest(IntentRequest request) { var log = curContext.Logger; slots = request.Intent.Slots; Slot monAirshowSlot = null; Slot monLocSlot = null; if (slots.ContainsKey(MONAIRSHOW)) { monAirshowSlot = slots[MONAIRSHOW]; log.LogLine($"Slot : Monitor_Video_Src : Value -" + monAirshowSlot.Value); } if (slots.ContainsKey(MONITORLOC)) { monLocSlot = slots[MONITORLOC]; log.LogLine($"Slot : Monitor_Loc : Value - " + monLocSlot.Value); } //if (String.IsNullOrEmpty(monVidSrcSlot.Value) || String.IsNullOrWhiteSpace(monVidSrcSlot.Value)) //{ // log.LogLine($"Dialog State - " + request.DialogState); // // Using Alexa sdk's DialogDelegate // dlgElicitSlot = new DialogElicitSlot(monVidSrcSlot.Name); // outSpeech = new PlainTextOutputSpeech(); // (outSpeech as PlainTextOutputSpeech).Text = "Ok!. I can help you on that!. Tell me the name of the video source that you wanted to watch. " + "You can say, " + vidSrcHandler.GetRandomVidSrcName() + ", or , " + vidSrcHandler.GetRandomVidSrcName(); // dlgElicitSlot.UpdatedIntent = request.Intent; // skillResponse.Response.Directives.Add(dlgElicitSlot); // skillResponse.Response.OutputSpeech = outSpeech; // return skillResponse; //} //else if (String.IsNullOrEmpty(monLocSlot.Value) || String.IsNullOrWhiteSpace(monLocSlot.Value)) //{ // dlgElicitSlot = new DialogElicitSlot(monLocSlot.Name); // outSpeech = new PlainTextOutputSpeech(); // (outSpeech as PlainTextOutputSpeech).Text = "Tell me the location of the monitor where you wanted to watch " + monVidSrcSlot.Value + ". You can say, forward, or, Aft!"; // dlgElicitSlot.UpdatedIntent = request.Intent; // skillResponse.Response.Directives.Add(dlgElicitSlot); // skillResponse.Response.OutputSpeech = outSpeech; // return skillResponse; //} //if (!vidSrcHandler.IsConfigured(monVidSrcSlot.Value.ToLower())) //{ // log.LogLine($"Not Configured - " + monVidSrcSlot.Value); // dlgElicitSlot = new DialogElicitSlot(monVidSrcSlot.Name); // outSpeech = new PlainTextOutputSpeech(); // StringBuilder vidSources = new StringBuilder(); // vidSrcHandler.GetAvailableVidSources().ForEach(vidSrc => vidSources.AppendLine(vidSrc)); // (outSpeech as PlainTextOutputSpeech).Text = monVidSrcSlot.Value + " is not available on your aircraft! " + "Currently available video sources are \n" + vidSources.ToString(); // dlgElicitSlot.UpdatedIntent = request.Intent; // skillResponse.Response.Directives.Add(dlgElicitSlot); // skillResponse.Response.OutputSpeech = outSpeech; // return skillResponse; //} //else //{ Monitor_Video_Source monAirshowModeMsg = new Monitor_Video_Source { DeviceType = vidSrcHandler.ConfiguredVidSrcList[monAirshowSlot.Value.ToLower()].DeviceType, Instance = vidSrcHandler.ConfiguredVidSrcList[monAirshowSlot.Value.ToLower()].Instance, MonitorLocation = monLocSlot.Value }; AlexaMsg msg = new AlexaMsg { ID = 1010, IntentName = request.Intent.Name, Slot = monAirshowModeMsg }; await DynamoDB.PutAlexaMsg(msg); outSpeech = new PlainTextOutputSpeech(); (outSpeech as PlainTextOutputSpeech).Text = "Alright. " + monAirshowSlot.Value + " Airshow mode is pushed on " + monLocSlot.Value + " Monitor. Have a nice flight!"; //(outSpeech as PlainTextOutputSpeech).Text = "Have a nice flight!."; skillResponse.Response.OutputSpeech = outSpeech; skillResponse.Response.ShouldEndSession = true; //} return(skillResponse); }