DualSenseAPI 1.0.2

dotnet add package DualSenseAPI --version 1.0.2
NuGet\Install-Package DualSenseAPI -Version 1.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DualSenseAPI" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DualSenseAPI --version 1.0.2
#r "nuget: DualSenseAPI, 1.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DualSenseAPI as a Cake Addin
#addin nuget:?package=DualSenseAPI&version=1.0.2

// Install DualSenseAPI as a Cake Tool
#tool nuget:?package=DualSenseAPI&version=1.0.2

DualSenseAPI

docs workflow status nuget version

A .NET standard API for interacting with DualSense controllers. Full docs and API reference are available at https://the-demp.github.io/DualSenseAPI/.

Features

  • Basic Input: Analog sticks and triggers, d-pad, and all buttons. Basically any input library you will use can offer this, including DirectInput or similar.
  • Advanced Input: Most of the rest of input features for the DualSense. This includes:
    • 6-axis accelerometer (accelerometer and gyroscope)
    • 2-point multitouch
    • Battery status
  • Output: Most of the full suite of output features for the DualSense. This includes:
    • Haptic motors
    • Adaptive triggers
    • Lightbar color
  • Flexiblility of Control: Supports both synchronous and asynchronous/event-driven IO.

Example

This simple example connects to a DualSense controller using asynchronous polling. The repo contains a more detailed sample and also shows the usage of synchronous polling as well. Check it out here!

static void Main(string[] args)
{
    DualSense ds = DualSense.EnumerateControllers().First();
    ds.Acquire();
    ds.JoystickDeadZone = 0.1f;
    ds.BeginPolling(20, (sender) => {
        DualSenseInputState dss = sender.InputState;
        Console.WriteLine($"LS: ({dss.LeftAnalogStick.X:F2}, {dss.LeftAnalogStick.Y:F2})");
        Console.WriteLine($"RS: ({dss.RightAnalogStick.X:F2}, {dss.RightAnalogStick.Y:F2})");
        Console.WriteLine($"Triggers: ({dss.L2:F2}, {dss.R2:F2})");
        Console.WriteLine($"Touch 1: ({dss.Touchpad1.X}, {dss.Touchpad1.Y}, {dss.Touchpad1.IsDown}, {dss.Touchpad1.Id})");
        Console.WriteLine($"Touch 2: ({dss.Touchpad2.X}, {dss.Touchpad2.Y}, {dss.Touchpad2.IsDown}, {dss.Touchpad2.Id})");
        Console.WriteLine($"Gyro: ({dss.Gyro.X}, {dss.Gyro.Y}, {dss.Gyro.Z})");
        Console.WriteLine($"Accel: ({dss.Accelerometer.X}, {dss.Accelerometer.Y}, {dss.Accelerometer.Z}); m={dss.Accelerometer.Magnitude()}");
        Console.WriteLine($"Headphone: {dss.IsHeadphoneConnected}");
        Console.WriteLine($"Battery: {dss.BatteryStatus.IsCharging}, {dss.BatteryStatus.IsFullyCharged}, {dss.BatteryStatus.Level}");
    });
    Console.ReadKey(true);
    ds.EndPolling();
    ds.Release();
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 3,982 11/25/2021
1.0.1 3,670 11/25/2021
1.0.0 3,468 11/25/2021