Docstoc

qr32-denso-manual

Document Sample
qr32-denso-manual Powered By Docstoc
					QR Code Generator32 Version: W1.0

Software Tool for Generating QR Code

Generator3 ator32 QR Code Generator32

Contents
1 1.1 1.2 1.3 2 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 Introduction ................................................................................ 1 System Requirements ............................................................... 2 Installing the QR Code Generator32 ......................................... 3 The QR Code Generator32 User Surface ................................. 6 How to work with... .................................................................. 11 How to generate QR Code ....................................................... 12 How to work with the Input Data Editor .................................... 14 How to work with Levels of Error Correction ........................... 15 How to determine the Code Size ............................................. 17 How to read the Information Block ........................................... 19 How to export QR Code to other Applications ......................... 21 How to use the OLE Function .................................................. 23 How to use the Concatenation Capability ............................... 25 (Structured Append) Dynamic Data Exchange ......................................................... 27 How to establish a DDE Channel ........................................... 28 The Syntax of a DDE Macro ...................................................... 28 The Result of QR Code Generation ........................................ 30 DDE Macro Sample for WORD 97 ........................................... 30 The Library QRCODE.DLL ........................................................ 35 What is QR Code? .................................................................... 41 What is a Two Dimensional Code? ........................................ 42 Which are the main Characteristics of QR Code? .................. 43 Information Capacity ................................................................ 43 Code Size .................................................................................. 44 Storage Density (compared to a Bar code) ............................. 45 Data Restoration Ability ............................................................ 46 Outstanding Reading Abilities ................................................. 47 Definition of Terms ................................................................... 49

3 3.1 3.2 3.3 3.4 4 5 5.1 5.2 5.2.1 5.2.3 5.2.4 5.2.5 5.2.6 5.3

Section 1. Introduction

Introduction

1

The QR Code Generator32 is an easy- to-use software tool conceived to generate Two-dimensional code according to the AIM International Symbology Specification - QR Code.(Final Draft, May 29, 1997) The generated QR Codes can be exported as Windows Metafiles (graphics) or Bitmaps (BMP) to any Windows program and printed on any printer installed under Windows. No specific knowledge is required, as all major standards have been incorporated into the program.

QR Code Generator32 - main components and features
Input Data Editor Selection of Model 1 or Model 2 Subdividing data into several Codeparts Four user-selectable Levels of Error Correction User-definable Code and Cell size in mm and dots Information Block: Current printer, Number of characters, Code version, Number of cells, Current mask QR Code generating DLL can be implemented into applications Toolbar buttons for main functions: Calculate QR Code, Copy QR Code to clipboard, Save QR Code to file, Print QR Code and its parameter data, Help, Info, Exit program OLE-function for embedding and modifying QR Codes in target applications DDE macro interface for the Dynamic Data Exchange with other Windows applications Optimum encoding method is chosen automatically Positioning of Black and White Cells is optimized automatically

-

1

QR Code Generator32 User's Manual

1.1 System Requirements
The QR Code Generator32 is a Windows software for PCs. To run the program without problems, the following system requirements should be met: • Pentium • 4 MB RAM • MS-Windows 95 or Windows NT 4.0

2

Section 1. Introduction

1.2 Installing the QR Code Generator32
The QR Code Generator32 is delivered on a 3,5"-disk. The installation disk contains the SETUP program, which has the following functions: • checking the system configuration • selection of the installation directory • copying the program file QRE32.EXE • selection of the program group

Starting the installation
• Insert the installation disk into drive A: (or B:) • Start the Explorer (Windows 95) and open the Drive A window • Double-click the SETUP.EXE file The Installation Desktop opens and the Welcome box is displayed.

You can either confirm the installation start with OK or choose Cancel.

Setting the installation directory
You can - either confirm the default installation directory: C:\Programme\QRE32 or - enter a new directory or - choose one of the existing directories

3

QR Code Generator32 User's Manual

Directory already exists
If the installation directory exists, a corresponding message is displayed and you can - either confirm the installation directory (Yes) or - go back to the Installation Directory box (No).

4

Section 1. Introduction

Copying the program file
The QRE32.EXE is copied t the installation directory.

Setting the program group
Once the QRE32.EXE file is copied to the installation directory, the installation is completed and you are prompted - to confirm the program group QR Code Generator32 or - to enter the name of a new program group or - to choose one of the existing program groups

Installation completed
A message is displayed to inform you that the installation process has been successfully completed.

Program icon
If you work with Windows 95, it is advisable to drag the icon from the displayed program group to your Windows desktop.

5

QR Code Generator32 User's Manual

1.3 The QR Code Generator32 User Surface
The Menu and the Toolbar, the Data Editor, the Setting Options, as well as the Display Area are grouped into one clearly arranged mask.

User surface of the QR Code Generator32

