


Modern DI frameworks should correctly handle instantiation and disposal automatically, as well as suppplying a logger if registered. Var devices = serviceProvider.GetService() Register the service as a Singleton (so only one instance is created) using code similar to: services.AddSingleton() The Devices class implements IDisposable for asynchronous disposal, which cleans up all listeners.Īlternatively, the library is fully compatible with Dependency injection frameworks. In practice you should only ever create one of these. Note this instantiates a new instance of the Devices class which immediately starts listening for new HID devices. To start monitoring controllers add the following code: using var devices = new Devices() There is a sample program included which demonstrates using the library in various scenarios. NET Core, use the following command: dotnet add package The library is available via NuGet and is delivered via NuGet Package Manager: Install-Package HIDDevices This affects the "Microsoft XBox One for Windows Controller". I have been unable to find where this 'feature' is documented. It appears that the XInput-compatible HID device driver only transmits events from the HID device whilst the current process has a focussed window, so console applications/background services don't appear to work! This is not a bug in this library, although.ButtonPage.Button1 became ButtonPage.Button0 and when moving from version 2 to version 3, when the code generation was changed and the source of truth was changed to directly reference the published PDF specification (see #6).

Notable changes include from 2.0-2.1, when many of 1-indexed usages were changed to 0-indexed, e.g. In particular, any time the HID tables are updated, I will update This can cause breaking changes in your own code, so be careful when updating versions of the NuGet.

