Пример #1
0
        /// <summary>Get the command assigned to the specified gamepad axis.</summary>
        /// <param name="axis">The axis to test.</param>
        /// <returns>The command, or the default value if there is no such binding.</returns>
        public TCommand GetCommand(ExtendedAxes axis)
        {
            TCommand command;

            _gamePadAxisBindings.TryGetValue(axis, out command);
            return(command);
        }
        /// <summary>Maps the axes of the joystick</summary>
        /// <param name="joystick">Joystick for which axes are mapped</param>
        private void mapAxes(Joystick joystick)
        {
            IList <DeviceObjectInstance> axes = joystick.GetObjects(
                ObjectDeviceType.AbsoluteAxis
                );
            var unmappedReaders = new Queue <IAxisReader>();

            for (int index = 0; index < axes.Count; ++index)
            {
                if (axes[index].ObjectTypeGuid != ObjectGuid.Slider)
                {
                    ExtendedAxes axis = identifyAxis(
                        axes[index].Aspect, axes[index].ObjectTypeGuid
                        );

                    // If this axis could not be identified but we're still missing one of
                    // the standard axes (X, Y, Rx, Ry), remember it so we can later map it
                    // to the next unassigned standard axes in case some are left unassigned.
                    if (axis == 0)
                    {
                        if (unmappedReaders.Count < 4)
                        {
                            unmappedReaders.Enqueue(createAxisReader(joystick, axis, axes[index]));
                        }
                    }
                    else // Axis identified, build reader and store it
                    {
                        this.availableAxes |= axis;
                        this.axisReaders[indexFromAxis(axis)] = createAxisReader(
                            joystick, axis, axes[index]
                            );
                    }
                } // if
            }     // for

            // If the four standard axes are still not completely provided, use
            // the unidentified axis we remembered earlier as a fallback solution.
            if ((this.axisReaders[0] == null) && (unmappedReaders.Count > 0))
            {
                this.availableAxes |= ExtendedAxes.X;
                this.axisReaders[0] = unmappedReaders.Dequeue();
            }
            if ((this.axisReaders[1] == null) && (unmappedReaders.Count > 0))
            {
                this.availableAxes |= ExtendedAxes.Y;
                this.axisReaders[1] = unmappedReaders.Dequeue();
            }
            if ((this.axisReaders[12] == null) && (unmappedReaders.Count > 0))
            {
                this.availableAxes  |= ExtendedAxes.RotationX;
                this.axisReaders[12] = unmappedReaders.Dequeue();
            }
            if ((this.axisReaders[13] == null) && (unmappedReaders.Count > 0))
            {
                this.availableAxes  |= ExtendedAxes.RotationY;
                this.axisReaders[13] = unmappedReaders.Dequeue();
            }
        }
