Export (0) Print
Expand All

XInput Controller

Microsoft Robotics

Glossary Item Box

VPL User Interface Services: Game Controller

Microsoft Robotics Developer StudioSend feedback on this topic

XInput Controller

XInput Controller Icon

The Xbox 360 console uses a gaming controller that is compatible with Windows. You can use the XInput Controller service to communicate with these controllers when they are plugged into a Windows PC; up to four unique controllers can be plugged in at a time. (XInput is an API, Application Programming Interface, that is part of DirectX.) Using this service, any connected Xbox 360 controller can be queried for its state, and vibration effects can be set.

You will need an Xbox 360 Controlller or other controller that is compatible with XInput to use this service. Xbox 360 controllers come in wired (USB) and wireless forms. If you have a conventional joystick, look at the Game Controller service instead. Note that the Xbox 360 controller will also work with the Game Controller service as a joystick.

Dd145260.hs-caution(en-us,MSDN.10).gif

If you have previously paired a wireless control with an Xbox 360, you may need to re-pair it to work with your PC. Also note that if you are unable to pair, it may be due to interference from other wireless devices. For further information on using an Xbox 360 Controller with you PC, check the support information (e.g. http://support.microsoft.com/kb/906947?sd=xbox).

Drivers for the Xbox 360 Controller are not included in the RDS package. The drivers are available via Windows Update.

Operations

Xbox 360 controllers typically have two analog directional sticks, each with a digital button, two analog triggers, a digital directional pad with four directions, and eight digital buttons. The XInput Controller service provides the following operations to access the state of a controller.

OperationDescription
ButtonsChangedIndicates when one or more buttons are pressed or released.
ControllerChangedSend this message to change which controller this service instance is using. This notification is sent when the controller is changed or when the controller is connected or disconnected.
DPadChangedIndicates when the directional pad position is changed.
GetReturns the current state of the controller service.
PollRequests the controller to read current values. However, you do not need to issue this request because the service updates itself 20 times per second.
QueryControllersReturns a list of attached controllers.
ReplaceConfigures a controller or indicates when the controller's state has changed. This notification is also generated when service receives a subscription request (has a connection to its notifications).
SetVibrationSets the amount of vibration in the left and right rumble motors. The left motor is the low-frequency rumble motor. The right motor is the high-frequency rumble motor. This notification is sent when the vibration settings are changed.
ThumbsticksChangedIndicates when a thumbstick position is changed.
TriggersChangedIndicates when the position of a Point-Of-View (POV) hat switch is changed.

Get, Poll, and QueryControllers are supported as requests only (no notifications are generated).

Service State

The XInput Controller service state contains the following properties. Note that each of the different fields has its own data type. All of the types associated with input devices have a TimeStamp property.

NameTypeDescription
ButtonsButtonsCurrent state of all the buttons. See below.
ControllerControllerInformation about the current controller.
DPadDPadCurrent direction of the DPad as a set of Boolean fields: Left, Down, Right, Up.
ThumbsticksThumbsticksContains two sets of float values: LeftX, LeftY and RightX, RightY.
TriggersTriggersCurrent positions of the triggers as floats: Left and Right.
VibrationVibrationCurrent values of the vibration motors as floats: Left and Right.
TimeStampDateTimeThe timestamp of the most recent update.

The values returned in the controller state are also accessible through the notifications and requests (i.e. SetVibrationMotor) provided for the individual controller components.

Buttons (and the ButtonsChanged notification) returns a set of Boolean values corresponding to the controller's buttons and the timestamp of the button reading. If a button's state is True the button was pressed.

NameTypeDescription
ABooleanIndicates if the A button on the controller was pressed.
BBooleanIndicates if the B button on the controller was pressed.
XBooleanIndicates if the X button on the controller was pressed.
YBooleanIndicates if the Y button on the controller was pressed.
BackBooleanIndicates if the Back button on the controller was pressed.
StartBooleanIndicates if the Start button on the controller was pressed.
LeftStickBooleanIndicates if the left thumbstick on the controller was pressed.
RightStickBooleanIndicates if the right thumbstick on the controller was pressed.
LeftShoulderBooleanIndicates if the left shoulder (bumper) button on the controller was pressed.
RightShoulderBooleanIndicates if the right shoulder (bumper) button on the controller was pressed.
TimeStampDateTimeIndicates the timestamp of the current reading.

Controller (and the ControllerChanged notification) returns the following values.

NameTypeDescription
IsConnectedBooleanIndicates if a controller is connected.
PlayerIndexPlayerIndexIndicates which player the controller represents. The choices are 0-3.
TimeStampDateTiimeIndicates the timestamp of the current reading.

Each controller displays which ID it is using by lighting up a quadrant on the "ring of light" in the center of the controller. The PlayIndex can be set on the service's initial configuration, either by another service or by explicitly setting its Configuration properties.

DPad (and the DPadChanged notification) returns the following values.

NameTypeDescription
DownBooleanIndicates if the direction pad was moved down.
LeftBooleanIndicates if the direction pad was moved left.
RightBooleanIndicates if the direction pad was moved right.
UpBooleanIndicates if the direction pad was moved up.
TimeStampDateTimeIndicates the timestamp of the current reading.

Thumbsticks (and the ThumbsticksChanged notification) returns the following values.

NameTypeDescription
LeftXfloatIndicates the X value of the left thumbstick.
LeftYfloatIndicates the Y value of the left thumbstick.
RightXfloatIndicates the X value of the right thumbstick..
RightYfloatIndicates the Y value of the right thumbstick.
TimeStampDateTimeIndicates the timestamp of the current reading.

Triggers (and the TriggersChanged notification) returns the following values.

NameTypeDescription
LeftfloatIndicates the current reading of the left trigger.
RightfloatIndicates the current reading of the right trigger.
TimeStampDateTimeIndicates the timestamp of the current reading.

Vibration (and the SetVibrationMotor notification) returns the following values.

NameTypeDescription
LeftfloatIndicates the current reading of the left vibration motor.
RightfloatIndicates the current reading of the right vibration motor.
TimeStampDateTimeIndicates the timestamp of the current reading.

 

VPL User Interface Services: Game Controller

 

 

© 2012 Microsoft Corporation. All Rights Reserved.

Show:
© 2014 Microsoft