using HidSharp;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Threading;
public class MiraboxHidSharpController : IDisposable
{
private HidDevice _device;
private HidStream _stream;
private bool _isConnected = false;
// Mirabox 设备信息(需要根据实际设备修改)
private const int VENDOR_ID = 0xffff; // 替换为 Mirabox 的实际 VID
private const int PRODUCT_ID = 0xffff; // 替换为 Mirabox 的实际 PID
// Mirabox 规格
public const int KEY_COUNT = 15;
public const int IMAGE_SIZE = 72;
public const int REPORT_LENGTH = 1024; // HID 报告长度
public event EventHandler<MiraboxKeyEventArgs> KeyStateChanged;
public class MiraboxKeyEventArgs : EventArgs
{
public int KeyIndex { get; set; }
public bool IsPressed { get; set; }
}
// 设备检测
public static List<HidDevice> FindMiraboxDevices()
{
var deviceList = DeviceList.Local;
var allHidDevices = deviceList.GetHidDevices().ToList();
Please note that the WebSocket SDK may lack some device controls.
Finally, pay special attention when setting the device background; the size of the background image must be strictly controlled (this size can be viewed in the StreamDock software settings).
Incorrect size may cause device firmware corruption.