Пример #3
0
        /// <summary>Returns the axis index from a value in the axis enumeration</summary>
        /// <param name="axis">Axis enumeration values whose index will be returned</param>
        /// <returns>The index of the specified axis enumeration value</returns>
        private static int indexFromAxis(ExtendedAxes axis)
        {
            switch (axis)
            {
            case ExtendedAxes.X: { return(0); }

            case ExtendedAxes.Y: { return(1); }

            case ExtendedAxes.Z: { return(2); }

            case ExtendedAxes.VelocityX: { return(3); }

            case ExtendedAxes.VelocityY: { return(4); }

            case ExtendedAxes.VelocityZ: { return(5); }

            case ExtendedAxes.AccelerationX: { return(6); }

            case ExtendedAxes.AccelerationY: { return(7); }

            case ExtendedAxes.AccelerationZ: { return(8); }

            case ExtendedAxes.ForceX: { return(9); }

            case ExtendedAxes.ForceY: { return(10); }

            case ExtendedAxes.ForceZ: { return(11); }

            case ExtendedAxes.RotationX: { return(12); }

            case ExtendedAxes.RotationY: { return(13); }

            case ExtendedAxes.RotationZ: { return(14); }

            case ExtendedAxes.AngularVelocityX: { return(15); }

            case ExtendedAxes.AngularVelocityY: { return(16); }

            case ExtendedAxes.AngularVelocityZ: { return(17); }

            case ExtendedAxes.AngularAccelerationX: { return(18); }

            case ExtendedAxes.AngularAccelerationY: { return(19); }

            case ExtendedAxes.AngularAccelerationZ: { return(20); }

            case ExtendedAxes.TorqueX: { return(21); }

            case ExtendedAxes.TorqueY: { return(22); }

            case ExtendedAxes.TorqueZ: { return(23); }

            default: { return(-1); }
            }
        }
        /// <summary>Retrieves the state of the specified axis</summary>
        /// <param name="axis">Axis whose state will be retrieved</param>
        /// <returns>The state of the specified axis</returns>
        public float GetAxis(ExtendedAxes axis)
        {
            switch (axis)
            {
            case ExtendedAxes.X: { return(this.X); }

            case ExtendedAxes.Y: { return(this.Y); }

            case ExtendedAxes.Z: { return(this.Z); }

            case ExtendedAxes.VelocityX: { return(this.VelocityX); }

            case ExtendedAxes.VelocityY: { return(this.VelocityY); }

            case ExtendedAxes.VelocityZ: { return(this.VelocityZ); }

            case ExtendedAxes.AccelerationX: { return(this.AccelerationX); }

            case ExtendedAxes.AccelerationY: { return(this.AccelerationY); }

            case ExtendedAxes.AccelerationZ: { return(this.AccelerationZ); }

            case ExtendedAxes.ForceX: { return(this.ForceX); }

            case ExtendedAxes.ForceY: { return(this.ForceY); }

            case ExtendedAxes.ForceZ: { return(this.ForceZ); }

            case ExtendedAxes.RotationX: { return(this.RotationX); }

            case ExtendedAxes.RotationY: { return(this.RotationY); }

            case ExtendedAxes.RotationZ: { return(this.RotationZ); }

            case ExtendedAxes.AngularVelocityX: { return(this.AngularVelocityX); }

            case ExtendedAxes.AngularVelocityY: { return(this.AngularVelocityY); }

            case ExtendedAxes.AngularVelocityZ: { return(this.AngularVelocityZ); }

            case ExtendedAxes.AngularAccelerationX: { return(this.AngularAccelerationX); }

            case ExtendedAxes.AngularAccelerationY: { return(this.AngularAccelerationY); }

            case ExtendedAxes.AngularAccelerationZ: { return(this.AngularAccelerationZ); }

            case ExtendedAxes.TorqueX: { return(this.TorqueX); }

            case ExtendedAxes.TorqueY: { return(this.TorqueY); }

            case ExtendedAxes.TorqueZ: { return(this.TorqueZ); }

            default: { throw new ArgumentOutOfRangeException("axis", "Invalid axis"); }
            }
        }
Пример #5
0
        /// <summary>Add a new gamepad axis binding.</summary>
        /// <param name="command">The command that should be triggered.</param>
        /// <param name="axis">The gamepad axis for which to trigger the command.</param>
        public void Add(TCommand command, ExtendedAxes axis)
        {
            var bindings = GetBindings(command, true);

            if (bindings.GamePadAxes.Contains(axis))
            {
                return;
            }
            bindings.GamePadAxes.Add(axis);
            _gamePadAxisBindings.Add(axis, command);
        }
