添加项目文件。

This commit is contained in:
2026-03-26 10:45:29 +08:00
parent 10441f488c
commit b576d3f19d
48 changed files with 4812 additions and 0 deletions

42
DRI/Dri_Vendor.h Normal file
View File

@@ -0,0 +1,42 @@
#pragma once
#include "MID/Mid_Def.h"
#include <QtCore/QByteArray>
#include <QtCore/QString>
#include <Windows.h>
/*
* DRI Vendor 层:读写固件的 Vendor/NKRO HID 接口,支撑逻辑层功能诊断。
*
*/
struct Dri_Vendor_Struct_Port
{
/* 读写句柄Vendor 写、NKRO 写与通用读各占一个 */
HANDLE HandleRead = INVALID_HANDLE_VALUE;
HANDLE HandleWriteVendor = INVALID_HANDLE_VALUE;
HANDLE HandleWriteNkro = INVALID_HANDLE_VALUE;
HANDLE HandleEvent = nullptr;
OVERLAPPED OverlappedRead = {};
/* 运行状态 + 报文长度缓存,便于 UI/LOGIC 层快速判断 */
bool IsOpened = false;
bool IsReadPending = false;
quint16 InputLength = 0;
quint16 OutputLength = 0;
quint16 NkroWriteOutputLength = 0;
QByteArray ReadBuffer;
};
/* 关闭全部句柄,安全退出时务必调用以便复用设备。 */
void Dri_Vendor_Func_Close(Dri_Vendor_Struct_Port* p_Port);
/* 根据 VID/PID 打开对应 HID 接口,并创建必需句柄。 */
bool Dri_Vendor_Func_Open(Dri_Vendor_Struct_Port* p_Port,
const Mid_Struct_DeviceConfig& DeviceConfig,
QString* p_TextStatus);
/* 读取 Vendor 报文:一次返回一个 Mid_Struct_RawPacket。 */
bool Dri_Vendor_Func_Read(Dri_Vendor_Struct_Port* p_Port,
Mid_Struct_RawPacket* p_Packet,
QString* p_TextStatus);
/* 写入 Vendor/NKRO 报文ByteArray 按固件定义组包。 */
bool Dri_Vendor_Func_Write(Dri_Vendor_Struct_Port* p_Port,
const QByteArray& ByteArray,
QString* p_TextStatus);