Menu
The main menu contains three items with the following subitems: File Register OLE server Save Printer Setup Print Exit

6

Section 1. Introduction

Edit

Copy data Paste data QR Code as object Calculate QR Code Copy Code Cell width in dots Help Info

Help

The most frequently used subitems can be easily accessed by toolbar buttons.

Toolbar
The Toolbar contains four buttons to activate program functions as well as the help- and the information-button.

Exit program Save QR Code to file Calculate QR Code Copy QR Code to clipboard Print QR Code and its parameter Online help Information window

Input Data Editor
The Data Editor holds up to 1024 characters per row. In order to view the data entered you can scroll the editor window.
7

QR Code Generator32 User's Manual

Model
The Model can be set by simply clicking with the mouse.

Levels of Error Correction
The Level of Error Correction can be set by simply clicking with the mouse.

Code Width
You can enter the desired Code Width (which is equal to the Code Length) into the field Code Width. The unit is Millimetres. If you resize a QR Code by dragging with the mouse, the width is automatically displayed in the Code Width field.

Cell Width
You can enter the desired Cell Width into the field Cell Width. The unit is Millimetres. If you resize a QR Code by dragging with the mouse, the width is automatically displayed in the Cell Width field.

Information Block
Once the QR Code is calculated, some useful information is displayed within this block at the lower-left corner of the mask: the Current Printer, the Number of characters, the Code version, the Number of cells and the Current mask.

Display Area
The calculated code is positioned at the upper-left corner of the Display Area. This area has some typical characteristics and features. Resize the code In order to resize the code: • Point with the mouse cursor on the handle

8

Section 1. Introduction

The mouse cursor turns into a two-way arrow • Hold down the mouse button and drag the border to resize it
Rulers and grating

The Display Area of the QR Code Generator32 has a vertical and horizontal ruler with a corresponding grating. The grating unit is by default Centimetres.
Changing the grating unit

You can change the unit of the rulers and the grating to Inches (and back zu Centimetres): • Click the grated area with the right mouse button A small box appears, offering the options "Centimetres" and "Inches" • Click the option wanted The ruler and the grating change correspondingly
Disable/Enable the grating

In order to disable/enable the grating of the Display Area: • Click the small square at the intersection between the horizontal and the vertical ruler

Display Area with bordered QR Code, rulers and grating

9

QR Code Generator32 User's Manual

Space for your notes

10

Section 2. How to work with...

How to work with...

2

The QR Code Generator32 enables you to generate QR Code with a minimum of effort and special domain knowledge. There is only one clearly arranged mask you work with and this mask contains all the necessary options to generate and export QR Code. You don't need to experiment with sophisticated setting options. The QR Code Generator32 automatically chooses the best suited Coding Mode (Numeric, Alphanumeric or Binary) and the optimal distribution of Black and White Cells (Masking).

It's so easy
• • • • Enter the Input Data Click Calculate QR Code Click Copy QR Code to clipboard Paste the QR Code into your application

11

QR Code Generator32 User's Manual

2.1 How to generate QR Code
You can first read this whole section and then generate your first QR Code or you can first generate a QR Code and then read the further details. If you are eager to see your first QR Code: • Enter data (e. g. "How to generate QR Code") into the Data Editor • Click the Calculate QR Code button or press the <F2> key

The Calculate QR Code button The QR Code is by default generated with a standard width of 30 mm and the Standard Level of Error Correction (15%).

Your first QR Code

12

Section 2. How to work with...

More details?
Go on reading to get more details on the following topics: How to... - work with the Data Editor - work with Levels of Error Correction - determine the Code Size - use the Information Block - export QR Code to other applications - use the OLE function

13

QR Code Generator32 User's Manual

2.2 How to work with the Input Data Editor
The Input Data Editor placed at the upper side of the QR Code Generator32 program window holds up to 1024 alphanumeric characters per row. You can enter several rows - but not more than the maximum no. of Input Data Characters, which is: Model 1: - Numeric - Alphanumeric Model 2: - Numeric - Alphanumeric

max. 1167 (lowest Level of Error Correction, 7%) max. 707 (lowest Level of Error Correction, 7%)

max. 7089 (lowest Level of Error Correction, 7%) max. 4296 (lowest Level of Error Correction, 7%)

The Input Data Editor

The Input Data Editor allows the usual editing functions: Copying data to the Clipboard: • mark the data to be copied • and press <Strg>+<C> or choose Copy data in the Edit menu Cutting data: • mark the data to be copied • and press <Strg>+<X> Pasting data from the Clipboard: • make sure that the cursor is in the position you want the new data to be pasted • and press <Strg>+<V> or choose the Paste data in the Edit menu Note: With the Paste option you can import Input Data from the Clipboard.
14

Section 2. How to work with...

