/// <summary>
        /// Gets the battery information.
        /// </summary>
        /// <param name="batteryDeviceType">Type of the battery device.</param>
        /// <returns></returns>
        /// <unmanaged>unsigned int XInputGetBatteryInformation([In] XUSER_INDEX dwUserIndex,[In] BATTERY_DEVTYPE devType,[Out] XINPUT_BATTERY_INFORMATION* pBatteryInformation)</unmanaged>
        public BatteryInformation GetBatteryInformation(BatteryDeviceType batteryDeviceType)
        {
            BatteryInformation temp;
            var result = ErrorCodeHelper.ToResult(xinput.XInputGetBatteryInformation((int)userIndex, batteryDeviceType, out temp));

            result.CheckError();
            return(temp);
        }
        /// <summary>Gets the battery information.</summary>
        /// <param name="batteryDeviceType">Type of the battery device.</param>
        /// <returns></returns>
        /// <unmanaged>unsigned int XInputGetBatteryInformation([In] XUSER_INDEX dwUserIndex,[In] BATTERY_DEVTYPE devType,[Out] XINPUT_BATTERY_INFORMATION* pBatteryInformation)</unmanaged>
        public BatteryInformation GetBatteryInformation(
            BatteryDeviceType batteryDeviceType)
        {
            BatteryInformation batteryInformationRef;

            ErrorCodeHelper
            .ToResult(xinput.XInputGetBatteryInformation((int)this.userIndex, batteryDeviceType,
                                                         out batteryInformationRef)).CheckError();
            return(batteryInformationRef);
        }
Esempio n. 3
0
 /// <summary>
 /// Retrieves the battery type and charge status of a wireless controller.
 /// </summary>
 /// <param name="userIndex">Index of the user's controller. Can be a value in the range 0–3. </param>
 /// <param name="batteryDeviceType">Type of the battery device.</param>
 /// <returns>Instance of <see cref="BatteryInformation"/>.</returns>
 public static BatteryInformation GetBatteryInformation(int userIndex, BatteryDeviceType batteryDeviceType)
 {
     s_xInput.XInputGetBatteryInformation(userIndex, batteryDeviceType, out var result);
     return(result);
 }