Communicating with Human Interface Devices such as Alphanumeric display, Bar Code Reader, Sensors, Volume control on Speakers/Headsets becomes a primary use case for real-world, Cross-platform applications. Do you spend more time in building libraries to communicate with HID for your Delphi/C++ FireMonkey applications? WINSOFT Provides a powerful library to get the job done. It uses the standard Windows HID API.
Features:
- Able to notify on HID Device arrival and removal.
- Can retrieve all the HID devices information available in the System.
- Flexible to getting/set Feature Report for the HID devices.
- Works with Windows 32/64-bit applications.
Versions Supported: Delphi/C++ Builder XE2 – Delphi 10.4.
Platforms: Windows, OS X, Android, and iOS;
Steps to Download and use the Native HID Library:
- Download Native HID for FireMonkey and Unzip the file.
- Nahttps://winsoft.sk/nathid.htmvigate to the Library folder for different Versions. e.g) Delphi104-Win32.
- Read the Readme.txt file to know about features and copyright information.
- Create a Windows VCL Application and use FHid.pas in the uses section.
- Include the Library folder into Project->Options->Delphi Compiler->Search Path.
- Compile and check for using the library.
NativeHID Download and Use for FireMonkey demo:
Key HID concepts:
Report -Reports are the actual data that is exchanged between a device and a software client.
- Input Report – Data sent from the HID device to the application, typically when the state of a control changes.
- Output Report – Data sent from the application to the HID device, for example to the LEDs on a keyboard.
- Feature Report -Data that can be manually read and/or written, and are typically related to configuration information.
Report Descriptor – The Report Descriptor describes the format and meaning of the data that the device supports.
UsageTables – Contain a list with descriptions of Usages, which describe the intended meaning and use of a particular item described in the Report Descriptor. For example, a Usage is defined for the left button of a mouse. USB-IF WorkGroup Publishes the Usage Tables. See USB-IF HID Specifications.
How to build FireMonkey applications using Native HID library:
1. Open Rad Studio 10.4 and Create a Blank Multi Device Application, use FHid.pas in the uses section.
2. Include the Library folder into Project->Options->Delphi Compiler->Search Path.
3. Create a Device instance and open,
[crayon-674032b904c7f705287743/]- OnDeviceArrival– Provide the DeviceName which arrives at the system. Using DeviceName you can open the device, show the device properties.
- OnDeviceRemoved – Provide the DeviceName which removed from the system.
- Get/SetFeatureReport – Use this to manually Read/Write Related to configuration information.
- GetInputReport – Get the data sent by HID Device for the Report ID.
- SetOutputReport – Set the data to HID Device for the Report ID.
4. ShowDeviceProperties.
[crayon-674032b904c88573751956/]5. Get Device Names,
[crayon-674032b904c89171903020/]6. For each DeviceNames GetFeatureReport, GetInputReport and Read data by reopening the device in Read-only,
[crayon-674032b904c8a140164001/]7. Close the Device.
[crayon-674032b904c8b514960563/]Native HID Library for FireMonkey Code demo :
Conclusion: It’s quite easy to interact with HID in your FireMonkey applications. WINSOFT saved our time in nailing the Windows HID API and help us to build quickly using NativeHID Library.
Head over and check out the full WINSOFT Native HID Library for Access in Delphi and C++Builder.