2.3 How to work with Levels of Error Correction
The Error Detection/Correction ability of the QR Code serves to prevent reading failures, which may be caused by smear on the Symbol or by reading errors. The Error Correction ability is achieved by data redundancy. The lower the Level of Error Correction, the higher the Code Density.

The four Levels of Error Correction

There are four Levels of Error Correction, which can be choosen before generating a code. In order to set another than the Standard Level (default setting) • click on the option wanted

7% High Density Level
The first level is called High Density Level, as it allows the highest number of Input Data Characters. The data of a code generated at this level can be restored even if 7% of the code area is smeared or damaged.

15% Standard Level
This is the default setting. The Standard Level of Error Correction allows a good balance of density and reliabilty. The data of a code generated at this level can be restored even if 15% of the code area is smeared or damaged.

15

QR Code Generator32 User's Manual

25% High Reliability Level
This is the lower of the two High Reliability Levels. It allows a very good reliability on cost of the density. The data of a code generated at this level can be restored even if 25% of the code area is smeared or damaged.

30% High Reliability Level
This is the Ultra High Reliability Level. It allows the maximum of reliability, but only a low density. The data of a code generated at this level can be restored even if 30% of the code area is smeared or damaged.

16

Section 2. How to work with...

2.4 How to determine the Code Size
Due to the quadratic form of the QR Code it is sufficient to determine the Code Width. The code length is automatically adapted. You have three ways to determine the size of the QR Code. First way • Do nothing If you generate the code, the Standard Code Width of 20 mm is applied. You can change the Code Width afterwards in the target application. Note: When changing the Code Width in the target application, make sure that the proportions remain the same. Second way

• Enter the Code Width or Cell Width in Millimetres into the field Code or Cell. If you generate the code, the entered Code Width is applied. Using the scroll bar Edit the option Cell width in dots can be activated or deactivated.

Third way • Generate the code with the Standard Width (see First way) • Point with the mouse cursor on the handle The mouse cursor turns into a two-way arrow • Hold down the mouse button and drag the border to resize it

17

QR Code Generator32 User's Manual

Changing the Code Width by dragging with the mouse

If you change the CodeWidth by dragging with the mouse, the value displayed into the field Code Width is automatically adapted.

18

Section 2. How to work with...

2.5 How to read the Information Block
The Information Block at the lower-left side of the mask has the function of displaying important information on the QR Code generated.

The Information Block

Number of Characters
After having generated a QR Code, the program displays the total number of coded characters, including the input data auxiliary data, such as Space or Carriage Return and Line Feed.

Code Version and Number of Cells
There are 14 Versions (1 to 14) for the QR Code Model 1- Symbol and 40 Versions (1 to 40) for the QR Code Model 2-Symbol depending on the number of component Cells. The Version 1 Symbol is the smallest and the Version 40 Symbol the largest. Version 1: Version 2: Version 3:
. . .

21 x 21 Cells 25 x 25 Cells 29 x 29 Cells 177 x 177 Cells

Version 40:

The Code Size grows by 4 Cells per Version.

19

QR Code Generator32 User's Manual

The Code Version and the corresponding number of Cells change in accordance with the Level of Error Correction (density) selected.

Current mask
The current mask number is provided for QR Code specialists only, to check the accordance with the QR Code specification.

20

Section 2. How to work with...

2.6 How to export QR Code to other Applications
There are two ways to make a generated QR Code available for other Windows applications. 1 The direct but temporary way: Copying the code to the Clipboard 2 The indirect but permanent way: Saving the code as a Windows Metafile (WMF) or Bitmap (BMP)

Copying QR Code to the Clipboard
• Click the Copy QR Code to clipboard button

Copy QR Code to clipboard The QR Code is now available in the Clipboard as a graphics file and can be pasted into any other Windows application. Note: This method has the important advantage, that you can use the OLE function of the QR Code Generator32.

Saving QR Code to a file
• Click on the Save QR Code to file button

Save QR Code to file A File Selection Box opens. In order to save the QR Code to a file • Select the target drive and directory • Enter the file name
21

QR Code Generator32 User's Manual

The extension is by default ".WMF" (Windows Metafile) • Click "OK" to save the QR Code to the specified file The QR Code is now available as a Windows Metafile (.WMF). This is a device independent Windows graphics format, which is supported by any Windows application. Note: If the QR Code is imported as a WMF-graphic to your application, the OLEfunction is not available. For Object Linking and Embedding (OLE) the QR Code must be imported from the Clipboard (Copy and Paste).

22

Section 2. How to work with...

2.7 How to use the OLE Function
Definition
OLE is the abbreviation of Object Linking end Embedding. By pasting a QR Code from the Clipboard into a document of your Windows application, a permanent Link is established between the QR Code Generator32 and the imported QR Code. That means, that the QR Code is embedded into the target application as an object linked with the source software QR Code Generator.

