Пример #1
0
        public void TestTally()
        {
            AtemMockServerWrapper.Each(_output, _pool, null, DeviceTestCases.All, helper =>
            {
                List <VideoSource> inputIds = helper.Helper.BuildLibState().Settings.Inputs
                                              .Where(i => i.Value.Properties.InternalPortType == InternalPortType.External).Select(i => i.Key)
                                              .ToList();
                TallyBySourceCommand tallyCmd = helper.Server.GetParsedDataDump().OfType <TallyBySourceCommand>().Single();

                foreach (VideoSource id in Randomiser.SelectionOfGroup(inputIds))
                {
                    AtemState stateBefore            = helper.Helper.BuildLibState();
                    InputState.TallyState tallyState = stateBefore.Settings.Inputs[id].Tally;

                    for (int i = 0; i < 5; i++)
                    {
                        bool isProgram     = tallyState.ProgramTally = Randomiser.RangeInt(10) > 5;
                        bool isPreview     = tallyState.PreviewTally = Randomiser.RangeInt(10) > 5;
                        tallyCmd.Tally[id] = Tuple.Create(isProgram, isPreview);

                        helper.SendFromServerAndWaitForChange(stateBefore, tallyCmd);
                    }
                }
            });
        }
Пример #2
0
        private static void UpdateInputs(AtemState state, UpdateResultImpl result, ICommand command)
        {
            if (command is InputPropertiesGetCommand propsCmd)
            {
                if (!state.Settings.Inputs.ContainsKey(propsCmd.Id))
                {
                    state.Settings.Inputs[propsCmd.Id] = new InputState();
                }
                InputState props = state.Settings.Inputs[propsCmd.Id];

                props.Properties.AreNamesDefault = propsCmd.AreNamesDefault;
                props.Properties.LongName        = propsCmd.LongName;
                props.Properties.ShortName       = propsCmd.ShortName;

                //props.IsExternal = cmd.IsExternal;
                props.Properties.AvailableExternalPortTypes = propsCmd.AvailableExternalPorts.FindFlagComponents();
                props.Properties.CurrentExternalPortType    = propsCmd.ExternalPortType;
                props.Properties.InternalPortType           = propsCmd.InternalPortType;
                props.Properties.SourceAvailability         = propsCmd.SourceAvailability;
                props.Properties.MeAvailability             = propsCmd.MeAvailability;
                result.SetSuccess($"Settings.Inputs.{propsCmd.Id:D}.Properties");
            }
            else if (command is TallyBySourceCommand tallyCmd)
            {
                foreach (KeyValuePair <VideoSource, Tuple <bool, bool> > inp in tallyCmd.Tally)
                {
                    if (state.Settings.Inputs.TryGetValue(inp.Key, out InputState input))
                    {
                        InputState.TallyState inputTally = input.Tally;
                        if (inputTally.ProgramTally != inp.Value.Item1 || inputTally.PreviewTally != inp.Value.Item2)
                        {
                            inputTally.ProgramTally = inp.Value.Item1;
                            inputTally.PreviewTally = inp.Value.Item2;
                            result.SetSuccess($"Settings.Inputs.{inp.Key:D}.Tally");
                        }
                    }
                }
            }
        }