Updated README.md

This commit is contained in:
EonaCat 2025-07-14 20:26:13 +02:00
parent 1b20217def
commit effcea8b4d
7 changed files with 110 additions and 91 deletions

View File

@ -5,6 +5,9 @@ using System.Windows.Forms;
namespace EonaCat.HID.Analyzer
{
// This file is part of the EonaCat project(s) which is released under the Apache License.
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
internal partial class AboutBox : Form
{
public AboutBox()

View File

@ -13,6 +13,9 @@ using System.Windows.Forms;
namespace EonaCat.HID.Analyzer
{
// This file is part of the EonaCat project(s) which is released under the Apache License.
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
public partial class MainForm : Form
{
IHidManager _deviceManager;

View File

@ -3,6 +3,8 @@ using System.Windows.Forms;
namespace EonaCat.HID.Analyzer
{
// This file is part of the EonaCat project(s) which is released under the Apache License.
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
internal static class Program
{
/// <summary>

View File

@ -4,6 +4,9 @@ using System.Globalization;
namespace EonaCat.HID.Example
{
// This file is part of the EonaCat project(s) which is released under the Apache License.
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
public class Program
{
static IHidManager _deviceManager;

View File

@ -7,7 +7,7 @@
<Copyright>Copyright 2024 EonaCat (Jeroen Saey)</Copyright>
<LangVersion>latest</LangVersion>
<PackageId>EonaCat.HID</PackageId>
<Version>1.0.3</Version>
<Version>1.0.4</Version>
<Title>EonaCat.HID</Title>
<Authors>EonaCat (Jeroen Saey)</Authors>
<Description>HID Devices</Description>

View File

@ -2,6 +2,8 @@
namespace EonaCat.HID.Models
{
// This file is part of the EonaCat project(s) which is released under the Apache License.
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
public class HidReport
{
public byte ReportId { get; }

View File

@ -6,10 +6,16 @@ Works on Windows, Linux and macOS.
Example Code:
```csharp
using EonaCat.HID.EventArguments;
using EonaCat.HID.Helpers;
using EonaCat.HID;
using EonaCat.HID.Models;
using System.Globalization;
class Program
namespace EonaCat.HID.Example
{
// This file is part of the EonaCat project(s) which is released under the Apache License.
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
public class Program
{
static IHidManager _deviceManager;
static IHid _device;
@ -52,7 +58,7 @@ class Program
_device.OnDataReceived += (s, e) =>
{
Console.WriteLine($"Rx Data: {BitConverter.ToString(e.Data)}");
Console.WriteLine($"Rx Data: {BitConverter.ToString(e.Report.Data)}");
};
_device.OnError += (s, e) =>
@ -63,19 +69,18 @@ class Program
_device.Open();
Console.WriteLine($"Connected to {_device.ProductName}");
await _device.StartListeningAsync();
await _device.StartListeningAsync(default);
Console.WriteLine("Listening... Press [Enter] to send test output report.");
Console.ReadLine();
// Example: Send output report
// Example: Send output report using HidReport
var data = ByteHelper.HexStringToByteArray("01-02-03");
byte[] outputReport = new byte[data.Length + 1];
outputReport[0] = 0x00; // Report ID
Array.Copy(data, 0, outputReport, 1, data.Length);
var reportId = (byte)0x00; // Report ID
var outputReport = new HidReport(reportId, data);
await _device.WriteOutputReportAsync(outputReport);
Console.WriteLine($"Sent output report: {BitConverter.ToString(outputReport)}");
Console.WriteLine($"Sent output report: Report ID: {reportId}, Data: {BitConverter.ToString(data)}");
Console.WriteLine("Press [Enter] to exit...");
Console.ReadLine();
@ -116,4 +121,5 @@ public static class ByteHelper
.ToArray();
}
}
}
```