Activating/Deactivating the OLE function
The OLE function is by default activated. In order to deactivate/activate the OLE fuction • click QR Code as object in the Edit menu

Editing an embedded QR Code
Once pasted into your document, you can edit the QR Code without leaving the target application. In order to edit an embedded QR Code from your document: • Double-click the QR Code The QR Code Generator32 opens, offering the embedded code with its input data and the corresponding settings • Edit the QR Code If you alter the input data or change the Level of Error Correction, the code must be calculated anew (Button Calculate QR Code) If you resize the code by dragging with the mouse it is not necessary to calculate it anew • Close the QR Code Generator32 with Close and back to... from the File menu A message box appears, where you can either choose to update the embedded code or to cancel the alterations. or • Choose Modify... from the Object menu first and then close the QR Code Generator32.

23

QR Code Generator32 User's Manual

If you have chosen to modify the QR Code, the original embedded QR Code is replaced by the edited version.

Register OLE Server
When embedding a QR Code your system automatically registers the Link by saving the path to the QR Code Generator32 software. In case you move the QR Code Generator32 into another directory, the registered link is not valid any more. In order to update the Link: • Choose Register OLE server in the File menu

24

Section 2. How to work with...

2.8 How to use the Concatenation Capability (Structured Append)

The QR Code can be divided into multiple data, allowing data to be encoded in a limited oblong space. One data can be divided into up to 16 codes. Generating code parts manually is a very specific function of QR Code Generator32. As the probability of wrong use is very high, it is recommended to have code parts generated automatically via DDE.

To divide a QR Code symbol into several code parts, a complete QR Code has to be generated first. Enter Codepart 0 of x. x = Total number of complete codes. After the complete QR Code has been generated, generate the first code part. Enter Codepart 1 of x. Enter the first part of the complete code contents (e.g. the first two words of the complete code contents) as Data. Afterwards, generate the QR Code again and generate the second code part. Repeat this procedure until you have generated the last code part. Please consider that the number of code parts must not exceed 16. Attention!!! Please take the following rules into account when generating code parts: - the contents of the individual code parts must be complete and in the right order with regard to the complete code. - all characters of the complete code must be contained in the code parts including SPACE and CRLF.

25

QR Code Generator32 User's Manual

Example: Contents of complete code (Codepart 0 of 2): Contents of code part 1 (Codepart 1 of 2): Contents of code part 1 (Codepart 2 of 2) How to use How<CRLF> to<SPACE>use

Attention !!! In large amounts of data are split, the probability of wrong use is very high. It is therefore recommended to generate code parts using the DDE interface.

26

Section 3. Dynamic Data Exchange

Dynamic Data Exchange

3

Using the DDE interface any other Windows application can call the QR Code Generator32 as a tool to generate QR Codes. The data is thereby converted into QR Code an re-transferred to the initial application.

Communication via DDE
• • • • DDE parameters of the QR Code Generator32 Syntax of a DDE macro Examples Macro samples for Word

27

QR Code Generator32 User's Manual

3.1 How to establish a DDE Channel
The following parameters are necessary to establish a channel for the Dynamic Data Exchange between a Windows application and the QR Code Generator32. Task: Topic: Item: qre32 DDEServerConv DDEServerItem (external program -> QR Code Generator32) DDEServerItemError (QR Code Generator32 -> external program Result of QR Code generation)

Item:

3.2 The Syntax of a DDE Macro
The QR Code Generator32 reacts on a DDE macro, which has the following syntax: Device, Process, Model, Level, CodePart, Number of Code, CodeWidth, CellWidth, Source, Target, Data Device Number to mark the application, that sends the makro. If you do not need to denote the application, enter "1".

Process Number to mark the process (task). If you do not need to distinguish between the received QR Codes, enter "1". Model Number of the requested model

Level

Level number for the desired Level of Error Correction "0" 7% High density level "1" 15% Standard level

28

Section 3. Dynamic Data Exchange

"2" "3" Code Part

25% High reliability level 30% (Ultra) high reliability level

Number of code parts "0" Structure Append not required

Number of Code Total number of code parts "0" Structure Append not required Code Width

Width of the QR Code in Millimetres "-1" Size of QR Code is determined by the cell width

Cell Width

Width of QR Code cell "-1" Size of QR Code is determined by the code width The Source number: "0" The data are attached to the DDE macro ( see "Data") "1" The data are to be pasted from the Clipboard "3" The data are taken from a file The Target can be "OLE" The generated QR Code is embedded as an OLE object Note: The option is only possible up to a maximum number of 1000 input characters. Otherwise the CLIPBOARD option is automatically been taken. "CLIPBOARD" The generated QR Code is imported via clipboard "File.WMF" The generated QR Code is saved to this WMF file. Instead of "File" you can enter any name you want. Note the complete path, for example, "c:\qre32\code1.wmf" The Input Data for the QR Code to be generated. You can enter - the Input Data - or a variable identifier (name) for marked data or for an input The variable identifier must be written between inverted commas, for example "data". Word makros need a special syntax for variable identifiers (see samples)
29

