Checking the integrity of a bar code

Allows, when manually collecting the fields present in a bar code, the application to validate the as the fields are being entered, in order to alert the operator in advance and allow him to correct the error. The routine activation format is as follows:

int ValidaCampoCodigoEmBarras (Data, Type)

ASCII interface#

ValidaCampoCodigoEmBarrasA (Result, Data, Type)
ParameterTypeStandard interfaceASCII InterfaceDescription
ResultOutput, by valueNot usedFixed 6Contains the result of the response to the routine call.
DataEntry, by valuechar *VariableMessage to be displayed on the PinPad display
TypeOutput, by referenceshort *Fixed 6Informs the type of document collected according to the following coding:

-1 → It was not possible to define the type yet
0 → Collection
1 → Title

Recommendation:

It is recommended that the terminal application, once it has identified that the document will be typed, opens fields collection forms for those present in the documents to be paid. To do this, she will need to identify whether it is a Card Compensation/Title/Block or Collection/Tax Form. This identification can be done through a question to the operator or through the routine described here.

If the user opts for automatic recognition, he must open a field as if it were a Collection field and, for each digit provided by the operator, pass the digits already provided to the routine. This procedure must be done until the moment the routine returns whether the document in question is a Title or Collection. In that At this point, the application no longer needs to call the routine for each digit provided and must, if necessary, modify the formatting the fields for capture.

In addition to identifying the document type, the routine checks the check digits for consistency, returning for application if there is an error and where it is located. The application can call the routine by passing the fields as they are being collected or at the end of collection, where a global analysis of the content will be carried out typed. If the call is while typing, the correct points are:

  • Collection: for each of the 4 typing blocks
  • Titles: each group of two typing blocks

Upon return, the routine returns 0 if everything is correct so far, -1 if it is an unrecognized bar code or a number from 1 to 4 indicating which field is incorrect or even the value 5 to indicate that the number as a whole is not correct.

We exemplify below how the terminal application should proceed, in the most generic way possible today day, to collect a document. In the example we will use a title and let the automation be informed which is this type of document. The document that will be used is the following:

23790.09505.91211.369656.04025.039209.1.17690000005625#

--------

Field opened by automation

--------
2

After typing the first number, the routine is called, passing “2” as a parameter. Returning to routine returned the result 0 and Type = 0 (fictitious because at that moment, for the current configuration of bar codes, it I would have already identified)

--------
23

After typing the first number, the routine is called, passing “23” as a parameter. Returning to routine returned the result 0 and Type = 1

--------
2379009505

The automation re-presents the fields already knowing that it is a title. Only after typing the first group of numbers she calls the routine passing “2379009505” as a parameter. Upon return, the routine continues to return Type = 1. The result may be 0, indicating that the block is correct or 1 indicating that it is wrong.

--------
237900950591211369656

The automation continues to collect the digits and only after typing the second group of numbers does it call the routine passing “237900950591211369656” as a parameter. Upon return, the routine continues to return Type = 1. The result may be 0, indicating that the blocks are correct, or 1 or 2 indicating that the first or second block is wrong.

--------
23790095059121136965604025039209191211

The automation continues to collect the digits by calling the routine at the end of the third block with the data 237900950591211369656 and at the end of the fourth block with all the data entered. Upon return, the routine continues return Type = 1 and the result will reflect the error situation or not of the blocks passed as a parameter. In In particular, if code 5 returns, it is because there is one of the blocks (it is not possible to identify which one) with an error.

Finally, the automation can also choose to check them for barcode consistency purposes. only at the end of typing all the fields. In this case, the routine will return 1, 2, 3 or 4 in that order. priority if it finds one or more blocks with an error and 5 in the situation that the internal blocks are correct, but the number as a whole has some error.