HidDeviceReaderLibrary 3.4.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package HidDeviceReaderLibrary --version 3.4.0
NuGet\Install-Package HidDeviceReaderLibrary -Version 3.4.0
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="HidDeviceReaderLibrary" Version="3.4.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HidDeviceReaderLibrary" Version="3.4.0" />
<PackageReference Include="HidDeviceReaderLibrary" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add HidDeviceReaderLibrary --version 3.4.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: HidDeviceReaderLibrary, 3.4.0"
#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.
#:package HidDeviceReaderLibrary@3.4.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=HidDeviceReaderLibrary&version=3.4.0
#tool nuget:?package=HidDeviceReaderLibrary&version=3.4.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
HidDeviceReaderLibrary
简介
HidDeviceReaderLibrary 是一个用于读取 USB HID 设备(不支持虚拟键盘模式)数据并解析 JSON 数据的 .NET 类库。适用于需要与 HID 设备通信并处理其数据的应用场景。
功能特性
- 支持通过 VendorID 和 ProductID 查找并连接 HID 设备
- 实时读取 HID 设备数据流
- 自动过滤 ASCII 数据并提取 JSON 字符串
- 支持解析 JSON 并获取指定字段内容
- 通过事件回调方式异步获取数据
- 支持自定义取消读取(CancellationToken)
支持平台
- .NET Core 2.0 及以上
- .NET 6/8/9
- Windows、Linux、macOS(依赖 HidSharp 支持的平台)
安装方法
dotnet add package HidDeviceReaderLibrary
快速上手示例
using System;
using System.Threading;
using HidDeviceReaderLibrary;
class Program {
static void Main()
{
// 替换为你的设备 VendorID 和 ProductID
var reader = new HidDeviceReaderV1(0x2F50, 0x0300);
reader.OnDataReceived += data =>
{
Console.WriteLine($"收到设备数据: {data}");
};
using (var cts = new CancellationTokenSource())
{
// 按 Ctrl+C 终止
Console.CancelKeyPress += (s, e) => {
e.Cancel = true;
cts.Cancel();
};
reader.StartReading(cts.Token);
}
}
}
依赖
许可证
MIT
| Product | Versions 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 is compatible. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 2.0
- HidSharp (>= 2.1.0)
- System.Runtime.CompilerServices.Unsafe (>= 5.0.0)
- System.Text.Json (>= 5.0.2)
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 |
|---|---|---|
| 4.5.0 | 296 | 5/16/2025 |
| 4.4.0 | 266 | 5/16/2025 |
| 4.3.0 | 262 | 5/16/2025 |
| 4.2.0 | 262 | 5/16/2025 |
| 4.1.0 | 272 | 5/16/2025 |
| 4.0.0 | 272 | 5/16/2025 |
| 3.9.3 | 276 | 5/16/2025 |
| 3.9.2 | 272 | 5/16/2025 |
| 3.9.1 | 280 | 5/15/2025 |
| 3.9.0 | 272 | 5/15/2025 |
| 3.7.0 | 274 | 5/15/2025 |
| 3.6.0 | 278 | 5/14/2025 |
| 3.5.0 | 276 | 5/14/2025 |
| 3.4.0 | 269 | 5/14/2025 |
| 3.3.0 | 278 | 5/14/2025 |
| 3.2.0 | 277 | 5/14/2025 |
| 3.1.0 | 272 | 5/14/2025 |
| 3.0.0 | 285 | 5/14/2025 |
| 1.2.0 | 286 | 5/14/2025 |
| 1.1.0 | 257 | 5/16/2025 |
Loading failed
## 版本 3.4.0
- [新增] README文档