Source

Target

Data

QR Code Generator32 User's Manual

3.3 The Result of QR Code Generation
After the generation of a QR Code the QR Code Generator32 sends the following message: If the QR Code could be generated without problems: "Device, Process, OK" In case an error occured, for example): "1, 1, "File c:\qrcode\test.wmf could not be created"

3.4 DDE Macro Sample for WORD 97
Those are examles for Macro instructions in the German Word 97. Please adapt Word basic commands in the national version.

Macro 1 for Word 97
Function: - you are prompted to enter the Input Data into an Input Box - the QR Code Generator32 is automatically started/activated - the QR Code is generated according to the macro parameters - the generated QR Code is copied to the Clipboard - and re-transferred to the Word document Syntax: Sub MAIN Data$ = InputBox$("InputData ", "QRCode Generation") If Tasks.Exists.("QRE32") = False Then Shell "C:\qrcode32\qre32.exe", 2 Tasks("Microsoft Word").Activate End If Kanal = DDEInitiate("Qre32", "DDEServerConv")
30

Section 3. Dynamic Data Exchange

DDEExecute Kanal, "1, 1, 1, 1, 0, 0, 30, -1, 0, CLIPBOARD, " + Chr$(34) + Data$ + Chr$(34) DDETerminate Kanal Selection.Range.Paste End Sub

Macro 2 für Word 97
Function: - starts/activates the QR Code Generator32 - the marked data are taken as Input Data and converted to a QR Code - the generated QR Code is embedded as an OLE object into the Word document Syntax: Sub MAIN Data$ = Markierung$() If Tasks.Exists("QRE32") = False Then Shell "C:\qrcode32\qre32.exe", 2 Tasks("Microsoft Word").Activate End If Kanal = DDEInitiate("Qre", "DDEServerConv") DDEExecute Kanal, "1, 1, 1, 1, 0, 0, 30, -1, 0, OLE," + Chr$(34) + Data$ + Chr$(34) DDETerminate Kanal Selection.Range.Paste End Sub

31

QR Code Generator32 User's Manual

Macro 3 für Word 97
Function: you are prompt to enter the Input Data into an Input Box you are prompt to enter the amount of code parts into a second Input Box the QR Code Generator32 generates code parts and saves them in the clipboard. the code parts are imported into Word form.

Syntax:
Sub Main() ' Dim Length_First, Length_Last TestS = InputBox$("Please enter a string:", "Input String") Number = InputBox("Number of part codes:", "Input part codes") L = Len(TestS) Length_First = Int(L / Number) Length_Last = L - ((Number - 1) * Length_First) If Tasks.Exists("QRE32") = False Then Shell "c:\buet\qre32\qre32.exe", 2 Tasks("Microsoft Word").Activate End If Kanal = DDEInitiate("QRE32", "DDEServerConv") DDEExecute Kanal, "1,1,1,1,0," + Chr$(34) + Str$(Number) + Chr$(34) + ",30,0,0,Clipboard, " + Chr$(34) + TestS + Chr$(34) Start = 1 For z = 1 To (Number - 1) Part = Mid$(TestS, Start, Length_First) MsgBox (Part) DDEExecute Kanal, "1,1,1,1," + Chr$(34) + Str$(z) + Chr$(34) + "," + Chr$(34) + Str$(Number) + Chr$(34) +
32

Section 3. Dynamic Data Exchange

",30,0,0,Clipboard, " + Chr$(34) + Part + Chr$(34) Selection.Range.Paste Start = Start + Length_First Next z Part = Right$(TestS, Length_Last) MsgBox (Part) DDEExecute Kanal, "1,1,1,1," + Chr$(34) + Str$(Number) + Chr$(34) + "," + Chr$(34) + Str$(Number) + Chr$(34) + ",30,0,0,Clipboard, " + Chr$(34) + Part + Chr$(34) Selection.Range.Paste MsgBox ("OK.") DDETerminate Kanal End Sub

Note: The Word macro language requires a special syntax for the data respective for the variable identifier. This is necessary to avoid, that the data are interpreted as a string. "Chr$(34) means nothing else than "Inverted comma": + Chr$(34) + Data$ + Chr$(34)

33

QR Code Generator32 User's Manual

Space for your notes

34

Section 4. The Library QRCODE.DLL

The Library QRCODE.DLL

4

The data transferred to the DLL consists of a parameter part and a data part.

I) Standard Mode Structure of the transferred strings: <X>A,<Data> X indicates the Error Correction Level: H Q M L Ultra High reliability level High reliability level Standard level High density level (Level H) (Level Q) (Level M) (Level L)

