Winsoft Native HID v1.0 Delphi/C++ Builder 5 - 10.3 Full Source
Winsoft Native HID v1.0 Delphi/C++ Builder 5 - 10.3 Full Source
Delphi and C++ Builder library for communicating with HID devices.
uses Windows HID API
supports Windows 32 and Windows 64
available for Delphi/C++ Builder 5 - 10.3 and Lazarus 2.0.4
source code included in registered version
royalty free distribution in applications
API
type
EHidError = class(Exception);
THidDeviceArrivalEvent = procedure(Sender: TObject; const DeviceName: string) of object;
THidDeviceRemovedEvent = procedure(Sender: TObject; const DeviceName: string) of object;
THidDevice = class
constructor Create;
function Enumerate: TStringDynArray;
procedure Open(const DeviceName: string; Read, Write: Boolean);
procedure Close;
procedure FlushInputQueue;
// Size has to be InputReportLength; Timeout in milliseconds
procedure Read(dаta: PByte; Size: Integer; Timeout: Integer);
function Read(Timeout: Integer): TByteDynArray;
// First byte is report ID; Size has to be OutputReportLength; Timeout in milliseconds
procedure Write(dаta: PByte; Size: Integer; Timeout: Integer);
procedure Write(ReportID: Byte; dаta: TByteDynArray; Timeout: Integer);
// First byte is report ID; Size has to be InputReportLength
procedure GetInputReport(dаta: PByte; Size: Integer);
function GetInputReport(ReportID: Byte): TByteDynArray;
// First byte is report ID; Size has to be OutputReportLength
procedure SetOutputReport(dаta: PByte; Size: Integer);
procedure SetOutputReport(ReportID: Byte; dаta: TByteDynArray);
// First byte is report ID; Size has to be FeatureReportLength
procedure GetFeatureReport(dаta: PByte; Size: Integer);
function GetFeatureReport(ReportID: Byte): TByteDynArray;
// First byte is report ID; Size has to be FeatureReportLength
procedure SetFeatureReport(dаta: PByte; Size: Integer);
procedure SetFeatureReport(ReportID: Byte; dаta: TByteDynArray);
procedure GetPhysicalDescriptor(dаta: PByte; Size: Integer);
property Active: Boolean read;
property DeviceName: string read;
property FeatureReportLength: Word read;
property FeatureReportSupported: Boolean read;
property Handle: THandle read;
property InputBufferCount: Integer read write;
property InputReportLength: Word read;
property InputReportSupported: Boolean read;
property Manufacturer: string read;
property OutputReportLength: Word read;
property OutputReportSupported: Boolean read;
property Product: string read;
property ProductID: Word read;
property ReadSupported: Boolean read;
property SerialNumber: string read;
property Strings[Index: Integer]: string read;
property HasString[Index: Integer]: Boolean read;
property Usage: Word read;
property UsagePage: Word read;
property VendorID: Word read;
property VersionNumber: Word read;
property WriteSupported: Boolean read;
property OnDeviceArrival: THidDeviceArrivalEvent read write;
property OnDeviceRemoved: THidDeviceRemovedEvent read write;
end;
type
EHidError = class(Exception);
THidDeviceArrivalEvent = procedure(Sender: TObject; const DeviceName: string) of object;
THidDeviceRemovedEvent = procedure(Sender: TObject; const DeviceName: string) of object;
THidDevice = class
constructor Create;
function Enumerate: TStringDynArray;
procedure Open(const DeviceName: string; Read, Write: Boolean);
procedure Close;
procedure FlushInputQueue;
// Size has to be InputReportLength; Timeout in milliseconds
procedure Read(dаta: PByte; Size: Integer; Timeout: Integer);
function Read(Timeout: Integer): TByteDynArray;
// First byte is report ID; Size has to be OutputReportLength; Timeout in milliseconds
procedure Write(dаta: PByte; Size: Integer; Timeout: Integer);
procedure Write(ReportID: Byte; dаta: TByteDynArray; Timeout: Integer);
// First byte is report ID; Size has to be InputReportLength
procedure GetInputReport(dаta: PByte; Size: Integer);
function GetInputReport(ReportID: Byte): TByteDynArray;
// First byte is report ID; Size has to be OutputReportLength
procedure SetOutputReport(dаta: PByte; Size: Integer);
procedure SetOutputReport(ReportID: Byte; dаta: TByteDynArray);
// First byte is report ID; Size has to be FeatureReportLength
procedure GetFeatureReport(dаta: PByte; Size: Integer);
function GetFeatureReport(ReportID: Byte): TByteDynArray;
// First byte is report ID; Size has to be FeatureReportLength
procedure SetFeatureReport(dаta: PByte; Size: Integer);
procedure SetFeatureReport(ReportID: Byte; dаta: TByteDynArray);
procedure GetPhysicalDescriptor(dаta: PByte; Size: Integer);
property Active: Boolean read;
property DeviceName: string read;
property FeatureReportLength: Word read;
property FeatureReportSupported: Boolean read;
property Handle: THandle read;
property InputBufferCount: Integer read write;
property InputReportLength: Word read;
property InputReportSupported: Boolean read;
property Manufacturer: string read;
property OutputReportLength: Word read;
property OutputReportSupported: Boolean read;
property Product: string read;
property ProductID: Word read;
property ReadSupported: Boolean read;
property SerialNumber: string read;
property Strings[Index: Integer]: string read;
property HasString[Index: Integer]: Boolean read;
property Usage: Word read;
property UsagePage: Word read;
property VendorID: Word read;
property VersionNumber: Word read;
property WriteSupported: Boolean read;
property OnDeviceArrival: THidDeviceArrivalEvent read write;
property OnDeviceRemoved: THidDeviceRemovedEvent read write;
end;
Only for V.I.P
Warning! You are not allowed to view this text.