SymScan: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: SymScan
| Old | New | Line | |
|---|---|---|---|
| 1 | + | ## About | |
| 2 | + | ||
| 3 | + | SymScan provides an Barcode scanning component and API link to the barcode scanner module in Symbol/Motorola MC series Windows CE based barcode scanners. | |
| 4 | + | ||
| 5 | + | ## Functional Description: | |
| 6 | + | ||
| 7 | + | Two principal units are provided: | |
| 8 | + | ||
| 9 | + | - symscanapi.pp contains the bindings to the MC's SCNAPI32.DLL library. | |
| 10 | + | - uscanner.pas provides a TScanner component that is derived from a TThread for easier access to the hardware scanner. | |
| 11 | + | ||
| 12 | + | A very simple project is included as an example. | |
| 13 | + | ||
| 14 | + | ## Author | |
| 15 | + | ||
| 16 | + | Arnold Bosch: arnoldb at mweb dot com dot na | |
| 17 | + | ||
| 18 | + | ## License | |
| 19 | + | ||
| 20 | + | The sample application is licensed under the GPL, and the libraries under LGPL | |
| 21 | + | ||
| 22 | + | ## Download | |
| 23 | + | ||
| 24 | + | It can be downloaded from [Lazarus-CCR SourceForge](http://sourceforge.net/project/showfiles.php?group_id=92177&package_id=323770). | |
| 25 | + | ||
| 26 | + | ## Dependencies / System Requirements | |
| 27 | + | ||
| 28 | + | ### Development requirements: | |
| 29 | + | ||
| 30 | + | - FPC 2.2.2 or later | |
| 31 | + | - Lazarus 0.9.26 or later | |
| 32 | + | - The appropriate cross-arm-wince-win32 installation for FPC/Lazarus above. | |
| 33 | + | ||
| 34 | + | ### Hardware: | |
| 35 | + | ||
| 36 | + | - For most MC series handhelds, a suitable aygshell.dll will have to be installed - see [here](http://wiki.lazarus.freepascal.org/WinCE_Programming_Tips) | |
| 37 | + | - Tested devices include: (If it works on others, please add!) | |
| 38 | + | - MC9000 series with Windows CE 4.2 | |
| 39 | + | - MC1000 series with Windows CE 4.2 | |
| 40 | + | - MC70 with Windows Mobile 5.0 | |
| 41 | + | ||
| 42 | + | NOTE: Because there is no normal Windows scanning interface to substitute for the MC's dll, application development can only be done by compiling and downloading the application to the hardware device for testing. In my experience, this is not always practical when developing a fairly big/complicated application, so I can do the following recommendation: | |
| 43 | + | ||
| 44 | + | - Keep all scanner-related code together in your code as far as possible, and put {\$IFDEF MCDEVICE} and {\$ENDIF MCDEVICE} before and after the code blocks. | |
| 45 | + | - At the top of your application, use a {\$DEFINE MCDEVICE} if you want to compile with scanner support, or comment it out (// {\$DEFINE MCDEVICE}) to test your application without scanner support on normal Windows, the Windows WinCE emulator or WinCE based devices that cannot use this unit. | |
| 46 | + | ||
| 47 | + | ## Documentation | |
| 48 | + | ||
| 49 | + | The TScanner component is derived from TThread, and introduces two events: | |
| 50 | + | ||
| 51 | + | ``` pascal | |
| 52 | + | OnScan(Barcode:String, Symbology: String); | |
| 53 | + | ``` | |
| 54 | + | ||
| 55 | + | Barcode is the barcode returned from a scan. Note that check-digits are NOT removed. Symbology returns the type of barcode that was scanned (EAN13, UTF8, Code 39 etc). | |
| 56 | + | ||
| 57 | + | ``` pascal | |
| 58 | + | OnError(ErrorMessage: String) | |
| 59 | + | ``` | |
| 60 | + | ||
| 61 | + | When the scanner component encounter an error, ErrorMessage contains a descriptive string. | |
| 62 | + | ||
| 63 | + | - To use the scanning component, include uscanner in your application's uses clause. | |
| 64 | + | - Add a component to the main form for the scanner, e.g. Scanner:TScanner | |
| 65 | + | - Add procedures to your form to handle OnScan and OnError events: | |
| 66 | + | ||
| 67 | + | ``` pascal | |
| 68 | + | TForm1 = class(TForm) | |
| 69 | + | procedure FormCreate(Sender: TObject); | |
| 70 | + | private | |
| 71 | + | Scanner:TScanner; | |
| 72 | + | Procedure GetScan(barcode:String; Symbology:String); | |
| 73 | + | Procedure GetScanError(ErrorMessage:string); | |
| 74 | + | { private declarations } | |
| 75 | + | public | |
| 76 | + | { public declarations } | |
| 77 | + | end; | |
| 78 | + | ``` | |
| 79 | + | ||
| 80 | + | - At an appropriate location in your code, create the scanner, with the suspended option set to TRUE | |
| 81 | + | - Set the scanner component's OnScan and OnError properties to the procedures you created for them | |
| 82 | + | - To enable the scanner, Resume the Scanner component | |
| 83 | + | ||
| 84 | + | ``` pascal | |
| 85 | + | procedure TForm1.FormCreate(Sender: TObject); | |
| 86 | + | begin | |
| 87 | + | Scanner := TScanner.Create(True); | |
| 88 | + | Scanner.OnError := @GetScanError; | |
| 89 | + | Scanner.OnScan := @GetScan; | |
| 90 | + | Scanner.Resume; | |
| 91 | + | end; | |
| 92 | + | ``` | |
| 93 | + | ||
| 94 | + | - Also remember to stop the scanner when your application closes: | |
| 95 | + | ||
| 96 | + | ``` pascal | |
| 97 | + | Scanner.Terminate; | |
| 98 | + | ``` | |
| 99 | + | ||
| 100 | + | --- | |
| 101 | + | *From the Free Pascal wiki, page "SymScan", as it stood on 2020-02-28 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* | |
| 102 | + | Category: Components | |
| 103 | + | Category: Hardware | |
| 104 | + | Category: Lazarus-CCR |