Example String := 'MA, Toyota Tsusho) II) Append Mode Choose the Append Mode, if you want to divide the QR Code into several parts (Structure Append). The Append Mode requires an extended parameter area. Structure of the transferred strings: D<Codepart><Number of Codes><PB>,<X>A, <Data> D <Codepart> constant, indicates Append Mode number of code to be generated (e.g.. 01)

35

QR Code Generator32 User's Manual

<No. of Codes> number of code parts to be generated (e.g. 04) <PB> parity byte (xor added to the total Code, eg. 6a) Example: String := 'D01046a,MA,Toyota Tsusho'

After the code has been transmitted, the code is displayed in that area of the memory in which the data to be encoded was stored before. A line consists of zeros and ones. The generated mask is in the second line. The generated version in the last line.

Declaration of the DLL-Function
This function must be declared as an external function of the DLL (e.g. in Pascal via key word EXTERNAL). Please note that the DLL was written in C Language. If you do not use this function programming in C language, refer to your programming manual to find out how to pass the parameters according to C standard. Call the DLL Calling Result := run(<P1>,<P2>,<P3>); Result : Integer

Param. <P1> <P2> <P3>

Meaning

Type

Pointer on the memory area Pointer of Char (pChar) in which the string will be stored QR Code-Model Integer Debug Information Integer

A value between 0 and 6 will be passed to the variable Result: Value 0 1 Meaning OK Parameter Error

36

Section 4. The Library QRCODE.DLL

2 3 4 5 6

Range overflow Division information error Range overflow (block bytes) Range overflow (blocks) File error

Sample source for use of DLL (using Delphi3)
unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons; const DATAMAX = 7366; ERR_NONE = 0; // OK ERR_READ_DATA = 1; // Parameter error ERR_READ_DATA_COUNT = 2; // Range overflow ERR_DIVISION_INFO = 3; // Division information error ERR_DATA_MAX = 4; // Range overflow (block-bytes) ERR_BLK_MAX = 5; // Range overflow (bytes) ERR_DEBUG = 6; // File Error BUFF_SIZE_DATA = 5000; // Result length BUFF_SIZE_INPUT = 8000; // Parameter length type TForm1 = class(TForm) BitBtn1: TBitBtn; Memo1: TMemo; Memo2: TMemo; procedure BitBtn1Click(Sender: TObject);

37

QR Code Generator32 User's Manual

private { Private-Declarations } FParity: byte; procedure SetParity(s: string); public { Public-Declarations } end; var Form1: TForm1; function run(td: pChar; m: integer; d: integer): integer; cdecl; const qrcode = 'qrcode.dll'; implementation {$R *.DFM} function run; external qrcode name 'run'; procedure TForm1.SetParity(s: string); var i: integer; begin FParity := 0; if s = '' then Exit; FParity := Ord(s[1]); for i := 1 to Length(s) do FParity := FParity xor Ord(s[i]); end; function hexbyte(b: byte): string; const hexdigit : array[0..15] of char = '0123456789abcdef'; begin hexbyte := hexdigit[b shr 4] + hexdigit[b and $0F]; end; procedure TForm1.BitBtn1Click(Sender: TObject); var trans_data: array[0..8000] of char;

38

Section 4. The Library QRCODE.DLL

p_trans_data: pChar; levels, dummy_s, FErrorString: string; p: pChar; eof: Char; FErrorIndex, FLevel, FCodePart, FCodeCount, pos, len: integer; begin FCodePart := 0; FCodeCount := 4; FLevel := 1; p_trans_data := @trans_data[0]; strcopy(p_trans_data, ''); levels := 'LMQH'; eof := Char($FF); dummy_s := ''; if (FCodePart = 0) and (FCodeCount > 0) then SetParity(string(Memo1.Text)); if (FCodePart <> 0) and (FCodeCount <> 0) then dummy_s := 'D' + inttostr(FCodePart) + inttostr(FCodeCount) + hexbyte(FParity) + ','; dummy_s := dummy_s + levels[FLevel + 1] + 'A,'; pos := Length(dummy_s); Move(pChar(dummy_s)^, trans_data, pos); p := @trans_data[pos]; len := Length(Memo1.Text); Move(pChar(Memo1.Text)^, p^, len); p := @trans_data[pos + len]; Move(eof, p^, 1); FErrorIndex := run(p_trans_data, 2, 0); case FErrorIndex of ERR_NONE: begin Memo2.Text := string(p_trans_data); FErrorString := 'OK'; end; ERR_READ_DATA: FErrorString := 'Parameter error'; ERR_READ_DATA_COUNT: FErrorString := 'Range overflow';

39

QR Code Generator32 User's Manual

