Beispiel #1
0
        async static public Task <bool> PutAlexaMsg(LightsAlexaMsg msg)
        {
            try
            {
                DynamoDBContext context = new DynamoDBContext(DynamoDBClient);
                await context.SaveAsync <LightsAlexaMsg>(msg);
            }
            catch (Exception ex)
            {
                LambdaLogger.Log(ex.Message);
            }

            return(true);
        }
        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);
        }