Пример #6
0
        /// <summary>Initializes a new extended game pas state to the provided values</summary>
        /// <param name="availableAxes">Bit mask of the axes made available in the state</param>
        /// <param name="axes">
        ///   Values of all 24 axes in the order they appear in the ExtendedAxes enumeration
        /// </param>
        /// <param name="availableSliders">Bit mask of the slider provided by the state</param>
        /// <param name="sliders">
        ///   Values of all 8 sliders in the order they appear in the ExtendedSliders enumeration
        /// </param>
        /// <param name="buttonCount">Number of buttons provided by the state</param>
        /// <param name="buttons">State of all 128 buttons in the state</param>
        /// <param name="povCount">Number of Point-of-View controllers in the state</param>
        /// <param name="povs">State of all 4 Point-of-View controllers</param>
        public ExtendedGamePadState(
            ExtendedAxes availableAxes, float[] /*24*/ axes,
            ExtendedSliders availableSliders, float[] /*8*/ sliders,
            int buttonCount, bool[] /*128*/ buttons,
            int povCount, int[] /*4*/ povs
            )
        {
            // Take over all axes
            this.AvailableAxes        = availableAxes;
            this.X                    = axes[0];
            this.Y                    = axes[1];
            this.Z                    = axes[2];
            this.VelocityX            = axes[3];
            this.VelocityY            = axes[4];
            this.VelocityZ            = axes[5];
            this.AccelerationX        = axes[6];
            this.AccelerationY        = axes[7];
            this.AccelerationZ        = axes[8];
            this.ForceX               = axes[9];
            this.ForceY               = axes[10];
            this.ForceZ               = axes[11];
            this.RotationX            = axes[12];
            this.RotationY            = axes[13];
            this.RotationZ            = axes[14];
            this.AngularVelocityX     = axes[15];
            this.AngularVelocityY     = axes[16];
            this.AngularVelocityZ     = axes[17];
            this.AngularAccelerationX = axes[18];
            this.AngularAccelerationY = axes[19];
            this.AngularAccelerationZ = axes[20];
            this.TorqueX              = axes[21];
            this.TorqueY              = axes[22];
            this.TorqueZ              = axes[23];

            // Take over all sliders
            this.AvailableSliders    = availableSliders;
            this.Slider1             = sliders[0];
            this.Slider2             = sliders[1];
            this.VelocitySlider1     = sliders[2];
            this.VelocitySlider2     = sliders[3];
            this.AccelerationSlider1 = sliders[4];
            this.AccelerationSlider2 = sliders[5];
            this.ForceSlider1        = sliders[6];
            this.ForceSlider2        = sliders[7];

            // Take over all buttons
            this.ButtonCount  = buttonCount;
            this.buttonState1 = 0;
            for (int index = 0; index < Math.Min(64, buttonCount); ++index)
            {
                if (buttons[index])
                {
                    this.buttonState1 |= (1UL << index);
                }
            }
            this.buttonState2 = 0;
            for (int index = 0; index < (buttonCount - 64); ++index)
            {
                if (buttons[index + 64])
                {
                    this.buttonState2 |= (1UL << index);
                }
            }

            // Take over all PoV controllers
            this.PovCount = povCount;
            this.Pov1     = povs[0];
            this.Pov2     = povs[1];
            this.Pov3     = povs[2];
            this.Pov4     = povs[3];
        }
        /// <summary>Creates an axis reader for the specified object</summary>
        /// <param name="joystick">Joystick providing the control object</param>
        /// <param name="axis">Axis a reader will be created for</param>
        /// <param name="control">Control description for the axis</param>
        /// <returns>A new axis reader for the specified axis</returns>
        private static IAxisReader createAxisReader(
      Joystick joystick, ExtendedAxes axis, DeviceObjectInstance control
    )
        {
            int id = (int)control.ObjectType;
              ObjectProperties properties = joystick.GetObjectPropertiesById(id);

              int min = properties.LowerRange;
              int max = properties.UpperRange;

              switch (axis) {
            case ExtendedAxes.X: {
              return new XAxisReader(min, max);
            }
            case ExtendedAxes.Y: {
              return new YAxisReader(min, max);
            }
            case ExtendedAxes.Z: {
              return new ZAxisReader(min, max);
            }
            case ExtendedAxes.VelocityX: {
              return new VelocityXAxisReader(min, max);
            }
            case ExtendedAxes.VelocityY: {
              return new VelocityYAxisReader(min, max);
            }
            case ExtendedAxes.VelocityZ: {
              return new VelocityZAxisReader(min, max);
            }
            case ExtendedAxes.AccelerationX: {
              return new AccelerationXAxisReader(min, max);
            }
            case ExtendedAxes.AccelerationY: {
              return new AccelerationYAxisReader(min, max);
            }
            case ExtendedAxes.AccelerationZ: {
              return new AccelerationZAxisReader(min, max);
            }
            case ExtendedAxes.ForceX: {
              return new ForceXAxisReader(min, max);
            }
            case ExtendedAxes.ForceY: {
              return new ForceYAxisReader(min, max);
            }
            case ExtendedAxes.ForceZ: {
              return new ForceZAxisReader(min, max);
            }
            case ExtendedAxes.RotationX: {
              return new RotationXAxisReader(min, max);
            }
            case ExtendedAxes.RotationY: {
              return new RotationYAxisReader(min, max);
            }
            case ExtendedAxes.RotationZ: {
              return new RotationZAxisReader(min, max);
            }
            case ExtendedAxes.AngularVelocityX: {
              return new AngularVelocityXAxisReader(min, max);
            }
            case ExtendedAxes.AngularVelocityY: {
              return new AngularVelocityYAxisReader(min, max);
            }
            case ExtendedAxes.AngularVelocityZ: {
              return new AngularVelocityZAxisReader(min, max);
            }
            case ExtendedAxes.AngularAccelerationX: {
              return new AngularAccelerationXAxisReader(min, max);
            }
            case ExtendedAxes.AngularAccelerationY: {
              return new AngularAccelerationYAxisReader(min, max);
            }
            case ExtendedAxes.AngularAccelerationZ: {
              return new AngularAccelerationZAxisReader(min, max);
            }
            case ExtendedAxes.TorqueX: {
              return new TorqueXAxisReader(min, max);
            }
            case ExtendedAxes.TorqueY: {
              return new TorqueYAxisReader(min, max);
            }
            case ExtendedAxes.TorqueZ: {
              return new TorqueZAxisReader(min, max);
            }
            default: {
              return null;
            }
              }
        }
 /// <summary>Returns the axis index from a value in the axis enumeration</summary>
 /// <param name="axis">Axis enumeration values whose index will be returned</param>
 /// <returns>The index of the specified axis enumeration value</returns>
 private static int indexFromAxis(ExtendedAxes axis)
 {
     switch (axis) {
     case ExtendedAxes.X: { return 0; }
     case ExtendedAxes.Y: { return 1; }
     case ExtendedAxes.Z: { return 2; }
     case ExtendedAxes.VelocityX: { return 3; }
     case ExtendedAxes.VelocityY: { return 4; }
     case ExtendedAxes.VelocityZ: { return 5; }
     case ExtendedAxes.AccelerationX: { return 6; }
     case ExtendedAxes.AccelerationY: { return 7; }
     case ExtendedAxes.AccelerationZ: { return 8; }
     case ExtendedAxes.ForceX: { return 9; }
     case ExtendedAxes.ForceY: { return 10; }
     case ExtendedAxes.ForceZ: { return 11; }
     case ExtendedAxes.RotationX: { return 12; }
     case ExtendedAxes.RotationY: { return 13; }
     case ExtendedAxes.RotationZ: { return 14; }
     case ExtendedAxes.AngularVelocityX: { return 15; }
     case ExtendedAxes.AngularVelocityY: { return 16; }
     case ExtendedAxes.AngularVelocityZ: { return 17; }
     case ExtendedAxes.AngularAccelerationX: { return 18; }
     case ExtendedAxes.AngularAccelerationY: { return 19; }
     case ExtendedAxes.AngularAccelerationZ: { return 20; }
     case ExtendedAxes.TorqueX: { return 21; }
     case ExtendedAxes.TorqueY: { return 22; }
     case ExtendedAxes.TorqueZ: { return 23; }
     default: { return -1; }
       }
 }
