Ejemplo n.º 1
0
        public virtual IEnumerator <ITask> ResetEncoderHandler(ResetMotorEncoder reset)
        {
            LogInfo("TrackRoamerBrickPowerService:ResetEncoderHandler() id=" + reset.Body.HardwareIdentifier);

            switch (reset.Body.HardwareIdentifier)
            {
            case 1:
                _brickConnection.ResetEncoderLeft();
                _state.MotorEncoder.LeftDistance = 0.0d;
                _state.TimeStamp = DateTime.Now;
                break;

            case 2:
                _brickConnection.ResetEncoderRight();
                _state.MotorEncoder.RightDistance = 0.0d;
                _state.TimeStamp = DateTime.Now;
                break;
            }

            // Send Notifications to subscribers
            _subMgrPort.Post(new submgr.Submit(_state.MotorEncoder, DsspActions.ReplaceRequest));

            reset.ResponsePort.Post(DefaultReplaceResponseType.Instance);
            yield break;
        }
		public virtual IEnumerator<ITask> ResetEncoderHandler(ResetMotorEncoder reset)
		{
            LogInfo("TrackRoamerBrickPowerService:ResetEncoderHandler() id=" + reset.Body.HardwareIdentifier);

			switch(reset.Body.HardwareIdentifier)
			{
				case 1:
                    _brickConnection.ResetEncoderLeft();
                    _state.MotorEncoder.LeftDistance = 0.0d;
                    _state.TimeStamp = DateTime.Now;
                    break;

				case 2:
                    _brickConnection.ResetEncoderRight();
                    _state.MotorEncoder.RightDistance = 0.0d;
                    _state.TimeStamp = DateTime.Now;
                    break;
			}

			// Send Notifications to subscribers
			_subMgrPort.Post(new submgr.Submit(_state.MotorEncoder, DsspActions.ReplaceRequest));

			reset.ResponsePort.Post(DefaultReplaceResponseType.Instance);
			yield break;
		}