DualSenseAPI 1.0.2

.NET Core 3.1
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, C# scripting and .NET Interactive. 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 Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp3.1
Compatible target framework(s)
Additional computed target framework(s)
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,364 11/25/2021
1.0.1 3,264 11/25/2021
1.0.0 3,072 11/25/2021