Exemplo n.º 1
0
        public DriveContext(StateType initialStateType, GPS gate)
        {
            this.gate = gate;

            // GPSDriveState is default unless specified
            this.driveState = StateTypeHelper.ToDriveState(initialStateType, gate);
            this.stateType  = initialStateType;

            this.sendDriveCommandLock = new Object();
        }
Exemplo n.º 2
0
        //TODO look at this function
        /// <summary>
        /// Change the current DriveState if required and return the corresponding StateType of the new DriveState.
        /// </summary>
        /// <returns>StateType - the StateType for the new DriveState</returns>
        public StateType ChangeState(StateType nextState)
        {
            if (!this.IsStateChangeRequired(nextState))
            {
                return(this.stateType);
            }

            this.driveState = StateTypeHelper.ToDriveState(nextState, this.gate);
            this.stateType  = nextState;

            return(nextState);
        }