コード例 #1
0
        /// <summary>
        /// Creates the internal triggers of the underlying state machine.
        /// </summary>
        private void CreateInternalTriggers()
        {
            if (!this.internalTriggersCreated)
            {
                /// Creating the operators needed for the internal triggers.
                SMOperator[] channelStabilityOps = new SMOperator[this.channels.Length];
                for (int i = 0; i < this.channels.Length; i++)
                {
                    /// The channel stability operator of channel[i] is satisfied in 2 cases:
                    ///     Channel is engaged and the underlying session has been connected OR...
                    SMOperator sessionIsStable = new SMOperator(SMOperatorType.AND, new ISMState[2] {
                        this.channels[i].Engaged,
                        this.sessions[i].SendingSetupStepRQ
                    });
                    /// ... the channel is opened or closed and the underlying session has reached the inactive state.
                    SMOperator channelNotEngaged = new SMOperator(SMOperatorType.OR, new ISMState[2] {
                        this.channels[i].Opened,
                        this.channels[i].Closed
                    });
                    SMOperator noSession = new SMOperator(SMOperatorType.AND, new ISMState[1] {
                        this.sessions[i].Inactive
                    },
                                                          new SMOperator[1] {
                        channelNotEngaged
                    });
                    /// Here we create the channel stability operator for the channel[i].
                    channelStabilityOps[i] = new SMOperator(SMOperatorType.OR, new SMOperator[2] {
                        sessionIsStable, noSession
                    });
                }

                /// The channels are in permanent states when all channel stability operators are satisfied.
                SMOperator permanentChannelStatesOp = new SMOperator(SMOperatorType.AND, channelStabilityOps);
                SMOperator transientChannelStatesOp = new SMOperator(SMOperatorType.NOT, new SMOperator[1] {
                    permanentChannelStatesOp
                });

                /// The setup can continue when all channels are stable and the setup step timer is over.
                SMOperator setupCanContinueOp = new SMOperator(SMOperatorType.AND, new ISMState[1] {
                    this.SetupStepTimerInactive
                },
                                                               new SMOperator[1] {
                    permanentChannelStatesOp
                });

                /// Creating the internal triggers of the DSS-manager
                this.LobbyCreated.AddInternalTrigger(this.SendingSetupStepRQs, null, permanentChannelStatesOp);
                this.WaitingSetupStepAWs.AddInternalTrigger(this.SendingSetupStepRQs, this.StopSetupStepAwTimer, setupCanContinueOp);

                /// Creating the internal triggers of the channel stability monitor
                this.TransientChannelStates.AddInternalTrigger(this.PermanentChannelStates, null, permanentChannelStatesOp);
                this.PermanentChannelStates.AddInternalTrigger(this.TransientChannelStates, null, transientChannelStatesOp);

                this.internalTriggersCreated = true;
            }
            else
            {
                throw new DssException("Internal triggers have already been created!");
            }
        }
コード例 #2
0
        public IHttpActionResult reset(string userName)
        {
            string result;

            try
            {
                SMOperator op = new SMOperator();
                result = op.ResetOperatorPass(userName);
            }
            catch (Exception ex)
            {
                result = ex.Message.ToString();
            }
            return(Ok(result));
        }