Пример #9
0
        /// <summary>Initializes a new mocked game pad</summary>
        public MockedGamePad()
        {
            this.states = new Queue<ExtendedGamePadState>();
              this.current = new ExtendedGamePadState();

              this.buttonStates = new bool[128];
              this.axisStates = new float[24];
              this.sliderStates = new float[8];
              this.povStates = new int[4] { -1, -1, -1, -1 };

              this.buttonCount = 11;
              this.availableAxes =
            ExtendedAxes.X | ExtendedAxes.Y |
            ExtendedAxes.RotationX | ExtendedAxes.RotationY;
              this.availableSliders =
            ExtendedSliders.Slider1 | ExtendedSliders.Slider2;
              this.povCount = 1;
        }
Пример #10
0
        /// <summary>Moves an axis to the specified position</summary>
        /// <param name="axis">Axis that will be moved</param>
        /// <param name="position">
        ///   Position the axis will be moved to in the range from -1.0 to +1.0
        /// </param>
        public void MoveAxis(ExtendedAxes axis, float position)
        {
            if ((axis & this.availableAxes) != axis) {
            throw new ArgumentException(
              "Not such axis - did you forget to assign the AvailableAxes property?",
              "axis"
            );
              }

              switch (axis) {
            case ExtendedAxes.X: { this.axisStates[0] = position; break; }
            case ExtendedAxes.Y: { this.axisStates[1] = position; break; }
            case ExtendedAxes.Z: { this.axisStates[2] = position; break; }
            case ExtendedAxes.VelocityX: { this.axisStates[3] = position; break; }
            case ExtendedAxes.VelocityY: { this.axisStates[4] = position; break; }
            case ExtendedAxes.VelocityZ: { this.axisStates[5] = position; break; }
            case ExtendedAxes.AccelerationX: { this.axisStates[6] = position; break; }
            case ExtendedAxes.AccelerationY: { this.axisStates[7] = position; break; }
            case ExtendedAxes.AccelerationZ: { this.axisStates[8] = position; break; }
            case ExtendedAxes.ForceX: { this.axisStates[9] = position; break; }
            case ExtendedAxes.ForceY: { this.axisStates[10] = position; break; }
            case ExtendedAxes.ForceZ: { this.axisStates[11] = position; break; }
            case ExtendedAxes.RotationX: { this.axisStates[12] = position; break; }
            case ExtendedAxes.RotationY: { this.axisStates[13] = position; break; }
            case ExtendedAxes.RotationZ: { this.axisStates[14] = position; break; }
            case ExtendedAxes.AngularVelocityX: { this.axisStates[15] = position; break; }
            case ExtendedAxes.AngularVelocityY: { this.axisStates[16] = position; break; }
            case ExtendedAxes.AngularVelocityZ: { this.axisStates[17] = position; break; }
            case ExtendedAxes.AngularAccelerationX: { this.axisStates[18] = position; break; }
            case ExtendedAxes.AngularAccelerationY: { this.axisStates[19] = position; break; }
            case ExtendedAxes.AngularAccelerationZ: { this.axisStates[20] = position; break; }
            case ExtendedAxes.TorqueX: { this.axisStates[21] = position; break; }
            case ExtendedAxes.TorqueY: { this.axisStates[22] = position; break; }
            case ExtendedAxes.TorqueZ: { this.axisStates[23] = position; break; }
            default: {
              throw new ArgumentException("Invalid axis specified", "axis");
            }
              }
        }