ERR_DIVISION_INFO: FErrorString := 'Division information error'; ERR_DATA_MAX: FErrorString := 'Range overflow (block-bytes)'; ERR_BLK_MAX: FErrorString := 'Range overflow (blocks)'; ERR_DEBUG: FErrorString := 'File error'; end; end; end.

40

Section 5. What is QR Code?

What is QR Code?

5

The Two-dimensional QR Code (Quick Response Code) developed by Denso Corporation was first published in September, 1994.

Features of QR Code
• Storage of large capacity and high density information • Data restoration ability • Omni-directional reading • Ultra high speed reading

41

QR Code Generator32 User's Manual

5.1 What is a Two Dimensional Code?
Two-dimensional ID codes were developed to meet the increasing demand for printing bulk amount of data in a limited space. Unlike the usual Bar code a Two-dimensional code allows information to be stored in two directions: both horizontal and vertical.
Information

Information

Information

No information

Two-dimensional code (QR Code)

Bar code (EAN-13)

Large information capacity
Compared to a Bar code, which can store a maximum information of about 20 characters, a Two-dimensional code has an information capacity of approx. 2,000 characters (about 100 times higher than a Bar code).

Alphanumeric information
All Two-dimensional codes support alphanumeric characters.

High storage density
Compared to a Bar code the storage density of a Two-dimensional code for an area with identical size is about 20 to 40 times higher.

42

Section 5. What is QR Code?

Data Restoration (error correction) ability
Two dimensional codes have the ability of data Restoration. That means, that the code is still readable, even if a part of its surface is smeared or damaged. This restoration ability is achieved by data redundancy. Bar codes cannot contain redundant data.

5.2 Which are the main Characteristics of QR Code?
The Denso QR Code combines all the features of a Two-dimensional matrix code with outstanding reading abilities. All the features described below correspond to the Denso QR Code Specification (Ver. 1.1).

5.2.1 Information Capacity
The number of Input Data Characters which a Symbol can store change depending on the Coding Mode and the Error Correction Level. At the lowest Error Correction Level (7%) the maximum information which can be stored by a QR Code Symbol is: Model 1 Numeric Mode: max. 1,167 characters The Numeric Mode uses only decimal digits (0 to 9) as Input Data Characters. In this mode, three Input Data Characters are usually represented by 10 bits. Alphanumeric Mode: max. 707 characters The Alphanumeric Mode uses a total of 45 characters (0 to 9, A/a to Z/z, Space, $, %, *, +, -, ., /,:). Basically, two Input Characters are represented by 11 bits.

43

QR Code Generator32 User's Manual

Binary Mode (8 bits) : max. 486 characters In this Mode, one Input Character is represented by 8 bits ( 1 byte). Each Input Data Character is encoded to the hexadecimal number according to an Encoding/ Decoding Table.

Model 2 Numeric Mode: max. 7,089 characters The Numeric Mode uses only decimal digits (0 to 9) as Input Data Characters. In this mode, three Input Data Characters are usually represented by 10 bits. Alphanumeric Mode: max. 4,296 characters The Alphanumeric Mode uses a total of 45 characters (0 to 9, A/a to Z/z, Space, $, %, *, +, -, ., /,:). Basically, two Input Characters are represented by 11 bits. Binary Mode (8 bits) : max. 2,953 characters In this Mode, one Input Character is represented by 8 bits ( 1 byte). Each Input Data Character is encoded to the hexadecimal number according to an Encoding/ Decoding Table.

Note: The QRCode Generator32 automatically chooses the best suited Coding Mode for your Input Data.

5.2.3 Code Size
The QR Code is composed of square Cells, the number of which depends on the number of Input Data Characters and the Level of Error Correction.

Model 1: Number of Cells: 21 x 21 Cells (Version 1) to 73 x 73 Cells (Version 14). The code size grows by 4 Cells per Version Model 2:
Number of Cells: 21 x 21 Cells (Version 1) to 177 x 177 Cells (Version 40). The code size grows by 4 Cells per Version
44

Section 5. What is QR Code?

Example: If 105 Cells (0.25 mm/cell) are used, the size of the space required can be calculated as follows: 0.25 mm x 105 = 26.25 mm² (+ 4 Cells for Quiet zones) Note: The QR Code Generator32 automatically calculates the Cell Size according to the needed Code Size.

5.2.4 Storage Density (compared to a Bar code)
QR Code stores a large amount of information on a very limited area. Best you can see the storage density of a QR Code by comparison with an EAN 13 Bar Code. - Same information, but QR Code demands only 11% of the Bar Code size QR Code Information: "4012345678901" Cell size = 0.33 mm Error correction level: 15% Size: 9,6 mm² EAN 13 Bar Code Information: "401234567891" Minimum bar width = 0.33 mm Size: 24.5 mm (H) x 37,3 mm (W)

