2 * Copyright (c) 2007-2010 SlimDX Group
\r
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
\r
5 * of this software and associated documentation files (the "Software"), to deal
\r
6 * in the Software without restriction, including without limitation the rights
\r
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
\r
8 * copies of the Software, and to permit persons to whom the Software is
\r
9 * furnished to do so, subject to the following conditions:
\r
11 * The above copyright notice and this permission notice shall be included in
\r
12 * all copies or substantial portions of the Software.
\r
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\r
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
\r
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
\r
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\r
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
\r
24 #include "../Result.h"
\r
26 #include "CapabilitiesXI.h"
\r
27 #include "BatteryInformation.h"
\r
29 #include "Keystroke.h"
\r
31 #include "Vibration.h"
\r
33 using System::Runtime::InteropServices::OutAttribute;
\r
40 /// Represents an XInput controller.
\r
42 public ref class Controller
\r
45 System::UInt32 m_UserIndex;
\r
47 static int ConvertError( int errorCode );
\r
51 /// Gets a value indicating whether or not the controller is connected.
\r
53 property bool IsConnected
\r
59 /// Gets the identifier for the sound renderer in the controller.
\r
61 property System::Guid SoundRenderGuid
\r
67 /// Gets the identifier for the sound capture device in the controller.
\r
69 property System::Guid SoundCaptureGuid
\r
75 /// Initializes a new instance of the <see cref="Controller"/> class.
\r
77 /// <param name="userIndex">The index of the player whose controller is being represented.</param>
\r
78 Controller( UserIndex userIndex );
\r
81 /// Retrieves battery information for the controller.
\r
83 /// <param name="battery">The type of battery whose information is being retrieved.</param>
\r
84 /// <returns>A <see cref="BatteryInformation"/> structure describing the battery in the controller.</returns>
\r
85 BatteryInformation GetBatteryInformation( BatteryDeviceType battery );
\r
88 /// Retrieves the capabilities of the controller.
\r
90 /// <param name="device">The type of the device whose capabilities are being retrieved.</param>
\r
91 /// <returns>A <see cref="XInput::Capabilities"/> structure describing the capabilities of the controller.</returns>
\r
92 Capabilities GetCapabilities( DeviceQueryType device );
\r
95 /// Gets the state of the controller.
\r
97 /// <returns>A <see cref="XInput::State"/> structure describing the state of the controller.</returns>
\r
101 /// Gets keystroke information from the device.
\r
103 /// <param name="flag">The type of the device to query.</param>
\r
104 /// <param name="keystroke">Keystroke information from the device.</param>
\r
105 /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>
\r
106 Result GetKeystroke( DeviceQueryType flag, [Out] Keystroke% keystroke );
\r
109 /// Sets vibration information for the controller.
\r
111 /// <param name="vibration">Vibration settings for the controller.</param>
\r
112 /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>
\r
113 Result SetVibration( Vibration vibration );
\r
116 /// Enables or disables data reporting in XInput.
\r
118 /// <param name="value"><c>true</c> to enable XInput, <c>false</c> to disable it.</param>
\r
119 static void SetReporting( bool value );
\r