Пример #11
0
        /// <summary>Maps the axes of the joystick</summary>
        /// <param name="joystick">Joystick for which axes are mapped</param>
        private void mapAxes(Joystick joystick)
        {
            IList<DeviceObjectInstance> axes = joystick.GetObjects(
            ObjectDeviceType.AbsoluteAxis
              );
              var unmappedReaders = new Queue<IAxisReader>();

              for (int index = 0; index < axes.Count; ++index) {
            if (axes[index].ObjectTypeGuid != ObjectGuid.Slider) {
              ExtendedAxes axis = identifyAxis(
            axes[index].Aspect, axes[index].ObjectTypeGuid
              );

              // If this axis could not be identified but we're still missing one of
              // the standard axes (X, Y, Rx, Ry), remember it so we can later map it
              // to the next unassigned standard axes in case some are left unassigned.
              if (axis == 0) {
            if (unmappedReaders.Count < 4) {
              unmappedReaders.Enqueue(createAxisReader(joystick, axis, axes[index]));
            }
              } else { // Axis identified, build reader and store it
            this.availableAxes |= axis;
            this.axisReaders[indexFromAxis(axis)] = createAxisReader(
              joystick, axis, axes[index]
            );
              }
            } // if
              } // for

              // If the four standard axes are still not completely provided, use
              // the unidentified axis we remembered earlier as a fallback solution.
              if ((this.axisReaders[0] == null) && (unmappedReaders.Count > 0)) {
            this.availableAxes |= ExtendedAxes.X;
            this.axisReaders[0] = unmappedReaders.Dequeue();
              }
              if ((this.axisReaders[1] == null) && (unmappedReaders.Count > 0)) {
            this.availableAxes |= ExtendedAxes.Y;
            this.axisReaders[1] = unmappedReaders.Dequeue();
              }
              if ((this.axisReaders[12] == null) && (unmappedReaders.Count > 0)) {
            this.availableAxes |= ExtendedAxes.RotationX;
            this.axisReaders[12] = unmappedReaders.Dequeue();
              }
              if ((this.axisReaders[13] == null) && (unmappedReaders.Count > 0)) {
            this.availableAxes |= ExtendedAxes.RotationY;
            this.axisReaders[13] = unmappedReaders.Dequeue();
              }
        }