- Same size, but QR Code contains 84 times of the Bar Code information QR Code Information: 1,098 digits Cell size = 0.33 mm Error correction level: 15% Size: 29.4 mm² EAN 13 Bar Code Information: 13 digits Minimum bar width = 0.33 mm Size: 24.5 mm (H) x 37,3 mm (W)

45

QR Code Generator32 User's Manual

5.2.5 Data Restoration Ability
Due to its Data Restoration Ability the QR Code has a high durability against dirt and damage. Data can be restored even if up to 30% of the code area is damaged. The restoration ability depends on the Level of Error Correction set before calculating the code: Level of error Correction 1 (High density) 2 (Standard) 3 (High reliability) 4 (Ultra high reliabilty) Data can be restored even if,... approx. 7% of the code is damaged approx. 15% of the code is damaged approx. 25% of the code is damaged approx. 30% of the code is damaged

The error correction / restore function is realized by adding redundant data to the element data. So the whole information can be read from parts of the code (Level 4: at least 70% of the code area must be readable in order to decode the whole information). Note: All the four Levels of Error Correction are supported by the QR Code Generator32. Some examples of damaged, yet readable codes:

46

Section 5. What is QR Code?

5.2.6 Outstanding Reading Abilities
Omnidirectional reading
Due to its Position Detection Pattern, the QR Code can be read in any position. The specified pattern is retrieved synchronizing with the image acquisition to detect the position of the code. A separate Timing Pattern is uses to calculate the central coordinate of each Cell.

QR Code symbol structure (Model 1)

47

QR Code Generator32 User's Manual

QR Code symbol structure (Model 2)

The three Position Detection Points allow the detection of - position - tilt - and size This is achieved by a specified pattern for each detection point, which is as follows: B:W:B:W:B = 1:1:3:1:1 (B = Black, W = White)

The diagonal pattern can be easily recognized, because the length of the black and white segments is greater than that of the vertical and horizontal patterns.

48

Section 5. What is QR Code?

High-speed reading
As the code is decoded after its position, very little data processing (very little time) is required. Due to this feature the code meets the requirements for high-speed reading. Example: Codes containing each 100 characters can be read in approx. 32 msec. per code.

5.3 Definition of Terms
The following terms are important to understand QR Code generation:

Symbol

The QR Code Symbol which consists of black and white unit squares Unit squares which comprise the Symbol. One Cell corresponds to one bit Cells which provide various information, such as: Position Detection Pattern, Timing Pattern and Separator (separates Function Cells from Data Cells) Cells which represent Input Data Characters and their auxiliary information. Binary codes which reparesent this data are converted to Black and White Cells and positioned in the Symbol. The Data Cell Area includes Data Characters, RS Characters and Format Information Blank area around the Symbol

Cell

Function Cells

Data Cells

Quiet Zone

Position Detec- A Cell group which is used to detect the position of the tion Pattern Symbol in a visual image Timing Pattern A Cell group which is used to obtain the Coordinate of each Cell
49

QR Code Generator32 User's Manual

Separator

A Cell group which is positioned in the Symbol and separates the Function Cells from the Data cells. Each Cell of the Separator has the same optical characteristics as the White Cells A Cell group (Black and White Cells) which represents Input Data Characters and their auxiliary information. One Character is represented by 8 bits ( 8 Cells)

Character

Data Character

Characters which represent Input Data Characters. The first Data Character has a 4-bit Cell area only. Thus, 4 bits of "0" are added to it for the Error Detection coding, so that it can be treated as 8 bits (one Character) If the input data characters do not make the maximum number of Data Characters for the respective Version, the Data Characters are supplemented by Dummy Characters A Character which represents a check symbol of the RS code, which is added for the Error Correction purpose A series of bits which is added to the leading edge of the Input Data Characters to indicate the number of Input Data Characters. The Character No. Indicator is part of the Data Character Kinds of Data Characters which can be input. There are three Modes available for the QR Code: Numeric, Alphanumeric and Binary. Additionally there is the Mixed Mode in which all the Modes can be mixed in one Symbol Data which indicates the end of Input Data Characters and is represented by 4 bits Kinds of the QR Code defined by the number of Cells. There are 40 Versions for the QR Code from Version 1 (21 x 21 Cells) to Version 40 (177 x 177 Cells). The number of Cells grows by 4 Cells per Version Kinds of QR Codes defined by the Error Correction ability. There are 4 Levels available for the QR Code: the Standard, High Density, High Reliability and Ultra High Reliability Level

RS Character

Character No.

Mode

Terminator

Version

Level

50

Section 5. What is QR Code?

Masking

Conversion of Cell values to achieve a well balanced arrangement of Black and White Cells

51

QR Code Generator32 User's Manual

52


				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:87
posted:4/14/2009
language:
pages:54