diff --git a/readme.md b/readme.md
index 5664c69..6df675c 100644
--- a/readme.md
+++ b/readme.md
@@ -8,6 +8,8 @@ Supported HIDAPI version: Up to 0.14
## Use
To use the library please reference the [nuget package](https://www.nuget.org/packages/HidApi.Net/) in your project. Additionally it is required to either ensure that [HIDAPI] is available on the host system or is distributed as part of your application.
+To get an overview of the API please refer to the [API documentation][api].
+
### Code sample
You can use the [Hid class](https://github.com/badcel/HidApi.Net/blob/main/src/HidApi.Net/Hid.cs) to enumerate over devices or directly use the [device class](https://github.com/badcel/HidApi.Net/blob/main/src/HidApi.Net/Device.cs) to connect to a known device:
@@ -47,3 +49,4 @@ HidApi.Net is licensed under the terms of the MIT-License. Please see the [licen
[HIDAPI]:https://github.com/libusb/hidapi
[udev]:https://github.com/libusb/hidapi/blob/master/udev/69-hid.rules
[license]:https://raw.githubusercontent.com/badcel/HidApi.Net/main/license.txt
+[api]:https://badcel.github.io/HidApi.Net/api/HidApi.html
diff --git a/src/HidApi.Net/Device.cs b/src/HidApi.Net/Device.cs
index dcb541b..3d6e7b5 100644
--- a/src/HidApi.Net/Device.cs
+++ b/src/HidApi.Net/Device.cs
@@ -13,6 +13,7 @@ public sealed class Device : IDisposable
///
/// Vendor id of target device
/// product id of target device
+ /// Raised on failure
public Device(ushort vendorId, ushort productId)
{
handle = NativeMethods.Open(vendorId, productId, NullTerminatedString.Empty);
@@ -27,6 +28,7 @@ public Device(ushort vendorId, ushort productId)
/// Vendor id of target device
/// Product id of target device
/// Serial number of target device
+ /// Raised on failure
public Device(ushort vendorId, ushort productId, string serialNumber)
{
handle = NativeMethods.Open(vendorId, productId, WCharT.CreateNullTerminatedString(serialNumber));
@@ -39,6 +41,7 @@ public Device(ushort vendorId, ushort productId, string serialNumber)
/// Connects to a given device.
///
/// Path to the device
+ /// Raised on failure
public Device(string path)
{
handle = NativeMethods.OpenPath(path);
@@ -51,6 +54,7 @@ public Device(string path)
/// Write an output report to the device.
///
/// Data to send. The first byte must contain the report id or 0x00 if the device only supports one report
+ /// Raised on failure
public void Write(ReadOnlySpan data)
{
var result = NativeMethods.Write(handle, data);
@@ -66,6 +70,7 @@ public void Write(ReadOnlySpan data)
/// timeout in milliseconds. -1 for blocking mode.
/// The received data of the HID device. If the timeout is exceeded an empty result is returned.
/// Raised if maxlength is smaller than 0
+ /// Raised on failure
public ReadOnlySpan ReadTimeout(int maxLength, int milliseconds)
{
if (maxLength < 0)
@@ -86,6 +91,7 @@ public ReadOnlySpan ReadTimeout(int maxLength, int milliseconds)
/// Max length of the expected data. The value can be greater than the actual report.
/// The received data of the HID device. If non blocking mode is enabled and no data is available an empty result will be returned.
/// Raised if maxlength is smaller than 0
+ /// Raised on failure
public ReadOnlySpan Read(int maxLength)
{
if (maxLength < 0)
@@ -105,6 +111,7 @@ public ReadOnlySpan Read(int maxLength)
///
/// true: Enable non blocking mode.
/// false: Disable non blocking mode.
+ /// Raised on failure
public void SetNonBlocking(bool setNonBlocking)
{
var result = NativeMethods.SetNonBlocking(handle, setNonBlocking ? 1 : 0);
@@ -117,6 +124,7 @@ public void SetNonBlocking(bool setNonBlocking)
/// Sends a feature report to the device.
///
/// The data which should be sent to the device. The first byte must contain the report id or 0x0 if the device does not use numbered reports.
+ /// Raised on failure
public void SendFeatureReport(ReadOnlySpan data)
{
var result = NativeMethods.SendFeatureReport(handle, data);
@@ -132,6 +140,7 @@ public void SendFeatureReport(ReadOnlySpan data)
/// Max length of the expected data. The value can be greater than the actual report.
/// The received data of the HID device.
/// Raised if maxLength is smaller than 1
+ /// Raised on failure
public ReadOnlySpan GetFeatureReport(byte reportId, int maxLength)
{
if (maxLength < 1)
@@ -155,6 +164,7 @@ public ReadOnlySpan GetFeatureReport(byte reportId, int maxLength)
/// Max length of the expected data. The value can be greater than the actual report.
/// The received data of the HID device.
/// Raised if maxLength is smaller than 1
+ /// Raised on failure
/// Available since hidapi 0.10.0
public ReadOnlySpan GetInputReport(byte reportId, int maxLength)
{
@@ -173,11 +183,12 @@ public ReadOnlySpan GetInputReport(byte reportId, int maxLength)
}
///
- /// Returns the manufactuerer.
+ /// Returns the manufacturer.
///
/// Max length of the returned manufacturer string
/// A string containing the name of the manufacturer
/// Raised if maxlength is smaller than 0
+ /// Raised on failure
public string GetManufacturer(int maxLength = 128)
{
if (maxLength < 0)
@@ -198,6 +209,7 @@ public string GetManufacturer(int maxLength = 128)
/// Max length of the returned product string
/// A string containing the name of the product
/// Raised if maxlength is smaller than 0
+ /// Raised on failure
public string GetProduct(int maxLength = 128)
{
if (maxLength < 0)
@@ -218,6 +230,7 @@ public string GetProduct(int maxLength = 128)
/// Max length of the returned serial number string
/// A string containing the serial number
/// Raised if maxlength is smaller than 0
+ /// Raised on failure
public string GetSerialNumber(int maxLength = 128)
{
if (maxLength < 0)
@@ -236,6 +249,7 @@ public string GetSerialNumber(int maxLength = 128)
/// Returns the device info for a device.
///
///
+ /// Raised on failure
/// Available since hidapi 0.13.0
public DeviceInfo GetDeviceInfo()
{
@@ -257,6 +271,7 @@ public DeviceInfo GetDeviceInfo()
/// Max length of the string
/// The string at the given index.
/// Raised if maxlength is smaller than 0
+ /// Raised on failure
public string GetIndexedString(int stringIndex, int maxLength = 128)
{
if (maxLength < 0)
@@ -278,6 +293,7 @@ public string GetIndexedString(int stringIndex, int maxLength = 128)
/// The report descriptor
/// Available since hidapi 0.14.0
/// Raised if bufLength is less than 0
+ /// Raised on failure
public ReadOnlySpan GetReportDescriptor(int bufSize = 4096)
{
if (bufSize < 0)
diff --git a/src/HidApi.Net/HidApi.Net.csproj b/src/HidApi.Net/HidApi.Net.csproj
index 1c3d0e6..6d4eacf 100644
--- a/src/HidApi.Net/HidApi.Net.csproj
+++ b/src/HidApi.Net/HidApi.Net.csproj
@@ -1,6 +1,6 @@
- 1.0.1
+ 1.0.2
HidApi
true