Esempio n. 1
0
        /// <see cref="IDssHostSetup.ExecuteNextStep"/>
        public DssSetupResult ExecuteNextStep(IDssGuestChannel[] channelsToGuests)
        {
            TraceManager.WriteAllTrace("SETUP_CALL: Execute setup step", TestClientTraceFilters.TEST_INFO);
            foreach (List <RCPackage> rq in this.rqs)
            {
                rq.Clear();
            }

            if (this.firstSetupStep)
            {
                FirstSetupStep(channelsToGuests);
                this.firstSetupStep = false;
            }

            DssSetupResult result = ProcessUiActions(channelsToGuests);

            if (result == DssSetupResult.CONTINUE_SETUP)
            {
                ProcessGuestChannels(channelsToGuests);
                int i = 0;
                foreach (List <RCPackage> rq in this.rqs)
                {
                    channelsToGuests[i].RequestToGuest = rq.ToArray();
                    i++;
                }
            }

            /// Refresh the display
            Rectangle refreshedArea;

            Display.Instance.RenderOneFrame(out refreshedArea);
            this.uiCallMarshal.RefreshDisplay();
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// This function is called by the SMC framework when the DSS-manager has to call the setup interface
        /// of the client module.
        /// </summary>
        /// <param name="state"></param>
        private void CallClientModuleSetupIface(ISMState state)
        {
            if (state == this.SendingSetupStepRQs)
            {
                TraceManager.WriteAllTrace("Calling IDssHostSetup.ExecuteNextStep on client module.", DssTraceFilters.SETUP_STAGE_INFO);

                /// Unlock the channel interfaces for the client module.
                IDssGuestChannel[] channelIfaces = this.DssChannelIfaces;
                for (int i = 0; i < this.channels.Length; i++)
                {
                    if (this.channels[i].CurrentState == this.channels[i].Opened)
                    {
                        this.channelProxies[i].UnlockForClient(null, DssChannelState.CHANNEL_OPENED);
                    }
                    else if (this.channels[i].CurrentState == this.channels[i].Closed)
                    {
                        this.channelProxies[i].UnlockForClient(null, DssChannelState.CHANNEL_CLOSED);
                    }
                    else if (this.channels[i].CurrentState == this.channels[i].Engaged)
                    {
                        SetupStep currStep = this.hostRoot.GetStep(i);
                        this.channelProxies[i].UnlockForClient(currStep.StepPackageList, DssChannelState.GUEST_CONNECTED);
                    }
                    else
                    {
                        throw new DssException("Unexpected channel state!");
                    }
                }

                /// Calling the client module for setup step execution.
                DssSetupResult result = this.hostRoot.SetupIface.ExecuteNextStep(channelIfaces);

                /// Lock the channel interfaces.
                for (int i = 0; i < this.channels.Length; i++)
                {
                    this.channelProxies[i].Lock();
                }

                /// Evaluate the result of the setup step execution.
                if (result == DssSetupResult.CONTINUE_SETUP)
                {
                    ContinueSetup();
                }
                else if (result == DssSetupResult.LEAVE_DSS)
                {
                    LeaveDss();
                }
                else if (result == DssSetupResult.START_SIMULATION)
                {
                    StartSimulation();
                }
                else
                {
                    throw new DssException("Unexpected answer from client module!");
                }
            }
            else
            {
                throw new DssException("Unexpected state!");
            }
        }