Пример #12
0
        /// <summary>Creates an axis reader for the specified object</summary>
        /// <param name="joystick">Joystick providing the control object</param>
        /// <param name="axis">Axis a reader will be created for</param>
        /// <param name="control">Control description for the axis</param>
        /// <returns>A new axis reader for the specified axis</returns>
        private static IAxisReader createAxisReader(
            Joystick joystick, ExtendedAxes axis, DeviceObjectInstance control
            )
        {
            int id = (int)control.ObjectType;
            ObjectProperties properties = joystick.GetObjectPropertiesById(id);

            int min = properties.LowerRange;
            int max = properties.UpperRange;

            switch (axis)
            {
            case ExtendedAxes.X: {
                return(new XAxisReader(min, max));
            }

            case ExtendedAxes.Y: {
                return(new YAxisReader(min, max));
            }

            case ExtendedAxes.Z: {
                return(new ZAxisReader(min, max));
            }

            case ExtendedAxes.VelocityX: {
                return(new VelocityXAxisReader(min, max));
            }

            case ExtendedAxes.VelocityY: {
                return(new VelocityYAxisReader(min, max));
            }

            case ExtendedAxes.VelocityZ: {
                return(new VelocityZAxisReader(min, max));
            }

            case ExtendedAxes.AccelerationX: {
                return(new AccelerationXAxisReader(min, max));
            }

            case ExtendedAxes.AccelerationY: {
                return(new AccelerationYAxisReader(min, max));
            }

            case ExtendedAxes.AccelerationZ: {
                return(new AccelerationZAxisReader(min, max));
            }

            case ExtendedAxes.ForceX: {
                return(new ForceXAxisReader(min, max));
            }

            case ExtendedAxes.ForceY: {
                return(new ForceYAxisReader(min, max));
            }

            case ExtendedAxes.ForceZ: {
                return(new ForceZAxisReader(min, max));
            }

            case ExtendedAxes.RotationX: {
                return(new RotationXAxisReader(min, max));
            }

            case ExtendedAxes.RotationY: {
                return(new RotationYAxisReader(min, max));
            }

            case ExtendedAxes.RotationZ: {
                return(new RotationZAxisReader(min, max));
            }

            case ExtendedAxes.AngularVelocityX: {
                return(new AngularVelocityXAxisReader(min, max));
            }

            case ExtendedAxes.AngularVelocityY: {
                return(new AngularVelocityYAxisReader(min, max));
            }

            case ExtendedAxes.AngularVelocityZ: {
                return(new AngularVelocityZAxisReader(min, max));
            }

            case ExtendedAxes.AngularAccelerationX: {
                return(new AngularAccelerationXAxisReader(min, max));
            }

            case ExtendedAxes.AngularAccelerationY: {
                return(new AngularAccelerationYAxisReader(min, max));
            }

            case ExtendedAxes.AngularAccelerationZ: {
                return(new AngularAccelerationZAxisReader(min, max));
            }

            case ExtendedAxes.TorqueX: {
                return(new TorqueXAxisReader(min, max));
            }

            case ExtendedAxes.TorqueY: {
                return(new TorqueYAxisReader(min, max));
            }

            case ExtendedAxes.TorqueZ: {
                return(new TorqueZAxisReader(min, max));
            }

            default: {
                return(null);
            }
            }
        }
