Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

QrcodeUSBComReader

Example of using Datalogic QD2500 qrcode usb qrcode reader in Delphi-7 and C#

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

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

  1. Import UUSBCom.pas to your project. Then use UUSBCom in your file.

    pascal
    uses ... , UUSBCom;
  2. Define a data receiver procedure callback function:

    pascal
    procedure  TForm1.DataReceived(const Data: string);
    var
    ExtractedData: TExtractedData;
    begin
        ExtractedData := ExtractDataUsingPerlRegEx(Data);
        Memo1.Text:=(Data);
    end;
  3. Create USBCome instance and pass callback to it , Then start reader by calling StartReading():

    pascal
    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.

  4. Make sure destroy object and release the com port when your work was down :

pascal
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.