Esempio n. 1
0
        public void ProcessControllerDirective()
        {
            IPremiseObject switcher = GetSwitcherZone();

            if (switcher == null || !switcher.IsValidObject())
            {
                string name = Endpoint.GetPathAsync().GetAwaiter().GetResult();
                ReportError(AlexaErrorTypes.NO_SUCH_ENDPOINT, $"No switcher child object in MediaZone at {name}.");
                return;
            }

            Dictionary <string, IPremiseObject> inputs = GetAllInputs(switcher);

            if (inputs.ContainsKey(Request.directive.payload.input.ToUpper()))
            {
                // switch inputs
                IPremiseObject newInput   = inputs[Request.directive.payload.input];
                string         newInputId = newInput.GetObjectIDAsync().GetAwaiter().GetResult();
                switcher.SetValueAsync("CurrentSource", newInputId).GetAwaiter().GetResult();
                Response.Event.header.name = "Response";
                Response.context.properties.AddRange(PropertyHelpers.FindRelatedProperties(Endpoint, ""));
            }
            else
            {
                ReportError(AlexaErrorTypes.INVALID_VALUE, $"Input {Request.directive.payload.input} not found!");
            }
        }