Пример #13
0
        /// <summary>Moves an axis to the specified position</summary>
        /// <param name="axis">Axis that will be moved</param>
        /// <param name="position">
        ///   Position the axis will be moved to in the range from -1.0 to +1.0
        /// </param>
        public void MoveAxis(ExtendedAxes axis, float position)
        {
            if ((axis & this.availableAxes) != axis)
            {
                throw new ArgumentException(
                          "Not such axis - did you forget to assign the AvailableAxes property?",
                          "axis"
                          );
            }

            switch (axis)
            {
            case ExtendedAxes.X: { this.axisStates[0] = position; break; }

            case ExtendedAxes.Y: { this.axisStates[1] = position; break; }

            case ExtendedAxes.Z: { this.axisStates[2] = position; break; }

            case ExtendedAxes.VelocityX: { this.axisStates[3] = position; break; }

            case ExtendedAxes.VelocityY: { this.axisStates[4] = position; break; }

            case ExtendedAxes.VelocityZ: { this.axisStates[5] = position; break; }

            case ExtendedAxes.AccelerationX: { this.axisStates[6] = position; break; }

            case ExtendedAxes.AccelerationY: { this.axisStates[7] = position; break; }

            case ExtendedAxes.AccelerationZ: { this.axisStates[8] = position; break; }

            case ExtendedAxes.ForceX: { this.axisStates[9] = position; break; }

            case ExtendedAxes.ForceY: { this.axisStates[10] = position; break; }

            case ExtendedAxes.ForceZ: { this.axisStates[11] = position; break; }

            case ExtendedAxes.RotationX: { this.axisStates[12] = position; break; }

            case ExtendedAxes.RotationY: { this.axisStates[13] = position; break; }

            case ExtendedAxes.RotationZ: { this.axisStates[14] = position; break; }

            case ExtendedAxes.AngularVelocityX: { this.axisStates[15] = position; break; }

            case ExtendedAxes.AngularVelocityY: { this.axisStates[16] = position; break; }

            case ExtendedAxes.AngularVelocityZ: { this.axisStates[17] = position; break; }

            case ExtendedAxes.AngularAccelerationX: { this.axisStates[18] = position; break; }

            case ExtendedAxes.AngularAccelerationY: { this.axisStates[19] = position; break; }

            case ExtendedAxes.AngularAccelerationZ: { this.axisStates[20] = position; break; }

            case ExtendedAxes.TorqueX: { this.axisStates[21] = position; break; }

            case ExtendedAxes.TorqueY: { this.axisStates[22] = position; break; }

            case ExtendedAxes.TorqueZ: { this.axisStates[23] = position; break; }

            default: {
                throw new ArgumentException("Invalid axis specified", "axis");
            }
            }
        }