QrcodeUSBComReader
Example of using Datalogic QD2500 qrcode usb qrcode reader in Delphi-7 and C#
- Active · last change 12-16-2024
- ★ 1 on GitHub
README
Qrcode USBCom Reader
Example of using Datalogic QD2500 qrcode usb qrcode reader in Delphi-7 and C# while supporting unicode and single shout read. This examples implemented event based or call back function and Delphi7/Gui used and read thread to prevent GUI locking.
How to use in Delphi-7
-
Import
UUSBCom.pasto your project. Then useUUSBComin your file.uses ... , UUSBCom; -
Define a data receiver procedure callback function:
procedure TForm1.DataReceived(const Data: string); var ExtractedData: TExtractedData; begin ExtractedData := ExtractDataUsingPerlRegEx(Data); Memo1.Text:=(Data); end; -
Create USBCome instance and pass callback to it , Then start reader by calling
StartReading():var USBCom : TUSBCom; begin ... USBCom := TUSBCom.Create(DataReceived); ... end;* You can pass port name like 'Com1' and baud rate to StartReading(Port: string = ''; BaudRate: DWORD = 9600). Otherwise it automatically choose last available com port and 9600 baud rate.
-
Make sure destroy object and release the com port when your work was down :
USBCom.Free();More
If you going to use this unit to extract data from qrcode text. Import PerlRegEx/pcre.pas , PerlRegEx/PerlRegEx.pas , UStringUtils.pas. Then ExtractDataUsingPerlRegEx() use for data extracting data from string. Change regular expressions relative to pattern.
If you are dealing with arabic / persian unicode text use UTF8ToWindows1256AndConvertNumbers to convert utf8 string back to windows-1256 encoding which is compatible with Delphi 7.

